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 |
|---|---|---|---|---|---|---|
330,532 | <p>I'm looking for a complete solution to a automated "building" and testing of PHP application. I came across PhpUnderControl, a solution for running automated application builds created around Cruise Control.</p>
<p>Unfortunately PhpUC is still in it's early stages of development and I can't get it to work on window... | [
{
"answer_id": 331444,
"author": "Jeffrey Fredrick",
"author_id": 35894,
"author_profile": "https://Stackoverflow.com/users/35894",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>I'm wondering if Cruise Control is\n able to merge logs created by PHPUnit\n (in XML format)... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330532",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38769/"
] | I'm looking for a complete solution to a automated "building" and testing of PHP application. I came across PhpUnderControl, a solution for running automated application builds created around Cruise Control.
Unfortunately PhpUC is still in it's early stages of development and I can't get it to work on windows box.
Af... | >
> I'm wondering if Cruise Control is
> able to merge logs created by PHPUnit
> (in XML format) into project log or is
> it working for Java's JUnit files
> only.
>
>
>
CC will merge any xml file you point it at. When you say merging the files isn't working are you getting an error merging them or are the tes... |
330,543 | <p>I have this php code, with which I am trying to generate a popup window that will contain the contents of a html file, however after adding in the script tags, no html is displayed. I tried echoing out $row2, but the word array is printed to the screen and nothing else.</p>
<pre><code><?php
session_start();
if (... | [
{
"answer_id": 330550,
"author": "Gonzalo Quero",
"author_id": 40996,
"author_profile": "https://Stackoverflow.com/users/40996",
"pm_score": 0,
"selected": false,
"text": "<p>Your <code><script></code> tag is never closed and your <em>JavaScript</em> instructions are not ended with... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have this php code, with which I am trying to generate a popup window that will contain the contents of a html file, however after adding in the script tags, no html is displayed. I tried echoing out $row2, but the word array is printed to the screen and nothing else.
```
<?php
session_start();
if (isset($_GET["cmd"... | As well as the missing `</script>`,
`child1.document.write('.$row2["ARTICLE_DESC"].')`
should be
`child1.document.write(' . json_encode($row2["ARTICLE_DESC"]) . ');`
The [`json_encode()`](http://www.php.net/json_encode) function will take care of any quoting for you.
Edit:
`<a href='#' onclick=makewindows()>` shou... |
330,562 | <p>My usage-scenario may seem a bit unusual, but here it is: When using vim (it's one of about 4 different editors I use regularly), I use it in two different situations. The first is via the GUI, in which I'll have multiple buffers and have some settings different than when I use it from the command-line (by testing "... | [
{
"answer_id": 330689,
"author": "rampion",
"author_id": 9859,
"author_profile": "https://Stackoverflow.com/users/9859",
"pm_score": 4,
"selected": true,
"text": "<p>do your session magic in your <code>.gvimrc</code> and everything else in your <code>.vimrc</code>. The GUI will source b... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6421/"
] | My usage-scenario may seem a bit unusual, but here it is: When using vim (it's one of about 4 different editors I use regularly), I use it in two different situations. The first is via the GUI, in which I'll have multiple buffers and have some settings different than when I use it from the command-line (by testing "`if... | do your session magic in your `.gvimrc` and everything else in your `.vimrc`. The GUI will source both, but the CL version will only source the `.vimrc`.
The session magic is to set up autocommands to write your session to a file on exit, and reload it by sourcing the file upon entrance.
```
au VimLeave * mksession ~... |
330,569 | <p>Is there a way to find a node matched on part of a value.</p>
<p>If I have the following:</p>
<pre><code><competition id="100" name="Barclays Premier League"/>
<competition id="101" name="CocaCola Championship" />
<competition id="102" name="CocaCola League 1" />
</code></pre>
<p>Given the strin... | [
{
"answer_id": 330583,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 5,
"selected": true,
"text": "<p>String handling is not something XSLT is amazing at but there are a few options.</p>\n\n<p>In this case you might try:<... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/274/"
] | Is there a way to find a node matched on part of a value.
If I have the following:
```
<competition id="100" name="Barclays Premier League"/>
<competition id="101" name="CocaCola Championship" />
<competition id="102" name="CocaCola League 1" />
```
Given the string "Premier League" or even "Prem", how would I matc... | String handling is not something XSLT is amazing at but there are a few options.
In this case you might try:
```
//competition[contains(@name,'Prem')]
```
see [here](http://www.w3schools.com/Xpath/xpath_functions.asp#string) for more options and details |
330,571 | <p>I have a DataGrid that looks like this (slightly simplified here):</p>
<pre><code><asp:DataGrid ID="grdQuotas" runat="server" AutoGenerateColumns="False">
<HeaderStyle CssClass="quotas-header" />
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
... | [
{
"answer_id": 330642,
"author": "netadictos",
"author_id": 31791,
"author_profile": "https://Stackoverflow.com/users/31791",
"pm_score": 1,
"selected": false,
"text": "<p>You could do the Databinding of the DropDownlist in the Databound event of the DataGrid.</p>\n\n<p>Edit:\nI will giv... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] | I have a DataGrid that looks like this (slightly simplified here):
```
<asp:DataGrid ID="grdQuotas" runat="server" AutoGenerateColumns="False">
<HeaderStyle CssClass="quotas-header" />
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
Max order level</HeaderTemplate>
... | Create another DataSource and bind it to the DataGrid. Where the SelectMethod would return the default values in a simple object.
Then all the binding should happily work together. |
330,590 | <p>I'm using a JComboBox with an ItemListener on it. When the value is changed, the itemStateChanged event is called twice. The first call, the ItemEvent is showing the original item selected. On the second time, it is showing the item that has been just selected by the user. Here's some tester code:</p>
<pre><code>pu... | [
{
"answer_id": 330602,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 6,
"selected": true,
"text": "<p>Have a look at this source:</p>\n\n<pre><code>import javax.swing.*;\nimport java.awt.*;\nimport java.awt.event.*;\n... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21144/"
] | I'm using a JComboBox with an ItemListener on it. When the value is changed, the itemStateChanged event is called twice. The first call, the ItemEvent is showing the original item selected. On the second time, it is showing the item that has been just selected by the user. Here's some tester code:
```
public Tester(){... | Have a look at this source:
```
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class Tester {
public Tester(){
JComboBox box = new JComboBox();
box.addItem("One");
box.addItem("Two");
box.addItem("Three");
box.addItem("Four");
box.addIte... |
330,601 | <p>Is there a way to make stack trace to display the whole generated SQL statement when there is an error instead just the first few characters of it?</p>
<p>This is what it currently displays</p>
<blockquote>
<p>...\Zend\Db\Adapter\Pdo\Abstract.php(220): Zend_Db_Adapter_Abstract->query('UPDATE "diction...', Array)... | [
{
"answer_id": 332110,
"author": "Solid Rhino",
"author_id": 42111,
"author_profile": "https://Stackoverflow.com/users/42111",
"pm_score": 4,
"selected": false,
"text": "<p>If you want to view the complete sql statement you can use Zend_Debug. For example if your sql statement is in the ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a way to make stack trace to display the whole generated SQL statement when there is an error instead just the first few characters of it?
This is what it currently displays
>
> ...\Zend\Db\Adapter\Pdo\Abstract.php(220): Zend\_Db\_Adapter\_Abstract->query('UPDATE "diction...', Array)
>
>
>
..and I would... | If you want to view the complete sql statement you can use Zend\_Debug. For example if your sql statement is in the variable $select and you want to view the complete sql statement you can use the following line of code:
```
Zend_Debug::Dump($select);
exit;
```
Or if your code is created withe the Zend\_Db\_Table cl... |
330,609 | <p>I have an animation which moves some views around. When this animation completes I want the window to recalculate the keyview loop. My code is simmilar to the follow mock code:</p>
<pre><code>[NSAnimationContext beginGrouping];
[newView setAlpha: 0.0]; //hide newView
[self addSubView:newView];
//position t... | [
{
"answer_id": 330759,
"author": "adam",
"author_id": 33604,
"author_profile": "https://Stackoverflow.com/users/33604",
"pm_score": 1,
"selected": false,
"text": "<p>if you use CAAnimation this has an animationDidStop:finished: delegate method..</p>\n\n<p><a href=\"http://developer.apple... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an animation which moves some views around. When this animation completes I want the window to recalculate the keyview loop. My code is simmilar to the follow mock code:
```
[NSAnimationContext beginGrouping];
[newView setAlpha: 0.0]; //hide newView
[self addSubView:newView];
//position the views
[[old... | Something that's not so obvious, or at least wasn't to me, is that there are two animations going on when you do a `setFrame:`, with keys `frameSize` and `frameOrigin`.
Depending on what your original and final frames are you may need to register yourself as a delegate for one or both of them.
I'd also recommend that... |
330,612 | <p>I have a table of time-series data of which I need to find all columns that contain at least one non-null value within a given time period. So far I am using the following query:</p>
<pre><code>select max(field1),max(field2),max(field3),...
from series where t_stamp between x and y
</code></pre>
<p>Afterwards ... | [
{
"answer_id": 330626,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 0,
"selected": false,
"text": "<p>Edit: I think I misread the question... this will give you all the <em>rows</em> with a non-null value. I'll leave it her... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330612",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33805/"
] | I have a table of time-series data of which I need to find all columns that contain at least one non-null value within a given time period. So far I am using the following query:
```
select max(field1),max(field2),max(field3),...
from series where t_stamp between x and y
```
Afterwards I check each field of the ... | The EXISTS operation may be faster since it can stop searching as soon as it finds any row that matches the criteria (vs. the MAX which you are using). It depends on your data and how smart your SQL server is. If most of your columns have a high rate of non-null data then this method will find rows quickly and it shoul... |
330,622 | <p>In C# language when you refer to an array element you can write:</p>
<p>myclass.my_array['element_name'] = new Point(1,1);</p>
<p>I think about refering to a element with name element_name by using dot in place of backets:</p>
<p>myclass.my_array.element_name = new Point(1,1);</p>
<p>Do you know any language whe... | [
{
"answer_id": 330639,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 1,
"selected": false,
"text": "<p>What would be the advantage of such a syntax for you? </p>\n\n<p>If you have fix names why not create a class with... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330622",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38940/"
] | In C# language when you refer to an array element you can write:
myclass.my\_array['element\_name'] = new Point(1,1);
I think about refering to a element with name element\_name by using dot in place of backets:
myclass.my\_array.element\_name = new Point(1,1);
Do you know any language where exists similar syntax t... | You could almost certainly do this in any dynamic language, by handling property/variable access as an indexer if the specified property/variable didn't actually exist. I suspect that many dynamic languages already provide this functionality in some areas.
It's possible that in C# 4 you'll be able to make your objects... |
330,625 | <p>We have implemented a popup window as a modal dialog using the IE method:</p>
<pre><code>window.showModalDialog('...aspx')
</code></pre>
<p>The target of the popup window is itself an ASP.Net web page.</p>
<p>Assume for the following steps that the popup has never been launched:</p>
<ol>
<li>Launch popup.</li>
<... | [
{
"answer_id": 330651,
"author": "Greg Hurlman",
"author_id": 35,
"author_profile": "https://Stackoverflow.com/users/35",
"pm_score": 4,
"selected": true,
"text": "<p>Add a timestamp querystring variable to the URL of the dialog content - number of ticks since 1/1/08 or something - IE wi... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3362/"
] | We have implemented a popup window as a modal dialog using the IE method:
```
window.showModalDialog('...aspx')
```
The target of the popup window is itself an ASP.Net web page.
Assume for the following steps that the popup has never been launched:
1. Launch popup.
2. Page\_Load event handler executes on server si... | Add a timestamp querystring variable to the URL of the dialog content - number of ticks since 1/1/08 or something - IE will treat it as a new page and ignore the cache. |
330,649 | <p>I have followed the suggestion in this question...</p>
<p>[<a href="https://stackoverflow.com/questions/220020/how-to-handle-checkboxes-in-aspnet-mvc-forms][1]">How to handle checkboxes in ASP.NET MVC forms?</a></p>
<p>...to setup multiple checkboxes with the same name="..." attribute and the form behaves as expec... | [
{
"answer_id": 330682,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 2,
"selected": true,
"text": "<p>FWIW, here is what I do (not sure if it related):</p>\n\n<pre><code> // please MS, stop screwing around!!!!!!!!!!!!!!!\n... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23208/"
] | I have followed the suggestion in this question...
[[How to handle checkboxes in ASP.NET MVC forms?](https://stackoverflow.com/questions/220020/how-to-handle-checkboxes-in-aspnet-mvc-forms][1])
...to setup multiple checkboxes with the same name="..." attribute and the form behaves as expected the FIRST time its submi... | FWIW, here is what I do (not sure if it related):
```
// please MS, stop screwing around!!!!!!!!!!!!!!!
string r = Request.Form["r"];
```
Then proceed to extract the values manually from 'r'. I still use Preview 4, as they have really broken too many existing features, and not fixed reported bugs. |
330,662 | <p>I am downloading a text string from a web service into an RBuf8 using this kind of code (it works..)</p>
<pre><code>void CMyApp::BodyReceivedL( const TDesC8& data ) {
int newLength = iTextBuffer.Length() + data.Length();
if (iTextBuffer.MaxLength() < newLength)
{
iTextBuffer.ReAll... | [
{
"answer_id": 330706,
"author": "michael aubert",
"author_id": 17867,
"author_profile": "https://Stackoverflow.com/users/17867",
"pm_score": 1,
"selected": false,
"text": "<p>void RBuf16::Copy(const TDesC8&) will take an 8bit descriptor and convert it into a 16bit descriptor.</p>\n\... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] | I am downloading a text string from a web service into an RBuf8 using this kind of code (it works..)
```
void CMyApp::BodyReceivedL( const TDesC8& data ) {
int newLength = iTextBuffer.Length() + data.Length();
if (iTextBuffer.MaxLength() < newLength)
{
iTextBuffer.ReAllocL(newLength);
... | What you may need is something to the effect of:
```
RDebug::Print( _L( "downloaded text %S" ), &buf );
```
[This tutorial](http://wiki.forum.nokia.com/index.php/How_to_use_RDebug) may help you. |
330,688 | <p>I'm using the following query, but I currently have to enter a value in every parameter for the query to work. Is there a way of making the parameters optional, so that 1 or more values will return a result?</p>
<pre><code>SELECT * FROM film
WHERE day LIKE '%day%'
AND month LIKE '%month%'
AND year LIKE '%year%'
</c... | [
{
"answer_id": 330703,
"author": "adam",
"author_id": 33604,
"author_profile": "https://Stackoverflow.com/users/33604",
"pm_score": 0,
"selected": false,
"text": "<pre><code>SELECT * FROM film\nWHERE day LIKE '%day%'\nOR month LIKE '%month%'\nOR year LIKE '%year%'\n</code></pre>\n\n<p>Yo... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using the following query, but I currently have to enter a value in every parameter for the query to work. Is there a way of making the parameters optional, so that 1 or more values will return a result?
```
SELECT * FROM film
WHERE day LIKE '%day%'
AND month LIKE '%month%'
AND year LIKE '%year%'
```
---
someth... | Why don't you create your query dynamically?
Depending on the parameters you have, append the filters dynamically.
e.g.:
```
string query = "SELECT * FROM film";
string paramenters = string.empty;
if(day!= string.empty)
parameters = " Where day LIKE '%day%'";
if(month != string.empty)
{
if(parameters != strin... |
330,707 | <p>I'm using an SqlCommand object to insert a record into a table with an autogenerated primary key. How can I write the command text so that I get the newly created ID when I use the ExecuteScalar() method?</p>
| [
{
"answer_id": 330721,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 4,
"selected": false,
"text": "<pre><code>insert into Yourtable() \nvalues() \nSELECT SCOPE_IDENTITY()\n</code></pre>\n\n<p>I just ran a test and ver... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16440/"
] | I'm using an SqlCommand object to insert a record into a table with an autogenerated primary key. How can I write the command text so that I get the newly created ID when I use the ExecuteScalar() method? | ```
INSERT INTO YourTable(val1, val2, val3 ...)
VALUES(@val1, @val2, @val3...);
SELECT SCOPE_IDENTITY();
```
Don't forget the semicolons at the end of each statement. |
330,709 | <p>I just had some basic php questions to further my understanding as I learn, that I could not find easy answers to</p>
<ol>
<li><p>I have a php ajax application that generates a table of mysql rows. I would like to know if there is a way to get php to generate neat html, as it seems neat enough as I echo it out, but... | [
{
"answer_id": 330713,
"author": "BlaM",
"author_id": 999,
"author_profile": "https://Stackoverflow.com/users/999",
"pm_score": 0,
"selected": false,
"text": "<ol>\n<li><p>You could use the <a href=\"http://de3.php.net/manual/de/intro.tidy.php\" rel=\"nofollow noreferrer\">PHP Tidy Addon... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I just had some basic php questions to further my understanding as I learn, that I could not find easy answers to
1. I have a php ajax application that generates a table of mysql rows. I would like to know if there is a way to get php to generate neat html, as it seems neat enough as I echo it out, but when "viewing s... | Question 1
----------
You need to separate the PHP code and the HTML output. The easiest thing to do, as a newbie, is :
* Fill a var named $tab with your entries.
* Create a file called "`my_tab_template.php`" including your xHTML code, using very few PHP to unpack $tab and only with the **PHP alternative syntax**.
... |
330,730 | <p>What does the following expression return in Java?</p>
<pre><code>Math.max(Float.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
</code></pre>
<p>I saw this question in a website and the answer is <code>Double.POSITIVE_INFINITY</code>. I'm not sure about this answer as how can we compare 2 infinities? Can someone c... | [
{
"answer_id": 330742,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 2,
"selected": false,
"text": "<p>Certainly you can compare infinities. Unless you get into transfinite numbering systems where there are varying degr... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40945/"
] | What does the following expression return in Java?
```
Math.max(Float.POSITIVE_INFINITY, Double.POSITIVE_INFINITY);
```
I saw this question in a website and the answer is `Double.POSITIVE_INFINITY`. I'm not sure about this answer as how can we compare 2 infinities? Can someone clarify this? Thanks. | Float.POSITIVE\_INFINITY returns float and Double.POSITIVE\_INFINITY returns double.
There is no method called Math.max(float, double).
only Math.max(float, float) and Math.max(double, double)
Therefore when the method is called Math.max(float, double), it converts the float argument to double and so the Math.max(dou... |
330,737 | <p>I am using the jQuery Datepicker widget with two input boxes, one for the <strong>"From"</strong> date and the second with the <strong>"To"</strong> date. I am using the <a href="http://jqueryui.com/datepicker/" rel="noreferrer">jQuery Datepicker functional demo</a> as a basis for getting the two input boxes to work... | [
{
"answer_id": 330859,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 2,
"selected": false,
"text": "<p>Consider using rangeSelect to have one control instead of two.</p>\n\n<p>To achieve what you are after, I suppose ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1831/"
] | I am using the jQuery Datepicker widget with two input boxes, one for the **"From"** date and the second with the **"To"** date. I am using the [jQuery Datepicker functional demo](http://jqueryui.com/datepicker/) as a basis for getting the two input boxes to work with each other, but I need to be able to add these addi... | Many thanks for your help Ben, I have built upon your posts and have come up with this. It is now complete and works brilliantly!
Here's a **[Working Demo](http://jsbin.com/evudo)**. Add **/edit** to the URL to see the code
Complete Code below-
```
$(function ()
{
$('#txtStartDate, #txtEndDate').datepicker({... |
330,750 | <p>I wish to display a list of letters from a through z on a form.
Each letter needs to be clickable with that value being passed as a click argument.
Aside from creating 26 letters and using the click event of each letter does anyone know of a quick way to do this?
I know how to load dynamic controls etc and how to do... | [
{
"answer_id": 330811,
"author": "Stefan",
"author_id": 19307,
"author_profile": "https://Stackoverflow.com/users/19307",
"pm_score": 1,
"selected": false,
"text": "<p>This is the \"dynamic way\" I would do it in. I know you asked for other clever ways to do it in but I think this is the... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35441/"
] | I wish to display a list of letters from a through z on a form.
Each letter needs to be clickable with that value being passed as a click argument.
Aside from creating 26 letters and using the click event of each letter does anyone know of a quick way to do this?
I know how to load dynamic controls etc and how to do it... | You can use a FlowLayoutPanel and a loop like this:
```
private void button1_Click(object sender, EventArgs e)
{
flowLayoutPanel1.FlowDirection = FlowDirection.LeftToRight;
flowLayoutPanel1.AutoSize = true;
flowLayoutPanel1.WrapContents = false; //or true, whichever you like
flowLayoutPanel1.Controls.Clear();
... |
330,757 | <p>I tried to write a <code>TransformMesh</code> function. The function accepts a <code>Mesh</code> object and a <code>Matrix</code> object. The idea is to transform the mesh using the matrix. To do this, I locked the vertex buffer, and called Vector3::TransformCoordinate on each vertex. It did <em>not</em> produce exp... | [
{
"answer_id": 512708,
"author": "Coincoin",
"author_id": 42,
"author_profile": "https://Stackoverflow.com/users/42",
"pm_score": 2,
"selected": false,
"text": "<p>Without contextual code around what you are doing, it might be hard to know the exact problem. How is the mesh created? How ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45603/"
] | I tried to write a `TransformMesh` function. The function accepts a `Mesh` object and a `Matrix` object. The idea is to transform the mesh using the matrix. To do this, I locked the vertex buffer, and called Vector3::TransformCoordinate on each vertex. It did *not* produce expected results. The resulting mesh was unrec... | I totally agree with Coincoin, contextual code would help.
And if you want just to draw transformed mesh to the screen, you don't need to transform the mesh in this way. You can just change one of world, view, and projection matrices. This produces expected result. Like in the following sample code.
```
// Cl... |
330,793 | <p>I want to initialize a struct element, split in declaration and initialization. This is what I have:</p>
<pre><code>typedef struct MY_TYPE {
bool flag;
short int value;
double stuff;
} MY_TYPE;
void function(void) {
MY_TYPE a;
...
a = { true, 15, 0.123 }
}
</code></pre>
<p>Is this the way to declare a... | [
{
"answer_id": 330802,
"author": "robert",
"author_id": 32805,
"author_profile": "https://Stackoverflow.com/users/32805",
"pm_score": 2,
"selected": false,
"text": "<pre class=\"lang-C prettyprint-override\"><code>void function(void) {\n MY_TYPE a;\n a.flag = true;\n a.value = 15;\n ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834/"
] | I want to initialize a struct element, split in declaration and initialization. This is what I have:
```
typedef struct MY_TYPE {
bool flag;
short int value;
double stuff;
} MY_TYPE;
void function(void) {
MY_TYPE a;
...
a = { true, 15, 0.123 }
}
```
Is this the way to declare and initialize a local vari... | In (ANSI) C99, you can use a **designated initializer** to initialize a structure:
```
MY_TYPE a = { .flag = true, .value = 123, .stuff = 0.456 };
```
Other members are initialized as zero: "Omitted field members are implicitly initialized the same as objects that have static storage duration." (<https://gcc.gnu.org... |
330,832 | <p>How do I call the correct overloaded function given a reference to an object based on the actual type of the object. For example...</p>
<pre><code>class Test
{
object o1 = new object();
object o2 = new string("ABCD");
MyToString(o1);
MyToString(o2);//I want this to call the second overloaded functio... | [
{
"answer_id": 330833,
"author": "Sandeep Datta",
"author_id": 39648,
"author_profile": "https://Stackoverflow.com/users/39648",
"pm_score": 3,
"selected": true,
"text": "<p>Ok as soon as I hit post I remembered this can indeed be done using reflection...</p>\n\n<pre><code>var methInfo =... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39648/"
] | How do I call the correct overloaded function given a reference to an object based on the actual type of the object. For example...
```
class Test
{
object o1 = new object();
object o2 = new string("ABCD");
MyToString(o1);
MyToString(o2);//I want this to call the second overloaded function
void My... | Ok as soon as I hit post I remembered this can indeed be done using reflection...
```
var methInfo = typeof(Test).GetMethod("MyToString", new Type[] {o.GetType()});
methInfo.Invoke(this, new object[] {o});
``` |
330,836 | <p>How do I uninstall a Windows Service when there is no executable for it left on the system? I can not run <code>installutil -u</code> since there is not executable left on the system. I can still see an entry for the service in the Services console. </p>
<p>The reason for this state is probably because of a problem... | [
{
"answer_id": 330845,
"author": "Samiksha",
"author_id": 29515,
"author_profile": "https://Stackoverflow.com/users/29515",
"pm_score": 2,
"selected": false,
"text": "<p>Create a copy of executables of same service and paste it on the same path of the existing service and then uninstall.... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330836",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/966/"
] | How do I uninstall a Windows Service when there is no executable for it left on the system? I can not run `installutil -u` since there is not executable left on the system. I can still see an entry for the service in the Services console.
The reason for this state is probably because of a problem in the msi package t... | You should be able to uninstall it using sc.exe (I think it is included in the Windows Resource Kit) by running the following in an "administrator" command prompt:
```
sc.exe delete <service name>
```
where `<service name>` is the name of the service itself as you see it in the service management console, not of the... |
330,878 | <p>Consider the following code and its output:</p>
<h3>Code</h3>
<pre><code>#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $HOURS_PER_DAY = 24.0 * 1.0;
my $BSA = 1.7 * 1.0;
my $MCG_PER_MG = 1000.0 * 1.0;
my $HOURS_DURATION = 20.0 * $HOURS_PER_DAY;
my $dummy = $HOURS_PER_DAY * $BSA * $MCG_PER_MG * $HOURS_DURAT... | [
{
"answer_id": 330885,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 3,
"selected": false,
"text": "<p>Data::Dumper is using a simple pattern on the string representation of the variable to determine if it is a numbe... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17523/"
] | Consider the following code and its output:
### Code
```
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
my $HOURS_PER_DAY = 24.0 * 1.0;
my $BSA = 1.7 * 1.0;
my $MCG_PER_MG = 1000.0 * 1.0;
my $HOURS_DURATION = 20.0 * $HOURS_PER_DAY;
my $dummy = $HOURS_PER_DAY * $BSA * $MCG_PER_MG * $HOURS_DURATION;
print Dumper($... | Data::Dumper's job is to serialize data and you can't tell much about what perl is doing internally with the data based on its output. The [Devel::Peek](http://search.cpan.org/perldoc?Devel::Peek) module can dump the underlying flags and values stored in the variables. The Devel::Peek POD explains the significance of t... |
330,900 | <p>If I want to split a list of words separated by a delimiter character, I can use</p>
<pre><code>>>> 'abc,foo,bar'.split(',')
['abc', 'foo', 'bar']
</code></pre>
<p>But how to easily and quickly do the same thing if I also want to handle quoted-strings which can contain the delimiter character ?</p>
<pre>... | [
{
"answer_id": 330908,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": false,
"text": "<p>The <a href=\"https://docs.python.org/3/library/csv.html\" rel=\"nofollow noreferrer\" title=\"CSV File Reading and Writin... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42127/"
] | If I want to split a list of words separated by a delimiter character, I can use
```
>>> 'abc,foo,bar'.split(',')
['abc', 'foo', 'bar']
```
But how to easily and quickly do the same thing if I also want to handle quoted-strings which can contain the delimiter character ?
```
In: 'abc,"a string, with a comma","anoth... | ```
import csv
input = ['abc,"a string, with a comma","another, one"']
parser = csv.reader(input)
for fields in parser:
for i,f in enumerate(fields):
print i,f # in Python 3 and up, print is a function; use: print(i,f)
```
Result:
```
0 abc
1 a string, with a comma
2 another, one
``` |
330,927 | <p>I'm learning DI, and made my first project recently.</p>
<p>In this project I've implement the repository pattern. I have the interfaces and the concrete implementations. I wonder if is possible to build the implementation of my interfaces as "plugins", dlls that my program will load dynamically.</p>
<p>So the pro... | [
{
"answer_id": 330932,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 2,
"selected": false,
"text": "<p>you can easily do it with normal C# reflection, you don't need any extra technology.</p>\n\n<p>There are quite a few exam... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32415/"
] | I'm learning DI, and made my first project recently.
In this project I've implement the repository pattern. I have the interfaces and the concrete implementations. I wonder if is possible to build the implementation of my interfaces as "plugins", dlls that my program will load dynamically.
So the program could be imp... | While [Sean Chambers' solution](https://stackoverflow.com/a/1733373) works in the case that you control the plugins, it does not work in the case where plugins might be developed by third parties and you don't want them to have to be dependent on writing ninject modules.
This is pretty easy to do with the [Conventions... |
330,937 | <p>I am using in the first part of my program</p>
<p><code>On Error GoTo start</code></p>
<p>Suppose in my second part I am again using</p>
<p><code>On Error Resume Next</code></p>
<p>This second error trap will not get activated as the first one will still be active. Is there any way to de-activate the first error han... | [
{
"answer_id": 330947,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 1,
"selected": false,
"text": "<p>try </p>\n\n<pre><code>On Error Goto 0\n</code></pre>\n\n<p>For further help look here: <a href=\"http://msdn.micr... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31132/"
] | I am using in the first part of my program
`On Error GoTo start`
Suppose in my second part I am again using
`On Error Resume Next`
This second error trap will not get activated as the first one will still be active. Is there any way to de-activate the first error handler after it has been used?
```vb
Set objexcel ... | It is nearly always better to avoid errors, rather than handling them. For example:
```vb
Set objexcel = CreateObject("excel.Application")
objexcel.Visible = True
'On Error GoTo Openwb '
'wbExists = False '
If Dir("C:\REPORT3.xls") = "" Then
objexcel.Workbooks.Add
Set wbexcel = objexcel.ActiveWorkbook
Se... |
330,951 | <p>Is there a simple way to remove a leading zero (as in 01 becoming 1)?</p>
| [
{
"answer_id": 330962,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 3,
"selected": false,
"text": "<pre><code>$str = \"01\";\necho intval($str);\n</code></pre>\n"
},
{
"answer_id": 330969,
"author": "J.D. Fitz... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a simple way to remove a leading zero (as in 01 becoming 1)? | You can use the [`ltrim`](http://php.net/ltrim) function:
```
ltrim($str,"0");
``` |
330,965 | <p>I currently store my log file in the Program Files\My App folder but some users don't have permission to write here if they are not a power user or administrator. Is there a common location for this type of log file?</p>
<h3>Update:</h3>
<p>I'm currently using Application.StartupPath.</p>
<pre><code>logFileLocation ... | [
{
"answer_id": 330986,
"author": "John Sibly",
"author_id": 1078,
"author_profile": "https://Stackoverflow.com/users/1078",
"pm_score": 0,
"selected": false,
"text": "<p>I would use the temporary folder.</p>\n\n<p>Use the function <a href=\"http://msdn.microsoft.com/en-us/library/aa36499... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I currently store my log file in the Program Files\My App folder but some users don't have permission to write here if they are not a power user or administrator. Is there a common location for this type of log file?
### Update:
I'm currently using Application.StartupPath.
```
logFileLocation = System.Windows.Forms.... | [I'd use Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData)](http://msdn.microsoft.com/en-us/library/system.environment.getfolderpath.aspx) and then [Path.Combine](http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx) that with ApplicationName\Version\LogFileName |
330,971 | <p>I have create a form class for editing deleting and add users to a database. If I want to edit a user how can I simply supply the information of the user to the form.</p>
<p>I use a Zend_Db_Table to get the data from the database.</p>
<p>This is the userForm class:</p>
<pre><code>class UsersForm extends Zend_Form... | [
{
"answer_id": 331591,
"author": "markus",
"author_id": 11995,
"author_profile": "https://Stackoverflow.com/users/11995",
"pm_score": 3,
"selected": true,
"text": "<p>This is done with:</p>\n\n<pre><code>$form->populate($data);\n</code></pre>\n\n<p>where $data is an array with your ta... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42111/"
] | I have create a form class for editing deleting and add users to a database. If I want to edit a user how can I simply supply the information of the user to the form.
I use a Zend\_Db\_Table to get the data from the database.
This is the userForm class:
```
class UsersForm extends Zend_Form
{
public function ini... | This is done with:
```
$form->populate($data);
```
where $data is an array with your table-row-data where the field names have to match the ones from the form. Zend will do the rest. |
330,978 | <p>Something I do often if I'm storing a bunch of string values and I want to be able to find them in O(1) time later is:</p>
<pre><code>foreach (String value in someStringCollection)
{
someDictionary.Add(value, String.Empty);
}
</code></pre>
<p>This way, I can comfortably perform <strong>constant-time</strong> l... | [
{
"answer_id": 331014,
"author": "user7116",
"author_id": 7116,
"author_profile": "https://Stackoverflow.com/users/7116",
"pm_score": 4,
"selected": true,
"text": "<p>If you're using .Net 3.5, try <a href=\"http://msdn.microsoft.com/en-us/library/bb359438.aspx\" rel=\"nofollow noreferrer... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2273/"
] | Something I do often if I'm storing a bunch of string values and I want to be able to find them in O(1) time later is:
```
foreach (String value in someStringCollection)
{
someDictionary.Add(value, String.Empty);
}
```
This way, I can comfortably perform **constant-time** lookups on these string values later on,... | If you're using .Net 3.5, try [HashSet](http://msdn.microsoft.com/en-us/library/bb359438.aspx). If you're not using .Net 3.5, try [C5](http://www.itu.dk/research/c5/). Otherwise your current method is ok (bool as @leppie suggests is better, or not as @JonSkeet suggests, dun dun dun!).
```
HashSet<string> stringSet = n... |
330,993 | <p>I'm new to ruby and started to create my *nd toy app.
I:</p>
<ol>
<li>Created controller 'questions'</li>
<li>Created model 'question'</li>
<li>Created controller action 'new'</li>
<li>Added 'New.html.erb' file</li>
</ol>
<p>in erb file I use <code>form_for</code> helper and and <code>new</code> controller action ... | [
{
"answer_id": 331085,
"author": "Michael Sepcot",
"author_id": 6033,
"author_profile": "https://Stackoverflow.com/users/6033",
"pm_score": 4,
"selected": true,
"text": "<p>In <code>config/routes.rb</code> you will need to add:</p>\n\n<pre><code>map.resources :questions\n</code></pre>\n\... | 2008/12/01 | [
"https://Stackoverflow.com/questions/330993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/430254/"
] | I'm new to ruby and started to create my \*nd toy app.
I:
1. Created controller 'questions'
2. Created model 'question'
3. Created controller action 'new'
4. Added 'New.html.erb' file
in erb file I use `form_for` helper and and `new` controller action where I instantiate
`@question` instance variable.
When I try to ... | In `config/routes.rb` you will need to add:
```
map.resources :questions
```
to fix the undefined method questions\_path problem.
One way to get `/questions/ask` is to modify `routes.rb` like so:
```
map.ask_question '/questions/ask', :controller => 'questions', :action => 'create'
```
which will give you `ask_q... |
331,002 | <p>I need to change the date format from US (mm/dd/YYYY) to UK (dd/mm/YYYY) on a single database on a SQL server machine.</p>
<p>How can this be done?</p>
<p>I've seen statements that do this for the whole system, and ones that do it for the session, but I can't change the code now as it will have to go through QA ag... | [
{
"answer_id": 331031,
"author": "Mladen Prajdic",
"author_id": 31345,
"author_profile": "https://Stackoverflow.com/users/31345",
"pm_score": -1,
"selected": false,
"text": "<p>You do realize that format has nothing to do with how SQL Server stores datetime, right?</p>\n\n<p>You can use ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] | I need to change the date format from US (mm/dd/YYYY) to UK (dd/mm/YYYY) on a single database on a SQL server machine.
How can this be done?
I've seen statements that do this for the whole system, and ones that do it for the session, but I can't change the code now as it will have to go through QA again, so I need a ... | You could use **SET DATEFORMAT**, like in this example
```
declare @dates table (orig varchar(50) ,parsed datetime)
SET DATEFORMAT ydm;
insert into @dates
select '2008-09-01','2008-09-01'
SET DATEFORMAT ymd;
insert into @dates
select '2008-09-01','2008-09-01'
select * from @dates
```
You would need to specify th... |
331,007 | <p>I have a TextBox control on my Form. I use the Leave event on the control to process user input. It works fine if the user clicks on some other control on the form, but the even doesn't get fired when the user goes straight to the main menu. Any ideas which event should I use to get it fired everytime?</p>
| [
{
"answer_id": 331035,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 2,
"selected": false,
"text": "<p>You should use \"Validating\" and \"Validated\" events for checking user's input.\nThen if user go to another control \"A\... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5363/"
] | I have a TextBox control on my Form. I use the Leave event on the control to process user input. It works fine if the user clicks on some other control on the form, but the even doesn't get fired when the user goes straight to the main menu. Any ideas which event should I use to get it fired everytime? | I found a reasonable workaround, I set the focus on the main menu manually:
EDIT: As suggested by @TcKs, I changed the event from ItemClicked to MenuActivate. Thanks very much for help!
```
private void menuStrip1_MenuActivate( object sender, EventArgs e )
{
menuStrip1.Focus();
}
``` |
331,013 | <p>I'm refactoring some objects that are serialized to XML but need to keep a few properties for backwards compatibility, I've got a method that converts the old object into the new one for me and nulls the obsolete property. I want to use the <code>Obsolete</code> attribute to tell other developers not to use this pro... | [
{
"answer_id": 331038,
"author": "user7116",
"author_id": 7116,
"author_profile": "https://Stackoverflow.com/users/7116",
"pm_score": 5,
"selected": false,
"text": "<p><em>EDIT</em>: <a href=\"https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94241&wa=w... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4950/"
] | I'm refactoring some objects that are serialized to XML but need to keep a few properties for backwards compatibility, I've got a method that converts the old object into the new one for me and nulls the obsolete property. I want to use the `Obsolete` attribute to tell other developers not to use this property but it i... | *EDIT*: [After reading a MS Connect article](https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94241&wa=wsignin1.0), it appears that .Net 2.0 has a 'feature' where it makes ObsoleteAttribute equivalent to XmlIgnoreAttribute without any notification in the documentation. So I'm going to re... |
331,045 | <p>This question is related to <a href="https://stackoverflow.com/questions/232926/how-to-make-consistent-dll-binaries-across-vs-versions">"How to make consistent dll binaries across VS versions ?"</a></p>
<ul>
<li>We have applications and DLLs built
with VC6 and a new application built
with VC9. The VC9-app has to us... | [
{
"answer_id": 331060,
"author": "Joris Timmermans",
"author_id": 33987,
"author_profile": "https://Stackoverflow.com/users/33987",
"pm_score": 1,
"selected": false,
"text": "<p>There are other things you need to consider too, such as which run-times are being used by the various librari... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27596/"
] | This question is related to ["How to make consistent dll binaries across VS versions ?"](https://stackoverflow.com/questions/232926/how-to-make-consistent-dll-binaries-across-vs-versions)
* We have applications and DLLs built
with VC6 and a new application built
with VC9. The VC9-app has to use
DLLs compiled with VC6,... | Interface member names will *not* be decorated -- they're just offsets in a vtable. You can define an interface (using a C struct, rather than a COM "interface") in a header file, thusly:
```
struct IFoo {
int Init() = 0;
};
```
Then, you can export a function from the DLL, with no mangling:
```
class CFoo : pu... |
331,052 | <p>I have a canvas element defined statically in the html with a width and height. If I attempt to use JavaScript to resize it dynamically (setting a new width and height - either on the attributes of the canvas or via the style properties) I get the following error in Firefox:</p>
<blockquote>
<p>uncaught exception... | [
{
"answer_id": 331462,
"author": "Eugene Lazutkin",
"author_id": 26394,
"author_profile": "https://Stackoverflow.com/users/26394",
"pm_score": 6,
"selected": false,
"text": "<p>You didn't publish your code, and I suspect you do something wrong. it is possible to change the size by assign... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42145/"
] | I have a canvas element defined statically in the html with a width and height. If I attempt to use JavaScript to resize it dynamically (setting a new width and height - either on the attributes of the canvas or via the style properties) I get the following error in Firefox:
>
> uncaught exception: [Exception... "Ill... | You didn't publish your code, and I suspect you do something wrong. it is possible to change the size by assigning width and height attributes using numbers:
```
canvasNode.width = 200; // in pixels
canvasNode.height = 100; // in pixels
```
At least it works for me. Make sure you don't assign strings (e.g., "2cm", ... |
331,068 | <p>I have been using anonymous namespaces to store local data and functions and wanted to know when the data is initialized? Is it when the application starts in the same way as static data or is it compiler dependent? For example:</p>
<pre><code>// foo.cpp
#include "foo.h"
namespace {
const int SOME_VALUE = 42;
... | [
{
"answer_id": 331078,
"author": "Mathieu Pagé",
"author_id": 5861,
"author_profile": "https://Stackoverflow.com/users/5861",
"pm_score": 2,
"selected": false,
"text": "<p>In this particular case (a global variable that is const) the variable is \"initialized\" at compile time.</p>\n\n<p... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] | I have been using anonymous namespaces to store local data and functions and wanted to know when the data is initialized? Is it when the application starts in the same way as static data or is it compiler dependent? For example:
```
// foo.cpp
#include "foo.h"
namespace {
const int SOME_VALUE = 42;
}
void foo::Som... | C++ Standard, **3.6.2/1** :
>
> Zero-initialization and
> initialization with a constant
> expression are collectively called
> static initialization; all other
> initialization is dynamic
> initialization. Objects of POD types
> (3.9) with static storage duration
> initialized with constant expressions
> (5.... |
331,070 | <p>I've got a website running under ASP .NET 2/IIS7/Vista. I have a URL rewriting module which allows me to have extensionless URLs. To get this to work I have configured the system.webServer section of the config file such that all requests are forwarded to the aspnet_isapi.dll. I have also added the URL rewrite modul... | [
{
"answer_id": 331484,
"author": "Douglas",
"author_id": 8231,
"author_profile": "https://Stackoverflow.com/users/8231",
"pm_score": 0,
"selected": false,
"text": "<p>Normally the Java EE security model will not allow the retrieval of the user password, for security reasons. But it depen... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12277/"
] | I've got a website running under ASP .NET 2/IIS7/Vista. I have a URL rewriting module which allows me to have extensionless URLs. To get this to work I have configured the system.webServer section of the config file such that all requests are forwarded to the aspnet\_isapi.dll. I have also added the URL rewrite module ... | I can't give you a generic solution, but this is what has worked for us. We have the app server connect to LDAP as a specific user that has the ability to request credentials for other users. Then we have some generic security code that we can use to request a users credentials from inside the session beans, based on t... |
331,073 | <p>Are there any optimizations to consider when connecting to Oracle with NHibernate? My calls to Oracle are taking an extremely long time. If I run the NHibernate query (copied from my output window in Visual Studio) directly against Oracle, it comes right back in under a second. Here is my config file for NHibernate.... | [
{
"answer_id": 331164,
"author": "Bluenuance",
"author_id": 33111,
"author_profile": "https://Stackoverflow.com/users/33111",
"pm_score": 2,
"selected": true,
"text": "<p>You may consider using this tool for \"debugging NHibernate\"\n<a href=\"http://ayende.com/projects/nhibernate-query-... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] | Are there any optimizations to consider when connecting to Oracle with NHibernate? My calls to Oracle are taking an extremely long time. If I run the NHibernate query (copied from my output window in Visual Studio) directly against Oracle, it comes right back in under a second. Here is my config file for NHibernate. I ... | You may consider using this tool for "debugging NHibernate"
[NHibernate Query Analyzer](http://ayende.com/projects/nhibernate-query-analyzer.aspx) |
331,082 | <p>I find this very strange, must be something I'm doing wrong, but still...
I'm working on a page using PHP and TPL files.
In my TPL file, there's a place in the footer for some extra lines if needed.</p>
<p>For instance, formchecking with Javascript.</p>
<p>so in PHP I did this:</p>
<pre><code>$foot = "<script ... | [
{
"answer_id": 331091,
"author": "donohoe",
"author_id": 24224,
"author_profile": "https://Stackoverflow.com/users/24224",
"pm_score": 1,
"selected": false,
"text": "<p>I believe with {} that PHP is expecting a variable within them. I haven't tested this, but try using single quote inste... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11795/"
] | I find this very strange, must be something I'm doing wrong, but still...
I'm working on a page using PHP and TPL files.
In my TPL file, there's a place in the footer for some extra lines if needed.
For instance, formchecking with Javascript.
so in PHP I did this:
```
$foot = "<script type=\"text/javascript\">if(doc... | Obviously the [template engine you are using](http://www.smarty.net/) eats away the part in curly braces.
Try something like:
```
$foot = "{literal}<script type=\"text/javascript\">if(document.getElementById){loadEvents();}</script>{/literal}";
``` |
331,109 | <p>I have a simple model called <code>Party</code> with a corresponding table called <code>parties</code>. There's also a controller with all the usual CRUD actions and so on. This model is used in a website and only one admin user is allowed to edit the parties - everyone else is allowed to call GET actions (index, sh... | [
{
"answer_id": 331134,
"author": "Milan Novota",
"author_id": 26123,
"author_profile": "https://Stackoverflow.com/users/26123",
"pm_score": 2,
"selected": false,
"text": "<p>I would go for the boolean flag and create nested singleton resource (promoted), which I would implement in Partie... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20467/"
] | I have a simple model called `Party` with a corresponding table called `parties`. There's also a controller with all the usual CRUD actions and so on. This model is used in a website and only one admin user is allowed to edit the parties - everyone else is allowed to call GET actions (index, show). Nothing special so f... | A simple "front\_page" attribute would suffice or another model like you mentioned, using the has\_one relationship would be fine as well.
Using another model would allow you to maintain some more information, like how long should it remain on the front page (expiration date?) or how many times it was featured (assumi... |
331,131 | <p>What we are looking for is: while compiling the same configuration, say Release|Win32, is there a way to only do the postbuild steps sometimes. Like, if I am on a dev machine do all the post-build steps or if I am on a build server then don't do them. Or is the only way to accomplish this is by implementing a new co... | [
{
"answer_id": 331168,
"author": "Chris",
"author_id": 1212,
"author_profile": "https://Stackoverflow.com/users/1212",
"pm_score": 1,
"selected": false,
"text": "<p>If you want to crack into MSBuild itself (.*proj files are essentially just MSBuild scripts), you can run machine-specific ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26564/"
] | What we are looking for is: while compiling the same configuration, say Release|Win32, is there a way to only do the postbuild steps sometimes. Like, if I am on a dev machine do all the post-build steps or if I am on a build server then don't do them. Or is the only way to accomplish this is by implementing a new confi... | You could use environment variables in the post build script. Something like this:
```
if NOT %ComputerName% == DEVMACHINENAME GOTO end
c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\ngen "$(TargetPath)"
:end
``` |
331,148 | <p>In C the following horror is valid:</p>
<pre><code>myFunc()
{
return 42; // return type defaults to int.
}
</code></pre>
<p>But, what about in C++? I can't find a reference to it either way...</p>
<p>My compiler (Codegear C++Builder 2007) currently accepts it without warning, but I've had comments that this <s... | [
{
"answer_id": 331155,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 5,
"selected": true,
"text": "<p>It's <em>ill-formed</em> in C++. Meaning that it doesn't compile with a standard conforming compiler. Par... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] | In C the following horror is valid:
```
myFunc()
{
return 42; // return type defaults to int.
}
```
But, what about in C++? I can't find a reference to it either way...
My compiler (Codegear C++Builder 2007) currently accepts it without warning, but I've had comments that this ***is*** an error in C++. | It's *ill-formed* in C++. Meaning that it doesn't compile with a standard conforming compiler. Paragraph **7.1.5/4** in Annex C of the Standard explains the change "Banning implicit int". |
331,152 | <p>I have an external stylesheet that has specific IE-hacks. Every so often my site will fail to build due to these hacks (it is the hash-hack; for example <strong><code>#margin-top:-2px;</code></strong>). This is the error:</p>
<blockquote>
<p>Unexpected character sequence. Expected a property name for the
" : ... | [
{
"answer_id": 331163,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 1,
"selected": false,
"text": "<p>The easiest thing is to close the file in the editor and it should stop complaining. </p>\n"
},
{
"answer_id... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I have an external stylesheet that has specific IE-hacks. Every so often my site will fail to build due to these hacks (it is the hash-hack; for example **`#margin-top:-2px;`**). This is the error:
>
> Unexpected character sequence. Expected a property name for the
> " : " declaration
>
>
>
I haven't found out a... | I'm not sure about 2008, but in 2005 (IIRC), you can go to:
```
Tools | Options | Text Editor | CSS | CSS Specific
```
and then untick **Detect Errors**
I remember having exactly the same problem on 100% valid CSS which MS didn't recognise (big shock), flicked this switch and forgot about the problem forever more... |
331,157 | <p>Does SQL Server CheckSum calculate a CRC? If not how can I get SQL Server to calculate a CRC on an arbitrary varchar column?</p>
| [
{
"answer_id": 331256,
"author": "Ian Varley",
"author_id": 37539,
"author_profile": "https://Stackoverflow.com/users/37539",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think T-SQL gives you the option to specify using a proper CRC as your checksum function. FYI, SQL Server In... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3153/"
] | Does SQL Server CheckSum calculate a CRC? If not how can I get SQL Server to calculate a CRC on an arbitrary varchar column? | I apologize for the crudity of the model, but this seems to do a correct CRC32 calculation.
I'm not a TSQL expert, and I'm sure that this could be improved mightily by a real SQL Server pro...
@input is the variable to calculate the CRC32 on.
It should be trivial to package this as a sproc or a udf, and the lookup tab... |
331,185 | <p>I have a div tag in the view that I'd like to update with a graph that I generate via Gruff.</p>
<p>I have the following controller action which does this at the end</p>
<pre><code>send_data g.to_blob, :disposition=>'inline', :type=>'image/png', :filename=>'top_n.pdf'
</code></pre>
<p>Now if I directly i... | [
{
"answer_id": 331565,
"author": "ARemesal",
"author_id": 36599,
"author_profile": "https://Stackoverflow.com/users/36599",
"pm_score": 2,
"selected": true,
"text": "<p>In your link_to_remote tag just set :complete to something like this:</p>\n\n<pre><code>:complete => \"updateImg(id_... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695/"
] | I have a div tag in the view that I'd like to update with a graph that I generate via Gruff.
I have the following controller action which does this at the end
```
send_data g.to_blob, :disposition=>'inline', :type=>'image/png', :filename=>'top_n.pdf'
```
Now if I directly invoke this action, I can see the graph. (M... | In your link\_to\_remote tag just set :complete to something like this:
```
:complete => "updateImg(id_of_div, request.responseText)"
```
And write a JS function:
```
function updateImg(id, img)
{
$(id).innerHTML = '<img src="' + img + '" />';
}
```
Where id\_of\_div is the id of the div when you want to show d... |
331,205 | <p>I'm creating a KVC/KVO-compliant mutable array on one of my objects the recommended way:</p>
<pre><code>@interface Factory {
NSMutableArray *widgets;
}
- (NSArray *)widgets;
- (void)insertObject:(id)obj inWidgetsAtIndex:(NSUInteger)idx;
- (void)removeObjectFromWidgetsAtIndex:(NSUInteger)idx;
@end
</code></pre>
... | [
{
"answer_id": 331480,
"author": "tcurdt",
"author_id": 33165,
"author_profile": "https://Stackoverflow.com/users/33165",
"pm_score": 0,
"selected": false,
"text": "<p>You will need locking on all reading and writing methods. If your insert and remove are also locking (like you said) the... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/79/"
] | I'm creating a KVC/KVO-compliant mutable array on one of my objects the recommended way:
```
@interface Factory {
NSMutableArray *widgets;
}
- (NSArray *)widgets;
- (void)insertObject:(id)obj inWidgetsAtIndex:(NSUInteger)idx;
- (void)removeObjectFromWidgetsAtIndex:(NSUInteger)idx;
@end
```
Clearly this is a tric... | Your `widgets` accessor should be fine, although you should be aware that none of the objects in that array are locked. So, you could run into problems trying to concurrently run code like
```
[[[myFactory widgets] objectAtIndex:7] setName:@"mildred"];
```
and
```
[myTextField setStringValue:[[[myFactory widgets] o... |
331,215 | <p>I am trying to unit test my WPF databindings using the test suit provided by Microsoft Team System. I would like to be able to test the bindings without showing the window because most of my tests will be for user controls and not actually on a window. Is this possible or is there a better way to do it? The code ... | [
{
"answer_id": 331654,
"author": "Gishu",
"author_id": 1695,
"author_profile": "https://Stackoverflow.com/users/1695",
"pm_score": 2,
"selected": false,
"text": "<p><strong>Eyeball it.</strong><br>\nThis kind of declarative markup rarely breaks.. unless someone goes in manual and screws ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] | I am trying to unit test my WPF databindings using the test suit provided by Microsoft Team System. I would like to be able to test the bindings without showing the window because most of my tests will be for user controls and not actually on a window. Is this possible or is there a better way to do it? The code below ... | Shane, if what you're really worried about is a binding breaking silently, you should look at redirecting the binding traces to somewhere you can examine. I'd start here:
<http://blogs.msdn.com/mikehillberg/archive/2006/09/14/WpfTraceSources.aspx>
Other than that, I agree with Gishu that bindings aren't good candidat... |
331,224 | <p>So my question is if I can somehow send data to my program and then send the same data AND its result to another program without having to create a temporary file (in my case ouputdata.txt).
Preferably using linux pipes/bash.</p>
<p>I currently do the following:</p>
<p>cat inputdata.txt | ./MyProg > outputdata.txt... | [
{
"answer_id": 331246,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 5,
"selected": true,
"text": "<p>Choice 1 - fix <code>MyProg</code> to write the merged output from the input and it's own output. Then you can do this.<... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17500/"
] | So my question is if I can somehow send data to my program and then send the same data AND its result to another program without having to create a temporary file (in my case ouputdata.txt).
Preferably using linux pipes/bash.
I currently do the following:
cat inputdata.txt | ./MyProg > outputdata.txt
cat inputdata.t... | Choice 1 - fix `MyProg` to write the merged output from the input and it's own output. Then you can do this.
```
./MyProg <inputdata.txt | ./MyProg2
```
Choice 2 - If you can't fix `MyProg` to write both input and output, you need to merge.
```
./MyProg <inputdata.txt | cat inputdata.txt - | ./MyProg2
``` |
331,231 | <p>When I click on a row in my GridView, I want to go to a other page with the ID I get from the database. </p>
<p>In my RowCreated event I have the following line:</p>
<pre><code>e.Row.Attributes.Add(
"onClick",
ClientScript.GetPostBackClientHyperlink(
this.grdSearchResults, "Select$" + e.Row.Row... | [
{
"answer_id": 331236,
"author": "Andrew Bullock",
"author_id": 28543,
"author_profile": "https://Stackoverflow.com/users/28543",
"pm_score": 0,
"selected": false,
"text": "<p>Can your ID be related to the data item displayed in the gridview?</p>\n\n<p>If so you can use e.Row.DataItem, a... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40676/"
] | When I click on a row in my GridView, I want to go to a other page with the ID I get from the database.
In my RowCreated event I have the following line:
```
e.Row.Attributes.Add(
"onClick",
ClientScript.GetPostBackClientHyperlink(
this.grdSearchResults, "Select$" + e.Row.RowIndex));
```
To pre... | I have the solution.
This is what i have done:
```
if(e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onClick"] = "location.href='view.aspx?id=" + DataBinder.Eval(e.Row.DataItem, "id") + "'";
}
```
I have putted the preceding code in the RowDataBound event. |
331,240 | <p>I have a problem with classic ASP. The encoding is wrong when I send data with <code>XMLHttp.send</code>. The response is a PDF file, but the “ÆØÅ” gets wrong, the “Ø” is read as “øy” for example. It’s like it’s a converting mistake from UTF-8 to ISO-8859-1, but it should be ISO-8859-1 now. I have <code><%@COD... | [
{
"answer_id": 331275,
"author": "D'Arcy Rittich",
"author_id": 39430,
"author_profile": "https://Stackoverflow.com/users/39430",
"pm_score": 2,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code>Session.CodePage = 28591\n</code></pre>\n\n<p>There is some good information <a href=\"ht... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a problem with classic ASP. The encoding is wrong when I send data with `XMLHttp.send`. The response is a PDF file, but the “ÆØÅ” gets wrong, the “Ø” is read as “øy” for example. It’s like it’s a converting mistake from UTF-8 to ISO-8859-1, but it should be ISO-8859-1 now. I have `<%@CODEPAGE="28591"%>` at the ... | Try:
```
Session.CodePage = 28591
```
There is some good information [here](http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/en/RAS_SDK/rassdk_com_doc/doc/rassdk_com_doc/BestPractices11.html), and I got the CodePage number [here](http://support.microsoft.com/kb/287946). |
331,254 | <p>I want to pixelate and/or blur an image.
I've found the command for the blurring:</p>
<pre><code>$convert image.jpg -blur 18,5 newimage.jpg
</code></pre>
<p>to work but I cannot blur the image any more.
And how do I pixelate the image? I couldn't find a sound example around the net.</p>
<p>Thx</p>
| [
{
"answer_id": 331285,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": -1,
"selected": false,
"text": "<p>I don't know anything about ImageMagick, but you can try resizing the image using bicubic to a much... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42153/"
] | I want to pixelate and/or blur an image.
I've found the command for the blurring:
```
$convert image.jpg -blur 18,5 newimage.jpg
```
to work but I cannot blur the image any more.
And how do I pixelate the image? I couldn't find a sound example around the net.
Thx | This worked nicely for me, gives a sort of cross between pixelating and blurring:
```
convert -resize 10% image.jpg newimage.jpg
convert -resize 1000% newimage.jpg newimage.jpg
```
You can be sure that the data cannot be retrieved, should that be important to you.
Changing the %ages will change the amount of pixela... |
331,262 | <p>In the past I have needed to create custom SOAP headers in a C# project that was using an imported WSDL web reference. I found a way to do it but I was never happy with it and I have sense wondered if there was a better way. What I did was create a header that derives from SoapHeader:</p>
<pre><code>[System.Xml.Ser... | [
{
"answer_id": 333074,
"author": "Eric Rosenberger",
"author_id": 41624,
"author_profile": "https://Stackoverflow.com/users/41624",
"pm_score": 1,
"selected": false,
"text": "<p>There is a way to do it, sort of; it's not necessarily pretty, and on a very simple web service it may not be ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25343/"
] | In the past I have needed to create custom SOAP headers in a C# project that was using an imported WSDL web reference. I found a way to do it but I was never happy with it and I have sense wondered if there was a better way. What I did was create a header that derives from SoapHeader:
```
[System.Xml.Serialization.Xml... | It seems that you are using .Net 2.0 and asmx webservices.
Do you know that there is a framework called WCF (Windows Communication Framework) in .Net 3.0.
I know that it is not easy to migrate to a new framework, but with WCF you get so much.
Furthermore WCf can be used for so much more than WebServices (remoting, msmq... |
331,265 | <p>How do I perform a join between two DataTables in a Dataset?</p>
<p>I created a DataRelation between two tables….then what?</p>
<p>I'm looking at one explanation on how to do it (<a href="http://www.emmet-gray.com/Articles/DataTableJoins.htm" rel="nofollow noreferrer">http://www.emmet-gray.com/Articles/DataTableJo... | [
{
"answer_id": 331877,
"author": "peeles",
"author_id": 29788,
"author_profile": "https://Stackoverflow.com/users/29788",
"pm_score": 1,
"selected": false,
"text": "<p>DataTables support selection only on columns they own, joining many tables isn't supported.</p>\n"
},
{
"answer_... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37759/"
] | How do I perform a join between two DataTables in a Dataset?
I created a DataRelation between two tables….then what?
I'm looking at one explanation on how to do it (<http://www.emmet-gray.com/Articles/DataTableJoins.htm>) which involves copying rows from tables to a result table?
Is there a better way to do this? | See if this helps
```
DataTable person = new DataTable();
person.Columns.Add("Id");
person.Columns.Add("Name");
DataTable pet = new DataTable();
pet.Columns.Add("Id");
pet.Columns.Add("Name");
pet.Columns.Add("OwnerId");
DataSet ds = new DataSet();
ds.Tables.AddRange(new[] { person, pet });
ds.Relations.Add("Person... |
331,276 | <p>The callstack shows the following:</p>
<pre><code>[MissingMethodException: No parameterless constructor defined for this object.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +... | [
{
"answer_id": 331699,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Did you remove Default.aspx? That needs to be in place to render the root properly. This can also happen if you're trying t... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11333/"
] | The callstack shows the following:
```
[MissingMethodException: No parameterless constructor defined for this object.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandle& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.Creat... | I solved the issue which is caused of SelectList object because it does not provide the default constructor so we cant have in out ViewModel. |
331,277 | <p>Doing a refresh after certain action in asp.net seems to make them happen again even when that action doesn't make sense (think double delete). The web way to deal with this situation is to redirect after a post to get a clean version of the page that can be refreshed without reposting an action to the webserver. H... | [
{
"answer_id": 331338,
"author": "Cristian Libardo",
"author_id": 16526,
"author_profile": "https://Stackoverflow.com/users/16526",
"pm_score": 3,
"selected": false,
"text": "<p>I have a feeling there is a deeper problem I'm not getting but here goes. In your postback event:</p>\n\n<pre>... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] | Doing a refresh after certain action in asp.net seems to make them happen again even when that action doesn't make sense (think double delete). The web way to deal with this situation is to redirect after a post to get a clean version of the page that can be refreshed without reposting an action to the webserver. How c... | I have a feeling there is a deeper problem I'm not getting but here goes. In your postback event:
```
// the post handling logic, e.g. the click event code
Response.Redirect(Request.RawUrl);
``` |
331,278 | <p>I've got some directories that have been moved or renamed. The Linux command line SVN client ignores these directories. The TortoiseSVN plugin for Explorer shows them. If I delete them and update, they come back.</p>
<p>All of the file movement and deletion has been done using the Linux SVN CLI tools. When doing an... | [
{
"answer_id": 331338,
"author": "Cristian Libardo",
"author_id": 16526,
"author_profile": "https://Stackoverflow.com/users/16526",
"pm_score": 3,
"selected": false,
"text": "<p>I have a feeling there is a deeper problem I'm not getting but here goes. In your postback event:</p>\n\n<pre>... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331278",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39933/"
] | I've got some directories that have been moved or renamed. The Linux command line SVN client ignores these directories. The TortoiseSVN plugin for Explorer shows them. If I delete them and update, they come back.
All of the file movement and deletion has been done using the Linux SVN CLI tools. When doing an 'svn upda... | I have a feeling there is a deeper problem I'm not getting but here goes. In your postback event:
```
// the post handling logic, e.g. the click event code
Response.Redirect(Request.RawUrl);
``` |
331,287 | <p>Try to commit my first iPhone application to Subversion found that there's "code signing identity" section in my xcode project.pbxproj file.</p>
<pre><code>CODE_SIGN_IDENTITY = "iPhone Developer: my username here...;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: above...";
</code></pre>
<p>The issue is,... | [
{
"answer_id": 331429,
"author": "tcurdt",
"author_id": 33165,
"author_profile": "https://Stackoverflow.com/users/33165",
"pm_score": 0,
"selected": false,
"text": "<p>The obvious choice would be to create other build configurations.</p>\n"
},
{
"answer_id": 331442,
"author":... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42170/"
] | Try to commit my first iPhone application to Subversion found that there's "code signing identity" section in my xcode project.pbxproj file.
```
CODE_SIGN_IDENTITY = "iPhone Developer: my username here...;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer: above...";
```
The issue is, in our team we use differ... | You can base a project or target configuration on the contents of an `xcconfig` file that is not checked in to Subversion or is otherwise customized per developer. Add an appropriate `xcconfig` file to your project and then choose the file from the "Based On" pop-up at the bottom of the Build tab in the Project Info or... |
331,295 | <p>What is the Worst Case Time Complexity t(n) :-
I'm reading this book about algorithms and as an example
how to get the T(n) for .... like the selection Sort Algorithm</p>
<hr>
<p>Like if I'm dealing with the selectionSort(A[0..n-1])</p>
<pre><code>//sorts a given array by selection sort
//input: An array A[0..n -... | [
{
"answer_id": 331325,
"author": "Nicholas Mancuso",
"author_id": 8945,
"author_profile": "https://Stackoverflow.com/users/8945",
"pm_score": 4,
"selected": false,
"text": "<p>That would be O(n^2).</p>\n\n<p>The reason is you have a single for loop nested in another for loop. The run tim... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What is the Worst Case Time Complexity t(n) :-
I'm reading this book about algorithms and as an example
how to get the T(n) for .... like the selection Sort Algorithm
---
Like if I'm dealing with the selectionSort(A[0..n-1])
```
//sorts a given array by selection sort
//input: An array A[0..n - 1] of orderable eleme... | @[sara jons](https://stackoverflow.com/questions/331295/worst-case-time-complexity-for-an-algorithm/331380#331380)
[The slide set that you've referenced - and the algorithm therein](http://www.sy-stu.com/stu/PublicFiles/StdLibrary/L_15_Design_and_analysis_of_Algorithms_DA_Algorithms_04.ppt)
The complexity is being mea... |
331,322 | <p>I have read numerous articles now and it's not clear and there's lots of versions and this that and the other and I have been piecing things together and have got so far, my problem is the 'rar' command doesn't seem to accept my substition variable and instead reads it as a string.</p>
<p>But this is what I have</p... | [
{
"answer_id": 331337,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 3,
"selected": true,
"text": "<p>I think this is your problem:</p>\n\n<pre><code>set _rarpath=C:\\Program Files (x86)\\WinRAR\n</code></pre>\n\n<p>In ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331322",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27412/"
] | I have read numerous articles now and it's not clear and there's lots of versions and this that and the other and I have been piecing things together and have got so far, my problem is the 'rar' command doesn't seem to accept my substition variable and instead reads it as a string.
But this is what I have
```
@echo o... | I think this is your problem:
```
set _rarpath=C:\Program Files (x86)\WinRAR
```
In batch files, the environment variable delimiter is a space, so it thinks `_rarpath` is `C:\Program`
Enclose the path in double quotes and see if that helps:
```
set _rarpath="C:\Program Files (x86)\WinRAR"
```
Also, in your FOR l... |
331,345 | <p>I have a linq to sql database. Very simplified we have 3 tables, Projects and Users. There is a joining table called User_Projects which joins them together. </p>
<p>I already have a working method of getting <code>IEnumberable<Project></code> for a given user. </p>
<pre><code>from up in User_Projects
select... | [
{
"answer_id": 331454,
"author": "technophile",
"author_id": 23029,
"author_profile": "https://Stackoverflow.com/users/23029",
"pm_score": 0,
"selected": false,
"text": "<p>try this:</p>\n\n<pre><code>var userProjects = GetProjects();\nreturn db.Projects.Except(userProjects.ToArray());\n... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331345",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3193/"
] | I have a linq to sql database. Very simplified we have 3 tables, Projects and Users. There is a joining table called User\_Projects which joins them together.
I already have a working method of getting `IEnumberable<Project>` for a given user.
```
from up in User_Projects
select up.Project;
```
Now I want to get ... | Linq to Sql doesn't understand how to work with an arbitrary in-memory sequence of objects. You need to express this in relational terms, which works on IDs:
```
var userProjectIds =
from project in GetProjects()
select project.ProjectId;
var nonUserProjects =
from project in db.Projects
where !userPr... |
331,357 | <p>I am working on a Windows Forms app for quite some time now, and I really find myself doing more typecasts in the GUI code than I ever did in my underlying business code.</p>
<p>What I mean becomes apparent if you watch the ComboBox control that accepts some vague "object" as it's item.
Then you go off and may dis... | [
{
"answer_id": 331374,
"author": "mackenir",
"author_id": 25457,
"author_profile": "https://Stackoverflow.com/users/25457",
"pm_score": 1,
"selected": false,
"text": "<p>I dont think you're missing anything.\nIt's just that these classes were created back in the pre-Generics days, and Wi... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21699/"
] | I am working on a Windows Forms app for quite some time now, and I really find myself doing more typecasts in the GUI code than I ever did in my underlying business code.
What I mean becomes apparent if you watch the ComboBox control that accepts some vague "object" as it's item.
Then you go off and may display some ... | While the criticism of "didn't use generics" can't be fairly applied to controls developed before their existence... one must wonder about WPF controls (new in .NET 3.0, after generics in .NET 2.0).
I checked out the [AddChild](http://msdn.microsoft.com/en-us/library/system.windows.controls.itemscontrol.addchild.aspx)... |
331,367 | <p>Say I have 2 tables: Customers and Orders. A Customer can have many Orders.</p>
<p>Now, I need to show any Customers with his latest Order. This means if a Customer has more than one Orders, show only the Order with the latest Entry Time.</p>
<p>This is how far I managed on my own:</p>
<pre><code>SELECT a.*, b.Id... | [
{
"answer_id": 331392,
"author": "devio",
"author_id": 21336,
"author_profile": "https://Stackoverflow.com/users/21336",
"pm_score": 1,
"selected": false,
"text": "<pre><code>SELECT Cust.*, Ord.*\nFROM Customers cust INNER JOIN Orders ord ON cust.ID = ord.CustID\nWHERE ord.OrderID = \n ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19582/"
] | Say I have 2 tables: Customers and Orders. A Customer can have many Orders.
Now, I need to show any Customers with his latest Order. This means if a Customer has more than one Orders, show only the Order with the latest Entry Time.
This is how far I managed on my own:
```
SELECT a.*, b.Id
FROM Customer a INNER JOIN ... | I don't think you do want to use MAX() as you don't want to group the OrderID. What you need is an ordered sub query with a SELECT TOP 1.
```
select *
from Customers
inner join Orders
on Customers.CustomerID = Orders.CustomerID
and OrderID = (
SELECT TOP 1 subOrders.OrderID
... |
331,376 | <p>I have a class and I want to be able to iterate over a certain array member. I did a quick search and found <code>IteratorAggregate</code>:</p>
<pre><code>class foo implements IteratorAggregate
{
protected $_array = array('foo'=>'bar', 'baz'=>'quux');
public function getIterator()
{
retur... | [
{
"answer_id": 331392,
"author": "devio",
"author_id": 21336,
"author_profile": "https://Stackoverflow.com/users/21336",
"pm_score": 1,
"selected": false,
"text": "<pre><code>SELECT Cust.*, Ord.*\nFROM Customers cust INNER JOIN Orders ord ON cust.ID = ord.CustID\nWHERE ord.OrderID = \n ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31003/"
] | I have a class and I want to be able to iterate over a certain array member. I did a quick search and found `IteratorAggregate`:
```
class foo implements IteratorAggregate
{
protected $_array = array('foo'=>'bar', 'baz'=>'quux');
public function getIterator()
{
return new ArrayIterator($this->_arr... | I don't think you do want to use MAX() as you don't want to group the OrderID. What you need is an ordered sub query with a SELECT TOP 1.
```
select *
from Customers
inner join Orders
on Customers.CustomerID = Orders.CustomerID
and OrderID = (
SELECT TOP 1 subOrders.OrderID
... |
331,377 | <p>How to pack python libs I'm using so I can distribute them with my app and have as few dependencies as possible and also not to conflict with different lib/version that is already on my system.</p>
<p>L.E.: Sorry i forgot to specify. I will be doing this on linux. And I'm not referring in making my app a installabl... | [
{
"answer_id": 331410,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": 2,
"selected": false,
"text": "<p>Try <a href=\"http://www.py2exe.org/\" rel=\"nofollow noreferrer\">py2exe</a>.</p>\n"
},
{
"answer_id": 3... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789/"
] | How to pack python libs I'm using so I can distribute them with my app and have as few dependencies as possible and also not to conflict with different lib/version that is already on my system.
L.E.: Sorry i forgot to specify. I will be doing this on linux. And I'm not referring in making my app a installable file lik... | You can have your users run the system from a startup script, and that script can fix the pythonpath ahead of time to put your versions first. For example if you put CherryPy, SQLAlchemy, etc. in an "external" subdirectory, you could try:
```
# startproj.sh
script_path=`dirname $0`
export PYTHONPATH=${script_path}/ext... |
331,388 | <p><strong>What is the best way to make one of the branches of a subversion repository the new trunk?</strong> </p>
<p>There has been a major rewrite for the entire system: things have been moved around, rewritten, replaces, removed, renamed etc. The rewritten code has been tested and is ready to replace the old trun... | [
{
"answer_id": 331395,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": 8,
"selected": true,
"text": "<p>Use <a href=\"http://svnbook.red-bean.com/en/1.1/re18.html\" rel=\"noreferrer\">svn move</a> to move the contents ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22674/"
] | **What is the best way to make one of the branches of a subversion repository the new trunk?**
There has been a major rewrite for the entire system: things have been moved around, rewritten, replaces, removed, renamed etc. The rewritten code has been tested and is ready to replace the old trunk.
Basically, the the o... | Use [svn move](http://svnbook.red-bean.com/en/1.1/re18.html) to move the contents of the old trunk somewhere else and rename the branch to trunk afterward.
Note that copy and move in svn work like file operations. You can use them to move/copy stuff around in your repository and these changes are versioned as well. Th... |
331,394 | <p>I know this is probably on the Internet somewhere but I can't find the answer here on Stackoverflow so I thought I may boost up the knowledge base here a little.</p>
<p>I'm a newbie to Ruby and Rails but my company is getting pretty invested in it so I'm trying to get to know it in a little more detail.</p>
<p>It'... | [
{
"answer_id": 331408,
"author": "danmayer",
"author_id": 27738,
"author_profile": "https://Stackoverflow.com/users/27738",
"pm_score": 6,
"selected": false,
"text": "<p>Yeah you can, if you are using a relationship like has_many you just do this</p>\n\n<pre><code>has_many :memberships, ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39086/"
] | I know this is probably on the Internet somewhere but I can't find the answer here on Stackoverflow so I thought I may boost up the knowledge base here a little.
I'm a newbie to Ruby and Rails but my company is getting pretty invested in it so I'm trying to get to know it in a little more detail.
It's been difficult ... | you can also set the :dependent option to :delete\_all. :delete\_all will issue a single SQL statement to delete all child records. because of this using :delete\_all may give you better performance.
```
has_many :memberships, dependent: :delete_all
``` |
331,398 | <p>I have an http module on a sharepoint site and this module instantiates a custom class and add it to the session and does other initial things for my site.
However, I'm noticing that the http module is being called for all request types (.aspx, .js, .png, .jpg).</p>
<p>Is there any way to have an http module only b... | [
{
"answer_id": 331408,
"author": "danmayer",
"author_id": 27738,
"author_profile": "https://Stackoverflow.com/users/27738",
"pm_score": 6,
"selected": false,
"text": "<p>Yeah you can, if you are using a relationship like has_many you just do this</p>\n\n<pre><code>has_many :memberships, ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an http module on a sharepoint site and this module instantiates a custom class and add it to the session and does other initial things for my site.
However, I'm noticing that the http module is being called for all request types (.aspx, .js, .png, .jpg).
Is there any way to have an http module only be called f... | you can also set the :dependent option to :delete\_all. :delete\_all will issue a single SQL statement to delete all child records. because of this using :delete\_all may give you better performance.
```
has_many :memberships, dependent: :delete_all
``` |
331,400 | <p>I'm trying to understand a particular Perl code from <a href="http://sourceforge.net/projects/vcake" rel="nofollow noreferrer">vcake</a>. Usually I find my way around in Perl but the following statement baffles me. I suspect that this is simply an error but I'm not completely sure. The statement is:</p>
<pre><code>... | [
{
"answer_id": 331425,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": 5,
"selected": true,
"text": "<p><code>my $numReads</code> means: Create a new local variable within the context of the <code>foreach</code> loop. ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331400",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1968/"
] | I'm trying to understand a particular Perl code from [vcake](http://sourceforge.net/projects/vcake). Usually I find my way around in Perl but the following statement baffles me. I suspect that this is simply an error but I'm not completely sure. The statement is:
```
foreach my $seq (keys %$set) {
if( (defined $se... | `my $numReads` means: Create a new local variable within the context of the `foreach` loop. Its initial value is `undef`, which in numerical context is treated as `0`.
So the code reads:
```
if ((...) and (0 >= ($coverage)) ) {
}
```
which means "do something" is never executed unless $coverage is set to 0 or less.
... |
331,407 | <p>I am using the following code to set a tray icon in Windows and Linux. It works wonderful in Windows and works okay in Linux. In Linux (Ubuntu) I have my panel set to be (somewhat) transparent and when I add a GIF (with a transparent background) the background of the icon shows up all grey and ugly (see image, green... | [
{
"answer_id": 331464,
"author": "Richard Walton",
"author_id": 15075,
"author_profile": "https://Stackoverflow.com/users/15075",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried converting it to a .PNG (with transparency) instead? I've found they tend to be better supported... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24998/"
] | I am using the following code to set a tray icon in Windows and Linux. It works wonderful in Windows and works okay in Linux. In Linux (Ubuntu) I have my panel set to be (somewhat) transparent and when I add a GIF (with a transparent background) the background of the icon shows up all grey and ugly (see image, green di... | Chances are this problem cannot be resolved. It depends on wether Java is doing a good job in creating the tray subwindow in Linux or not. If Jave does it wrong, transparency is already lost when the image is drawn.
1. What is the real background value of the icon you are using? Is it the gray tone shown above? Set it... |
331,488 | <p>Is there an elegantish way in Swing to find out if there are any tooltips currently being displayed in my frame?</p>
<p>I'm using custom tooltips, so it would be very easy to set a flag in my <code>createToolTip()</code> method, but I can't see a way to find out when the tooltip is gone.</p>
<p><code>ToolTipManage... | [
{
"answer_id": 331530,
"author": "James Van Huis",
"author_id": 31828,
"author_profile": "https://Stackoverflow.com/users/31828",
"pm_score": 3,
"selected": true,
"text": "<p>It appears that the isEnabled() property of the hideTipAction is directly tied to the tipShowing boolean. You co... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34360/"
] | Is there an elegantish way in Swing to find out if there are any tooltips currently being displayed in my frame?
I'm using custom tooltips, so it would be very easy to set a flag in my `createToolTip()` method, but I can't see a way to find out when the tooltip is gone.
`ToolTipManager` has a nice flag for this, tipS... | It appears that the isEnabled() property of the hideTipAction is directly tied to the tipShowing boolean. You could try this:
```
public boolean isTooltipShowing(JComponent component) {
AbstractAction hideTipAction = (AbstractAction) component.getActionMap().get("hideTip");
return hideTipAction.isEnabled();
}... |
331,490 | <p>After getting the objectEnumerator in the following code, the set1 retain count goes to 3. I was surprised to see that because I didn't expect it to change. I searched the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html#//apple_ref/occ/instm/N... | [
{
"answer_id": 331528,
"author": "Darron",
"author_id": 22704,
"author_profile": "https://Stackoverflow.com/users/22704",
"pm_score": 1,
"selected": false,
"text": "<p>Reusing set1 after the release won't cause problems, because the retain count is on the Object referenced by the variabl... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331490",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9711/"
] | After getting the objectEnumerator in the following code, the set1 retain count goes to 3. I was surprised to see that because I didn't expect it to change. I searched the [documentation](http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSSet_Class/Reference/Reference.html#//apple_ref/occ/ins... | It's generally not a good idea to rely on the retain count of objects, as it's an internal detail of the framework. Instead make sure your code adheres to the memory management principles, particularly ensuring that retain/new/copy and release/autorelease are balanced. |
331,502 | <p>I've got 2 Questions:</p>
<p>1.
I've sarted working around with Linq to XML and i'm wondering if it is possible to change an XML document via Linq. I mean, is there someting like </p>
<pre><code>XDocument xmlDoc = XDocument.Load("sample.xml");
update item in xmlDoc.Descendants("item")
where (int)item .Attribute("... | [
{
"answer_id": 335418,
"author": "Robert Rossney",
"author_id": 19403,
"author_profile": "https://Stackoverflow.com/users/19403",
"pm_score": 3,
"selected": false,
"text": "<p>Is this what you have in mind?</p>\n\n<pre><code>using System;\nusing System.Linq;\nusing System.Xml.Linq;\n\nst... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've got 2 Questions:
1.
I've sarted working around with Linq to XML and i'm wondering if it is possible to change an XML document via Linq. I mean, is there someting like
```
XDocument xmlDoc = XDocument.Load("sample.xml");
update item in xmlDoc.Descendants("item")
where (int)item .Attribute("id") == id
...
```
... | thank you for your answer. everything works fine.
just as completition to my questions the code below shows how to modify a single entry:
```
string xml = @"<data><record id='1' info='sample Info'/><record id='2' info='sample Info'/><record id='3' info='sample Info'/></data>";
StringReader sr = new StringReader(xml);... |
331,505 | <p>Let say I have a sheet in with columns Customer and CreatedDate with lots of row with data. Anyone who knows how to setup (through VBA or Formula) a second sheet that displays rows from the first sheet based on certain where statements, i.e. all rows with customers "created this month." (similar to a select ... wher... | [
{
"answer_id": 331539,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 2,
"selected": false,
"text": "<p>You can create a Pivot Table out of your data, then slice-n-dice it lots of ways.</p>\n"
},
{
"answer_id": 3... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331505",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] | Let say I have a sheet in with columns Customer and CreatedDate with lots of row with data. Anyone who knows how to setup (through VBA or Formula) a second sheet that displays rows from the first sheet based on certain where statements, i.e. all rows with customers "created this month." (similar to a select ... where q... | There isn't an exact equivalent to the SQL `select ... where` functionality in Excel, but take a look at the `VLOOKUP` function. It may be what you are looking for. If that doesn't have enough functionality, you will probably have to use VBA:
```
Dim DataRange as Range
Dim RowNum as Integer
Dim NewRow as Integer
Dim ... |
331,520 | <p>I've added a weakly named assembly to my <a href="http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2005" rel="noreferrer">Visual Studio 2005</a> project (which is strongly named). I'm now getting the error:</p>
<blockquote>
<p>"Referenced assembly 'xxxxxxxx' does not have a strong name"</... | [
{
"answer_id": 331555,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 9,
"selected": true,
"text": "<p>To avoid this error you could either:</p>\n\n<ul>\n<li>Load the assembly dynamically, or</li>\n<li>Sign the third-p... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331520",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36860/"
] | I've added a weakly named assembly to my [Visual Studio 2005](http://en.wikipedia.org/wiki/Microsoft_Visual_Studio#Visual_Studio_2005) project (which is strongly named). I'm now getting the error:
>
> "Referenced assembly 'xxxxxxxx' does not have a strong name"
>
>
>
Do I need to sign this third-party assembly? | To avoid this error you could either:
* Load the assembly dynamically, or
* Sign the third-party assembly.
You will find instructions on signing third-party assemblies in *[.NET-fu: Signing an Unsigned Assembly (Without Delay Signing)](https://dzone.com/articles/net-fu-zero-delay-signing-of-a)*.
### Signing Third-P... |
331,538 | <p>My code is like the following:</p>
<pre><code>URLConnection cnx = address.openConnection();
cnx.setAllowUserInteraction(false);
cnx.setDoOutput(true);
cnx.addRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
InputStream is = cnx.getInputStream();
</code></pre>
<p>Is... | [
{
"answer_id": 331633,
"author": "Ken Gentle",
"author_id": 8709,
"author_profile": "https://Stackoverflow.com/users/8709",
"pm_score": 5,
"selected": true,
"text": "<p>The headers <strong>must</strong> be set prior to getting the <code>InputStream</code> to have any affect - an <code>Il... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31610/"
] | My code is like the following:
```
URLConnection cnx = address.openConnection();
cnx.setAllowUserInteraction(false);
cnx.setDoOutput(true);
cnx.addRequestProperty("User-Agent",
"Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)");
InputStream is = cnx.getInputStream();
```
Is it ok if I set the header... | The headers **must** be set prior to getting the `InputStream` to have any affect - an `IllegalStateException` will be thrown if the connection is already open.
As far as the `User-Agent` header specifically, it should be sent if it has been set.
See the [URLConnection](http://docs.oracle.com/javase/6/docs/api/java/n... |
331,549 | <p>I have an existing htaccess that works fine:</p>
<pre><code>RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) /default.php
DirectoryIndex index.php /default.php
</code></pre>
<p>I wish to modify this so that all urls that start with /test/ go to /test/default.... | [
{
"answer_id": 331593,
"author": "xahtep",
"author_id": 42184,
"author_profile": "https://Stackoverflow.com/users/42184",
"pm_score": 1,
"selected": false,
"text": "<p>Put the rule for /test/ in before the rule for everything else, but give it an <code>[L]</code> flag to stop the rewrite... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an existing htaccess that works fine:
```
RewriteEngine On
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteRule (.*) /default.php
DirectoryIndex index.php /default.php
```
I wish to modify this so that all urls that start with /test/ go to /test/default.php, **while keeping all o... | Put the rule for /test/ in before the rule for everything else, but give it an `[L]` flag to stop the rewrite rule processing there if it matches. |
331,568 | <p>I need to create an <code>XmlDocument</code> with a root element containing multiple namespaces. Am using C# 2.0 or 3.0</p>
<p>Here is my code:</p>
<pre><code>XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("JOBS", "http://www.example.com");
doc.AppendChild(root);
XmlElement job = doc.Cr... | [
{
"answer_id": 331645,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 0,
"selected": false,
"text": "<p>try to add the namespace attribute to the root element:</p>\n\n<pre><code> XmlDocument doc = new XmlDocumen... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9664/"
] | I need to create an `XmlDocument` with a root element containing multiple namespaces. Am using C# 2.0 or 3.0
Here is my code:
```
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("JOBS", "http://www.example.com");
doc.AppendChild(root);
XmlElement job = doc.CreateElement("JOB", "http://www.ex... | The following will generate the desired output that you requested above:
```
XmlDocument doc = new XmlDocument();
XmlElement root = doc.CreateElement("JOBS");
root.SetAttribute("xmlns:JOBS", "http://www.example.com");
root.SetAttribute("xmlns:JOB", "http://www.example.com");
doc.AppendChild(root);
XmlElement job = d... |
331,569 | <p>When trying to kill a buffer that contains changes in Emacs, the message:
" Buffer [buffer] modified; kill anyway? (yes or no)" is displayed. </p>
<p>Instead of this I'd like to have Emacs ask me if I want to:
1. View a diff of what changed,
2. Save the buffer,
3. Kill the buffer.</p>
<p>How?</p>
| [
{
"answer_id": 331631,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 3,
"selected": false,
"text": "<p>You'll want to write some code to put in the <a href=\"http://www.gnu.org/software/emacs/manual/html_node/emacs/... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331569",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41829/"
] | When trying to kill a buffer that contains changes in Emacs, the message:
" Buffer [buffer] modified; kill anyway? (yes or no)" is displayed.
Instead of this I'd like to have Emacs ask me if I want to:
1. View a diff of what changed,
2. Save the buffer,
3. Kill the buffer.
How? | The answer lies in using [advice](http://www.delorie.com/gnu/docs/elisp-manual-21/elisp_212.html "advice"), because the hooks normally run when killing buffers run **after** the "buffer modified" prompt you want to change.
The following advice does what you want (I think). A couple of notes:
1. When running the diff,... |
331,599 | <p>I am using a nested html unordered list styled as a drop down. When the a tag within the inner lists list item is clicked it trigger some javascript which is supposed to set the value of a hidden field to the text for the link that was clicked.</p>
<p>The javascript seems to work - I used an alert to read the value... | [
{
"answer_id": 331756,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 4,
"selected": false,
"text": "<p>I would do this: First, remove the <code>runat='server'</code> attribute from the hidden field (inside body):</p>\n... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40623/"
] | I am using a nested html unordered list styled as a drop down. When the a tag within the inner lists list item is clicked it trigger some javascript which is supposed to set the value of a hidden field to the text for the link that was clicked.
The javascript seems to work - I used an alert to read the value from the ... | I would do this: First, remove the `runat='server'` attribute from the hidden field (inside body):
```
<input type="hidden" id="accomodationAnswer" />
```
Now, on the server, where you want to read that value, do this:
```
string accomodationAnswer = Request.Form["accomodationAnswer"];
// now use accomodationAnswe... |
331,607 | <p>I don't have too much experience with C# so if someone could point me in the right direction I would greatly appreciate it. I have a foreach loop that references a variable of an object. I wish to make another foreach loop inside the main one that compares (or performs actions on) the current variable to the rest ... | [
{
"answer_id": 331618,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": -1,
"selected": false,
"text": "<p>In this case, it's probably better to use a regular for loop with an index to what element you are on. Trying to iterate... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33523/"
] | I don't have too much experience with C# so if someone could point me in the right direction I would greatly appreciate it. I have a foreach loop that references a variable of an object. I wish to make another foreach loop inside the main one that compares (or performs actions on) the current variable to the rest of th... | Each time you execute foreach, (even while nesting them) the internal Enumerator should "new" up a new iterator for you, there should not be any issue with that. The issues come about when you are adding, or removing items from the collection while you are still iterating...
Remember, in the inner foreach, to check to... |
331,620 | <p>Okay I have this RewriteRule which is supposed to redirect any request for the file base.css to {folder of .htacces file}/include/style/base.css, but is just keeps redirecting in an infinite loop, I thought the L parameter would make sure that wouldn't happen.</p>
<pre><code>RewriteRule (.*)/base.css$ include/style... | [
{
"answer_id": 331625,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 3,
"selected": true,
"text": "<p>You have Redirect and Rewrite confused. A redirect is a HTTP status code that tells the browser to go to another URL. Y... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35197/"
] | Okay I have this RewriteRule which is supposed to redirect any request for the file base.css to {folder of .htacces file}/include/style/base.css, but is just keeps redirecting in an infinite loop, I thought the L parameter would make sure that wouldn't happen.
```
RewriteRule (.*)/base.css$ include/style/base.css [L,N... | You have Redirect and Rewrite confused. A redirect is a HTTP status code that tells the browser to go to another URL. You actually just want to Rewrite the location to another file location. Try
```
RewriteRule (.*)/(.*).css$ /include/style/$2.css [L,NC]
```
If this doesn't work try adding the following right after ... |
331,642 | <p>In a bash script I execute a command on a remote machine through ssh. If user breaks the script by pressing Ctrl+C it only stops the script - not even ssh client. Moreover even if I kill ssh client the remote command is still running...</p>
<p>How can make bash to kill local ssh client and remote command invocation... | [
{
"answer_id": 331679,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 1,
"selected": false,
"text": "<pre><code>trap \"some_command\" SIGINT\n</code></pre>\n\n<p>will execute <code>some_command</code> locally... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42201/"
] | In a bash script I execute a command on a remote machine through ssh. If user breaks the script by pressing Ctrl+C it only stops the script - not even ssh client. Moreover even if I kill ssh client the remote command is still running...
How can make bash to kill local ssh client and remote command invocation on Crtl+c... | Eventual I found a solution like that:
```
#/bin/bash
ssh -t -x root@db-host 'mysqldump db' -r file.sql
```
So - I use '-t' instead of '-n'.
Removing '-n', or using different user than root does not help. |
331,663 | <p>Is there a difference in behavior between adding a control to the ASPX page directly and loading a control programmatically and adding to a placeholder?</p>
<p>The control inherits from <code>System.Web.UI.WebControls.DataBoundControl</code>.</p>
<p>The reason I ask is that I have a control that works when I add i... | [
{
"answer_id": 331698,
"author": "Matt Briggs",
"author_id": 10771,
"author_profile": "https://Stackoverflow.com/users/10771",
"pm_score": 1,
"selected": false,
"text": "<p>If you are setting properties outside of the LoadControl call, why are you making that new empty object array inste... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331663",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38522/"
] | Is there a difference in behavior between adding a control to the ASPX page directly and loading a control programmatically and adding to a placeholder?
The control inherits from `System.Web.UI.WebControls.DataBoundControl`.
The reason I ask is that I have a control that works when I add it to the ASPX page like so:
... | The control tree ends up the same if you define in markup or add programmatically. However there is plenty of room for the control implementor to screw up along the way.
You can go look how ASP.NET compiles the aspx:
```
C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files
```
The timing when the c... |
331,666 | <p>I have the following very simple Javascript-compatible regular expression:</p>
<pre><code><script type="text/javascript" id="(.+)" src="([^"]+)">
</code></pre>
<p>I am trying to match on script tags and gather both the ID and src attributes. I'd like to make the order of the attributes irrelevant, so that th... | [
{
"answer_id": 331700,
"author": "Nick Berardi",
"author_id": 17,
"author_profile": "https://Stackoverflow.com/users/17",
"pm_score": 0,
"selected": false,
"text": "<p>Try the following:</p>\n\n<pre><code><script\\s*\\S*\\s*(id=\"([^\"]+)\")?\\s*\\S*\\s*(src=\"([^\"]+)\")\\s*\\S*\\s*(... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8215/"
] | I have the following very simple Javascript-compatible regular expression:
```
<script type="text/javascript" id="(.+)" src="([^"]+)">
```
I am trying to match on script tags and gather both the ID and src attributes. I'd like to make the order of the attributes irrelevant, so that the following will still match:
`... | Disclaimer: Be careful with regular expressions and HTML source code. It's brittle and therefore easily broken or circumvented, you should not even think of using it to validate user input.
If you are sincere of the source data and know it conforms to the rules of well-formed HTML, you can use this:
```
var html = "... |
331,690 | <p>What is the standard encoding of C++ source code? Does the C++ standard even say something about this? Can I write C++ source in Unicode?</p>
<p>For example, can I use non-ASCII characters such as Chinese characters in comments? If so, is full Unicode allowed or just a subset of Unicode? (e.g., that 16-bit first pa... | [
{
"answer_id": 331724,
"author": "Head Geek",
"author_id": 12193,
"author_profile": "https://Stackoverflow.com/users/12193",
"pm_score": 4,
"selected": false,
"text": "<p>The C++ standard doesn't say anything about source-code file encoding, so far as I know.</p>\n\n<p>The usual encoding... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30187/"
] | What is the standard encoding of C++ source code? Does the C++ standard even say something about this? Can I write C++ source in Unicode?
For example, can I use non-ASCII characters such as Chinese characters in comments? If so, is full Unicode allowed or just a subset of Unicode? (e.g., that 16-bit first page or what... | Encoding in C++ is quite a bit complicated. Here is my understanding of it.
Every implementation has to support characters from the *basic source character set*. These include common characters listed in §2.2/1 (§2.3/1 in C++11). These characters should all fit into one `char`. In addition implementations have to supp... |
331,695 | <p>My problem:</p>
<p>I'm looking for a way to represent a person's name and address as an encoded id. The id should contain only alpha-numeric characters, be collision-proof, and be represented in a smallest number of characters possible. My first thought was to simply use a cryptographic hash function like MD5 or ... | [
{
"answer_id": 331719,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 3,
"selected": false,
"text": "<p>I know you said no to MD5 and SHA1, but I think you should consider them anyway. As well as being well studied hash... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331695",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42203/"
] | My problem:
I'm looking for a way to represent a person's name and address as an encoded id. The id should contain only alpha-numeric characters, be collision-proof, and be represented in a smallest number of characters possible. My first thought was to simply use a cryptographic hash function like MD5 or SHA1, but th... | I know you said no to MD5 and SHA1, but I think you should consider them anyway. As well as being well studied hashing algorithms, the length gives you more protection against possible collisions. No hash is collision-proof, but the cryptographic ones generally are less collision-prone than something you couuld come up... |
331,731 | <p>Is there a way in .net to refer to a control generically (so that if the control name changes, etc.) you don't have a problem.</p>
<p>I.e., the object level version of the "me" keyword.</p>
<p>So, I'd like to use something generic instead of RadioButton1 in the example below.</p>
<pre><code>Private Sub RadioButto... | [
{
"answer_id": 331736,
"author": "bobwienholt",
"author_id": 24257,
"author_profile": "https://Stackoverflow.com/users/24257",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, the \"sender\" parameter is the control that triggered the event.</p>\n"
},
{
"answer_id": 331738,
... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331731",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4906/"
] | Is there a way in .net to refer to a control generically (so that if the control name changes, etc.) you don't have a problem.
I.e., the object level version of the "me" keyword.
So, I'd like to use something generic instead of RadioButton1 in the example below.
```
Private Sub RadioButton1_CheckedChanged(ByVal send... | Lets see if I remember VB.NET:
```
Dim rb as RadioButton = sender
If rb.Checked Then...
``` |
331,744 | <p>Is it possible for a JPA entity class to contain two embedded (<code>@Embedded</code>) fields? An example would be:</p>
<pre><code>@Entity
public class Person {
@Embedded
public Address home;
@Embedded
public Address work;
}
public class Address {
public String street;
...
}
</code></pre>
... | [
{
"answer_id": 331849,
"author": "Loki",
"author_id": 39057,
"author_profile": "https://Stackoverflow.com/users/39057",
"pm_score": 6,
"selected": true,
"text": "<p>If you want to have the same embeddable object type twice in the same entity, the column name defaulting will not work: at ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24396/"
] | Is it possible for a JPA entity class to contain two embedded (`@Embedded`) fields? An example would be:
```
@Entity
public class Person {
@Embedded
public Address home;
@Embedded
public Address work;
}
public class Address {
public String street;
...
}
```
In this case a `Person` can conta... | If you want to have the same embeddable object type twice in the same entity, the column name defaulting will not work: at least one of the columns will have to be explicit. Hibernate goes beyond the EJB3 spec and allows you to enhance the defaulting mechanism through the NamingStrategy. DefaultComponentSafeNamingStrat... |
331,767 | <p>I've created a small python script to toggle between two files I'm using for testing.</p>
<p>My question is, what is a good Python format style for the following code:</p>
<pre><code>import filecmp
import shutil
local = "local.txt"
remote = "remote.txt"
config_file = "C:\some\path\file.txt"
shutil.copyfile( remo... | [
{
"answer_id": 331775,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 3,
"selected": false,
"text": "<p>The most common naming I've seen is underscode separated words, to_copy.</p>\n\n<p>As for the format style, I've ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20654/"
] | I've created a small python script to toggle between two files I'm using for testing.
My question is, what is a good Python format style for the following code:
```
import filecmp
import shutil
local = "local.txt"
remote = "remote.txt"
config_file = "C:\some\path\file.txt"
shutil.copyfile( remote if( filecmp.cmp(lo... | For the conditional statement, I would probably go with:
```
if filecmp.cmp(local, config_file):
shutil.copyfile(remote, config_file)
else:
shutil.copyfile(local, config_file)
```
There's little need to use the inline `y if x else z` in this case, since the surrounding code is simple enough. |
331,770 | <pre><code>SELECT
avg(con_hits) as avg_hits
FROM
content
WHERE
con_type = 1
AND con_posttime < $twelve_hrs_ago
AND con_refresh = 0
ORDER BY
con_posttime DESC
LIMIT 100
</code></pre>
<p>I would like it to go to the first record that was posted at least 12 hours ago (denoted by the <code>$twelve... | [
{
"answer_id": 331783,
"author": "troelskn",
"author_id": 18180,
"author_profile": "https://Stackoverflow.com/users/18180",
"pm_score": 5,
"selected": true,
"text": "<p><code>LIMIT</code> is applied to the resultset, after <code>AVG</code> is calculated. You can do what you want, with a ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
SELECT
avg(con_hits) as avg_hits
FROM
content
WHERE
con_type = 1
AND con_posttime < $twelve_hrs_ago
AND con_refresh = 0
ORDER BY
con_posttime DESC
LIMIT 100
```
I would like it to go to the first record that was posted at least 12 hours ago (denoted by the `$twelve_hrs_ago` variable which ha... | `LIMIT` is applied to the resultset, after `AVG` is calculated. You can do what you want, with a subselect:
```
SELECT avg(con_hits) as avg_hits
FROM (
SELECT con_hits
FROM content
WHERE
con_type = 1
AND con_posttime < $twelve_hrs_ago
AND con_refresh = 0
ORDER BY con_posttime DESC
LIMIT 100
) x;
... |
331,786 | <p>If I understand correctly the .net runtime will always clean up after me. So if I create new objects and I stop referencing them in my code, the runtime will clean up those objects and free the memory they occupied.</p>
<p>Since this is the case why then do some objects need to have a destructor or dispose method? ... | [
{
"answer_id": 331793,
"author": "Brian Knoblauch",
"author_id": 15689,
"author_profile": "https://Stackoverflow.com/users/15689",
"pm_score": 0,
"selected": false,
"text": "<p>Some objects might need to clean up low-level items. Such as hardware that needs to be closed, etc.</p>\n"
}... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42214/"
] | If I understand correctly the .net runtime will always clean up after me. So if I create new objects and I stop referencing them in my code, the runtime will clean up those objects and free the memory they occupied.
Since this is the case why then do some objects need to have a destructor or dispose method? Won’t the ... | Finalizers are needed to guarantee the release of scarce resources back into the system like file handles, sockets, kernel objects, etc. Since the finalizer always runs at the end of the objects life, it’s the designated place to release those handles.
The `Dispose` pattern is used to provide deterministic destruction... |
331,829 | <p>We have a 32-bit application that launches other 32-bit applications during its process. The application is working fine on other 64-bit platforms but on Windows Server 2003 64-bit, we get an error trying to launch the apps:</p>
<pre><code>error 193 (not a valid 32 bit application)
</code></pre>
<p>We can manually... | [
{
"answer_id": 332321,
"author": "Pedro",
"author_id": 13188,
"author_profile": "https://Stackoverflow.com/users/13188",
"pm_score": 0,
"selected": false,
"text": "<p>Are you sure the to-be-launched applications are compiled for 32-bit? When you run each of the apps directly, make sure ... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42215/"
] | We have a 32-bit application that launches other 32-bit applications during its process. The application is working fine on other 64-bit platforms but on Windows Server 2003 64-bit, we get an error trying to launch the apps:
```
error 193 (not a valid 32 bit application)
```
We can manually launch these applications... | IIRC, you can get that error code even if the app really is a valid 32-bit .exe, for a host of various other reasons, such as a dll dependency problem. Or if the Windows loader is confused by 64-bit dlls in the path with the same name as the 32-bit dll it needs. |
331,852 | <p>What is the best practices regarding storing files uploaded from users?</p>
<p>Currently, I am during the following method for storing files:</p>
<pre><code><web_app_root>/course_material/<term_id>/<course_id>/<file_id>
</code></pre>
<p>As you can see, the files are stored according to the... | [
{
"answer_id": 331869,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 1,
"selected": false,
"text": "<p>I've always just stored the files in a directory with unique GUID based filenames, and mapped the guid to the f... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6001/"
] | What is the best practices regarding storing files uploaded from users?
Currently, I am during the following method for storing files:
```
<web_app_root>/course_material/<term_id>/<course_id>/<file_id>
```
As you can see, the files are stored according to the keys in the database. I thought this was safer, since I ... | I suggest you to take then out of the web\_app\_root.
I like the way you're doing in the first example. |
331,855 | <p>I need to check whether a page is being redirected or not without actually downloading the content. I just need the final URL. What's the best way of doing this is Python?
Thanks!</p>
| [
{
"answer_id": 331871,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 1,
"selected": false,
"text": "<p>When you open the URL with <code>urllib2</code>, and you're redirected, you get a status 30x for redirection. Check the... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/280/"
] | I need to check whether a page is being redirected or not without actually downloading the content. I just need the final URL. What's the best way of doing this is Python?
Thanks! | If you specifically want to avoid downloading the content, you'll need to use the HEAD request method. I believe the `urllib` and `urllib2` libraries do not support HEAD requests, so you'll have to use the lower-level `httplib` library:
```
import httplib
h = httplib.HTTPConnection('www.example.com')
h.request('HEAD'... |
331,856 | <p>I may be barking up the wrong tree... However, what I have is a MySQL server that accepts connections only from a client with a valid SSL cert (see <a href="http://dev.mysql.com/doc/refman/5.0/en/secure-create-certs.html" rel="nofollow noreferrer">this link</a>). This works great for example with Rails. I have my da... | [
{
"answer_id": 331895,
"author": "Stepan Mazurov",
"author_id": 40786,
"author_profile": "https://Stackoverflow.com/users/40786",
"pm_score": 4,
"selected": true,
"text": "<p>in your <code>config.inc.php</code> add this line after applicable server stuff: </p>\n\n<pre><code>$cfg['Server... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39034/"
] | I may be barking up the wrong tree... However, what I have is a MySQL server that accepts connections only from a client with a valid SSL cert (see [this link](http://dev.mysql.com/doc/refman/5.0/en/secure-create-certs.html)). This works great for example with Rails. I have my database on one server, and a Rails app th... | in your `config.inc.php` add this line after applicable server stuff:
```
$cfg['Servers'][$i]['ssl']=true;
```
Assuming your php and its mysql client is configured with SSL in mind this should work. |
331,889 | <p>I have an input file that I want to sort based on timestamp which is a substring of each record. I want to store multiple attributes of the </p>
<p>The list is currently about 1000 records. But, I want it to be able to scale up a bit just in case.</p>
<p>When I did it with a Linked List by searching the entire l... | [
{
"answer_id": 331897,
"author": "Paul Nathan",
"author_id": 26227,
"author_profile": "https://Stackoverflow.com/users/26227",
"pm_score": 2,
"selected": false,
"text": "<p>The stl has a sort algorithm in the header</p>\n\n<pre><code> <algorithm>\n</code></pre>\n\n<p><a href=\"http... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39360/"
] | I have an input file that I want to sort based on timestamp which is a substring of each record. I want to store multiple attributes of the
The list is currently about 1000 records. But, I want it to be able to scale up a bit just in case.
When I did it with a Linked List by searching the entire list for insertion i... | Sorting a linked-list will inherently be either O(N^2) or involve external random-access storage.
Vectors have random access storage. So do arrays. Sorting can be O(NlogN).
At 1000 elements you will begin to see a difference between O(N^2) and O(NlogN). At 1,000,000 elements you'll definitely notice the difference!
... |
331,937 | <p>I'm building a GUI class for C++ and dealing a lot with pointers. An example call:</p>
<pre><code>mainGui.activeWindow->activeWidget->init();
</code></pre>
<p>My problem here is that I want to cast the <strong>activeWidget</strong> pointer to another type. <strong>activeWidget</strong> is of type GUI_BASE.... | [
{
"answer_id": 331942,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>You just need more parentheses:</p>\n\n<pre><code>((GUI_TEXTBOX*)(mainGui.activeWindow->activeWidget))->function... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42224/"
] | I'm building a GUI class for C++ and dealing a lot with pointers. An example call:
```
mainGui.activeWindow->activeWidget->init();
```
My problem here is that I want to cast the **activeWidget** pointer to another type. **activeWidget** is of type GUI\_BASE. Derived from BASE I have other classes, such as GUI\_BUTTO... | The problem is that casts have lower precedence than the . -> () [] operators. You'll have to use a C++ style cast or add extra parentheses:
```
((GUI_TEXTBOX*)mainGui.activeWindow->activeWidget)->function(); // Extra parentheses
dynamic_cast<GUI_TEXTBOX*>(mainGui.activeWindow->activeWidget)->function(); // C++ styl... |
331,953 | <p>I recently came across this in some code - basically someone trying to create a large object, coping when there's not enough heap to create it:</p>
<pre><code>try {
// try to perform an operation using a huge in-memory array
byte[] massiveArray = new byte[BIG_NUMBER];
} catch (OutOfMemoryError oome) {
/... | [
{
"answer_id": 332022,
"author": "jsight",
"author_id": 1432,
"author_profile": "https://Stackoverflow.com/users/1432",
"pm_score": 2,
"selected": false,
"text": "<p>I don't believe that there's a reasonable, generic approach to this that could safely be assumed to be 100% reliable. Eve... | 2008/12/01 | [
"https://Stackoverflow.com/questions/331953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21849/"
] | I recently came across this in some code - basically someone trying to create a large object, coping when there's not enough heap to create it:
```
try {
// try to perform an operation using a huge in-memory array
byte[] massiveArray = new byte[BIG_NUMBER];
} catch (OutOfMemoryError oome) {
// perform the ... | freeMemory isn't quite right. You'd also have to add maxMemory()-totalMemory(). e.g. assuming you start up the VM with max-memory=100M, the JVM may at the time of your method call only be using (from the OS) 50M. Of that, let's say 30M is actually in use by the JVM. That means you'll show 20M free (roughly, because we'... |