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 |
|---|---|---|---|---|---|---|
506,921 | <p>I am using the WPF Datagrid from Codeplex.</p>
<p>I am able to style the rows and with the following attributes in the dg:DataGrid element.</p>
<p>But how do I style the Headers? I find 100s of examples on the web which define Styles and use e.g. x:Key="DataGridColumnHeaderStyle" in the Datagrid element, but none ... | [
{
"answer_id": 506973,
"author": "user61477",
"author_id": 61477,
"author_profile": "https://Stackoverflow.com/users/61477",
"pm_score": 3,
"selected": true,
"text": "<p>The style in this case is in a file called generic.xaml it should be loacted in a themems folder in your project.</p>\... | 2009/02/03 | [
"https://Stackoverflow.com/questions/506921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | I am using the WPF Datagrid from Codeplex.
I am able to style the rows and with the following attributes in the dg:DataGrid element.
But how do I style the Headers? I find 100s of examples on the web which define Styles and use e.g. x:Key="DataGridColumnHeaderStyle" in the Datagrid element, but none of them seem to w... | The style in this case is in a file called generic.xaml it should be loacted in a themems folder in your project.
find it and open it. inside you will find this line that controls the background of the column headers
```
<dg:DataGridHeaderBorder SortDirection="{TemplateBinding SortDirection}"
... |
506,934 | <p>I'm using the following function to map columns from a DataTable (passed from the data tier) to object properties. The function exists within the class I'm populating. The class has two methods: Load() which loads the object with values and LoadAll() which returns a collection of populated objects. I wanted to be ab... | [
{
"answer_id": 506942,
"author": "ggf31416",
"author_id": 38561,
"author_profile": "https://Stackoverflow.com/users/38561",
"pm_score": 3,
"selected": false,
"text": "<p>How about :</p>\n\n<pre><code>dim Inc as Incident \nif target.Equals(me) then \n Inc = Me\nelse\n Inc = new Incide... | 2009/02/03 | [
"https://Stackoverflow.com/questions/506934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20048/"
] | I'm using the following function to map columns from a DataTable (passed from the data tier) to object properties. The function exists within the class I'm populating. The class has two methods: Load() which loads the object with values and LoadAll() which returns a collection of populated objects. I wanted to be able ... | It appears to me that your `If` and `Else` blocks only differ in the fact that one assumes an existing object(the current instance) has been passed and the other overwrites any passed reference by creating it anew.
This would seem like an ideal case for a ByRef parameter, in other words, let the calling code pass diff... |
506,984 | <p>I'm having trouble <strong>laying a html div over the Google Earth plugin</strong> in a web application, any help would be appreciated.</p>
<p>It's fine for Map, Terrain and Hybrid mode, but on '<strong>Earth</strong>' mode, the <strong>Flash kicks in and automatically layers the map on top</strong>.</p>
<p>Z-inde... | [
{
"answer_id": 601407,
"author": "thomasrutter",
"author_id": 53212,
"author_profile": "https://Stackoverflow.com/users/53212",
"pm_score": 2,
"selected": false,
"text": "<p>If it is a plugin, then you cannot reliably place other elements over the top of it. Browsers usually let go of m... | 2009/02/03 | [
"https://Stackoverflow.com/questions/506984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54556/"
] | I'm having trouble **laying a html div over the Google Earth plugin** in a web application, any help would be appreciated.
It's fine for Map, Terrain and Hybrid mode, but on '**Earth**' mode, the **Flash kicks in and automatically layers the map on top**.
Z-indexing doesn't help.
Presumably I could do something like... | I put together a demo showing how to use `IFRAME` shims here:
<http://earth-api-samples.googlecode.com/svn/trunk/demos/customcontrols/index.html> |
507,006 | <p>I am having problem implementing django mptt.</p>
<p>Here is my model:</p>
<pre><code> class Company(models.Model):
name = models.CharField( max_length=100)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
mptt.register(Company, order_insertion_by=['name'])
</c... | [
{
"answer_id": 507008,
"author": "Mark Brittingham",
"author_id": 15592,
"author_profile": "https://Stackoverflow.com/users/15592",
"pm_score": 3,
"selected": false,
"text": "<p>You should probably take a look at the \"Pragmatic Unit Testing\" series. <a href=\"https://rads.stackoverflo... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am having problem implementing django mptt.
Here is my model:
```
class Company(models.Model):
name = models.CharField( max_length=100)
parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
mptt.register(Company, order_insertion_by=['name'])
```
And
```
class Fi... | Have a look at [Michael Feathers on what is a unit test](http://www.artima.com/weblogs/viewpost.jsp?thread=126923) (or what makes unit tests bad unit tests)
Have a look at the idea of "Arrange, Act, Assert", i.e. the idea that a test does only three things, in a fixed order:
* **Arrange** any input data and processin... |
507,042 | <p>I have a working C++ project on VS2005, I made a small change which causes a problem and I dont know what is it and how to resolve,
I added a new string entry in the resource file using the VS2005 RC editor (the default one in VS2005) but after compilation I get two compilation errors</p>
<ol>
<li><p>Error 22 e... | [
{
"answer_id": 507079,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 1,
"selected": false,
"text": "<p>Check that the rc file is using the same encoding as the rest of the application (ASCII or unicode). See this <a h... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42749/"
] | I have a working C++ project on VS2005, I made a small change which causes a problem and I dont know what is it and how to resolve,
I added a new string entry in the resource file using the VS2005 RC editor (the default one in VS2005) but after compilation I get two compilation errors
1. Error 22 error RC2135 : file n... | Your resource type, 11, is wrong. That means RT\_MESSAGETABLE, the resource compiler tries to load an .mc file. Pick something else, like 99 or MYCUSTOMRESOURCE |
507,043 | <p>Maybe I am wrong, but this seems to be a very basic question. Suddenly my inheritance chain stopped working. Writing a small basic test application proved that it was me that was wrong (so I can't blame the compiler).</p>
<p>I have a base class, with the default behavior in a virtual function. A child class derives... | [
{
"answer_id": 507047,
"author": "mghie",
"author_id": 30568,
"author_profile": "https://Stackoverflow.com/users/30568",
"pm_score": 5,
"selected": true,
"text": "<p>You are calling a virtual method in the constructor, which is not going to work, as the child class isn't fully initializ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56763/"
] | Maybe I am wrong, but this seems to be a very basic question. Suddenly my inheritance chain stopped working. Writing a small basic test application proved that it was me that was wrong (so I can't blame the compiler).
I have a base class, with the default behavior in a virtual function. A child class derives from that... | You are calling a virtual method in the constructor, which is not going to work, as the child class isn't fully initialized yet.
See also [this StackOverflow question](https://stackoverflow.com/questions/496440/c-virtual-function-from-constructor). |
507,059 | <p>I got an <code>Int16</code> value, from the database, and need to convert this to an enum type. This is unfortunately done in a layer of the code that knows very little about the objects except for what it can gather through reflection.</p>
<p>As such, it ends up calling <code>Convert.ChangeType</code> which fails ... | [
{
"answer_id": 507091,
"author": "Peter",
"author_id": 58553,
"author_profile": "https://Stackoverflow.com/users/58553",
"pm_score": 8,
"selected": true,
"text": "<p><code>Enum.ToObject(....</code> is what you're looking for!</p>\n\n<p><strong>C#</strong></p>\n\n<pre><code>StringComparis... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/267/"
] | I got an `Int16` value, from the database, and need to convert this to an enum type. This is unfortunately done in a layer of the code that knows very little about the objects except for what it can gather through reflection.
As such, it ends up calling `Convert.ChangeType` which fails with an invalid cast exception.
... | `Enum.ToObject(....` is what you're looking for!
**C#**
```
StringComparison enumValue = (StringComparison)Enum.ToObject(typeof(StringComparison), 5);
```
**VB.NET**
```
Dim enumValue As StringComparison = CType([Enum].ToObject(GetType(StringComparison), 5), StringComparison)
```
If you do a lot of Enum converti... |
507,063 | <p>I am trying this query:</p>
<pre><code>SELECT ARTICLE_NO,
USERNAME,
ACCESSSTARTS,
ARTICLE_NAME,
date_format( ACCESSSTARTS, '%d %m %Y' ) AS shortDate
FROM AUCTIONS
WHERE upper( ARTICLE_NAME ) LIKE '%hardy%'
LIMIT 0 , 10;
</code></pre>
<p>Which works fine, but shortDate is null, and I am unsur... | [
{
"answer_id": 507071,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": true,
"text": "<p>The formatting of ACCESSSTARTS looks like the date you have there is a varchar, but DATE_FORMAT expects a DATE or DATET... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I am trying this query:
```
SELECT ARTICLE_NO,
USERNAME,
ACCESSSTARTS,
ARTICLE_NAME,
date_format( ACCESSSTARTS, '%d %m %Y' ) AS shortDate
FROM AUCTIONS
WHERE upper( ARTICLE_NAME ) LIKE '%hardy%'
LIMIT 0 , 10;
```
Which works fine, but shortDate is null, and I am unsure why.
The contents of th... | The formatting of ACCESSSTARTS looks like the date you have there is a varchar, but DATE\_FORMAT expects a DATE or DATETIME value.
YOu could try using [STR\_TO\_DATE](http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_str-to-date) to turn that string into a date value first, e.g.
```
SELECT ... |
507,073 | <p>Is there any Java library allowing to build a simple standalone webservice server without any application server framework?</p>
| [
{
"answer_id": 507183,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 5,
"selected": true,
"text": "<p>Java 6 contains JAX-WS, which makes it very easy to host a web service in a stand-alone application:</p>\n\n<pre><... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2612/"
] | Is there any Java library allowing to build a simple standalone webservice server without any application server framework? | Java 6 contains JAX-WS, which makes it very easy to host a web service in a stand-alone application:
```
javax.xml.ws.Endpoint.publish("http://localhost:8000/myService/", myServiceImplementation);
``` |
507,087 | <p>I placed the scritmanager to masterpage. "scriptmanager1"</p>
<p>There is an updatepanel in the masterpage shows total. "updatepanel1"</p>
<p>In the contentpage I have nested listviews. the "listview2" inside the "listview1" has itemtemplate with a linkbutton called "addtoTotal"</p>
<p>I want to update the update... | [
{
"answer_id": 507105,
"author": "Josh Mein",
"author_id": 2486,
"author_profile": "https://Stackoverflow.com/users/2486",
"pm_score": 0,
"selected": false,
"text": "<p>for finding the addtoTotal button I believe you are gonna have to do the following in the code behind</p>\n\n<pre><code... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51151/"
] | I placed the scritmanager to masterpage. "scriptmanager1"
There is an updatepanel in the masterpage shows total. "updatepanel1"
In the contentpage I have nested listviews. the "listview2" inside the "listview1" has itemtemplate with a linkbutton called "addtoTotal"
I want to update the updatepanel1 inside the master... | You can put a subroutine on your master page that updates the panel and you can call it from the content page like so.
```
Public Partial Class _Default1
Inherits System.Web.UI.MasterPage
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
... |
507,089 | <p>Here is my sample program for web service server side and client side. I met with a strnage performance problem, which is, even if I increase the number of threads to call web services, the performance is not improved. At the same time, the CPU/memory/network consumption from performance panel of task manager is low... | [
{
"answer_id": 507129,
"author": "gbjbaanb",
"author_id": 13744,
"author_profile": "https://Stackoverflow.com/users/13744",
"pm_score": 3,
"selected": false,
"text": "<p>My experience is generally that locking is the problem: I had a massively parallel server once that spent more time co... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is my sample program for web service server side and client side. I met with a strnage performance problem, which is, even if I increase the number of threads to call web services, the performance is not improved. At the same time, the CPU/memory/network consumption from performance panel of task manager is low. I... | My experience is generally that locking is the problem: I had a massively parallel server once that spent more time context switching than it did performing work.
So - check your memory and process counters in perfmon, if you look at context switches and its high (more than 4000 per second) then you're in trouble.
Y... |
507,109 | <p>I opened a file stream to a very big file using fopen.
Before performing any read operation on that stream, I deleted the file using unlink().
And still, I was able to read the whole file.</p>
<p>I am guessing that there is a buffer associated with the stream, which holds the data of the file. But obviously that bu... | [
{
"answer_id": 507128,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 5,
"selected": true,
"text": "<p>In Unix and Unix-like operating systems, the file doesn't actually go away until the last open file handle on it is c... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29405/"
] | I opened a file stream to a very big file using fopen.
Before performing any read operation on that stream, I deleted the file using unlink().
And still, I was able to read the whole file.
I am guessing that there is a buffer associated with the stream, which holds the data of the file. But obviously that buffer will ... | In Unix and Unix-like operating systems, the file doesn't actually go away until the last open file handle on it is closed. This is a very useful trick for temporary files - if you unlink it as soon as you open it, the file won't be visible to other processes, and it will be removed from the system as soon as your prog... |
507,115 | <p>I'm looking for a Rake task to do deployment via FTP.</p>
<p>Does anyone know of any?</p>
<p>Anders</p>
| [
{
"answer_id": 508046,
"author": "Lolindrath",
"author_id": 7985,
"author_profile": "https://Stackoverflow.com/users/7985",
"pm_score": 2,
"selected": false,
"text": "<p>Not that I know of though the <a href=\"http://net-ssh.rubyforge.org/sftp/v2/api/\" rel=\"nofollow noreferrer\">Net::S... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1740/"
] | I'm looking for a Rake task to do deployment via FTP.
Does anyone know of any?
Anders | Ok, I decided to do it myself. The code is not very beautiful since it contains a lot of exception handling, but it gets the job done :)
```
require 'rake'
require 'net/ftp'
def ftp_files(prefixToRemove, sourceFileList, targetDir, hostname, username, password)
Net::FTP.open(hostname, username, password) do |ftp|
... |
507,123 | <p>I'm working in WinXP 5.1.2600, writing a Python application involving Chinese pinyin, which has involved me in endless Unicode problems. Switching to Python 3.0 has solved many of them. But the print() function for console output is not Unicode-aware for some odd reason. Here's a teeny program.</p>
<pre><code>print... | [
{
"answer_id": 507293,
"author": "Brandon",
"author_id": 28916,
"author_profile": "https://Stackoverflow.com/users/28916",
"pm_score": 4,
"selected": false,
"text": "<p>The Windows command prompt (cmd.exe) cannot display the Unicode characters you are using, even though Python is handlin... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507123",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61923/"
] | I'm working in WinXP 5.1.2600, writing a Python application involving Chinese pinyin, which has involved me in endless Unicode problems. Switching to Python 3.0 has solved many of them. But the print() function for console output is not Unicode-aware for some odd reason. Here's a teeny program.
```
print('sys.stdout e... | The Windows command prompt (cmd.exe) cannot display the Unicode characters you are using, even though Python is handling it in a correct manner internally. You need to use IDLE, Cygwin, or another program that can display Unicode correctly.
See this thread for a full explanation:
<http://www.nabble.com/unable-to-prin... |
507,138 | <p>I have an element that already has a class:</p>
<pre class="lang-html prettyprint-override"><code><div class="someclass">
<img ... id="image1" name="image1" />
</div>
</code></pre>
<p>Now, I want to create a JavaScript function that will add a class to the <code>di... | [
{
"answer_id": 507157,
"author": "Ishmael",
"author_id": 8930,
"author_profile": "https://Stackoverflow.com/users/8930",
"pm_score": 12,
"selected": true,
"text": "<h1>If you're only targeting modern browsers:</h1>\n\n<p>Use <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/DOMT... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I have an element that already has a class:
```html
<div class="someclass">
<img ... id="image1" name="image1" />
</div>
```
Now, I want to create a JavaScript function that will add a class to the `div` (not replace, but add).
How can I do that? | If you're only targeting modern browsers:
=========================================
Use [element.classList.add](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add) to add a class:
```
element.classList.add("my-class");
```
And [element.classList.remove](https://developer.mozilla.org/en-US/docs/Web/AP... |
507,141 | <p>Any recommendations of a <strong>recent</strong> tutorial, or guide, on uploading Rails applications to a (gs) rails container?</p>
<p>I've followed a couple tutorials already, both of which haven't worked.</p>
| [
{
"answer_id": 507157,
"author": "Ishmael",
"author_id": 8930,
"author_profile": "https://Stackoverflow.com/users/8930",
"pm_score": 12,
"selected": true,
"text": "<h1>If you're only targeting modern browsers:</h1>\n\n<p>Use <a href=\"https://developer.mozilla.org/en-US/docs/Web/API/DOMT... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53875/"
] | Any recommendations of a **recent** tutorial, or guide, on uploading Rails applications to a (gs) rails container?
I've followed a couple tutorials already, both of which haven't worked. | If you're only targeting modern browsers:
=========================================
Use [element.classList.add](https://developer.mozilla.org/en-US/docs/Web/API/DOMTokenList/add) to add a class:
```
element.classList.add("my-class");
```
And [element.classList.remove](https://developer.mozilla.org/en-US/docs/Web/AP... |
507,144 | <p>I am new at the area of iPhone. i am trying to build an iPhone app by using Cocos2d. I have used this type of classe like bellow-</p>
<pre><code>@interface MenuScene : Scene {}
@end
@interface FlipView : UIImageView
{
CGPoint startTouchPosition;
NSString *dirString;
UIImageView *firstPieceView;
... | [
{
"answer_id": 523261,
"author": "clarkcox3",
"author_id": 51867,
"author_profile": "https://Stackoverflow.com/users/51867",
"pm_score": 1,
"selected": false,
"text": "<p>You cannot, as Objective-C does not have multiple inheritance. Additionally, it doesn't really make sense to have a s... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am new at the area of iPhone. i am trying to build an iPhone app by using Cocos2d. I have used this type of classe like bellow-
```
@interface MenuScene : Scene {}
@end
@interface FlipView : UIImageView
{
CGPoint startTouchPosition;
NSString *dirString;
UIImageView *firstPieceView;
UIImageView *s... | You can't. As Clark says, Objective-C does not support multiple inherritance. This is because the designers believe that the advantages of multiple inherritance do not justify the complexity and bad design it encourages.
Instead, they have included something that will meet your needs. You can declare a 'protocol' usin... |
507,155 | <p>I am developing Web Custom control which able to apply filters to the LinqDataSource object. It is generic control since it should operate with object of certain type.</p>
<p>The control knows what field of object it should operate by following field</p>
<pre><code> /// <summary>
/// Method to get com... | [
{
"answer_id": 507198,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>The LINQ to SQL provider is responsible for translation your expression tree into a valid T-SQL statement. As ther... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507155",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am developing Web Custom control which able to apply filters to the LinqDataSource object. It is generic control since it should operate with object of certain type.
The control knows what field of object it should operate by following field
```
/// <summary>
/// Method to get compared column from object
... | The LINQ to SQL provider is responsible for translation your expression tree into a valid T-SQL statement. As there is not a 1-to-1 relationship between C# and T-SQL it is highly probable that the more sophisticated your expression tree, the less likely it is that LINQ to SQL will be able to translate.
When you use a ... |
507,179 | <p>Suppose I have 2 tables, Products and ProductCategories. Both tables have relationship on CategoryId. And this is the query.</p>
<pre><code>SELECT p.ProductId, p.Name, c.CategoryId, c.Name AS Category
FROM Products p
INNER JOIN ProductCategories c ON p.CategoryId = c.CategoryId
WHERE c.CategoryId = 1;
</code></pre>... | [
{
"answer_id": 507197,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 9,
"selected": true,
"text": "<p>Foreign Keys are a referential integrity tool, not a performance tool. At least in SQL Server, the creation of an FK does ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2398110/"
] | Suppose I have 2 tables, Products and ProductCategories. Both tables have relationship on CategoryId. And this is the query.
```
SELECT p.ProductId, p.Name, c.CategoryId, c.Name AS Category
FROM Products p
INNER JOIN ProductCategories c ON p.CategoryId = c.CategoryId
WHERE c.CategoryId = 1;
```
When I create executi... | Foreign Keys are a referential integrity tool, not a performance tool. At least in SQL Server, the creation of an FK does not create an associated index, and you should create indexes on all FK fields to improve look up times. |
507,215 | <p>is there any way to bring up a subheader row at changes in a field in an databound asp:repeater control e.g.</p>
<p>Instead of</p>
<pre>
country | colour | number
uk | red | 3
uk | green | 3
france | red 3</pre>
<p>Do this:</p>
<pre>
==UK==
colour | number
red | 3
green 3
==FRANCE==
colour | number
red | 3</pre>... | [
{
"answer_id": 507257,
"author": "darasd",
"author_id": 42119,
"author_profile": "https://Stackoverflow.com/users/42119",
"pm_score": 0,
"selected": false,
"text": "<p>Ah - you're after a grouping repeater. The <a href=\"http://www.dotnetjunkies.ddj.com/Article/4365153F-D2F5-4C77-9FE7-94... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61545/"
] | is there any way to bring up a subheader row at changes in a field in an databound asp:repeater control e.g.
Instead of
```
country | colour | number
uk | red | 3
uk | green | 3
france | red 3
```
Do this:
```
==UK==
colour | number
red | 3
green 3
==FRANCE==
colour | number
red | 3
```
Many thanks for any help. | There seem to be a few bugs in the dotnetjunkies code but I've found a much simpler solution here <http://www.west-wind.com/weblog/posts/140753.aspx>
Now repeaters don't support grouping, so you have to do this on your own, but it's pretty easy to do. In the repeater above the following data expression is responsible ... |
507,220 | <p>I have a need for a confirm message box from a button click, but only on some conditions. I am cheking two values on the aspx.page, and if one is higher than another, I need a confirmation from the user. Are there any ( simple) way of doing this ? I have been reading about javascript and alert messages, but I cant s... | [
{
"answer_id": 507255,
"author": "Andy Rose",
"author_id": 1762,
"author_profile": "https://Stackoverflow.com/users/1762",
"pm_score": 4,
"selected": true,
"text": "<p>JavaScript provides what you need with the confirm function. This displays a confirmation box allowing the user to 'OK' ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15138/"
] | I have a need for a confirm message box from a button click, but only on some conditions. I am cheking two values on the aspx.page, and if one is higher than another, I need a confirmation from the user. Are there any ( simple) way of doing this ? I have been reading about javascript and alert messages, but I cant seem... | JavaScript provides what you need with the confirm function. This displays a confirmation box allowing the user to 'OK' or 'Cancel'.
An example function based on what you require:
```
function FormSubmit(){
var value1 = document.getElementById("Textbox1").value;
var value2 = document.getElementById("Textbox2")... |
507,253 | <p>I'm trying to do conditional formatting so that the cell color will change if the value is different from the value in the cell left of it (each column is a month, in each row are the expenses on certain object. I want to monitor easily changes in prices over months.)</p>
<p>I can do it per cell and format-drag it, ... | [
{
"answer_id": 507275,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 4,
"selected": false,
"text": "<p>When creating your conditional formatting, set the range to which it applies to what you want (the whole sheet), then e... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58807/"
] | I'm trying to do conditional formatting so that the cell color will change if the value is different from the value in the cell left of it (each column is a month, in each row are the expenses on certain object. I want to monitor easily changes in prices over months.)
I can do it per cell and format-drag it, but I wou... | ```
=OFFSET(INDIRECT(ADDRESS(ROW(), COLUMN())),0,-1)
``` |
507,262 | <p>In C# how can you find if an object is an instance of certain class but not any of that class’s superclasses?</p>
<p>“is” will return true even if the object is actually from a superclass.</p>
| [
{
"answer_id": 507273,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>Unfortunately this is not possible in C# as C# does not support multiple inheritance. Give this inheritance tree:<... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37694/"
] | In C# how can you find if an object is an instance of certain class but not any of that class’s superclasses?
“is” will return true even if the object is actually from a superclass. | ```
typeof(SpecifiedClass) == obj.GetType()
``` |
507,263 | <p>I have a simple XML with two levels (Header and Line) of tags such as:</p>
<pre><code><?xml version="1.0"?>
<Header>
<line>Line 1</line>
<line>Line 2</line>
<line>Line 3</line>
<line>Line 4</line>
<line>Line 5</line>... | [
{
"answer_id": 507359,
"author": "morechilli",
"author_id": 5427,
"author_profile": "https://Stackoverflow.com/users/5427",
"pm_score": 1,
"selected": false,
"text": "<p>In general in XSLT if you want to create a heirarchy from a list you can make use of the preceding-sibling and followi... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1134977/"
] | I have a simple XML with two levels (Header and Line) of tags such as:
```
<?xml version="1.0"?>
<Header>
<line>Line 1</line>
<line>Line 2</line>
<line>Line 3</line>
<line>Line 4</line>
<line>Line 5</line>
<line>Line 6</line>
<line>Line 7</line>
<line>Line 8</line>
<line>Line 9</lin... | **The following transformation produces the required result**:
```
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:variable name="vN" select="3"/>
<xsl:template match="/*">
<xsl:copy>
<xsl:apply-templates
... |
507,265 | <p>My Java source code:</p>
<pre><code>String result = "B123".replaceAll("B*","e");
System.out.println(result);
</code></pre>
<p>The output is:<code>ee1e2e3e</code>.
Why?</p>
| [
{
"answer_id": 507278,
"author": "Anders Westrup",
"author_id": 36845,
"author_profile": "https://Stackoverflow.com/users/36845",
"pm_score": 5,
"selected": true,
"text": "<p>'*' means zero or more matches of the previous character. So each empty string will be replaced with an \"e\".</p... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10927/"
] | My Java source code:
```
String result = "B123".replaceAll("B*","e");
System.out.println(result);
```
The output is:`ee1e2e3e`.
Why? | '\*' means zero or more matches of the previous character. So each empty string will be replaced with an "e".
You probably want to use '+' instead:
>
> `replaceAll("B+", "e")`
>
>
> |
507,266 | <p>We had an asp.net 1.1 application that we recently migrated to 3.5. We are facing some problems when we do code modification on the migrated application. Here is what is happening</p>
<ol>
<li><p>In the asp.net 1.1 application we have the page directive codebehind="ePC.aspx.cs". This migrated fine.</p></li>
<li><p>... | [
{
"answer_id": 507278,
"author": "Anders Westrup",
"author_id": 36845,
"author_profile": "https://Stackoverflow.com/users/36845",
"pm_score": 5,
"selected": true,
"text": "<p>'*' means zero or more matches of the previous character. So each empty string will be replaced with an \"e\".</p... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44555/"
] | We had an asp.net 1.1 application that we recently migrated to 3.5. We are facing some problems when we do code modification on the migrated application. Here is what is happening
1. In the asp.net 1.1 application we have the page directive codebehind="ePC.aspx.cs". This migrated fine.
2. We made some code changes to ... | '\*' means zero or more matches of the previous character. So each empty string will be replaced with an "e".
You probably want to use '+' instead:
>
> `replaceAll("B+", "e")`
>
>
> |
507,271 | <p>I use the following command to output the schema for a MySQL db:</p>
<pre><code>mysqldump --no-data --skip-add-drop-table
</code></pre>
<p>I will do this for two databases I want to compare, and then diff the two output files. This is my crude way of tracking database changes between environments.</p>
<p>However... | [
{
"answer_id": 507285,
"author": "Pierre",
"author_id": 58082,
"author_profile": "https://Stackoverflow.com/users/58082",
"pm_score": 1,
"selected": false,
"text": "<pre><code>mysqldump --no-data --skip-add-drop-table | grep -v AUTO_INCREMENT\n</code></pre>\n\n<p>?</p>\n"
},
{
"a... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26848/"
] | I use the following command to output the schema for a MySQL db:
```
mysqldump --no-data --skip-add-drop-table
```
I will do this for two databases I want to compare, and then diff the two output files. This is my crude way of tracking database changes between environments.
However, a minor inconvenience to me is t... | Check out this [`ticket`](http://bugs.mysql.com/bug.php?id=20786) on this problem. It was closed as "Won't Fix"
You could do this, alternatively:
```
mysqldump --no-data --skip-add-drop-table my_database | sed 's/AUTO_INCREMENT=[0-9]*\b//' > database.dump
``` |
507,295 | <p>As a fun side-project for myself to help in learning yet another PHP MVC framework, I've been writing Reversi / Othello as a PHP & Ajax application, mostly straightforward stuff. I decided against using a multidimensional array for a number of reasons and instead have a linear array ( in this case 64 elements l... | [
{
"answer_id": 507325,
"author": "cg.",
"author_id": 52439,
"author_profile": "https://Stackoverflow.com/users/52439",
"pm_score": 3,
"selected": true,
"text": "<p>I don't have the time to measure this myself right now, but I would suspect that a pre-computed lookup table would beat your... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9908/"
] | As a fun side-project for myself to help in learning yet another PHP MVC framework, I've been writing Reversi / Othello as a PHP & Ajax application, mostly straightforward stuff. I decided against using a multidimensional array for a number of reasons and instead have a linear array ( in this case 64 elements long ) an... | I don't have the time to measure this myself right now, but I would suspect that a pre-computed lookup table would beat your solution in speed. The code would look something like this:
```
class Converter {
private $_table;
function __construct()
{
$this->_table = array();
for ($i=0; $i<... |
507,299 | <p>I'm trying to commit to my local SVN which has been working just fine, but today its giving this error:</p>
<pre><code>Unable to open repository
'file:///C:/wamp/www/svns/[myproject]/[dir]/[subdir]'
</code></pre>
<p>What could be the problem?</p>
<p>Edit: full error:</p>
<pre><code>Commit failed (details follow... | [
{
"answer_id": 507318,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 0,
"selected": false,
"text": "<p>First three things I'd check:</p>\n\n<ol>\n<li>That a local path is what you intended</li>\n<li>That the directory... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49153/"
] | I'm trying to commit to my local SVN which has been working just fine, but today its giving this error:
```
Unable to open repository
'file:///C:/wamp/www/svns/[myproject]/[dir]/[subdir]'
```
What could be the problem?
Edit: full error:
```
Commit failed (details follow):
Unable to open an ra_local session to URL... | [The usage of the file:// URL scheme to access repositories might result in repository corruption](http://svnbook.red-bean.com/en/1.5/svn.serverconfig.choosing.html#svn.serverconfig.choosing.recommendations) since the file:// protocol is stateless by nature, and is often not used when there are multiple users for a rep... |
507,300 | <p>I have a database for a carpet company. I have a form which enables the user to make a quote, including choosing the customer, etc. There is a also subform dealing with the products and extras, with quantities and unit prices. To state whether the user requires fitting there is a checkbox. When ticked I would like f... | [
{
"answer_id": 507340,
"author": "Fionnuala",
"author_id": 2548,
"author_profile": "https://Stackoverflow.com/users/2548",
"pm_score": 2,
"selected": false,
"text": "<p>I think the easiest way is to use an append query.</p>\n\n<pre><code>If Me.Fitting Then\n strSQL=\"INSERT INTO [Order... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61960/"
] | I have a database for a carpet company. I have a form which enables the user to make a quote, including choosing the customer, etc. There is a also subform dealing with the products and extras, with quantities and unit prices. To state whether the user requires fitting there is a checkbox. When ticked I would like fitt... | On the check box control, you are going to add an [Event Procedure] on the After Update event for the checkbox (see the properties window). This will stub out the VBA code, click on the ellipsis ("...") to get to the VBA code.
You can use Remou's code (after a fashion) to insert the new Product:
```
If Me.Fitting The... |
507,310 | <p>For my theory of computing languages class, we got a homework assignment to implement a piece of code in a language that only has while statements for flow control (no if statements). This is mainly to prove that you can write a Turing-complete language with only a while loop.</p>
<p>For those of you who can under... | [
{
"answer_id": 507312,
"author": "Jason Baker",
"author_id": 2147,
"author_profile": "https://Stackoverflow.com/users/2147",
"pm_score": 4,
"selected": true,
"text": "<p>Here's my code:</p>\n\n<pre><code>continue := True\nwhile d = 0 and continue do\n x := 1\n continue := False\nod... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | For my theory of computing languages class, we got a homework assignment to implement a piece of code in a language that only has while statements for flow control (no if statements). This is mainly to prove that you can write a Turing-complete language with only a while loop.
For those of you who can understand langu... | Here's my code:
```
continue := True
while d = 0 and continue do
x := 1
continue := False
od
while d != 0 and continue do
x := a/d
continue := False
od
``` |
507,317 | <p>I am trying to create unittests that can be shared amongst my development team so I need to have all paths in the project be relative.</p>
<p>Where this is giving me trouble is with the HttpWebRequest class.
I want it to serve static testdata from a file in the local filesystem.</p>
<p>I'd like to do something lik... | [
{
"answer_id": 507349,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 2,
"selected": true,
"text": "<p>Is the file you are trying to server have a relative path compared to any of the assemblies in your project? If so the... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21699/"
] | I am trying to create unittests that can be shared amongst my development team so I need to have all paths in the project be relative.
Where this is giving me trouble is with the HttpWebRequest class.
I want it to serve static testdata from a file in the local filesystem.
I'd like to do something like this:
```
fil... | Is the file you are trying to server have a relative path compared to any of the assemblies in your project? If so then you could build a non-relative URL based on the path of one of the assemblies and return that to the caller.
For Example:
```
var basePath = Path.GetDirectoryName(typeof(MyType).Assembly.Location);... |
507,324 | <p>I have PHP 5.1.6 (cli) installed and whenever the GET query string is more than 128 characters it fails with HTTP 406 Not Acceptable error. Any suggestions how I can fix this so can use more than 128 characters? POST is not an option.</p>
<p>The error is being returned by the server so don't think it's browser issu... | [
{
"answer_id": 507344,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>Do you have <a href=\"http://www.modsecurity.org/\" rel=\"nofollow noreferrer\">mod_security</a> enabled on your webse... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61965/"
] | I have PHP 5.1.6 (cli) installed and whenever the GET query string is more than 128 characters it fails with HTTP 406 Not Acceptable error. Any suggestions how I can fix this so can use more than 128 characters? POST is not an option.
The error is being returned by the server so don't think it's browser issue.
And the... | Have found answer thanks to comment from Ben.
Although this generates 406 error:
test.php?129+characters
This works fine:
test.php?data=129+characters
So my guess is that in the first instance PHP is attempting to use the 129 characters as name in $\_GET array whereas the second example has only 4 characters for the... |
507,341 | <p>How do you create a report with 2 columns:</p>
<p>Example:</p>
<pre><code>Student Name: Reyes JA Student Name: Reyes K
Student ID: 2008-1000 Student ID: 2008-1000
Semester: First Sem, 2008-2009 Semester: First Sem, 2008-2009
Amount: 2000.00 ... | [
{
"answer_id": 507344,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>Do you have <a href=\"http://www.modsecurity.org/\" rel=\"nofollow noreferrer\">mod_security</a> enabled on your webse... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507341",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26087/"
] | How do you create a report with 2 columns:
Example:
```
Student Name: Reyes JA Student Name: Reyes K
Student ID: 2008-1000 Student ID: 2008-1000
Semester: First Sem, 2008-2009 Semester: First Sem, 2008-2009
Amount: 2000.00 Amount: 20... | Have found answer thanks to comment from Ben.
Although this generates 406 error:
test.php?129+characters
This works fine:
test.php?data=129+characters
So my guess is that in the first instance PHP is attempting to use the 129 characters as name in $\_GET array whereas the second example has only 4 characters for the... |
507,347 | <p>This is a batch file in Windows.</p>
<p>Here is my .bat file </p>
<pre><code>@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"
"C:\ThirdParty.exe"
</code></pre>
<p>This works fine except the .bat file leaves the command window open the whole time the "ThirdParty" application is running.<br... | [
{
"answer_id": 507363,
"author": "Oskar Duveborn",
"author_id": 49293,
"author_profile": "https://Stackoverflow.com/users/49293",
"pm_score": 2,
"selected": false,
"text": "<p>I haven't really found a good way to do that natively, so I just use a utility called <a href=\"http://www.ntwin... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61339/"
] | This is a batch file in Windows.
Here is my .bat file
```
@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"
"C:\ThirdParty.exe"
```
This works fine except the .bat file leaves the command window open the whole time the "ThirdParty" application is running.
I need the command window to close.
I... | Using `start` works for me:
```
@echo off
copy "C:\Remoting.config-Training" "C:\Remoting.config"
start C:\ThirdParty.exe
```
EDIT: Ok, looking more closely, `start` seems to interpret the first parameter as the new window title if quoted. So, if you need to quote the path to your ThirdParty.exe you must supply a ti... |
507,351 | <p>If I create a user control (EDIT:not a web control/server control) it's pretty trivial to get databinding. I just add a datasourceID property.</p>
<p>In code behind (vb)</p>
<pre><code>Partial Public Class BandedControl
Inherits UserControl
Public Property DataSourceID() As String
Get
... | [
{
"answer_id": 521548,
"author": "CalvinR",
"author_id": 55990,
"author_profile": "https://Stackoverflow.com/users/55990",
"pm_score": 1,
"selected": false,
"text": "<p>Web UserControls are compiled dynamically at run time and so are not rendered at Design time, what you want to do is cr... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507351",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29411/"
] | If I create a user control (EDIT:not a web control/server control) it's pretty trivial to get databinding. I just add a datasourceID property.
In code behind (vb)
```
Partial Public Class BandedControl
Inherits UserControl
Public Property DataSourceID() As String
Get
Return MyGridView.Dat... | You could try adding the IDReferenceProperty attribute to your property definition...
```
public partial class BandedControl : UserControl
{
[System.Web.UI.IDReferenceProperty(typeof(DataSourceControl))]
public string DataSourceID
{
get
{
return MyGridView.DataSourceID;
}... |
507,354 | <p>I am writing a winforms app in which a user selects an item from a listbox and edits some data that forms part of an associated object. The edits are then applied from the object list to an underlying file.</p>
<p>In ASP.Net assigning a different system value to a list item than the display text the user sees is tr... | [
{
"answer_id": 507407,
"author": "Phaedrus",
"author_id": 46072,
"author_profile": "https://Stackoverflow.com/users/46072",
"pm_score": 2,
"selected": false,
"text": "<p>Try grabbing the \"ValueMember\" from within the ListBox1_SelectedValueChanged event.</p>\n\n<pre><code>private void L... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am writing a winforms app in which a user selects an item from a listbox and edits some data that forms part of an associated object. The edits are then applied from the object list to an underlying file.
In ASP.Net assigning a different system value to a list item than the display text the user sees is trivial. In ... | Okay so the answer came as a result of Andy's answer, hence my upvoting that answer.
But when I created a little class and tried to cast the listitem into that class the program threw an exception.
Revealingly the exception told me that the program could not cast a DictionaryEntry into a class of the type I had defin... |
507,358 | <p>Hello Stack Overflow Experts, i have need of your expertice:</p>
<p>I am trying to use Hibernate on an Existing DB.
Currently im trying to load a User object and a list of UserData objects that go along.</p>
<p>in the DB the (simplified) layout is</p>
<pre><code>| User | | UserData ... | [
{
"answer_id": 507407,
"author": "Phaedrus",
"author_id": 46072,
"author_profile": "https://Stackoverflow.com/users/46072",
"pm_score": 2,
"selected": false,
"text": "<p>Try grabbing the \"ValueMember\" from within the ListBox1_SelectedValueChanged event.</p>\n\n<pre><code>private void L... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61963/"
] | Hello Stack Overflow Experts, i have need of your expertice:
I am trying to use Hibernate on an Existing DB.
Currently im trying to load a User object and a list of UserData objects that go along.
in the DB the (simplified) layout is
```
| User | | UserData |
---------------- ... | Okay so the answer came as a result of Andy's answer, hence my upvoting that answer.
But when I created a little class and tried to cast the listitem into that class the program threw an exception.
Revealingly the exception told me that the program could not cast a DictionaryEntry into a class of the type I had defin... |
507,380 | <p>I'm working on a Windows Form in VB.NET 2005 and I would like to have some buttons with images (I'm talking about the plain, vanilla System.Windows.Forms.Button). I have everything set up the way I want it but the images are displaying too low on the button, such that the bottom of the icon is almost right on the b... | [
{
"answer_id": 507449,
"author": "Ken Wootton",
"author_id": 7357,
"author_profile": "https://Stackoverflow.com/users/7357",
"pm_score": 3,
"selected": true,
"text": "<p>Typically, we'll set the following properties (for an image on the right, for example):</p>\n\n<pre><code>ImageAlign: ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22392/"
] | I'm working on a Windows Form in VB.NET 2005 and I would like to have some buttons with images (I'm talking about the plain, vanilla System.Windows.Forms.Button). I have everything set up the way I want it but the images are displaying too low on the button, such that the bottom of the icon is almost right on the botto... | Typically, we'll set the following properties (for an image on the right, for example):
```
ImageAlign: MiddleRight
TextAlign: MiddleLeft
```
You'll want to align both the text and image in a similar fashion. Outside of that, make sure that you are setting the Image property, not the BackgroundImage property and mak... |
507,381 | <p>Does anyone know how to get the browser height in IE7+ with javascript? I've seen several ways to get the document or the body height but this is not the same. window.innerHeight works fine in firefox and other browsers, but ie doesnt seem to support it. Thanks</p>
| [
{
"answer_id": 507389,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 0,
"selected": false,
"text": "<p>To determine the actual size of the browser window, use the following properties:</p>\n\n<h3>Mozilla based browswers</h3... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60810/"
] | Does anyone know how to get the browser height in IE7+ with javascript? I've seen several ways to get the document or the body height but this is not the same. window.innerHeight works fine in firefox and other browsers, but ie doesnt seem to support it. Thanks | ```
var windowWidth = -1, windowHeight = -1;
if(typeof(window.innerWidth) == 'number') { //Non-IE
windowWidth = window.innerWidth;
windowHeight = window.innerHeight;
} else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) { //IE 6+ in 'standards co... |
507,387 | <p>In order to extend my <a href="https://stackoverflow.com/questions/506009/scanning-multiple-files-in-perl">"grep" emulator</a> in Perl I have added support for a <code>-r</code> switch which enables recursive searching in sub-directories. Now the command line invocation looks something like this:</p>
<pre><code>per... | [
{
"answer_id": 507450,
"author": "J.J.",
"author_id": 21204,
"author_profile": "https://Stackoverflow.com/users/21204",
"pm_score": 1,
"selected": false,
"text": "<ul>\n<li>Add a -d switch for your directory. My opinion is, \"if a command is optional it should have a switch to enable it.... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2533756/"
] | In order to extend my ["grep" emulator](https://stackoverflow.com/questions/506009/scanning-multiple-files-in-perl) in Perl I have added support for a `-r` switch which enables recursive searching in sub-directories. Now the command line invocation looks something like this:
```
perl pgrep.pl -r <directory> <expressio... | You should be using [`GetOpt::Long`](http://search.cpan.org/perldoc?Getopt::Long). This will do everything you need as described. |
507,396 | <p>As a follow on from <a href="https://stackoverflow.com/questions/492115/c-enums-as-function-parameters">this question.</a></p>
<p>How can I call a function and pass in an Enum?</p>
<p>For example I have the following code:</p>
<pre><code>enum e1
{
//...
}
public void test()
{
myFunc( e1 );
}
public void... | [
{
"answer_id": 507418,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 3,
"selected": false,
"text": "<p>You are trying to pass the type of the enum as an instance of that type - try something like this:</p>\n\n<pre><cod... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | As a follow on from [this question.](https://stackoverflow.com/questions/492115/c-enums-as-function-parameters)
How can I call a function and pass in an Enum?
For example I have the following code:
```
enum e1
{
//...
}
public void test()
{
myFunc( e1 );
}
public void myFunc( Enum e )
{
var names = Enu... | You can use a generic function:
```
public void myFunc<T>()
{
var names = Enum.GetNames(typeof(T));
foreach (var name in names)
{
// do something!
}
}
```
and call like:
```
myFunc<e1>();
```
**(EDIT)**
The compiler complains if you try to constraint `... |
507,401 | <p>Whenever I rightclick something in visualstudio, I get a context menu for about half a second. Then it goes away, before I got a chance to click anything. Sometimes if I'm really fast I manage to click something anyway, then it works.</p>
<p>So annoying.</p>
<p>Sometimes the problem goes away for a few hours, the... | [
{
"answer_id": 507418,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 3,
"selected": false,
"text": "<p>You are trying to pass the type of the enum as an instance of that type - try something like this:</p>\n\n<pre><cod... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47901/"
] | Whenever I rightclick something in visualstudio, I get a context menu for about half a second. Then it goes away, before I got a chance to click anything. Sometimes if I'm really fast I manage to click something anyway, then it works.
So annoying.
Sometimes the problem goes away for a few hours, then it comes back (i... | You can use a generic function:
```
public void myFunc<T>()
{
var names = Enum.GetNames(typeof(T));
foreach (var name in names)
{
// do something!
}
}
```
and call like:
```
myFunc<e1>();
```
**(EDIT)**
The compiler complains if you try to constraint `... |
507,405 | <p>I have the following code.</p>
<pre><code>from xml.dom.minidom import Document
doc = Document()
root = doc.createElement('root')
doc.appendChild(root)
main = doc.createElement('Text')
root.appendChild(main)
text = doc.createTextNode('Some text here')
main.appendChild(text)
print doc.toprettyxml(indent='\t')
</c... | [
{
"answer_id": 507555,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 4,
"selected": true,
"text": "<blockquote>\n <p>Can this easily be done?</p>\n</blockquote>\n\n<p>It depends what exact rule you want, but generally no,... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55366/"
] | I have the following code.
```
from xml.dom.minidom import Document
doc = Document()
root = doc.createElement('root')
doc.appendChild(root)
main = doc.createElement('Text')
root.appendChild(main)
text = doc.createTextNode('Some text here')
main.appendChild(text)
print doc.toprettyxml(indent='\t')
```
The result ... | >
> Can this easily be done?
>
>
>
It depends what exact rule you want, but generally no, you get little control over pretty-printing. If you want a specific format you'll usually have to write your own walker.
The DOM Level 3 LS parameter format-pretty-print in [pxdom](http://www.doxdesk.com/software/py/pxdom.ht... |
507,409 | <p>Using VBA, how do I retrieve custom shape information from a Visio 2003 diagram.</p>
| [
{
"answer_id": 508223,
"author": "Jon Fournier",
"author_id": 5106,
"author_profile": "https://Stackoverflow.com/users/5106",
"pm_score": 4,
"selected": true,
"text": "<p>To get custom shape information from a Visio shape:</p>\n\n<pre><code>Function GetCustomPropertyValue(TheShape As Vis... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507409",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2665/"
] | Using VBA, how do I retrieve custom shape information from a Visio 2003 diagram. | To get custom shape information from a Visio shape:
```
Function GetCustomPropertyValue(TheShape As Visio.Shape, ThePropertyName As String) As String
On Error Resume Next
GetCustomPropertyValue = TheShape.CellsU("Prop." & ThePropertyName).ResultStr(visNone)
End Function
```
All this function does is uses the... |
507,422 | <p>i have a debug and a release version of an assembly dll.</p>
<p>They are sitting is directories on my computer. For other developers they are sitting in directories on their computer.</p>
<p>For the debug version of the application i want to use the debug assembly. For the release version of the application i want... | [
{
"answer_id": 507451,
"author": "Peter",
"author_id": 58553,
"author_profile": "https://Stackoverflow.com/users/58553",
"pm_score": 0,
"selected": false,
"text": "<p>Include the project and link to the project? dont know if that does work in your situration...</p>\n"
},
{
"answe... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | i have a debug and a release version of an assembly dll.
They are sitting is directories on my computer. For other developers they are sitting in directories on their computer.
For the debug version of the application i want to use the debug assembly. For the release version of the application i want to use the relea... | Use a common structure for these DLLs (a common directory-name) and link to this relative.
Example from a .csproj-file:
```
<Reference Include="utils_xxx, Version=1.2.10.0, Culture=neutral, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\common_utils_dllproject_dir\utils\bin\... |
507,425 | <p>I'm working on my first significant Python project and I'm having trouble with scope issues and executing code in included files. Previously my experience is with PHP. </p>
<p>What I would like to do is have one single file that sets up a number of configuration variables, which would then be used throughout the co... | [
{
"answer_id": 507576,
"author": "Grzegorz Gacek",
"author_id": 61972,
"author_profile": "https://Stackoverflow.com/users/61972",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I know program-wide global variables/functions/classes/etc. does not exist in Python, everything is \"... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm working on my first significant Python project and I'm having trouble with scope issues and executing code in included files. Previously my experience is with PHP.
What I would like to do is have one single file that sets up a number of configuration variables, which would then be used throughout the code. Also, ... | In python, it is a common practice to have a bunch of modules that implement various functions and then have one single module that is the point-of-access to all the functions. This is basically the [facade pattern](http://en.wikipedia.org/wiki/Facade_Pattern).
An example: say you're writing a package `foo`, which inc... |
507,436 | <p>I have the following string:</p>
<pre><code>"Look on http://www.google.com".
</code></pre>
<p>I need to convert it to:</p>
<blockquote>
<p>"Look on <a href="http://www.google.com" rel="noreferrer">http://www.google.com</a>"</p>
</blockquote>
<p>The original string can have more than 1 URL string.</p>
<p>How d... | [
{
"answer_id": 507459,
"author": "Ben",
"author_id": 11522,
"author_profile": "https://Stackoverflow.com/users/11522",
"pm_score": 7,
"selected": true,
"text": "<p>You can use the following:</p>\n\n<pre><code>$string = \"Look on http://www.google.com\";\n$string = preg_replace(\n ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/393302/"
] | I have the following string:
```
"Look on http://www.google.com".
```
I need to convert it to:
>
> "Look on <http://www.google.com>"
>
>
>
The original string can have more than 1 URL string.
How do I do this in php?
Thanks | You can use the following:
```
$string = "Look on http://www.google.com";
$string = preg_replace(
"~[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]~",
"<a href=\"\\0\">\\0</a>",
$string);
```
**PHP versions < 5.3 (ereg\_replace) otherwise (preg\_replace)** |
507,446 | <p>I am wondering why the following contrived example code works perfectly fine in Visual Studio 2005, but generates an error in GCC ("no matching function to call" when calling Interpolate() as shown below). </p>
<p>Also, how do I work around this? It seems that the error message is just a generic message because GCC... | [
{
"answer_id": 507459,
"author": "Ben",
"author_id": 11522,
"author_profile": "https://Stackoverflow.com/users/11522",
"pm_score": 7,
"selected": true,
"text": "<p>You can use the following:</p>\n\n<pre><code>$string = \"Look on http://www.google.com\";\n$string = preg_replace(\n ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59301/"
] | I am wondering why the following contrived example code works perfectly fine in Visual Studio 2005, but generates an error in GCC ("no matching function to call" when calling Interpolate() as shown below).
Also, how do I work around this? It seems that the error message is just a generic message because GCC did not h... | You can use the following:
```
$string = "Look on http://www.google.com";
$string = preg_replace(
"~[[:alpha:]]+://[^<>[:space:]]+[[:alnum:]/]~",
"<a href=\"\\0\">\\0</a>",
$string);
```
**PHP versions < 5.3 (ereg\_replace) otherwise (preg\_replace)** |
507,477 | <p>My product is targeted to a Portuguese audience where the comma is the decimal symbol. I usually use CString::Format to input numbers into strings, and it takes into account the computer's regional settings. While in general this is a good approach, I'm having problems in formatting SQL queries, for instance:</p>
<... | [
{
"answer_id": 507561,
"author": "MSalters",
"author_id": 15416,
"author_profile": "https://Stackoverflow.com/users/15416",
"pm_score": 3,
"selected": false,
"text": "<p>Bad idea, you really should be using prepared statements. It's not really trivial to do SQL injection with just number... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4880/"
] | My product is targeted to a Portuguese audience where the comma is the decimal symbol. I usually use CString::Format to input numbers into strings, and it takes into account the computer's regional settings. While in general this is a good approach, I'm having problems in formatting SQL queries, for instance:
```
CStr... | Here's what I did.
```
CString FormatQuery(LPCTSTR pszFormat, ...)
{
CString szLocale = setlocale(LC_NUMERIC, NULL);
setlocale(LC_NUMERIC, "English");
va_list args;
va_start(args, pszFormat);
CString szFormatted;
int nSize = (_vscprintf(pszFormat, args) + 1) * sizeof(char);
_vsnprintf_s(sz... |
507,478 | <p>Is there a direct LINQ syntax for finding the members of set A that are absent from set B? In SQL I would write this</p>
<pre><code>SELECT A.* FROM A LEFT JOIN B ON A.ID = B.ID WHERE B.ID IS NULL
</code></pre>
| [
{
"answer_id": 507499,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 5,
"selected": true,
"text": "<p>See the MSDN documentation on the <a href=\"https://msdn.microsoft.com/en-us/library/vstudio/bb300779%28v=vs.100%29.asp... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507478",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1715673/"
] | Is there a direct LINQ syntax for finding the members of set A that are absent from set B? In SQL I would write this
```
SELECT A.* FROM A LEFT JOIN B ON A.ID = B.ID WHERE B.ID IS NULL
``` | See the MSDN documentation on the [Except operator](https://msdn.microsoft.com/en-us/library/vstudio/bb300779%28v=vs.100%29.aspx). |
507,494 | <p>In order to take in account Richard's comment and Steen's answer of I have to specify independently of type mime file and independently of the type file marked in CVS, I am looking for how to treat all files as binary file in cvs2svn ? Perhaps is not possible ?</p>
<p>Please Richard (or others), may you tell me how... | [
{
"answer_id": 508460,
"author": "Steen",
"author_id": 1448983,
"author_profile": "https://Stackoverflow.com/users/1448983",
"pm_score": 2,
"selected": false,
"text": "<p>Subversion use a heuritic algorithm to determine whether a file is binary or not. Firstly, it checks if the <code>mim... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30791/"
] | In order to take in account Richard's comment and Steen's answer of I have to specify independently of type mime file and independently of the type file marked in CVS, I am looking for how to treat all files as binary file in cvs2svn ? Perhaps is not possible ?
Please Richard (or others), may you tell me how to know t... | I deduce it is impossible to force cvs2svn to consider all files as binary file. |
507,504 | <p>In Microsoft SQL Server, if I want to search case insensitively in a case-sensitive database, I can run the following SQL:</p>
<pre><code>SELECT * FROM MyTable
WHERE MyField = 'BobDillon' COLLATE Latin1_General_CI_AI
</code></pre>
<p>And that will find all "bobdillon" entries.</p>
<p>If I want to do the same in O... | [
{
"answer_id": 507538,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 4,
"selected": true,
"text": "<pre><code>SELECT *\nFROM MyTable\nWHERE NLSSORT(MyField, 'NLS_SORT = Latin_AI') = NLSSORT('BobDillon', 'NLS_SORT = Latin_... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6910/"
] | In Microsoft SQL Server, if I want to search case insensitively in a case-sensitive database, I can run the following SQL:
```
SELECT * FROM MyTable
WHERE MyField = 'BobDillon' COLLATE Latin1_General_CI_AI
```
And that will find all "bobdillon" entries.
If I want to do the same in Oracle, I know I can do this:
```... | ```
SELECT *
FROM MyTable
WHERE NLSSORT(MyField, 'NLS_SORT = Latin_AI') = NLSSORT('BobDillon', 'NLS_SORT = Latin_AI')
``` |
507,519 | <p>I'm trying to do some simple data retrieval with C# and Directory Services, but for some reason it doesn't work on any XP machines. If I run my code on a Server 2003 machine, there are no problems. I've spent a fair bit of time trying to find out if maybe there's some redistributable I need on XP or if the functiona... | [
{
"answer_id": 507587,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 2,
"selected": true,
"text": "<p>Based on the stack trace and reflector it looks like a call to <a href=\"http://msdn.microsoft.com/en-us/library/aa7722... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507519",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61983/"
] | I'm trying to do some simple data retrieval with C# and Directory Services, but for some reason it doesn't work on any XP machines. If I run my code on a Server 2003 machine, there are no problems. I've spent a fair bit of time trying to find out if maybe there's some redistributable I need on XP or if the functionalit... | Based on the stack trace and reflector it looks like a call to [ADsOpenObject](http://msdn.microsoft.com/en-us/library/aa772238(VS.85).aspx) is returning [E\_ADS\_BAD\_PATHNAME](http://msdn.microsoft.com/en-us/library/aa705940(VS.85).aspx). This error indicates that the path you supplied to the DirectoryEntry class is ... |
507,520 | <h3>Overview</h3>
<p>In another question, I asked about <a href="https://stackoverflow.com/questions/205138/globalizing-runtime-generated-assemblies">deploying localizations for some runtime compiled <code>UserControl</code>'s</a>. However, before I can get to deploying the localizations, I need a way of localizing th... | [
{
"answer_id": 1221424,
"author": "Stefan Haubold",
"author_id": 3353,
"author_profile": "https://Stackoverflow.com/users/3353",
"pm_score": 2,
"selected": false,
"text": "<p>I'm not sure if I understood your question correctly.</p>\n\n<p>Just check for the <a href=\"http://msdn.microsof... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23234/"
] | ### Overview
In another question, I asked about [deploying localizations for some runtime compiled `UserControl`'s](https://stackoverflow.com/questions/205138/globalizing-runtime-generated-assemblies). However, before I can get to deploying the localizations, I need a way of localizing the controls.
### Background
T... | I'm not sure if I understood your question correctly.
Just check for the [System.ComponentModel.LocalizableAttribute](http://msdn.microsoft.com/en-us/library/system.componentmodel.localizableattribute.aspx) on all properties to (de-)serialize if your control is Localizable.
```
// Gets the attributes for the property... |
507,522 | <p>Java Newbie question :</p>
<p>I need to capture the text being written to a printStream by a 3rd party component.</p>
<p>The PrintStream is defaulted to System.err, but can be changed to another PrintStream.</p>
<p>Looking through the docs, I couldn't find an easy way to direct the contents of a PrintStream to a ... | [
{
"answer_id": 507546,
"author": "Joao da Silva",
"author_id": 46329,
"author_profile": "https://Stackoverflow.com/users/46329",
"pm_score": 4,
"selected": true,
"text": "<pre><code>PipedOutputStream pipeOut = new PipedOutputStream();\nPipedInputStream pipeIn = new PipedInputStream(pipeO... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59015/"
] | Java Newbie question :
I need to capture the text being written to a printStream by a 3rd party component.
The PrintStream is defaulted to System.err, but can be changed to another PrintStream.
Looking through the docs, I couldn't find an easy way to direct the contents of a PrintStream to a string writer / buffer.
... | ```
PipedOutputStream pipeOut = new PipedOutputStream();
PipedInputStream pipeIn = new PipedInputStream(pipeOut);
System.setOut(new PrintStream(pipeOut));
// now read from pipeIn
``` |
507,526 | <p>I have a menu of links on the left, and content in the middle. If the content is longer than the links, it will wrap below them instead of staying neatly to the right.</p>
<p>Adding <code>float:left</code> to my <code>content</code> div fixes this, except in IE, where it causes the menu (and the footer) to disappea... | [
{
"answer_id": 507574,
"author": "markus",
"author_id": 11995,
"author_profile": "https://Stackoverflow.com/users/11995",
"pm_score": 1,
"selected": false,
"text": "<p>ok, if you're not happy with my former answer, I'll go through it step by step...</p>\n\n<p>there are very many things y... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7161/"
] | I have a menu of links on the left, and content in the middle. If the content is longer than the links, it will wrap below them instead of staying neatly to the right.
Adding `float:left` to my `content` div fixes this, except in IE, where it causes the menu (and the footer) to disappear entirely.
I need to either fi... | >
> find another way of keeping all my content to the right of the menu.
>
>
>
```
#content { margin-left: 200px; }
```
Consider adding a Standard Mode doctype to reduce the quirkiness of IE. |
507,536 | <p>I have an ActionFilter that checks if a parameter in the URL is valid.
If it is not valid I have to render a View. I dont want to redirect, because I still need the ActionExecutingContext.
Can that be done?</p>
<pre><code> public override void OnActionExecuting(ActionExecutingContext filterContext)
{
... | [
{
"answer_id": 507548,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 1,
"selected": false,
"text": "<p>Yes. Look at the source for HandleErrorAttribute.</p>\n"
},
{
"answer_id": 507596,
"author": "Nick Berar... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13442/"
] | I have an ActionFilter that checks if a parameter in the URL is valid.
If it is not valid I have to render a View. I dont want to redirect, because I still need the ActionExecutingContext.
Can that be done?
```
public override void OnActionExecuting(ActionExecutingContext filterContext)
{
Guid process... | `HandleErrorAttribute` had what I was looking for.
```
filterContext.Result = new ViewResult
{
ViewName = "MessagePage",
ViewData = filterContext.Controller.ViewData,
TempData = filterContext.Controller.TempData
};
``` |
507,541 | <p>I have an ASP.NET website. Very huge!</p>
<p>The latest addition I've made, everything is JavaScript/AJAX enabled.</p>
<p>I send HTML and JavaScript code back from the server to the client, and the client will inject the HTML into a DIV - and inject the JavaScript into the DOM using this:</p>
<pre><code>$('<sc... | [
{
"answer_id": 507601,
"author": "Dave Mosher",
"author_id": 33740,
"author_profile": "https://Stackoverflow.com/users/33740",
"pm_score": 0,
"selected": false,
"text": "<p>Dynamically creating elements should work fine, the script will be executed upon insertion into the DOM. To answer... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2972/"
] | I have an ASP.NET website. Very huge!
The latest addition I've made, everything is JavaScript/AJAX enabled.
I send HTML and JavaScript code back from the server to the client, and the client will inject the HTML into a DIV - and inject the JavaScript into the DOM using this:
```
$('<script type="text/javascript">' +... | Don't appendChild to 'document'; <script> can't go there and you should get a HIERARCHY\_REQUEST\_ERR DOMException according to the DOM Level 1 Core spec. The only element that can go in the Document object's child list is the single root documentElement, <html>.
Instead append the script to an element inside the docu... |
507,554 | <p>is there a way how to use Zend_Db relations for setting related objects?
I am looking for something like following code:</p>
<pre><code>$contentModel = new Content();
$categoryModel = new Category();
$category = $categoryModel->createRow();
$category->setName('Name Category 4');
$content = $conten... | [
{
"answer_id": 507594,
"author": "smack0007",
"author_id": 26566,
"author_profile": "https://Stackoverflow.com/users/26566",
"pm_score": 1,
"selected": false,
"text": "<p>I always override Zend_Db_Table and Zend_Db_Table_Row and use my own subclasses. In my Db_Table class I have:</p>\n\n... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39014/"
] | is there a way how to use Zend\_Db relations for setting related objects?
I am looking for something like following code:
```
$contentModel = new Content();
$categoryModel = new Category();
$category = $categoryModel->createRow();
$category->setName('Name Category 4');
$content = $contentModel->createRow()... | I designed and implemented the table-relationships code in Zend Framework.
A foreign key (`$content->category` in your example) contains the value of the the primary key in the parent row it references. In your example, the `$category` doesn't contain a primary key value yet because you haven't saved it (assuming it u... |
507,556 | <p>Just been looking at the Spring framework for JDBC - it looks like there is a bit of a learning curve - and I'm still not able to find a nice up to date quick start Spring/JDBC tutorial of any quality! </p>
<p>Is there something lighter than Spring for basic JDBC operations - or has anyone got any good links for t... | [
{
"answer_id": 507568,
"author": "IAdapter",
"author_id": 30453,
"author_profile": "https://Stackoverflow.com/users/30453",
"pm_score": 2,
"selected": false,
"text": "<p>yes, it has JdbcTemplate for that.</p>\n\n<p><a href=\"http://www.techfaq360.com/tutorial/spring/JdbcTemplate.jsp\" re... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5175/"
] | Just been looking at the Spring framework for JDBC - it looks like there is a bit of a learning curve - and I'm still not able to find a nice up to date quick start Spring/JDBC tutorial of any quality!
Is there something lighter than Spring for basic JDBC operations - or has anyone got any good links for tutorials
M... | Quite the opposite. JDBC support in Spring is very simple. Here is basic example:
```
dataSource = ... obtain data source... (e.g. via Spring config)
SimpleJdbcTemplate jdbcTemplate = new SimpleJdbcTemplate(dataSource);
Map<String, Object> row = jdbcTemplate.queryForMap(
"SELECT * FROM MyTable WHERE ID=? LIMIT... |
507,560 | <p>I have a number of VC 6.0 projects (dsps) which build into dlls which don't have resource files. Any idea how to add resources into an existing project?</p>
<p>The project is due for a major release shortly and I want to add a fileversion to those dlls currently lacking one. The dlls will be recompilied before rele... | [
{
"answer_id": 507645,
"author": "xtofl",
"author_id": 6610,
"author_profile": "https://Stackoverflow.com/users/6610",
"pm_score": 0,
"selected": false,
"text": "<p>You can always try use <code>editbin /VERSION:#[.#]</code> to change the version within the dll itself. Otherwise, it shou... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38892/"
] | I have a number of VC 6.0 projects (dsps) which build into dlls which don't have resource files. Any idea how to add resources into an existing project?
The project is due for a major release shortly and I want to add a fileversion to those dlls currently lacking one. The dlls will be recompilied before release so I'm... | Just add a VERSIONINFO block to the resource file for the DLL.
Open the .rc file, and use "Insert/Resource.../Version" and you'll get a new VERSIONINFO resource with a bunch of defaults. If the project does not already have a resource file, you can add one using "File/New.../Resource Script".
If you want to roll you... |
507,564 | <p>How can I use boolean choices in a model field to enable/disable other fields. If a boolean value is true/false I want it to enable/disable other model fields. Is there a way to natively express these relationships using django models/forms/widgets? I keep writing custom templates to model these relationships, bu... | [
{
"answer_id": 507838,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not entirely sure what you're doing with these objects but whichever the user chooses, you're pointing to a single mome... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36680/"
] | How can I use boolean choices in a model field to enable/disable other fields. If a boolean value is true/false I want it to enable/disable other model fields. Is there a way to natively express these relationships using django models/forms/widgets? I keep writing custom templates to model these relationships, but can'... | It would be helpful to clarify what you mean by "natively show this relationship," and think clearly about separation of concerns.
If all you want is to "gray out" or disable a certain field based on the value of another field, this is purely a presentation/UI issue, so the template (and/or Javascript) is the appropr... |
507,579 | <p>I'd like to put two columns on the side of the content div. The part I have problems with is that I want the columns being built from 3 parts. The top and bottom should have fixed heights, but the middle one would adjust depending on the content height. Look at the sample with one column:</p>
<pre><code><html>... | [
{
"answer_id": 507600,
"author": "Nick Van Brunt",
"author_id": 30470,
"author_profile": "https://Stackoverflow.com/users/30470",
"pm_score": 0,
"selected": false,
"text": "<p>try min-height for the one that needs to grow</p>\n"
},
{
"answer_id": 507604,
"author": "Andrew Duf... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29430/"
] | I'd like to put two columns on the side of the content div. The part I have problems with is that I want the columns being built from 3 parts. The top and bottom should have fixed heights, but the middle one would adjust depending on the content height. Look at the sample with one column:
```
<html>
<head>
<s... | This works in everything except IE6; for that you'll need a conditional comment and css expression to set a height instead of `bottom` on `#leftColumnMiddle`
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html><head>
<style>* { border: 1px solid black;}
#contentWrapper ... |
507,581 | <p>I'm securing the DB by only allowing interaction with the DB through a series of Sprocs; pretty common fare.</p>
<p>I've dug up and modified a script which loops through and assigns the user EXECUTE permission for all non-system SProcs. It works a treat except that I'd ideally like to add it to the Master DB so tha... | [
{
"answer_id": 507598,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 1,
"selected": false,
"text": "<p>You can use <a href=\"https://stackoverflow.com/questions/483798/creating-stored-procedure-in-another-database/483868... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6898/"
] | I'm securing the DB by only allowing interaction with the DB through a series of Sprocs; pretty common fare.
I've dug up and modified a script which loops through and assigns the user EXECUTE permission for all non-system SProcs. It works a treat except that I'd ideally like to add it to the Master DB so that I can ea... | Similiar to @Cade's answer, the way to do this is to use dynamic sql. Before each call to a database table, add '@DbName.' Then replace the @DbName with the actual database name (the database name can't be passed as a variable in SQL, so you have to do the replace).
Also Cursors are normally considered evil for perfor... |
507,589 | <p>I previously used <code>CDO.Message</code> and <code>CDO.Configuration</code> in ASP Classic to create HTML emails which was VERY simple to do. In .NET, it appears that you have to give the <code>System.Net.Mail.Message</code> object an HTML string for the content and then somehow embed the required images. Is there... | [
{
"answer_id": 507657,
"author": "mouviciel",
"author_id": 45249,
"author_profile": "https://Stackoverflow.com/users/45249",
"pm_score": 0,
"selected": false,
"text": "<p>If it could be useful by itself (think of a command line tool built around it), put it in the Models folder. If it is... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I previously used `CDO.Message` and `CDO.Configuration` in ASP Classic to create HTML emails which was VERY simple to do. In .NET, it appears that you have to give the `System.Net.Mail.Message` object an HTML string for the content and then somehow embed the required images. Is there an easy way to do this in .NET? I'm... | It's not a controller, content or a view, so don't use those. It sounds most closely related to your model, so you could put it in model under a subfolder called "Helpers" or "Utility" or some such. Or you can add another top level folder called Services and put it there. That's where I put all my app logic, the middle... |
507,602 | <p>How would you initialise a static <code>Map</code> in Java?</p>
<p>Method one: static initialiser <br>
Method two: instance initialiser (anonymous subclass)
or
some other method?</p>
<p>What are the pros and cons of each?</p>
<p>Here is an example illustrating the two methods:</p>
<pre><code>import java.util.Has... | [
{
"answer_id": 507621,
"author": "Tim Frey",
"author_id": 1471,
"author_profile": "https://Stackoverflow.com/users/1471",
"pm_score": 7,
"selected": false,
"text": "<p>One advantage to the second method is that you can wrap it with <code>Collections.unmodifiableMap()</code> to guarantee ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507602",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7412/"
] | How would you initialise a static `Map` in Java?
Method one: static initialiser
Method two: instance initialiser (anonymous subclass)
or
some other method?
What are the pros and cons of each?
Here is an example illustrating the two methods:
```
import java.util.HashMap;
import java.util.Map;
public class Test ... | The instance initialiser is just syntactic sugar in this case, right? I don't see why you need an extra anonymous class just to initialize. And it won't work if the class being created is final.
You can create an immutable map using a static initialiser too:
```
public class Test {
private static final Map<Intege... |
507,606 | <p>I apologize for the headline, I don't really know a better way of putting it (let me know if you have a better way, I will change it). Please consider the following code:</p>
<pre><code><html>
<head>
<title>IE 6 Menu Test</title>
<style type="text/css">
... | [
{
"answer_id": 507647,
"author": "David Kolar",
"author_id": 3283,
"author_profile": "https://Stackoverflow.com/users/3283",
"pm_score": 1,
"selected": false,
"text": "<p>I don't have a solution to the main issue, but you could change your code formatting to look nicer and still work in ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7186/"
] | I apologize for the headline, I don't really know a better way of putting it (let me know if you have a better way, I will change it). Please consider the following code:
```
<html>
<head>
<title>IE 6 Menu Test</title>
<style type="text/css">
.nMenu {
border: 1px solid b... | Apply `display: block;` to the `li`, tell IE6 to make the `a` 100% in width, and tell all browsers to display the `a` as a block instead.
```
.nMenu li {
display: block;
}
/* hack for IE6 */
* html .nMenu a
{
width: 100%
}
.nMenu a {
display: block;
padding: 3px 0px 3px 5px;
background-color: #... |
507,641 | <p>I am writing a Makefile with a lot of repetitive stuff, e.g.</p>
<pre><code>debug_ifort_Linux:
if [ $(UNAME) = Linux ]; then \
$(MAKE) FC=ifort FFLAGS=$(difort) PETSC_FFLAGS="..." \
TARGET=$@ LEXT="ifort_$(UNAME)" -e syst; \
else ... | [
{
"answer_id": 507867,
"author": "Ed.T",
"author_id": 3014,
"author_profile": "https://Stackoverflow.com/users/3014",
"pm_score": 0,
"selected": false,
"text": "<p>If the audience is not familiar with programming in <strong>Groovy</strong> there should be an introduction to that. Java wi... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51634/"
] | I am writing a Makefile with a lot of repetitive stuff, e.g.
```
debug_ifort_Linux:
if [ $(UNAME) = Linux ]; then \
$(MAKE) FC=ifort FFLAGS=$(difort) PETSC_FFLAGS="..." \
TARGET=$@ LEXT="ifort_$(UNAME)" -e syst; \
else ... | Here's some examples, but be warned that they're fairly trivial and don't really show you how the system works together. One of the strengths of Grails is that the different parts all combine to reduce your code complexity and speed development. I recommend doing a single project of moderate size (like blogging softwar... |
507,646 | <p>I'm trying to select the 5 most viewed articles out of a list of the 20 most recent entries in a table. My table structure is essentially this:</p>
<pre><code>id | date | title | content | views
</code></pre>
<p>My first thought was just to use an inner select to get the 20 most recent articles, then select from ... | [
{
"answer_id": 507727,
"author": "David Hanak",
"author_id": 42136,
"author_profile": "https://Stackoverflow.com/users/42136",
"pm_score": 0,
"selected": false,
"text": "<p>Why don't you run the first (inner) query separately, and create the second query programmatically?</p>\n\n<pre><co... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507646",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12605/"
] | I'm trying to select the 5 most viewed articles out of a list of the 20 most recent entries in a table. My table structure is essentially this:
```
id | date | title | content | views
```
My first thought was just to use an inner select to get the 20 most recent articles, then select from that, but I have yet to hav... | I just tested this and it works
```
SELECT *
FROM (
SELECT *
FROM news
ORDER BY id DESC
LIMIT 0, 20
) lasttwenty
ORDER BY views DESC
LIMIT 0, 5
```
Server version: 5.0.51a-3ubuntu5.4 |
507,653 | <p>How can I assign a set of text values to an array? Nothing I tried is working!</p>
<pre><code>Months = Array("Jan", "Feb", ..., "Dec")
</code></pre>
<p>and others I tried do not work!</p>
| [
{
"answer_id": 507663,
"author": "Mark Biek",
"author_id": 305,
"author_profile": "https://Stackoverflow.com/users/305",
"pm_score": 1,
"selected": false,
"text": "<p>I'm pretty sure you can only do it like this:</p>\n\n<pre><code> dim months(2) as string\n\n months(0) = \"Jan\"\n months... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59790/"
] | How can I assign a set of text values to an array? Nothing I tried is working!
```
Months = Array("Jan", "Feb", ..., "Dec")
```
and others I tried do not work! | Here's something about VB: <http://www.devx.com/vb2themax/Tip/18322>
>
> Visual Basic doesn't provide any way
> to declare an array and initialize its
> elements at the same time. In most
> cases you end up with setting
> individual elements one by one, as in:
>
>
>
```
Dim strArray(0 To 3) As String
strA... |
507,660 | <p>I'm using org.apache.commons.net.ftp.FTPClient and seeing behavior that is, well... perplexing.</p>
<p>The method beneath intends to go through an FTPFile list, read them in and then do something with the contents. That's all working. What is not (really) working is that the FTPClient object does the following...<... | [
{
"answer_id": 507776,
"author": "Zach Scrivena",
"author_id": 20029,
"author_profile": "https://Stackoverflow.com/users/20029",
"pm_score": 5,
"selected": true,
"text": "<p>According to the API for <a href=\"http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html#ret... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59947/"
] | I'm using org.apache.commons.net.ftp.FTPClient and seeing behavior that is, well... perplexing.
The method beneath intends to go through an FTPFile list, read them in and then do something with the contents. That's all working. What is not (really) working is that the FTPClient object does the following...
```
1) Pro... | According to the API for [`FTPClient.retrieveFileStream()`](http://commons.apache.org/net/api/org/apache/commons/net/ftp/FTPClient.html#retrieveFileStream(java.lang.String)), the method returns `null` when it cannot open the data connection, in which case you should check the reply code (e.g. [`getReplyCode()`](http://... |
507,665 | <p>In one of the recent <strong>Stackoverflow podcasts</strong>, Jeff talked about having a single image file having all of those tiny images that are all over a page and then cutting it with CSS so that all the images get displayed correctly. The whole point is to reduce the number of server requests so that the page ... | [
{
"answer_id": 507678,
"author": "krusty.ar",
"author_id": 43981,
"author_profile": "https://Stackoverflow.com/users/43981",
"pm_score": 2,
"selected": false,
"text": "<p>It's called <a href=\"http://www.alistapart.com/articles/sprites/\" rel=\"nofollow noreferrer\">css sprites</a>.</p>\... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8954/"
] | In one of the recent **Stackoverflow podcasts**, Jeff talked about having a single image file having all of those tiny images that are all over a page and then cutting it with CSS so that all the images get displayed correctly. The whole point is to reduce the number of server requests so that the page gets loaded fast... | Basically you use your single image as the background image, but move it off (to the left and up) by the offset of the image you want to display. E.g. to display the hammer icon:
```
.hammer
{
background: transparent url(myIcons.jpg) -50px -50px no-repeat;
}
```
But as far as I know, you have to make sure that the... |
507,677 | <p>I just want to verify that I'm not missing something here... so bear with me.</p>
<p>I'm rewriting a lot of old stored procedures and keep seeing IF statements formatted similar to this:</p>
<pre><code>begin
if @someParameter <> 'ThisType'
set @someCode = right(cast(@pYear as varchar(6)),2) + 'THIS'
... | [
{
"answer_id": 507697,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 2,
"selected": false,
"text": "<p>Correct. The begin...end block in your example encapsulates the IF statement, but does not affect it. Though the ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507677",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54804/"
] | I just want to verify that I'm not missing something here... so bear with me.
I'm rewriting a lot of old stored procedures and keep seeing IF statements formatted similar to this:
```
begin
if @someParameter <> 'ThisType'
set @someCode = right(cast(@pYear as varchar(6)),2) + 'THIS'
end
```
So the Begin...En... | In T-SQL Begin and END should wrap the contained statements of an IF (or other control structure) with multiple statements being executed (like a code block)
**Would Work**
```
if @someParameter <> 'ThisType'
set @someCode = right(cast(@pYear as varchar(6)),2) + 'THIS'
```
**Would Also Work but not strictly nec... |
507,693 | <p>What is a regular expression for </p>
<pre><code>initSock|north|router\r\n
</code></pre>
<p>Where there is <strong>north</strong> changes all the time but the rest is always the same.
So It can be:</p>
<pre><code>initSock|foo|router\r\n
initSock|bar|router\r\n
</code></pre>
<p>etc.</p>
<p>But where <strong>nort... | [
{
"answer_id": 507706,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 3,
"selected": false,
"text": "<pre><code>\"^initSock\\|([a-zA-Z]+)\\|router\\\\r\\\\n$\"\n</code></pre>\n\n<p>Although I would probably be tempted t... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61976/"
] | What is a regular expression for
```
initSock|north|router\r\n
```
Where there is **north** changes all the time but the rest is always the same.
So It can be:
```
initSock|foo|router\r\n
initSock|bar|router\r\n
```
etc.
But where **north**, **foo** or **bar** are there definitely should be something and can't ... | To extend the above answer from M Potato Head to allow for all possible characters I'd rewrite the regexp as:
```
"^initSock\|[^|]+\|router\\r\\n$"
```
or
```
"^initSock\|[^|][^|]*\|router\\r\\n$"
```
if you can't use extended regexp. That way you don't have to ensure that you've allowed for all possible chars in... |
507,738 | <p>I'm currently thinking about some design details of remoting / serialization between a Java Swing WebStart Application (Fat Client) and some remote services running on Tomcat. I want to use a http compatible transport to communicate with the server and since I'm already using Spring, I assume Spring's HTTP Remoting ... | [
{
"answer_id": 507781,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 0,
"selected": false,
"text": "<p>Firstly, I'd recommend using <a href=\"http://java.sun.com/docs/books/tutorial/rmi/index.html\" rel=\"nofollow nore... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49201/"
] | I'm currently thinking about some design details of remoting / serialization between a Java Swing WebStart Application (Fat Client) and some remote services running on Tomcat. I want to use a http compatible transport to communicate with the server and since I'm already using Spring, I assume Spring's HTTP Remoting is ... | If you're going to serialize, You'll probably need to implement readResolve to guarantee that you're not creating additional instances:
From the javadoc for Serializable:
>
> Classes that need to designate a
> replacement when an instance of it is
> read from the stream should implement
> this special method with... |
507,747 | <p>I understand that a stream is a representation of a sequence of bytes. Each stream provides means for reading and writing bytes to its given backing store. But what is the point of the stream? Why isn't the backing store itself what we interact with? </p>
<p>For whatever reason this concept just isn't clicking ... | [
{
"answer_id": 507750,
"author": "Torlack",
"author_id": 5243,
"author_profile": "https://Stackoverflow.com/users/5243",
"pm_score": 5,
"selected": false,
"text": "<p>The point of the stream is to provide a layer of abstraction between you and the backing store. Thus a given block of co... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507747",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/132931/"
] | I understand that a stream is a representation of a sequence of bytes. Each stream provides means for reading and writing bytes to its given backing store. But what is the point of the stream? Why isn't the backing store itself what we interact with?
For whatever reason this concept just isn't clicking for me. I've r... | The word "stream" has been chosen because it represents (in real life) a very similar meaning to what we want to convey when we use it.
Let's forget about the backing store for a little, and start thinking about the analogy to a water stream. You receive a continuous flow of data, just like water continuously flows in... |
507,751 | <p>I have a bunch of ZIP files that are in desperate need of some hierarchical reorganization and extraction. What I can do, currently, is create the directory structure and move the zip files to the proper location. The mystic cheese that I am missing is the part that extracts the files from the ZIP archive.</p>
<p... | [
{
"answer_id": 508030,
"author": "jro",
"author_id": 49888,
"author_profile": "https://Stackoverflow.com/users/49888",
"pm_score": 6,
"selected": false,
"text": "<p>From <a href=\"http://blogs.msdn.com/msdnmagazine/archive/2007/05/16/2675596.aspx\" rel=\"noreferrer\">MSDN</a>, </p>\n\n<p... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507751",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2894/"
] | I have a bunch of ZIP files that are in desperate need of some hierarchical reorganization and extraction. What I can do, currently, is create the directory structure and move the zip files to the proper location. The mystic cheese that I am missing is the part that extracts the files from the ZIP archive.
I have seen... | If you are manipulating ZIP files, you may want to look into a 3rd-party library to help you.
For example, DotNetZip, which has been recently updated. The current version is now v1.8. Here's an example to create a zip:
```
using (ZipFile zip = new ZipFile())
{
zip.AddFile("c:\\photos\\personal\\7440-N49th.png");
... |
507,757 | <p>I'm trying to setup a post-build event in .NET 3.5 that will run a suite of unit tests w/ MS test. I found <a href="http://www.highoncoding.com/Articles/398_Using%20Post-Build%20Event%20to%20Execute%20Unit%20Tests.aspx" rel="noreferrer">this</a> post that shows how to call a bat file using MbUnit but I'm wanting to... | [
{
"answer_id": 507771,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 2,
"selected": false,
"text": "<p>Personally I would not recomment running unit tests as a part of the compilation process. Instead, consider somet... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2701/"
] | I'm trying to setup a post-build event in .NET 3.5 that will run a suite of unit tests w/ MS test. I found [this](http://www.highoncoding.com/Articles/398_Using%20Post-Build%20Event%20to%20Execute%20Unit%20Tests.aspx) post that shows how to call a bat file using MbUnit but I'm wanting to see if anyone has done this typ... | We were using NUnit in the same style and decided to move to MSTest. When doing so, we just added the following to our Post-Build event of the applicable MSTest project:
```
CD $(TargetDir)
"$(DevEnvDir)MSTEST.exe" /testcontainer:$(TargetFileName)
```
The full set of MSTest command line options can be found at the [... |
507,799 | <p>Hi I have two data tables say:</p>
<p>Table 1:</p>
<pre><code>name age
---- ---
Bob 40
</code></pre>
<p>Table 2:</p>
<pre><code>auto kids
---- ----
3 3
</code></pre>
<p>I want to merge the two tables to get something like</p>
<pre><code>name age auto kids
--- --- --- ----
Bob 40 3 3
</code></pre>... | [
{
"answer_id": 507807,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 0,
"selected": false,
"text": "<p>Merge will only combine the data of tables with similar schema. </p>\n\n<p>You will probably have to iterate through... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55057/"
] | Hi I have two data tables say:
Table 1:
```
name age
---- ---
Bob 40
```
Table 2:
```
auto kids
---- ----
3 3
```
I want to merge the two tables to get something like
```
name age auto kids
--- --- --- ----
Bob 40 3 3
```
Is this possible? I tried merge but it does not seem to be working, thanks... | I'm going to take a shot at adding to the previous two answers in the hopes of making it clearer for you in case it's not. What Stingy and Menace are wondering why the two tables you speak of don't look something like this:
**Person**
PersonID (primary key)
FirstName
LastName
Age
**Demographics**
Demog... |
507,803 | <p>I have an object and in that object I start my thread (for loading doing some URL loading).</p>
<p>When I have a return of my data I call a selector to perform on the main thread.</p>
<p>Works fine if I call it the first time, but the second time it crashes (no specific error).</p>
<pre><code>[NSThread detachNewT... | [
{
"answer_id": 507901,
"author": "Mark",
"author_id": 62014,
"author_profile": "https://Stackoverflow.com/users/62014",
"pm_score": 0,
"selected": false,
"text": "<p>You may want to post some more information about your problem (which of the two lines crashes, what you've figured out fro... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62009/"
] | I have an object and in that object I start my thread (for loading doing some URL loading).
When I have a return of my data I call a selector to perform on the main thread.
Works fine if I call it the first time, but the second time it crashes (no specific error).
```
[NSThread detachNewThreadSelector:@selector(doTh... | When dealing with threads, avoid autoreleased objects like the plague. The autorelease pools will be drained at nondeterministic times, causing fun crashes. Use alloc/init and release on all objects involved, making sure to retain all objects that you take in on methods that are called from another thread using perform... |
507,819 | <p>A single/double/extended-precision floating-point representation of Pi is accurate up to how many decimal places?</p>
| [
{
"answer_id": 507844,
"author": "Robert Gould",
"author_id": 15124,
"author_profile": "https://Stackoverflow.com/users/15124",
"pm_score": 2,
"selected": false,
"text": "<p>6 places and 14 places.1 place is over 0 for the 3, and the last place although stored can't be considered as a pr... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A single/double/extended-precision floating-point representation of Pi is accurate up to how many decimal places? | ```c
#include <stdio.h>
#define E_PI 3.1415926535897932384626433832795028841971693993751058209749445923078164062
int main(int argc, char** argv)
{
long double pild = E_PI;
double pid = pild;
float pif = pid;
printf("%s\n%1.80f\n%1.80f\n%1.80Lf\n",
"3.14159265358979323846264338327950288419716939937... |
507,827 | <p>I have a case where I need to use pluralize to properly spell something. However, I need to render the html like so:</p>
<pre><code><span>1</span> thing
</code></pre>
<p>or,</p>
<pre><code><span>3</span> things
</code></pre>
<p>I could write a helper method, but I'm just making sure there... | [
{
"answer_id": 507917,
"author": "Lolindrath",
"author_id": 7985,
"author_profile": "https://Stackoverflow.com/users/7985",
"pm_score": 3,
"selected": false,
"text": "<p>This uses the Rails class <a href=\"http://api.rubyonrails.com/classes/ActionView/Helpers/TextHelper.html#M001714\" re... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/722/"
] | I have a case where I need to use pluralize to properly spell something. However, I need to render the html like so:
```
<span>1</span> thing
```
or,
```
<span>3</span> things
```
I could write a helper method, but I'm just making sure there isn't something in the box to do this. | In the interim, I've created this helper method, because it looks like there isn't what I'm looking for:
```
def pluralize_word(count, singular, plural = nil)
((count == 1 || count == '1') ? singular : (plural || singular.pluralize))
end
```
It's essentially identical to the pluralize method, except that it remove... |
507,832 | <p>I created a user control in WPF:</p>
<pre><code><UserControl x:Class="TestUserControl.Controls.GetLatest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock Name="theTextBlock"/>
</UserControl>
</code... | [
{
"answer_id": 507866,
"author": "Bubblewrap",
"author_id": 57497,
"author_profile": "https://Stackoverflow.com/users/57497",
"pm_score": 2,
"selected": false,
"text": "<p>FirstMessage is set after the constructor has been called.\nYou should change your Text from the setter of FirstMess... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | I created a user control in WPF:
```
<UserControl x:Class="TestUserControl.Controls.GetLatest"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBlock Name="theTextBlock"/>
</UserControl>
```
The code behind has a parameter ... | Your approach to binding doesn't work because your property FirstMessage doesn't notify when it gets updated. Use Dependency Properties for that. See below:
```
public partial class GetLatest : UserControl
{
public static readonly DependencyProperty FirstMessageProperty = DependencyProperty.Register("FirstMessage"... |
507,848 | <p>In Win32 programming, what is the difference between a window's parent and a window's owner? I thought I had it figured out, then I came across this code:</p>
<pre><code>SetWindowLong(handle, GWL_HWNDPARENT, foo);
</code></pre>
<p>This actually sets the window's owner, not the parent - despite the GWL_HWNDPARENT b... | [
{
"answer_id": 507915,
"author": "TheSmurf",
"author_id": 1975282,
"author_profile": "https://Stackoverflow.com/users/1975282",
"pm_score": 5,
"selected": true,
"text": "<p>Owner is the Window* responsible for a control or dialog (for example, responsible for creating/destroying the wind... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343/"
] | In Win32 programming, what is the difference between a window's parent and a window's owner? I thought I had it figured out, then I came across this code:
```
SetWindowLong(handle, GWL_HWNDPARENT, foo);
```
This actually sets the window's owner, not the parent - despite the GWL\_HWNDPARENT being used. Are the terms ... | Owner is the Window\* responsible for a control or dialog (for example, responsible for creating/destroying the window).
Parent is the next-senior window\* to a control or dialog in the window chain, but isn't actually responsible for it (doesn't necessarily care about its lifecycle, etc). A window's parent can also b... |
507,853 | <p>We have a few Win32 applications (coded in Delphi 2006) where sometimes the user gets an error message saying <strong>"System Error. Code: 8. Not enough storage is available to process this command."</strong>.</p>
<p>From the stacktrace it looks like it is always during CreateWnd call</p>
<pre><code>Main ($1edc):
... | [
{
"answer_id": 508211,
"author": "Aikislave",
"author_id": 47716,
"author_profile": "https://Stackoverflow.com/users/47716",
"pm_score": 1,
"selected": false,
"text": "<p>There could be bugs in the compiler, it's a fair bet it's something in your app that is causing the problem. Could it... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1008/"
] | We have a few Win32 applications (coded in Delphi 2006) where sometimes the user gets an error message saying **"System Error. Code: 8. Not enough storage is available to process this command."**.
From the stacktrace it looks like it is always during CreateWnd call
```
Main ($1edc):
004146cc +070 app.exe SysUtils ... | If your program uses a lot of windows resources it could be a Resource Heap shortage.
There is a registry entry that can be increased to raise the heap size for XP. For Vista Microsoft already sets the default value higher. I recommend changing the default 3072 to at least 8192.
This information is documented in the ... |
507,855 | <p>I'm a bit of newbie to c#/.net development, but I've put together a stock tracking application for a small set of assets in my company. I have also set up the database it connects to in SQL 2000. </p>
<p>It currently works brilliantly when a network connection is available, but I want to expand it for use when I'm ... | [
{
"answer_id": 507886,
"author": "Luke",
"author_id": 261917,
"author_profile": "https://Stackoverflow.com/users/261917",
"pm_score": 4,
"selected": true,
"text": "<p><code>System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()</code></p>\n\n<p>You can also use the events... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61999/"
] | I'm a bit of newbie to c#/.net development, but I've put together a stock tracking application for a small set of assets in my company. I have also set up the database it connects to in SQL 2000.
It currently works brilliantly when a network connection is available, but I want to expand it for use when I'm away from ... | `System.Net.NetworkInformation.NetworkInterface.GetIsNetworkAvailable()`
You can also use the events `NetworkAvailabilityChanged` and `NetworkAddressChanged` in that class to monitor IP address and network availability changes.
EDIT: Be aware that this method checks all available network interfaces that may be on the... |
507,869 | <p>Do you know if there's a quick way in sql server (via transact-sql) that I could trim all the database string fields.</p>
| [
{
"answer_id": 507883,
"author": "Adam Ralph",
"author_id": 49241,
"author_profile": "https://Stackoverflow.com/users/49241",
"pm_score": 4,
"selected": false,
"text": "<p>Your question is a bit vague but is this what you are after?</p>\n\n<pre><code>UPDATE mytable SET mycolumn= LTRIM(RT... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507869",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37783/"
] | Do you know if there's a quick way in sql server (via transact-sql) that I could trim all the database string fields. | No cursors. Copy and paste the output. Works also for SQL 2000, which doesn't have varchar(max). This can be easily extended to add a GO line to the end of each UPDATE if desired.
```
SELECT SQL
FROM ( SELECT t.TABLE_CATALOG
, t.TABLE_SCHEMA
, t.TABLE_NAME
... |
507,878 | <p>I am having trouble with something i wanna do. I have some big forms which take some time to create. To make the app load faster i thought of letting the forms be created in a thread which is created at main form's OnCreate event. The thread has a FApplication field of type TApplication which obviously is the Applic... | [
{
"answer_id": 507925,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 5,
"selected": false,
"text": "<p>Creating forms in a thread simply will not work. The VCL , and especially the visual portion, is not thread safe. Gi... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am having trouble with something i wanna do. I have some big forms which take some time to create. To make the app load faster i thought of letting the forms be created in a thread which is created at main form's OnCreate event. The thread has a FApplication field of type TApplication which obviously is the Applicati... | Creating forms in a thread simply will not work. The VCL , and especially the visual portion, is not thread safe. Give up on that idea, and instead optimize the code which is causing the form to take a long time to create. You haven't told us what the slow part is. If you can answer that, perhaps we can suggest a metho... |
507,884 | <p>For instance. I have some structure:</p>
<pre><code>s_Some{
std::string lable;
s_some_junk some_junk;
};
</code></pre>
<p>And a vector:</p>
<pre><code>std::vector<s_Some> mSome;
</code></pre>
<p>And then I fill this vector with a lot of s_Somes. </p>
<p>I need to find an iterator for a single s_Some i... | [
{
"answer_id": 507892,
"author": "Frederick The Fool",
"author_id": 32688,
"author_profile": "https://Stackoverflow.com/users/32688",
"pm_score": 3,
"selected": false,
"text": "<p>If you are to search only a few times or if your vector is likely to have different content every time you s... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25459/"
] | For instance. I have some structure:
```
s_Some{
std::string lable;
s_some_junk some_junk;
};
```
And a vector:
```
std::vector<s_Some> mSome;
```
And then I fill this vector with a lot of s\_Somes.
I need to find an iterator for a single s\_Some in this vector, which has a specific lable. So far I just ite... | Option 1)
If you are compelled to use the std::vector, but once the vector is filled it stays unchanged, then you could sort the vector and use the binary search. The only cost would be the sorting then and there will be no additional overhead. Searching time is logarithmic O(logN).
Option 2)
If you have the freedom a... |
507,903 | <p>I am trying to write a procmail forward script, which will forward all the mails received at mydomain.com to mydomain.NET. To be more clear, if mail is to:jack@mydomain.com, it should forward to: jack@mydomain.net. Like this it should forward for all corresponding emails: How Can I do this?</p>
| [
{
"answer_id": 508353,
"author": "Steen",
"author_id": 1448983,
"author_profile": "https://Stackoverflow.com/users/1448983",
"pm_score": 3,
"selected": true,
"text": "<p>I think what you're looking for is perhaps better implemented using sendmail. Since procmail in the case of redirectio... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45629/"
] | I am trying to write a procmail forward script, which will forward all the mails received at mydomain.com to mydomain.NET. To be more clear, if mail is to:jack@mydomain.com, it should forward to: jack@mydomain.net. Like this it should forward for all corresponding emails: How Can I do this? | I think what you're looking for is perhaps better implemented using sendmail. Since procmail in the case of redirection in any case just hands over the mail to sendmail.
Use the following directive in your sendmail virtual user table:
```
@mydomain.com %1@mydomain.net
```
which effectively will map every user at my... |
507,927 | <p>I used libcurl with no problems and used pyCurl once in the past. Now i want to set it up on my machine and dev. However i have no idea how to do it. I rather not DL libcirl files and compile that along with pycurl, i want to know the simplest method. I have libcurl installed on my machine.</p>
<p>I am on Windows. I... | [
{
"answer_id": 507955,
"author": "JosefAssad",
"author_id": 53936,
"author_profile": "https://Stackoverflow.com/users/53936",
"pm_score": 4,
"selected": false,
"text": "<p>Depends on platform. Here on ubuntu it's as simple as:</p>\n\n<pre><code>sudo apt-get install python-pycurl\n</code>... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I used libcurl with no problems and used pyCurl once in the past. Now i want to set it up on my machine and dev. However i have no idea how to do it. I rather not DL libcirl files and compile that along with pycurl, i want to know the simplest method. I have libcurl installed on my machine.
I am on Windows. I tried DL... | Depends on platform. Here on ubuntu it's as simple as:
```
sudo apt-get install python-pycurl
```
It's common enough a package to think that most major Linux distributions will have it in their sources.
If you're on windows, you'll need [cURL](http://curl.haxx.se/download.html) too. Then you can install [pycurl](ht... |
507,931 | <p>When executing the following using a smalldatetime constraint on the returned results, I get zero results:</p>
<pre><code>Execute sp_proc @DateOfBirth = '01/01/1900'
</code></pre>
<p><strong>or</strong> </p>
<pre><code>Execute sp_proc @DateOfBirth = '1900-01-01'
</code></pre>
<p><strong>But when using the... | [
{
"answer_id": 507964,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 0,
"selected": false,
"text": "<p>use a safe format like YYYYMMDD (no dashes)</p>\n\n<p>run these also to see what happens</p>\n\n<pre><code>select convert... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507931",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35286/"
] | When executing the following using a smalldatetime constraint on the returned results, I get zero results:
```
Execute sp_proc @DateOfBirth = '01/01/1900'
```
**or**
```
Execute sp_proc @DateOfBirth = '1900-01-01'
```
**But when using the following varchar argument all the sudden i get results which corres... | "01/01/00" is converted based on the "[two digit year cutoff](http://msdn.microsoft.com/en-us/library/ms189577(SQL.90).aspx)" option.
So it becomes 01 Jan 2000.
If you send '1900-01-01', then your code shows you'll only get results if you have DOB = 01 Jan 1900.
Other than that, it's working as advertised.
Unless yo... |
507,933 | <p>How can I find the number of internal angles of a polygon, bigger than 180º,
having only the vertices of the polygon?</p>
<p>For each vertex I want always the internal angle, not the external.</p>
<p>Thanks from Brazil.</p>
| [
{
"answer_id": 507970,
"author": "Niyaz",
"author_id": 184,
"author_profile": "https://Stackoverflow.com/users/184",
"pm_score": -1,
"selected": false,
"text": "<p>This is a question related to geometry, not exactly progamming related.</p>\n\n<p>If you have the vertices, you can just fin... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62010/"
] | How can I find the number of internal angles of a polygon, bigger than 180º,
having only the vertices of the polygon?
For each vertex I want always the internal angle, not the external.
Thanks from Brazil. | You can determine the angle of two vectors simply by taking the scalar product (dot product). A useful property is that if the vectors are orthogonal, their scalar product is zero; if their angle is obtuse, the product is negative, otherwise positive. So, the steps to take are:
* find the first edge from V0 to V1 (as ... |
507,941 | <p>This would have been a lot easier if not for certain situations.</p>
<p>Sample data:</p>
<pre><code>KENP989SD
KENP913E
KENPX189R
KENP913
</code></pre>
<p>What regular expression can I use to remove all characters from the string starting at the first non-alpha character? Basically, I want to find the first non-al... | [
{
"answer_id": 507954,
"author": "user54650",
"author_id": 54650,
"author_profile": "https://Stackoverflow.com/users/54650",
"pm_score": 3,
"selected": false,
"text": "<pre><code>s/([A-Za-z]*).*/$1/\n</code></pre>\n\n<p>... will work. It's not necessarily the best way of doing it, but i... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42229/"
] | This would have been a lot easier if not for certain situations.
Sample data:
```
KENP989SD
KENP913E
KENPX189R
KENP913
```
What regular expression can I use to remove all characters from the string starting at the first non-alpha character? Basically, I want to find the first non-alpha character and chop everything... | `$s =~ s/[^a-zA-Z].*$//;`
Literally, find the first non-alpha char and chop everything off starting from it. |
507,942 | <p>What does <code>{x:Static}</code> mean in XAML?</p>
<p>Code sample: </p>
<pre><code><SolidColorBrush Color="{x:Static SystemColors.ControlColor}" />
</code></pre>
| [
{
"answer_id": 507961,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 0,
"selected": false,
"text": "<p>I found the question <a href=\"https://stackoverflow.com/questions/32395/xaml-accessing-static-fields\">XAML - Access... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1659/"
] | What does `{x:Static}` mean in XAML?
Code sample:
```
<SolidColorBrush Color="{x:Static SystemColors.ControlColor}" />
``` | It is a way to insert any static value into XAML. For example, if I have a class:
```
namespace A
{
public class MyConstants
{
public static readonly string SomeConstantString = "BAM!";
}
}
```
I can place it into a WPF UI using XAML like this:
```
<TextBlock Text="{x:Static A:MyConstants.Som... |
507,944 | <p>I've defined some global keyboard handling using jQuery's keypress event.</p>
<p>Is there a way to suppress these events for <em>input</em>/<em>textarea</em> fields so as not to interfere with typing?<br>
I've used some hacks with conditions based on element selectors, but those had a big performance impact as they... | [
{
"answer_id": 508145,
"author": "Zach",
"author_id": 9128,
"author_profile": "https://Stackoverflow.com/users/9128",
"pm_score": 3,
"selected": true,
"text": "<p>Create an onfocus handler for all input and textareas that sets some global variable indicating that keyboard events should b... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've defined some global keyboard handling using jQuery's keypress event.
Is there a way to suppress these events for *input*/*textarea* fields so as not to interfere with typing?
I've used some hacks with conditions based on element selectors, but those had a big performance impact as they were fired on every sing... | Create an onfocus handler for all input and textareas that sets some global variable indicating that keyboard events should be ignored. Create another handler for the blur event to reset the global variable.
```
var DISABLE_KEY_HANDLERS = false;
$('input[type=text], input[type=password], textarea').focus(function(){
... |
507,968 | <p>I am trying to build a jquery script that will open a new browser window (popup window) for a mail like application (user can double click on mails and they will open in a new window).</p>
<p>That is not particular hard. My problem is that I want to keep track of the opened windows, so that if a user double clicks ... | [
{
"answer_id": 508636,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 3,
"selected": true,
"text": "<p>The only thing that I noticed is that you have an extra comma after menubar in your defaults. After removing that last... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32809/"
] | I am trying to build a jquery script that will open a new browser window (popup window) for a mail like application (user can double click on mails and they will open in a new window).
That is not particular hard. My problem is that I want to keep track of the opened windows, so that if a user double clicks on the sam... | The only thing that I noticed is that you have an extra comma after menubar in your defaults. After removing that last comma it worked fine for me on IE7. What version if IE is giving you this problem? |
507,971 | <p>I have a <code>std::map</code> like this:</p>
<pre><code>map<wstring,int> Scores;
</code></pre>
<p>It stores names of players and scores. When someone gets a score I would simply do:</p>
<pre><code>Scores[wstrPlayerName]++;
</code></pre>
<p>When there is no element in the map with the key <code>wstrPlayerN... | [
{
"answer_id": 507984,
"author": "hazzen",
"author_id": 5066,
"author_profile": "https://Stackoverflow.com/users/5066",
"pm_score": 4,
"selected": false,
"text": "<p>This will default-construct a new instance of <code>value</code>. For integers, the default construction is 0, so this wor... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58805/"
] | I have a `std::map` like this:
```
map<wstring,int> Scores;
```
It stores names of players and scores. When someone gets a score I would simply do:
```
Scores[wstrPlayerName]++;
```
When there is no element in the map with the key `wstrPlayerName` it will create one, but does it initialize to zero or null before ... | operator[] looks like this:
```
Value& map<Key, Value>::operator[](const Key& key);
```
If you call it with a **key** that's not yet in the map, it will default-construct a new instance of **Value**, put it in the map under **key** you passed in, and return a reference to it. In this case, you've got:
```
map<wstri... |
507,975 | <p>I'm trying to implement behaviour similar to the Firefox 3 AwesomeBar in WPF. I've got a ComboBox to use a DataTemplate that makes the dropdown look like the dropdown for the AwesomeBar, but I'm not sure how to get the right behaviour.</p>
<p>What I want to happen is for the user to type their search into the TextB... | [
{
"answer_id": 508514,
"author": "Robert Macnee",
"author_id": 19273,
"author_profile": "https://Stackoverflow.com/users/19273",
"pm_score": 3,
"selected": true,
"text": "<p>Most of the functionality you want is already in the ComboBox.</p>\n\n<blockquote>\n <p>Is there a programmatic w... | 2009/02/03 | [
"https://Stackoverflow.com/questions/507975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1912/"
] | I'm trying to implement behaviour similar to the Firefox 3 AwesomeBar in WPF. I've got a ComboBox to use a DataTemplate that makes the dropdown look like the dropdown for the AwesomeBar, but I'm not sure how to get the right behaviour.
What I want to happen is for the user to type their search into the TextBox bit of ... | Most of the functionality you want is already in the ComboBox.
>
> Is there a programmatic way to tell the ComboBox list to drop down?
>
>
>
Yes, you can do this by setting the [ComboBox.IsDropDownOpen](http://msdn.microsoft.com/en-us/library/system.windows.controls.combobox.isdropdownopen.aspx) property to **tru... |