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 |
|---|---|---|---|---|---|---|
468,664 | <p>I'm trying to inspect my mysql database information_schema to find out the attributes of the columns. I can't find where the details as to which columns are auto_increment. Does anyone know where I can find this info in the information_schema DB?</p>
| [
{
"answer_id": 468686,
"author": "jscoot",
"author_id": 54060,
"author_profile": "https://Stackoverflow.com/users/54060",
"pm_score": 5,
"selected": true,
"text": "<p>see the EXTRA column in the COLUMNS table:</p>\n\n<pre><code>select * from COLUMNS where TABLE_SCHEMA='yourschema' and T... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468664",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2975/"
] | I'm trying to inspect my mysql database information\_schema to find out the attributes of the columns. I can't find where the details as to which columns are auto\_increment. Does anyone know where I can find this info in the information\_schema DB? | see the EXTRA column in the COLUMNS table:
```
select * from COLUMNS where TABLE_SCHEMA='yourschema' and TABLE_NAME='yourtable' and EXTRA like '%auto_increment%'
``` |
468,669 | <p>A little (!) bit of background before I can get to the question :</p>
<p>I have an accordion control loaded with an array of grids, each of which is lazy loaded with arrays of things. I'm using an auto-generated web service proxy to retrieve these lists. I'd like for the user to be able to change the selected child... | [
{
"answer_id": 469292,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 1,
"selected": false,
"text": "<p>Ok, I think I understand: since the requests are made at selection-time, and you're calling through a local... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51998/"
] | A little (!) bit of background before I can get to the question :
I have an accordion control loaded with an array of grids, each of which is lazy loaded with arrays of things. I'm using an auto-generated web service proxy to retrieve these lists. I'd like for the user to be able to change the selected child in the ac... | Not sure if this helps, but I had a similar situation, where I had a RemoteObject on which I call the 4 CRUD methods, but only one resultHandler. I solved this using the `AsyncToken`.
My RemoteObject calls looked like this:
```
public function list() {
var token:AsyncToken = myService.list();
token.operation ... |
468,672 | <p>SQL Server 2005 has great <code>sys.XXX</code> views on the system catalog which I use frequently.</p>
<p>What stumbles me is this: why is there a <code>sys.procedures</code> view to see info about your stored procedures, but there is no <code>sys.functions</code> view to see the same for your stored functions?</p>
... | [
{
"answer_id": 468778,
"author": "Ayresome",
"author_id": 45699,
"author_profile": "https://Stackoverflow.com/users/45699",
"pm_score": 3,
"selected": false,
"text": "<p>It's very slightly more verbose, but this should do exactly the same thing:</p>\n\n<pre><code>select * from sys.object... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468672",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13302/"
] | SQL Server 2005 has great `sys.XXX` views on the system catalog which I use frequently.
What stumbles me is this: why is there a `sys.procedures` view to see info about your stored procedures, but there is no `sys.functions` view to see the same for your stored functions?
Doesn't anybody use stored functions? I find ... | I find UDFs are very handy and I use them all the time.
I'm not sure what Microsoft's rationale is for not including a sys.functions equivalent in SQL Server 2005 (or SQL Server 2008, as far as I can tell), but it's easy enough to roll your own:
```
CREATE VIEW my_sys_functions_equivalent
AS
SELECT *
FROM sys.objects... |
468,681 | <p>The AddComponent method on the IWindsorContainer interface has several overloads, for example:</p>
<pre><code>WindsorContainer.AddComponent<I,T>()
</code></pre>
<p>and</p>
<pre><code>WindsorContainer.AddComponent<I,T>(string key)
</code></pre>
<p>What's the use of the key parameter and why should I u... | [
{
"answer_id": 469176,
"author": "Craig Wilson",
"author_id": 25333,
"author_profile": "https://Stackoverflow.com/users/25333",
"pm_score": 3,
"selected": true,
"text": "<p>You would use the key parameter if you were registered multiple implementations of the same interface. That way yo... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57036/"
] | The AddComponent method on the IWindsorContainer interface has several overloads, for example:
```
WindsorContainer.AddComponent<I,T>()
```
and
```
WindsorContainer.AddComponent<I,T>(string key)
```
What's the use of the key parameter and why should I use it? | You would use the key parameter if you were registered multiple implementations of the same interface. That way you can later retrieve a specific one. For example, I may have multiple versions of IHandler.
```
container.AddComponent<IHandler, FileHandler>("handlers.file");
container.AddComponent<IHandler, HttpHandler>... |
468,703 | <p>I have been wondering how to put all the stored procedures on a SQL 2000 under source control. <BR>
We are using Subversion for all our normal source code, so it would be great if there were a solution to the problem using Subversion.</p>
<p>Do you have any ideas?</p>
<p>Update 16-02-2009: This is the vbs script i... | [
{
"answer_id": 468723,
"author": "DarkwingDuck",
"author_id": 51948,
"author_profile": "https://Stackoverflow.com/users/51948",
"pm_score": 2,
"selected": false,
"text": "<p>Usually you track the changes to SQL scripts in source control. \nFor example, you have a checkin for your base sc... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468703",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57855/"
] | I have been wondering how to put all the stored procedures on a SQL 2000 under source control.
We are using Subversion for all our normal source code, so it would be great if there were a solution to the problem using Subversion.
Do you have any ideas?
Update 16-02-2009: This is the vbs script i used to export al... | As other people have said, start off with each stored proc in a separated text file that is under source control. Write a script that deletes all you stored procedures then re-creates them from the text files (while logging/reporting any errors) – this script should be easy to run. Then every time you update from sourc... |
468,704 | <p>I have the followign bash script to update mtimes for maildir files:</p>
<pre><code>#!/bin/bash
for i in /test/emailfile
do
date=$(sed -n '/Received: from/ { :a; n; /;/ {s/.*; //p;q}; b a }' "$i")
newdate=$(date -d "$date" +'%Y%m%d%H%M.%S')
touch -t "$newdate" "$i"
done
</code></pre>
<p>This script h... | [
{
"answer_id": 468813,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 0,
"selected": false,
"text": "<p>Are you sure - it works for me.</p>\n\n<p>The only changes I made were:</p>\n\n<pre><code>#!/bin/bash\n\nfor i in ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have the followign bash script to update mtimes for maildir files:
```
#!/bin/bash
for i in /test/emailfile
do
date=$(sed -n '/Received: from/ { :a; n; /;/ {s/.*; //p;q}; b a }' "$i")
newdate=$(date -d "$date" +'%Y%m%d%H%M.%S')
touch -t "$newdate" "$i"
done
```
This script has always worked fine, wit... | It appears to work fine for me, try this little ditty and see what you get.
```
#!/bin/bash
echo 'Delivery-date: Sun, 22 Apr 2007 00:15:13 -0600
Received: from an-out-0708.google.com ([209.85.132.243])
by x.xxxx.com with esmtp (Exim 4.63)
(envelope-from <xxxxxx@gmail.com>)
id 1HfVLs-0002Io-RQ
for x@xxx... |
468,713 | <p>I am getting a string hash like this:</p>
<pre><code>string content = "a very long string";
int contentHash = content.GetHashCode();
</code></pre>
<p>I am then storing the hash into a dictionary as key mapping to another ID. This is useful so I don't have to compare <a href="http://dotnetperls.com/Content/Dictiona... | [
{
"answer_id": 468718,
"author": "John Källén",
"author_id": 40047,
"author_profile": "https://Stackoverflow.com/users/40047",
"pm_score": 1,
"selected": false,
"text": "<p>Strings are hashed based on their content, so yes, that hash should remain the same over time if you use the defaul... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311500/"
] | I am getting a string hash like this:
```
string content = "a very long string";
int contentHash = content.GetHashCode();
```
I am then storing the hash into a dictionary as key mapping to another ID. This is useful so I don't have to compare [big strings](http://dotnetperls.com/Content/Dictionary-String-Key.aspx) d... | Just to add some detail as to where the idea of a changing hashcode may have come from.
As the other answers have rightly said the hashcode for a specific string will always be the same for a specific runtime version. There is no guarantee that a newer runtime might use a different algorithm perhaps for performance re... |
468,721 | <p>I know it is possible to set the current folder of the OpenFolderDialog to a special folder, like "Program Files" or Desktop?</p>
<p>But where do I find this? </p>
| [
{
"answer_id": 468727,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 5,
"selected": true,
"text": "<p>Look at the System.Environment class, e.g:</p>\n\n<pre><code>string programFiles = System.Environment.GetFolderPath(\n S... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21733/"
] | I know it is possible to set the current folder of the OpenFolderDialog to a special folder, like "Program Files" or Desktop?
But where do I find this? | Look at the System.Environment class, e.g:
```
string programFiles = System.Environment.GetFolderPath(
System.Environment.SpecialFolder.ProgramFiles);
```
Update:
I'm not sure if this is part of the question, but to open the folder selection dialog, you then use this code:
```
using System.Windows.Forms;
//.... |
468,730 | <p>Question is should i use properties for my view controllers?</p>
<p>Consider the following case:</p>
<ol>
<li><p>I have a view controller object in my parent class: MyViewController *myVC;</p></li>
<li><p>I don't release this view controller in parent class's <em>dealloc</em> method.</p></li>
<li><p>I use view con... | [
{
"answer_id": 468743,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 1,
"selected": false,
"text": "<p>I am not aware of any way to get a development device and I would be surprised if there were one. Keep in mind tha... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49739/"
] | Question is should i use properties for my view controllers?
Consider the following case:
1. I have a view controller object in my parent class: MyViewController \*myVC;
2. I don't release this view controller in parent class's *dealloc* method.
3. I use view controller like this:
```
// Allocate and Initialize view... | You can get WinMobile phones sim-free a lot cheaper than Android Dev phones.
Have a look at something like the Samsung I200 - WinMobile 6.1 Pro and £160 sim-free in the UK - half the price of the android dev phone.
Sim free phones are ideal, you can use the free PAYG sim cards all the networks give away these days.
... |
468,742 | <p>I had displayed check box in a list and i want to access that which check box is selected or not and want to call controller action where i select option from dropdown list</p>
<pre><code><div id="pnlSent" style="display: none">
<%= Html.DropDownList("select","msgtype") %>
<% ... | [
{
"answer_id": 469222,
"author": "Eppz",
"author_id": 48478,
"author_profile": "https://Stackoverflow.com/users/48478",
"pm_score": -1,
"selected": false,
"text": "<p>You can loop through all of the controls on the div pnlsent and if the control type is a checkbox you can then determine ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I had displayed check box in a list and i want to access that which check box is selected or not and want to call controller action where i select option from dropdown list
```
<div id="pnlSent" style="display: none">
<%= Html.DropDownList("select","msgtype") %>
<% foreach (Usp_GetUserMessagesR... | In asp.net-MVC you should ahve the info that you want to be able to access on the controller side in a form as so, I noticed you did not add an ID to your checkbox, mine is dynamically binded and I am using the HTML helper that comes with asp.net-mvc:
```
<% using(Html.BeginForm("Retrieve", "Home")) %>//Retrieve is... |
468,756 | <p>I am trying to use the Axinom CMS with ASP Ajax and created a page containing ScriptManager, UpdatePanel and Timer.</p>
<p>When publishing the page in the CMS the actual page is created under </p>
<blockquote>
<p>(1) <a href="http://localhost/Site/publish/PageName.aspx" rel="nofollow noreferrer">http://localhost... | [
{
"answer_id": 469222,
"author": "Eppz",
"author_id": 48478,
"author_profile": "https://Stackoverflow.com/users/48478",
"pm_score": -1,
"selected": false,
"text": "<p>You can loop through all of the controls on the div pnlsent and if the control type is a checkbox you can then determine ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to use the Axinom CMS with ASP Ajax and created a page containing ScriptManager, UpdatePanel and Timer.
When publishing the page in the CMS the actual page is created under
>
> (1) <http://localhost/Site/publish/PageName.aspx>
>
>
>
but the user is meant to access it under
>
> (2) <http://localhos... | In asp.net-MVC you should ahve the info that you want to be able to access on the controller side in a form as so, I noticed you did not add an ID to your checkbox, mine is dynamically binded and I am using the HTML helper that comes with asp.net-mvc:
```
<% using(Html.BeginForm("Retrieve", "Home")) %>//Retrieve is... |
468,763 | <p>I cannot connect to database from my Jython program. Pure Java programs can connect, and I can connect to db from Jython but only using JDBC-ODBC bridge: "sun.jdbc.odbc.JdbcOdbcDriver". If I use native JDBC driver my program fails with "driver not found" exception.</p>
<p>Code:</p>
<pre><code>import sys
from com.z... | [
{
"answer_id": 472294,
"author": "Michał Niklas",
"author_id": 22595,
"author_profile": "https://Stackoverflow.com/users/22595",
"pm_score": 4,
"selected": true,
"text": "<p>I will answer myself:</p>\n\n<p>There was bug in Jython 2.5b1: <a href=\"http://bugs.jython.org/issue1127\" rel=\"... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22595/"
] | I cannot connect to database from my Jython program. Pure Java programs can connect, and I can connect to db from Jython but only using JDBC-ODBC bridge: "sun.jdbc.odbc.JdbcOdbcDriver". If I use native JDBC driver my program fails with "driver not found" exception.
Code:
```
import sys
from com.ziclix.python.sql impo... | I will answer myself:
There was bug in Jython 2.5b1: [Jython has problems to dynamically loading classes when installed on the boot classpath](http://bugs.jython.org/issue1127)
I was able to run my program if I invoked it with --verify flag.
Bug disappeared in Jython 2.5b3 |
468,764 | <p>Is there a difference in performance between <code>TOP</code> and <code>SET ROWCOUNT</code> or do they just get executed in the same manner?</p>
| [
{
"answer_id": 468781,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 5,
"selected": true,
"text": "<p>Yes, functionally they are the same thing. As far as I know there are no significant performance differences betwee... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6369/"
] | Is there a difference in performance between `TOP` and `SET ROWCOUNT` or do they just get executed in the same manner? | Yes, functionally they are the same thing. As far as I know there are no significant performance differences between the two.
Just one thing to note is that once you have `set rowcount` this will persist for the life of the connection so make sure you reset it to `0` once you are done with it.
---
### EDIT (post Mar... |
468,789 | <p>I need to determine if a user-supplied string is a valid file path (i.e., if <code>createNewFile()</code> will succeed or throw an Exception) but I don't want to bloat the file system with useless files, created just for validation purposes.</p>
<p>Is there a way to determine if the string I have is a valid file pa... | [
{
"answer_id": 468798,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 6,
"selected": true,
"text": "<p>This would check for the existance of the directory as well.</p>\n\n<pre><code>File file = new File(\"c:\\\\cygwin\\\... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468789",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1454/"
] | I need to determine if a user-supplied string is a valid file path (i.e., if `createNewFile()` will succeed or throw an Exception) but I don't want to bloat the file system with useless files, created just for validation purposes.
Is there a way to determine if the string I have is a valid file path without attempting... | This would check for the existance of the directory as well.
```
File file = new File("c:\\cygwin\\cygwin.bat");
if (!file.isDirectory())
file = file.getParentFile();
if (file.exists()){
...
}
```
It seems like file.canWrite() does not give you a clear indication if you have permissions to write to the direct... |
468,791 | <p><strong>Is there a way of setting culture for a whole application? All current threads and new threads?</strong></p>
<p>We have the name of the culture stored in a database, and when our application starts, we do </p>
<pre><code>CultureInfo ci = new CultureInfo(theCultureString);
Thread.CurrentThread.CurrentCultur... | [
{
"answer_id": 468805,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": false,
"text": "<p>This gets asked a lot. Basically, no there isn't, not for .NET 4.0. You have to do it manually at the start of eac... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39321/"
] | **Is there a way of setting culture for a whole application? All current threads and new threads?**
We have the name of the culture stored in a database, and when our application starts, we do
```
CultureInfo ci = new CultureInfo(theCultureString);
Thread.CurrentThread.CurrentCulture = ci;
Thread.CurrentThread.Curre... | In .NET 4.5, you can use the [`CultureInfo.DefaultThreadCurrentCulture`](http://msdn.microsoft.com/en-us/library/system.globalization.cultureinfo.defaultthreadcurrentculture.aspx) property to change the culture of an AppDomain.
For versions prior to 4.5 you have to use reflection to manipulate the culture of an AppDom... |
468,818 | <p>We are factoring out the common code from our Perl project. One main program should be split into several re-usable modules.</p>
<p>Our program name is <code>validate_results.pl</code> which contains set of validation commands. We are planning to split this into small modules so that <code>validate_results.pl</code... | [
{
"answer_id": 468902,
"author": "jrockway",
"author_id": 8457,
"author_profile": "https://Stackoverflow.com/users/8457",
"pm_score": 4,
"selected": true,
"text": "<p>The filesystem hierarchy is required. A::B::C will always be located in A/B/C.pm, somewhere in @INC.</p>\n\n<p>If you <e... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18657/"
] | We are factoring out the common code from our Perl project. One main program should be split into several re-usable modules.
Our program name is `validate_results.pl` which contains set of validation commands. We are planning to split this into small modules so that `validate_results.pl` should be like:
```
use Commo... | The filesystem hierarchy is required. A::B::C will always be located in A/B/C.pm, somewhere in @INC.
If you *have* to get around this, read [perldoc -f require](http://perldoc.perl.org/functions/require.html), specifically looking for the section about subroutine references in @INC. Yes, you can make the module loader... |
468,832 | <p><strong>Edit:</strong> I apologize everybody. I used the term "jagged array" when I actually meant to say "multi-dimensional array" (as can be seen in my example below). I apologize for using the incorrect name. I actually found jagged arrays to be faster than multi-dimensional ones! I have added my measurements for... | [
{
"answer_id": 468848,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 2,
"selected": false,
"text": "<p><s>Because a multidimensional array is just a syntactic sugar as it is really just a flat array with some index cal... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468832",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41283/"
] | **Edit:** I apologize everybody. I used the term "jagged array" when I actually meant to say "multi-dimensional array" (as can be seen in my example below). I apologize for using the incorrect name. I actually found jagged arrays to be faster than multi-dimensional ones! I have added my measurements for jagged arrays.
... | Single dimensional arrays with a lower bound of 0 are a different type to either multi-dimensional or non-0 lower bound arrays within IL (`vector` vs `array` IIRC). `vector` is simpler to work with - to get to element x, you just do `pointer + size * x`. For an `array`, you have to do `pointer + size * (x-lower bound)`... |
468,843 | <p>I have a url in an xml documnent which is encoded</p>
<pre><code><Link>http://www.sample.com/test.asp?goto=HOTWIZ%26eapid=857</Link>
</code></pre>
<p>I would like to convert that into a Url in the outputed Html.</p>
<p>I can output a link ok but i need the %26 to be converted to an &</p>
<p>I ass... | [
{
"answer_id": 468854,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 2,
"selected": false,
"text": "<p>There is a semantic difference between <code>…?foo=bar&baz</code> and <code>…?foo=bar%26baz</code>. The first is two ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/87783/"
] | I have a url in an xml documnent which is encoded
```
<Link>http://www.sample.com/test.asp?goto=HOTWIZ%26eapid=857</Link>
```
I would like to convert that into a Url in the outputed Html.
I can output a link ok but i need the %26 to be converted to an &
I assume i could use some sort of replace functionality in XS... | There is a semantic difference between `…?foo=bar&baz` and `…?foo=bar%26baz`. The first is two arguments (`foo` with the value `bar` and `bar` with an empty value) while the second is just one argument (`foo` with the value `bar&baz`). |
468,863 | <p>I am hoping some can help me a little bit, I am currently developing my first site using a PHP framework, part of the site is spilt into a members area, this is where my confusion begins to surface, withing the members area I want normal members to be able to add new comments and edit there own comments, simple enou... | [
{
"answer_id": 469265,
"author": "Barrett Conrad",
"author_id": 1227,
"author_profile": "https://Stackoverflow.com/users/1227",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, in most cases all of your authentication should go through the same controller. However, Zend Auth is not a ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57872/"
] | I am hoping some can help me a little bit, I am currently developing my first site using a PHP framework, part of the site is spilt into a members area, this is where my confusion begins to surface, withing the members area I want normal members to be able to add new comments and edit there own comments, simple enough ... | I recommend the book "Zend Framework in Action" from Manning Publications as a great, up-to-date, introduction to this. It's available as PDF download, so you can have it now :)
But to answer this particular question:
Let's start by defining two key terms.
The "Auth" in Zend\_Auth refers to Authentication, which prov... |
468,881 | <p>How do I print the indicated div (without manually disabling all other content on the page)?</p>
<p>I want to avoid a new preview dialog, so creating a new window with this content is not useful.</p>
<p>The page contains a couple of tables, one of them contains the div I want to print - the table is styled with vi... | [
{
"answer_id": 468888,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 5,
"selected": false,
"text": "<p>Could you use a <a href=\"http://css-discuss.incutio.com/?page=PrintStylesheets\" rel=\"noreferrer\">print stylesheet<... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42108/"
] | How do I print the indicated div (without manually disabling all other content on the page)?
I want to avoid a new preview dialog, so creating a new window with this content is not useful.
The page contains a couple of tables, one of them contains the div I want to print - the table is styled with visual styles for t... | Here is a general solution, using **CSS only**, which I have verified to work.
```
@media print {
body * {
visibility: hidden;
}
#section-to-print, #section-to-print * {
visibility: visible;
}
#section-to-print {
position: absolute;
left: 0;
top: 0;
}
}
```
Alternative approaches aren... |
468,893 | <p>I want to provide dynamic download of files. These files can be generated on-the-fly on serverside so they are represented as byte[] and do not exist on disk. I want the user to fill in an ASP.NET form, hit the download button and return the file he/she wanted.</p>
<p>Here is how my code behind the ASP.NET form loo... | [
{
"answer_id": 468903,
"author": "Filip Ekberg",
"author_id": 39106,
"author_profile": "https://Stackoverflow.com/users/39106",
"pm_score": 0,
"selected": false,
"text": "<p>Look <a href=\"http://www.iana.org/assignments/media-types/application/zip\" rel=\"nofollow noreferrer\">here</a> ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24451/"
] | I want to provide dynamic download of files. These files can be generated on-the-fly on serverside so they are represented as byte[] and do not exist on disk. I want the user to fill in an ASP.NET form, hit the download button and return the file he/she wanted.
Here is how my code behind the ASP.NET form looks like:
... | Here's a minor modification you need to make:
```
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.BinaryWrite(binary);
Response.End();
``` |
468,906 | <p>I am trying to run a Mono application on the Mac that has an embedded web browser control. The program runs, but now broswser is show and a message is output:</p>
<p>libgluezilla not found. To have webbrowser support, you need libgluezilla installed</p>
<p>I have searched, but have no idea how to install this. You... | [
{
"answer_id": 468903,
"author": "Filip Ekberg",
"author_id": 39106,
"author_profile": "https://Stackoverflow.com/users/39106",
"pm_score": 0,
"selected": false,
"text": "<p>Look <a href=\"http://www.iana.org/assignments/media-types/application/zip\" rel=\"nofollow noreferrer\">here</a> ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26157/"
] | I am trying to run a Mono application on the Mac that has an embedded web browser control. The program runs, but now broswser is show and a message is output:
libgluezilla not found. To have webbrowser support, you need libgluezilla installed
I have searched, but have no idea how to install this. Your guidance would ... | Here's a minor modification you need to make:
```
Response.Clear();
Response.ContentType = "application/x-zip-compressed";
Response.BinaryWrite(binary);
Response.End();
``` |
468,925 | <p>In ActionScript3, how do you get a reference to an object's class?</p>
| [
{
"answer_id": 468998,
"author": "hasseg",
"author_id": 4111,
"author_profile": "https://Stackoverflow.com/users/4111",
"pm_score": 4,
"selected": true,
"text": "<p>You can use <a href=\"http://livedocs.adobe.com/flex/3/langref/Object.html#constructor\" rel=\"nofollow noreferrer\">the <c... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11911/"
] | In ActionScript3, how do you get a reference to an object's class? | You can use [the `constructor` property](http://livedocs.adobe.com/flex/3/langref/Object.html#constructor) if your object has been created from a class (from the docs: *"If an object is an instance of a class, the constructor property holds a reference to the class object. If an object is created with a constructor fun... |
468,939 | <p>Because honestly</p>
<pre><code>:wq!
</code></pre>
<p>is just too much to type.</p>
<p>Please note that the question is about original Vi (say Vi which comes with FreeBSD) not Vim.</p>
| [
{
"answer_id": 468947,
"author": "user50264",
"author_id": 50264,
"author_profile": "https://Stackoverflow.com/users/50264",
"pm_score": 1,
"selected": false,
"text": "<p>Does <code>:x</code> work on Vi? Although for your case I guess it might be <code>:x!</code></p>\n"
},
{
"ans... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54247/"
] | Because honestly
```
:wq!
```
is just too much to type.
Please note that the question is about original Vi (say Vi which comes with FreeBSD) not Vim. | This seems to work on solaris' old version of vi:
```
Version SVR4.0, Solaris 2.5.0
$ vi -c "map g ZZ" test
```
**edit**: Also, this seems to work:
```
$ vi -c 'map g :q!^M' test
```
Where ^M is actually, ^V (ctl-v) then ^M (ctl-m) |
468,954 | <p>Does anyone know how to generate an XSD using LinqToXml? I can't find any examples of this anywhere. The XSD will be of the following fairly low level of complexity:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid XML Studio 6.1.18.0 - FREE Community Edition (http://www.liqu... | [
{
"answer_id": 468968,
"author": "aku",
"author_id": 1196,
"author_profile": "https://Stackoverflow.com/users/1196",
"pm_score": 2,
"selected": true,
"text": "<p>Why do you want to use LINQ in this scenario? How does the source data look like?</p>\n\n<p>Not much information given but any... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2608/"
] | Does anyone know how to generate an XSD using LinqToXml? I can't find any examples of this anywhere. The XSD will be of the following fairly low level of complexity:
```
<?xml version="1.0" encoding="utf-8" ?>
<!--Created with Liquid XML Studio 6.1.18.0 - FREE Community Edition (http://www.liquid-technologies.com)-->
... | Why do you want to use LINQ in this scenario? How does the source data look like?
Not much information given but anyway:
You can construct your XSD using similar code:
```
XNamespace nsXS = "http://www.w3.org/2001/XMLSchema";
XElement root = new XElement(nsXS + "schema",
new XAttribute("elementFormDefault", "qua... |
468,956 | <p>Can I get an object's name in run time (like getting an object's type via RTTI)? I want the object to be able to print its name.</p>
| [
{
"answer_id": 468969,
"author": "tunnuz",
"author_id": 25418,
"author_profile": "https://Stackoverflow.com/users/25418",
"pm_score": 1,
"selected": false,
"text": "<p>If you mean the name of the variable, I don't think this is possible. Maybe if you compile with the GNU Debugger option ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48461/"
] | Can I get an object's name in run time (like getting an object's type via RTTI)? I want the object to be able to print its name. | Its not possible. For on thing, an object doesn't have a unique name.
```
A a;
A& ar = a; // both a and ar refer to the same object
new A; // the object created doesn't have a name
A* ap = new A[100]; // either all 100 objects share the same name, or need to
// know that they are part of an ... |
468,972 | <p>From a COM library (Microsoft Office Document Imaging aka MODI) I receive an image as an IPictureDisp which I would like to convert to a System.Drawing.Image object. </p>
<p>What would be the best way to do that?</p>
<p>Currently I'm using the code below, which however throws an NotImplementedException.</p>
<pre>... | [
{
"answer_id": 468977,
"author": "John Källén",
"author_id": 40047,
"author_profile": "https://Stackoverflow.com/users/40047",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried:</p>\n\n<pre><code>picture1.image = Microsoft.VisualBasic.Compatibility.VB6.Support.IPictureDispToIm... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40347/"
] | From a COM library (Microsoft Office Document Imaging aka MODI) I receive an image as an IPictureDisp which I would like to convert to a System.Drawing.Image object.
What would be the best way to do that?
Currently I'm using the code below, which however throws an NotImplementedException.
```
internal sealed class ... | As it seems the picture obtained from the Microsoft Office Document Imaging COM components is not a valid IPictureDisp object and there seems no way to convert it. |
468,987 | <p>i've got some weird characters in my database, which seem to mess up django when returning a page. I get this error come up:</p>
<pre><code>TemplateSyntaxError at /search/legacy/
Caught an exception while rendering: Could not decode to UTF-8 column 'maker' with text 'i� G�r'
</code></pre>
<p>(the actual text is s... | [
{
"answer_id": 468999,
"author": "Guillaume",
"author_id": 23704,
"author_profile": "https://Stackoverflow.com/users/23704",
"pm_score": 2,
"selected": true,
"text": "<p>Probably not.</p>\n\n<p>Django is using UTF-8 Strings internally, and it seems that your database returns some invalid... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15616/"
] | i've got some weird characters in my database, which seem to mess up django when returning a page. I get this error come up:
```
TemplateSyntaxError at /search/legacy/
Caught an exception while rendering: Could not decode to UTF-8 column 'maker' with text 'i� G�r'
```
(the actual text is slightly different, but sin... | Probably not.
Django is using UTF-8 Strings internally, and it seems that your database returns some invalid string. You should fix the data in the database and use exclusively UTF-8 in all your application (data import, database, templates, source files, ...). |
468,989 | <p>I want log4net to write log files (using RollingFileAppender) to a subfolder of the common application data folder (e.g. C:\Documents and Settings\All Users\Application Data\Company\Product\Logs).<br>
However, on Win XP, there is no environment variable that specifies this folder. We have <code>%ALLUSERSPROFILE%</co... | [
{
"answer_id": 469017,
"author": "pilif",
"author_id": 5083,
"author_profile": "https://Stackoverflow.com/users/5083",
"pm_score": 5,
"selected": true,
"text": "<p><a href=\"http://marc.info/?l=log4net-user&m=110142086820117&w=2\" rel=\"noreferrer\">This posting</a> on the log4ne... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57474/"
] | I want log4net to write log files (using RollingFileAppender) to a subfolder of the common application data folder (e.g. C:\Documents and Settings\All Users\Application Data\Company\Product\Logs).
However, on Win XP, there is no environment variable that specifies this folder. We have `%ALLUSERSPROFILE%`, we have `%... | [This posting](http://marc.info/?l=log4net-user&m=110142086820117&w=2) on the log4net mailinglist explains how you can define your own path replacement variables. |
468,990 | <p>I have a simple query:</p>
<pre><code>select * from countries
</code></pre>
<p>with the following results:</p>
<pre><code>country_name
------------
Albania
Andorra
Antigua
.....
</code></pre>
<p>I would like to return the results in one row, so like this:</p>
<pre><code>Albania, Andorra, Antigua, ...
</code></p... | [
{
"answer_id": 469044,
"author": "tuinstoel",
"author_id": 43901,
"author_profile": "https://Stackoverflow.com/users/43901",
"pm_score": 2,
"selected": false,
"text": "<p>The fastest way it is to use the Oracle collect function. </p>\n\n<p>You can also do this:</p>\n\n<pre><code>select *... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468990",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21047/"
] | I have a simple query:
```
select * from countries
```
with the following results:
```
country_name
------------
Albania
Andorra
Antigua
.....
```
I would like to return the results in one row, so like this:
```
Albania, Andorra, Antigua, ...
```
Of course, I can write a PL/SQL function to do the job (I alread... | Here is a simple way without stragg or creating a function.
```
create table countries ( country_name varchar2 (100));
insert into countries values ('Albania');
insert into countries values ('Andorra');
insert into countries values ('Antigua');
SELECT SUBSTR (SYS_CONNECT_BY_PATH (country_name , ','), 2) csv
... |
468,993 | <p>I'm developing a JavaScript application that needs to run on the Google Android Phone OS. Is there a way to enable the JavaScript Error/Debug console within Safari on either the Android Emulator or an actual device? If so any instructions on how to do so would be appreciated.</p>
| [
{
"answer_id": 487622,
"author": "andynormancx",
"author_id": 46354,
"author_profile": "https://Stackoverflow.com/users/46354",
"pm_score": 6,
"selected": true,
"text": "<p>A quick Google turns up this <a href=\"https://web.archive.org/web/20120413212614/http://www.nanaze.com/2009/01/deb... | 2009/01/22 | [
"https://Stackoverflow.com/questions/468993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2723/"
] | I'm developing a JavaScript application that needs to run on the Google Android Phone OS. Is there a way to enable the JavaScript Error/Debug console within Safari on either the Android Emulator or an actual device? If so any instructions on how to do so would be appreciated. | A quick Google turns up this [blog post](https://web.archive.org/web/20120413212614/http://www.nanaze.com/2009/01/debugging-javascript-on-android.html) (posted after you asked your question), that should at least let you see any Javascript errors via the Android Debug Bridge using the command:
```
adb logcat WebCore:V... |
469,009 | <p>I have a MySQL database which contains a table of users. The primary key of the table is 'userid', which is set to be an auto increment field.</p>
<p>What I'd like to do is when I insert a new user into the table is to use the same value that the auto increment is creating in the 'userid' field in a different fiel... | [
{
"answer_id": 469065,
"author": "pilif",
"author_id": 5083,
"author_profile": "https://Stackoverflow.com/users/5083",
"pm_score": 2,
"selected": false,
"text": "<p>seeing that <code>last_insert_id()</code> wouldn't work in this case, yes, the trigger would be the only way to accomplish ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55402/"
] | I have a MySQL database which contains a table of users. The primary key of the table is 'userid', which is set to be an auto increment field.
What I'd like to do is when I insert a new user into the table is to use the same value that the auto increment is creating in the 'userid' field in a different field, 'default... | there's no need to create another table, and max() will have problems acording to the auto\_increment value of the table, do this:
```
CREATE TRIGGER trigger_name BEFORE INSERT ON tbl FOR EACH ROW
BEGIN
DECLARE next_id;
SET next_id = (SELECT AUTO_INCREMENT FROM information_schema.TABLES WHERE TABLE_SCHEMA=DATABA... |
469,019 | <p>Main problem is about changing the index of rows to 1,2,3.. where contact-id and type is the same. but all columns can contain exactly the same data because of some ex-employee messed up and update all rows by contact-id and type. somehow there are rows that aren't messed but index rows are same. It is total chaos. ... | [
{
"answer_id": 469070,
"author": "Amy B",
"author_id": 8155,
"author_profile": "https://Stackoverflow.com/users/8155",
"pm_score": 2,
"selected": false,
"text": "<p>Do you do any more fetches? You should show those as well. You're only showing us half the code.</p>\n\n<p>It should look... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469019",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3385/"
] | Main problem is about changing the index of rows to 1,2,3.. where contact-id and type is the same. but all columns can contain exactly the same data because of some ex-employee messed up and update all rows by contact-id and type. somehow there are rows that aren't messed but index rows are same. It is total chaos.
I... | I don't fully understand what was the problem with the *"update current of cursor"* but it is solved by using the fetch statement twice for the inner cursor:
```
FETCH NEXT FROM INNER_CURSOR
WHILE (@@FETCH_STATUS <> -1)
BEGIN
UPDATE CONTACTS
SET INDEX_NO = @COUNTER
WHERE CURRENT OF INNER_CURSOR
SET @COUNTER = @COUN... |
469,026 | <p>I have a stored procedure that ideally should be able to accept a list/table of NVARCHARs from the database client. I'm aware of table parameters in SQL Server 2008 but I'm stuck with running SQL Server 2003.</p>
<p>Currently, I'm concatenating the strings with a separator character on the client side, passing the... | [
{
"answer_id": 469087,
"author": "Rowland Shaw",
"author_id": 50447,
"author_profile": "https://Stackoverflow.com/users/50447",
"pm_score": 3,
"selected": true,
"text": "<p>Have you looked at passing in XML?</p>\n\n<p>So, for XML a little like:</p>\n\n<pre><code><ArrayOfService xmlns:... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40047/"
] | I have a stored procedure that ideally should be able to accept a list/table of NVARCHARs from the database client. I'm aware of table parameters in SQL Server 2008 but I'm stuck with running SQL Server 2003.
Currently, I'm concatenating the strings with a separator character on the client side, passing the resulting ... | Have you looked at passing in XML?
So, for XML a little like:
```
<ArrayOfService xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Service Id="2" Name="AUSTRALIA" Code="AUS" />
<Service Id="10" Name="FAR EAST" Code="FEE" />
</ArrayOfService>
```
In SQL Server ... |
469,028 | <p>I often find the need to do something along these lines:</p>
<pre><code>public class OperationResult
{
bool succes;
SomeOtherObject someobject;
}
public interface ICanDoSomethingWeird
{
OperationResult DoMyThing();
}
</code></pre>
<p>Where the OperationResult is really a class that belongs to the ICanDoSom... | [
{
"answer_id": 469051,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 4,
"selected": true,
"text": "<p>If <code>OperationResult</code> is a type used solely by <code>ICanDoSomethingWeird</code> and clients of <code>ICan... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47901/"
] | I often find the need to do something along these lines:
```
public class OperationResult
{
bool succes;
SomeOtherObject someobject;
}
public interface ICanDoSomethingWeird
{
OperationResult DoMyThing();
}
```
Where the OperationResult is really a class that belongs to the ICanDoSomethingWeird interface. I fi... | If `OperationResult` is a type used solely by `ICanDoSomethingWeird` and clients of `ICanDoSomethingWeird`, then it belongs in the same "context" as `ICanDoSomethingWeird`. That is, it *belongs* in the *same* namespace as `ICanDoSomethingWeird`:
```
namespace MyNamespace
{
public class OperationResult {}
publ... |
469,047 | <p>I'm implementing one project using PHP, in that I want to login into a page automatically .
The code is below.</p>
<pre><code>$ch = curl_init();
$postdata="Email=$username&Passwd=$password&continue=https://www.mail.google.com";
curl_setopt ($ch, CURLOPT_URL,"https://www.google.com");
curl_setopt ($ch, CURL... | [
{
"answer_id": 469086,
"author": "Aron Rotteveel",
"author_id": 11568,
"author_profile": "https://Stackoverflow.com/users/11568",
"pm_score": 3,
"selected": false,
"text": "<p>First of all: \"it won't work\" does not give us much information and context to help you solving the problem.</... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm implementing one project using PHP, in that I want to login into a page automatically .
The code is below.
```
$ch = curl_init();
$postdata="Email=$username&Passwd=$password&continue=https://www.mail.google.com";
curl_setopt ($ch, CURLOPT_URL,"https://www.google.com");
curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, FA... | First of all: "it won't work" does not give us much information and context to help you solving the problem.
To get your questions answered, please try to supply **details**, for example:
* What specific part is not working?
* Do you get any error messages?
* What operating system does you code run on?
It also helps... |
469,059 | <p>When looking at most sites (including SO), most of them use:</p>
<pre><code><input type="button" />
</code></pre>
<p>instead of:</p>
<pre><code><button></button>
</code></pre>
<ul>
<li>What are the main differences between the two, if any?</li>
<li>Are there valid reasons to use one instead of ... | [
{
"answer_id": 469073,
"author": "user54579",
"author_id": 54579,
"author_profile": "https://Stackoverflow.com/users/54579",
"pm_score": 6,
"selected": false,
"text": "<p>Quote</p>\n\n<blockquote>\n <p>Important: If you use the button element in an HTML form, different browsers will sub... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469059",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11568/"
] | When looking at most sites (including SO), most of them use:
```
<input type="button" />
```
instead of:
```
<button></button>
```
* What are the main differences between the two, if any?
* Are there valid reasons to use one instead of the other?
* Are there valid reasons to use combine them?
* Does using `<butto... | * [Here's a page](http://web.archive.org/web/20110721191046/http://particletree.com/features/rediscovering-the-button-element/) describing the differences (basically you can put html into a `<button></button>`)
* [And another page](http://www.peterbe.com/plog/button-tag-in-IE) describing why people avoid `<button></but... |
469,083 | <p>Is there any way to make a MFC DockablePane (from the new Feature Pack) that is docked in a window not able to float or to hide (and even disable the context menu that allows the user to select the states - dockable, float, hide etc.)</p>
<p>What I basically want is to have 3 panes on a window that can change their... | [
{
"answer_id": 492462,
"author": "user60280",
"author_id": 60280,
"author_profile": "https://Stackoverflow.com/users/60280",
"pm_score": 1,
"selected": false,
"text": "<p>Try changing the dwControlBarStyle when you create the window (with CDockablePane::Create).</p>\n"
},
{
"answ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51336/"
] | Is there any way to make a MFC DockablePane (from the new Feature Pack) that is docked in a window not able to float or to hide (and even disable the context menu that allows the user to select the states - dockable, float, hide etc.)
What I basically want is to have 3 panes on a window that can change their horizonta... | The solution is to extend the CDockablePane and override in this class the following events:
```
virtual BOOL CanFloat() const;
virtual BOOL CanBeClosed() const;
virtual BOOL CanAutoHide() const;
```
so that they return FALSE;
for more information see [MSDN Customization Tips for the MFC Extensions](http://msdn.mic... |
469,089 | <p>I would like to have a <code>SynchronousQueue</code> where I insert elements from one thread with <code>put()</code>, so the input is blocked until the element is taken in another thread.</p>
<p>In the other thread I perform lots of calculations and from time to time want to check if an element is already available... | [
{
"answer_id": 469124,
"author": "Tim",
"author_id": 53444,
"author_profile": "https://Stackoverflow.com/users/53444",
"pm_score": 4,
"selected": true,
"text": "<p>From <a href=\"http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/SynchronousQueue.html#put(E)\" rel=\"noreferrer\... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48181/"
] | I would like to have a `SynchronousQueue` where I insert elements from one thread with `put()`, so the input is blocked until the element is taken in another thread.
In the other thread I perform lots of calculations and from time to time want to check if an element is already available, and consume it. But it seems t... | From <http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/SynchronousQueue.html#put(E)> :
**isEmpty**
public boolean isEmpty()
Always returns true. A SynchronousQueue has no internal capacity.
(haven't looked into this in great detail, but you might want to take a look at either *poll* or *take* instea... |
469,126 | <p>What I have is following:</p>
<pre><code><xsl:variable name="myvar" select=".//spss:category[((not @varName) or @varName=$colVarName) and @text=$series]/spss:cell/@text"/>
</code></pre>
<p>What it <em>should</em> do is select the text of the <code>spss:cell</code>'s text-Attribute as long as it is a child of... | [
{
"answer_id": 469134,
"author": "Daren Thomas",
"author_id": 2260,
"author_profile": "https://Stackoverflow.com/users/2260",
"pm_score": 4,
"selected": true,
"text": "<p>OK, I think I found the mistake:</p>\n\n<p><code>not</code> must be used with parenthesis, so instead of</p>\n\n<pre>... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2260/"
] | What I have is following:
```
<xsl:variable name="myvar" select=".//spss:category[((not @varName) or @varName=$colVarName) and @text=$series]/spss:cell/@text"/>
```
What it *should* do is select the text of the `spss:cell`'s text-Attribute as long as it is a child of a `spss:category` that has
* either a `varName` ... | OK, I think I found the mistake:
`not` must be used with parenthesis, so instead of
```
(not @varName) or @varName=$colVarName
```
it should have been
```
not(@varName) or @varName=$colVarName
``` |
469,142 | <p>Im trying to compile a php interface for my linux shared object and i have managed to get it to compile all right using the output from swig, however when i try and load the so it complains of a missing symbol:</p>
<pre><code>error: undefined symbol: zend_register_long_constant
</code></pre>
<p>Now i have had a lo... | [
{
"answer_id": 469154,
"author": "Sesh",
"author_id": 38212,
"author_profile": "https://Stackoverflow.com/users/38212",
"pm_score": 4,
"selected": true,
"text": "<p>For web, check this link: </p>\n\n<p><a href=\"http://designingwebinterfaces.com/designing-web-interfaces-12-screen-pattern... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23339/"
] | Im trying to compile a php interface for my linux shared object and i have managed to get it to compile all right using the output from swig, however when i try and load the so it complains of a missing symbol:
```
error: undefined symbol: zend_register_long_constant
```
Now i have had a look at zend and it seems to... | For web, check this link:
<http://designingwebinterfaces.com/designing-web-interfaces-12-screen-patterns>
For windows forms, there is no such site (at least to my knowledge). What I do is to mimic the behavior of the applications I like (e.g. docking panels in Visual studio, some other GUI in Office and so on.
Medi... |
469,159 | <p>I am looking for a Linux command-line tool that would report the disk IO activity. Something similar to <code>htop</code> would be really cool. Has someone heard of something like that?</p>
| [
{
"answer_id": 469181,
"author": "jpalecek",
"author_id": 51831,
"author_profile": "https://Stackoverflow.com/users/51831",
"pm_score": 4,
"selected": false,
"text": "<p>It is not htop-like, but you could use <a href=\"http://www.atcomputing.nl/Tools/atop/\" rel=\"noreferrer\">atop</a>. ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54579/"
] | I am looking for a Linux command-line tool that would report the disk IO activity. Something similar to `htop` would be really cool. Has someone heard of something like that? | You could use [iotop](http://guichaz.free.fr/iotop/). It doesn't rely on a kernel patch. It Works with stock Ubuntu kernel
There is a package for it in the Ubuntu repos. You can install it using
```
sudo apt-get install iotop
```
 |
469,168 | <p>I have a TextBox.TextProperty bound to a ViewModel property. In the binding I have explicitly set <strong>ValidatesOnExceptions</strong> to <strong>True</strong>.</p>
<p>In resources the TextBox has this trigger:</p>
<pre><code><Trigger Property="Validation.HasError" Value="true">
<Setter
Proper... | [
{
"answer_id": 469198,
"author": "Stu Mackellar",
"author_id": 28591,
"author_profile": "https://Stackoverflow.com/users/28591",
"pm_score": 3,
"selected": true,
"text": "<p>This is because the validation code is being invoked via reflection. Any caught exceptions will be wrapped up in a... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52879/"
] | I have a TextBox.TextProperty bound to a ViewModel property. In the binding I have explicitly set **ValidatesOnExceptions** to **True**.
In resources the TextBox has this trigger:
```
<Trigger Property="Validation.HasError" Value="true">
<Setter
Property="ToolTip"
Value="{Binding RelativeSource={Relat... | This is because the validation code is being invoked via reflection. Any caught exceptions will be wrapped up in a [TargetInvocationException](http://msdn.microsoft.com/en-us/library/system.reflection.targetinvocationexception.aspx) instance. The original exception will be stored as this exception's [InnerException](ht... |
469,177 | <p>I have the following HTML / JS:</p>
<pre><code><html>
<body>
<script>
function foo(){
var html = "<iframe src=\"foo.html\" />";
document.getElementById('content').innerHTML=html;
}
function bar(){
var html = "<iframe src=\"bar.html\" />"... | [
{
"answer_id": 469231,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 2,
"selected": false,
"text": "<p>Set the SRC of the Iframe instead of changing the innerHTML of its container:</p>\n\n<p>html:</p>\n\... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6400/"
] | I have the following HTML / JS:
```
<html>
<body>
<script>
function foo(){
var html = "<iframe src=\"foo.html\" />";
document.getElementById('content').innerHTML=html;
}
function bar(){
var html = "<iframe src=\"bar.html\" />";
document.getElementById('content')... | Have you tried changing the url in your generated iframe?
E.g.
```
var randomNum = Math.random();
var html = "<iframe src=\"bar.html?rand="+randomNum+"\" />";
```
Even better, combine that with geowa4's appendChild() suggestion. |
469,200 | <p>I'm new to the MDX/OLAP and I'm wondering if there is any ORM similar like Django ORM for Python that would support OLAP.</p>
<p>I'm a Python/Django developer and if there would be something that would have some level of integration with Django I would be much interested in learning more about it.</p>
| [
{
"answer_id": 471669,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 4,
"selected": true,
"text": "<p>Django has some OLAP features that are nearing release.</p>\n\n<p>Read <a href=\"http://www.eflorenzano.com/blog/post/sec... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27098/"
] | I'm new to the MDX/OLAP and I'm wondering if there is any ORM similar like Django ORM for Python that would support OLAP.
I'm a Python/Django developer and if there would be something that would have some level of integration with Django I would be much interested in learning more about it. | Django has some OLAP features that are nearing release.
Read <http://www.eflorenzano.com/blog/post/secrets-django-orm/>
<http://doughellmann.com/2007/12/30/using-raw-sql-in-django.html>, also
If you have a proper star schema design in the first place, then one-dimensional results can have the following form.
```
fr... |
469,202 | <p>I need to remove multiple items from a Dictionary.
A simple way to do that is as follows :</p>
<pre><code> List<string> keystoremove= new List<string>();
foreach (KeyValuePair<string,object> k in MyCollection)
if (k.Value.Member==foo)
keystoremove.Add(k.Key);
foreach (string s in ... | [
{
"answer_id": 469227,
"author": "Geoff",
"author_id": 55487,
"author_profile": "https://Stackoverflow.com/users/55487",
"pm_score": 0,
"selected": false,
"text": "<p>Can you just change your loop to use an index (i.e. FOR instead of FOREACH)? You'd have to loop backwards, of course, i.... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47341/"
] | I need to remove multiple items from a Dictionary.
A simple way to do that is as follows :
```
List<string> keystoremove= new List<string>();
foreach (KeyValuePair<string,object> k in MyCollection)
if (k.Value.Member==foo)
keystoremove.Add(k.Key);
foreach (string s in keystoremove)
MyCollect... | Here's an alternate way
```
foreach ( var s in MyCollection.Where(kv => kv.Value.Member == foo).ToList() ) {
MyCollection.Remove(s.Key);
}
```
Pushing the code into a list directly allows you to avoid the "removing while enumerating" problem. The `.ToList()` will force the enumeration before the foreach really sta... |
469,243 | <p>I'd like to write a Python script for Amarok in Linux to automatically copy the stackoverflow podcast to my player. When I plug in the player, it would mount the drive, copy any pending podcasts, and eject the player. How can I listen for the "plugged in" event? I have looked through hald but couldn't find a good ex... | [
{
"answer_id": 469433,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 3,
"selected": false,
"text": "<p>I haven't tried writing such a program myself, however I've just looked at the following two links (thanks Google!), whic... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36330/"
] | I'd like to write a Python script for Amarok in Linux to automatically copy the stackoverflow podcast to my player. When I plug in the player, it would mount the drive, copy any pending podcasts, and eject the player. How can I listen for the "plugged in" event? I have looked through hald but couldn't find a good examp... | **Update**: As said in comments, Hal is not supported in recent distributions, the standard now is udev, Here is a small example that makes use of glib loop and **udev**, I keep the Hal version for historical reasons.
This is basically the [example in the pyudev documentation](http://pyudev.readthedocs.org/en/latest/a... |
469,249 | <p>I have a JAR-archive with java classes. One of them uses some resource that is embedded into the same JAR. In order to load that resource I use </p>
<pre><code>MyClass.class.getResourceAsStream(myResourceName);
</code></pre>
<p>One thing that bothers me though is whether it is guaranteed that required resource wil... | [
{
"answer_id": 469271,
"author": "Dave Ray",
"author_id": 40310,
"author_profile": "https://Stackoverflow.com/users/40310",
"pm_score": 2,
"selected": false,
"text": "<p>Yes. The first matching resource found on the class path is returned, just like an executable search path. This is why... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a JAR-archive with java classes. One of them uses some resource that is embedded into the same JAR. In order to load that resource I use
```
MyClass.class.getResourceAsStream(myResourceName);
```
One thing that bothers me though is whether it is guaranteed that required resource will be loaded from within th... | Yes. The first matching resource found on the class path is returned, just like an executable search path. This is why resources are often "namespaced" by putting them in directories that mirror the package structure of the library or application.
This behavior may be slightly different in the presence of custom class... |
469,287 | <p>I've been programming in Java for a while and just got thrown onto a project that's written entirely in C#. I'm trying to come up to speed in C#, and noticed enums used in several places in my new project, but at first glance, C#'s enums seem to be more simplistic than the Java 1.5+ implementation. Can anyone enum... | [
{
"answer_id": 469315,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 9,
"selected": true,
"text": "<p>Enumerations in the CLR are simply named constants. The underlying type must be integral. In Java an enumeration is ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13140/"
] | I've been programming in Java for a while and just got thrown onto a project that's written entirely in C#. I'm trying to come up to speed in C#, and noticed enums used in several places in my new project, but at first glance, C#'s enums seem to be more simplistic than the Java 1.5+ implementation. Can anyone enumerate... | Enumerations in the CLR are simply named constants. The underlying type must be integral. In Java an enumeration is more like a named instance of a type. That type can be quite complex and - as your example shows - contain multiple fields of various types.
To port the example to C# I would just change the enum to an i... |
469,318 | <p>Is it possible to update more than one local variable in a single select?</p>
<p>Something like:</p>
<pre><code>set
@variableOne = avg(someColumn),
@variableTwo = avg(otherColumn)
from tblTable
</code></pre>
<p>It seems a bit wasteful to make two separate select operations for something as trivial as ... | [
{
"answer_id": 469328,
"author": "Frederik Gheysels",
"author_id": 55774,
"author_profile": "https://Stackoverflow.com/users/55774",
"pm_score": 8,
"selected": true,
"text": "<p>Something like this:</p>\n\n<pre><code>select @var1 = avg(someColumn), @var2 = avg(otherColumn) \nfrom theTabl... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56506/"
] | Is it possible to update more than one local variable in a single select?
Something like:
```
set
@variableOne = avg(someColumn),
@variableTwo = avg(otherColumn)
from tblTable
```
It seems a bit wasteful to make two separate select operations for something as trivial as this task:
```
set @variableOne ... | Something like this:
```
select @var1 = avg(someColumn), @var2 = avg(otherColumn)
from theTable
``` |
469,330 | <p>I'm trying to use the task in CruiseControl.NET version 1.3.0.2918 with a rather straight forward :</p>
<pre><code> <project name="AppBuilder 1.0 (Debug)">
<workingDirectory>c:\depot\AppBuilder\1.0\</workingDirectory>
<triggers/>
<tasks>
<msbuild/>
</ta... | [
{
"answer_id": 469352,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 2,
"selected": false,
"text": "<p>Why is your msbuild tag empty? It should be something similar to:</p>\n\n<pre><code><msbuild>\n <executa... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2459/"
] | I'm trying to use the task in CruiseControl.NET version 1.3.0.2918 with a rather straight forward :
```
<project name="AppBuilder 1.0 (Debug)">
<workingDirectory>c:\depot\AppBuilder\1.0\</workingDirectory>
<triggers/>
<tasks>
<msbuild/>
</tasks>
</project>
```
However, when the project is ... | I think maybe it is your space in the artifact directory path. MSBuild really does not like spaces as it considers it a break between arguments. Can you try an remove the space from that path and see what happens? |
469,338 | <p>Let's say I have two tables, news and comments.</p>
<pre><code>news (
id,
subject,
body,
posted
)
comments (
id,
parent, // points to news.id
message,
name,
posted
)
</code></pre>
<p>I would like to create one query that grabs the latest x # of news item along with the name and posted date for ... | [
{
"answer_id": 469392,
"author": "Welbog",
"author_id": 52443,
"author_profile": "https://Stackoverflow.com/users/52443",
"pm_score": 1,
"selected": false,
"text": "<p>If speed is that important, why not create a recent_comment table that contains the id and parent id of just the most re... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/497/"
] | Let's say I have two tables, news and comments.
```
news (
id,
subject,
body,
posted
)
comments (
id,
parent, // points to news.id
message,
name,
posted
)
```
I would like to create one query that grabs the latest x # of news item along with the name and posted date for the *latest* comment for e... | I just realized the query does not return results if there are no comments attached to the news table, here's the fix as well as an added column for the total # of posts:
```
SELECT news.*, comments.name, comments.posted, (SELECT count(id) FROM comments WHERE comments.parent = news.id) AS numComments
FROM news
LEFT JO... |
469,347 | <p>Is there an equivalent to <code>Thread.Sleep()</code> in Access VBA?</p>
| [
{
"answer_id": 469358,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 7,
"selected": true,
"text": "<pre><code>Declare Sub Sleep Lib \"kernel32\" Alias \"Sleep\" _\n(ByVal dwMilliseconds As Long)\n</code></pre>\n\n<p>U... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469347",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1116/"
] | Is there an equivalent to `Thread.Sleep()` in Access VBA? | ```
Declare Sub Sleep Lib "kernel32" Alias "Sleep" _
(ByVal dwMilliseconds As Long)
```
Use the following syntax to call the Sleep function:
```
Sub Sleep()
Sleep 1000 'Implements a 1 second delay
End Sub
``` |
469,350 | <p>I'm using the <a href="http://www.google.co.uk/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fms647464(VS.85).aspx&ei=V4N4SbfNGNzFjAfoq4mzAQ&usg=AFQjCNGKeUAmRnuBiua6Y8uBzbkBFRGQxg&sig2=yInI3Sqsq-PRMuIMPmfGSA" rel="nofollow noreferrer">VerQueryValue... | [
{
"answer_id": 469611,
"author": "J__",
"author_id": 20315,
"author_profile": "https://Stackoverflow.com/users/20315",
"pm_score": 1,
"selected": false,
"text": "<p>Is the lpSubBlock parameter (the 2nd parameter) of VerQueryValue set to the correct value for the locale you're in? For <em... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] | I'm using the [VerQueryValue](http://www.google.co.uk/url?sa=t&source=web&ct=res&cd=1&url=http%3A%2F%2Fmsdn.microsoft.com%2Fen-us%2Flibrary%2Fms647464(VS.85).aspx&ei=V4N4SbfNGNzFjAfoq4mzAQ&usg=AFQjCNGKeUAmRnuBiua6Y8uBzbkBFRGQxg&sig2=yInI3Sqsq-PRMuIMPmfGSA) to retrieve strings from a DLL's VersionInfo.
All works fine, ... | Is the lpSubBlock parameter (the 2nd parameter) of VerQueryValue set to the correct value for the locale you're in? For *English - United Kingdom* this would be:
```
StringFileInfo\080904E4\FileVersion
```
[This page](http://techsupt.winbatch.com/TS/T000001050F49.html) has some more language/character-set identifier... |
469,357 | <p>Is there a quick way to set an HTML text input (<code><input type=text /></code>) to only allow numeric keystrokes (plus '.')?</p>
| [
{
"answer_id": 469362,
"author": "Ian G",
"author_id": 31765,
"author_profile": "https://Stackoverflow.com/users/31765",
"pm_score": 11,
"selected": true,
"text": "<h2>JavaScript</h2>\n<p>You can filter the input values of a text <code><input></code> with the following <code>setInp... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469357",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13370/"
] | Is there a quick way to set an HTML text input (`<input type=text />`) to only allow numeric keystrokes (plus '.')? | JavaScript
----------
You can filter the input values of a text `<input>` with the following `setInputFilter` function (supports Copy+Paste, Drag+Drop, keyboard shortcuts, context menu operations, non-typeable keys, the caret position, different keyboard layouts, validity error message, and [all browsers since IE 9](h... |
469,381 | <p>The DBA here at work is trying to turn my straightforward stored procs into a dynamic sql monstrosity. Admittedly, my stored procedure might not be as fast as they'd like, but I can't help but believe there's an adequate way to do what is basically a conditional join.</p>
<p>Here's an example of my stored proc:</p>... | [
{
"answer_id": 469403,
"author": "Russ Cam",
"author_id": 1831,
"author_profile": "https://Stackoverflow.com/users/1831",
"pm_score": 2,
"selected": false,
"text": "<p>You could INNER JOIN on the table returned from the UDF instead of using it in an IN clause</p>\n\n<p>Your UDF might be ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28926/"
] | The DBA here at work is trying to turn my straightforward stored procs into a dynamic sql monstrosity. Admittedly, my stored procedure might not be as fast as they'd like, but I can't help but believe there's an adequate way to do what is basically a conditional join.
Here's an example of my stored proc:
```
SELECT
... | You could INNER JOIN on the table returned from the UDF instead of using it in an IN clause
Your UDF might be something like
```
CREATE FUNCTION [dbo].[csl_to_table] (@list varchar(8000) )
RETURNS @list_table TABLE ([id] INT)
AS
BEGIN
DECLARE @index INT,
@start_index INT,
@id INT
... |
469,384 | <p>I have a VS2008 ASP.NET Web Service Application running on the local IIS of my XP machine. A separate project in the same solution uses test methods to invoke the WS calls, and run their processes.</p>
<p>When I added a web reference to the WS App, VS2008 created a Settings.settings file in the Properties folder to... | [
{
"answer_id": 469413,
"author": "Mahesh",
"author_id": 37571,
"author_profile": "https://Stackoverflow.com/users/37571",
"pm_score": 0,
"selected": false,
"text": "<p>There is no \"AppSettings\" section in your Web.config</p>\n"
},
{
"answer_id": 469435,
"author": "Drake",
... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469384",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a VS2008 ASP.NET Web Service Application running on the local IIS of my XP machine. A separate project in the same solution uses test methods to invoke the WS calls, and run their processes.
When I added a web reference to the WS App, VS2008 created a Settings.settings file in the Properties folder to store the... | When you add a \*.Settings file in a VS project its content doesn't go to the app.config file.
VS automatically create a class (in your case it is called **Settings**) that inherits from **ApplicationSettingsBase** and is automatically embedded in your dll/exe during build.
In order to get the settings stored you can... |
469,386 | <p>A basic dummy class:</p>
<pre><code>class foo
{
var $bar = 0;
function foo() {}
function boo() {}
}
echo memory_get_usage();
echo "\n";
$foo = new foo();
echo memory_get_usage();
echo "\n";
unset($foo);
echo memory_get_usage();
echo "\n";
$foo = null;
echo memory_get_usage();
echo "\n";
</code></pre>
... | [
{
"answer_id": 469413,
"author": "Mahesh",
"author_id": 37571,
"author_profile": "https://Stackoverflow.com/users/37571",
"pm_score": 0,
"selected": false,
"text": "<p>There is no \"AppSettings\" section in your Web.config</p>\n"
},
{
"answer_id": 469435,
"author": "Drake",
... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | A basic dummy class:
```
class foo
{
var $bar = 0;
function foo() {}
function boo() {}
}
echo memory_get_usage();
echo "\n";
$foo = new foo();
echo memory_get_usage();
echo "\n";
unset($foo);
echo memory_get_usage();
echo "\n";
$foo = null;
echo memory_get_usage();
echo "\n";
```
Outputs:
```
$ php tes... | When you add a \*.Settings file in a VS project its content doesn't go to the app.config file.
VS automatically create a class (in your case it is called **Settings**) that inherits from **ApplicationSettingsBase** and is automatically embedded in your dll/exe during build.
In order to get the settings stored you can... |
469,397 | <p>I'm trying to install windows service using the Microsoft.Sdc.Tasks library. </p>
<pre><code><ControlService Action="Install"
ServiceName="Service1"
User="XXX
Password="XXX"
ServiceExePath="$(DeployFolder)\XXX.exe"/>
</code></pre>
<p><strong><em>But I keep getting prompted for the user and pa... | [
{
"answer_id": 469661,
"author": "Riri",
"author_id": 298,
"author_profile": "https://Stackoverflow.com/users/298",
"pm_score": 3,
"selected": true,
"text": "<p>Found <a href=\"http://blogs.msdn.com/jmanning/archive/2008/04/06/localsystem-root-localservice-nobody.aspx\" rel=\"nofollow no... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/298/"
] | I'm trying to install windows service using the Microsoft.Sdc.Tasks library.
```
<ControlService Action="Install"
ServiceName="Service1"
User="XXX
Password="XXX"
ServiceExePath="$(DeployFolder)\XXX.exe"/>
```
***But I keep getting prompted for the user and password!*** This will not work as I'd like... | Found [this post](http://blogs.msdn.com/jmanning/archive/2008/04/06/localsystem-root-localservice-nobody.aspx) and since all my service does is writing and reading from local file I should be OK running under the Local Service account instead of a specific user. Even after updated the service installer the *ControlServ... |
469,401 | <p>I've stumbled across <a href="http://blog.getpaint.net/2008/12/06/a-fluent-approach-to-c-parameter-validation/" rel="nofollow noreferrer">this great post</a> about validating parameters in C#, and now I wonder how to implement something similar in C++. The main thing I like about this stuff is that is does not cost ... | [
{
"answer_id": 469429,
"author": "Toji",
"author_id": 25968,
"author_profile": "https://Stackoverflow.com/users/25968",
"pm_score": 0,
"selected": false,
"text": "<p>Can't say much to the rest of the question, but I did want to point out this:</p>\n\n<blockquote>\n <p>Though I'd guess t... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39912/"
] | I've stumbled across [this great post](http://blog.getpaint.net/2008/12/06/a-fluent-approach-to-c-parameter-validation/) about validating parameters in C#, and now I wonder how to implement something similar in C++. The main thing I like about this stuff is that is does not cost anything until the first validation fail... | Other than the fact that C++ does not have extension methods (which prevents being able to add in new validations as easily) it should be too hard.
```
class Validation
{
vector<string> *errors;
void AddError(const string &error)
{
if (errors == NULL) errors = new vector<string>();
errors->pu... |
469,402 | <p>im trying to return a string value from a method inside my script tag however it always returns an object and i cant get at the string value.</p>
<p>Here is the code:</p>
<p>i retrieve the object returned from a webservice call;;</p>
<pre><code> private function getNameResults(e:ResultEvent):String{
var n... | [
{
"answer_id": 469422,
"author": "Herms",
"author_id": 1409,
"author_profile": "https://Stackoverflow.com/users/1409",
"pm_score": 1,
"selected": false,
"text": "<p>Your getInfo() method isn't calling getNameResults(). It's calling getRoomZoneInfo(). I don't know what that method does,... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24481/"
] | im trying to return a string value from a method inside my script tag however it always returns an object and i cant get at the string value.
Here is the code:
i retrieve the object returned from a webservice call;;
```
private function getNameResults(e:ResultEvent):String{
var name:Array = new Array(e.resu... | You are setting the result of `getRoomZoneInfo()` to the variable site, but you are casting it as a String. `getRoomZoneInfo` is returning an object, and because the variable you are sticking it in is a string it is like calling `.toString()` on the object, which yields the [object `AsyncToken`].
Basically if `getRoo... |
469,417 | <p>I was wondering what is the best way to parse a DateTime object to your SQL server. </p>
<p>Where you are generating the SQL in code. </p>
<p>I have always used something like <code>DateTime.Now.TolongDateString()</code> and had good results, apart from today where i got a error, and it made me think. </p>
<pre><... | [
{
"answer_id": 469427,
"author": "mqp",
"author_id": 55943,
"author_profile": "https://Stackoverflow.com/users/55943",
"pm_score": 1,
"selected": false,
"text": "<p>Formatting using DateTime.ToString(\"yyyy-MM-dd HH:mm:ss:fff\") will match the MS SQL Server date/time format. (I believe ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469417",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27922/"
] | I was wondering what is the best way to parse a DateTime object to your SQL server.
Where you are generating the SQL in code.
I have always used something like `DateTime.Now.TolongDateString()` and had good results, apart from today where i got a error, and it made me think.
```
System.Data.SqlClient.SqlException... | there are only 2 safe formats
ISO and ISO8601
ISO = yymmdd
ISO8601 = yyyy-mm-dd Thh:mm:ss:mmm(no spaces) (notice the T)
See also here: [Setting a standard DateFormat for SQL Server](http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/setting-a-standard-dateformat-for-sql-se) |
469,418 | <p>Given <code>$displayHeight = "800";</code>, replace whatever number is at <code>800</code> with int value <code>y_res</code>.</p>
<pre><code>resultString = Regex.Replace(
im_cfg_contents,
@"\$displayHeight[\s]*=[\s]*""(.*)"";",
Convert.ToString(y_res));
</code></pre>
<p>In Python I'd use re.sub and i... | [
{
"answer_id": 469523,
"author": "Martin Brown",
"author_id": 20553,
"author_profile": "https://Stackoverflow.com/users/20553",
"pm_score": 0,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>resultString = Regex.Replace(\n im_cfg_contents,\n @\"\\$displayHeight[\\s]*=[\\... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469418",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20003/"
] | Given `$displayHeight = "800";`, replace whatever number is at `800` with int value `y_res`.
```
resultString = Regex.Replace(
im_cfg_contents,
@"\$displayHeight[\s]*=[\s]*""(.*)"";",
Convert.ToString(y_res));
```
In Python I'd use re.sub and it would work. In .NET it replaces the whole line, not the m... | Building on a couple of the answers already posted. The Zero-width assertion allows you to do a regular expression match without placing those characters in the match. By placing the first part of the string in a group we've separated it from the digits that you want to be replaced. Then by using a zero-width lookbehin... |
469,459 | <p>Does anyone know if the SqlDataAdapter.Dispose method actually closes or disposes any SqlConnections? I loaded up Reflector and I see that SqlDataAdapter inherits from DbDataAdapter. If I disassemble and look at the dispose method in that class, there appears to be no disposal of any SqlConnections. I suppose I c... | [
{
"answer_id": 469487,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 0,
"selected": false,
"text": "<p>Nope, it doesn't dispose the connection. I believe it shouldn't. You might want to use it elsewhere.</p>\n"
},
{
"a... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2657/"
] | Does anyone know if the SqlDataAdapter.Dispose method actually closes or disposes any SqlConnections? I loaded up Reflector and I see that SqlDataAdapter inherits from DbDataAdapter. If I disassemble and look at the dispose method in that class, there appears to be no disposal of any SqlConnections. I suppose I could w... | The first thing to be aware of is the DataAdapter does manage and close your connection in some circumstances. For example, if you're using a DataAdapter you're probably operating on DataTable/DataSet using `.Fill()` and `.Update()` functions.
From the [`.Fill()` docs](https://learn.microsoft.com/en-us/dotnet/api/syst... |
469,471 | <p>I have a table in PostgreSQL where the schema looks like this:</p>
<pre><code>CREATE TABLE "foo_table" (
"id" serial NOT NULL PRIMARY KEY,
"permalink" varchar(200) NOT NULL,
"text" varchar(512) NOT NULL,
"timestamp" timestamp with time zone NOT NULL
)... | [
{
"answer_id": 469553,
"author": "Baishampayan Ghose",
"author_id": 8024,
"author_profile": "https://Stackoverflow.com/users/8024",
"pm_score": 10,
"selected": true,
"text": "<p>I figured it out from the PostgreSQL docs, the exact syntax is:</p>\n\n<pre><code>ALTER TABLE the_table ADD CO... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8024/"
] | I have a table in PostgreSQL where the schema looks like this:
```
CREATE TABLE "foo_table" (
"id" serial NOT NULL PRIMARY KEY,
"permalink" varchar(200) NOT NULL,
"text" varchar(512) NOT NULL,
"timestamp" timestamp with time zone NOT NULL
)
```
Now I want to make the permalink unique across the table... | I figured it out from the PostgreSQL docs, the exact syntax is:
```
ALTER TABLE the_table ADD CONSTRAINT constraint_name UNIQUE (thecolumn);
```
Thanks [Fred](https://stackoverflow.com/users/55774/frederik-gheysels). |
469,477 | <p>Given a sorted vector with a number of values, as in the following example:</p>
<pre><code>std::vector<double> f;
f.pushback(10);
f.pushback(100);
f.pushback(1000);
f.pushback(10000);
</code></pre>
<p>I'm looking for the most elegant way to retrieve for any double d the two values that are immediately adjace... | [
{
"answer_id": 469503,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 0,
"selected": false,
"text": "<p>You could do a search in your vector for your value (which would tell you where your value would be if it were in the vect... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/455874/"
] | Given a sorted vector with a number of values, as in the following example:
```
std::vector<double> f;
f.pushback(10);
f.pushback(100);
f.pushback(1000);
f.pushback(10000);
```
I'm looking for the most elegant way to retrieve for any double d the two values that are immediately adjacent to it. For example, given the... | I'm going to post my own anser, and vote anyone up that helped me to reach it, since this is what I'll use in the end, and you've all helped me reach this conclusion. Comments are welcome.
```
std::pair<value_type, value_type> GetDivisions(const value_type& from) const
{
if (m_divisions.empty())
throw 0; /... |
469,494 | <p>I have the service name for a windows service in delphi, and I know how to get the handle from that as well. What I need to do is stop a service, and if the stop fails for some reason I need to kill the process associated with the service. The problem is that I have multiple services running from the same executab... | [
{
"answer_id": 469584,
"author": "Jk.",
"author_id": 50149,
"author_profile": "https://Stackoverflow.com/users/50149",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/ms684941(VS.85).aspx\" rel=\"nofollow noreferrer\"><code>QueryServiceStat... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469494",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16059/"
] | I have the service name for a windows service in delphi, and I know how to get the handle from that as well. What I need to do is stop a service, and if the stop fails for some reason I need to kill the process associated with the service. The problem is that I have multiple services running from the same executable, s... | Please note I have only accepted this solution so that a full delphi code solution is accepted, all due thanks to Jk though for pointing me on the correct path.
--
Ok, I've been able to figure out how to use the answer by Jk and have come up with this solution in delphi.
For reference, this is the link provided by J... |
469,495 | <p>(Let me give you some context)
I am currently designing an application that is supposed to generate a printable A4 page based on some data.
Naturally, the device independent pixels of WPF (96 pixels/inch) are not a very natural unit of measurement in the paper world. Something like millimetres would be more appropri... | [
{
"answer_id": 1142690,
"author": "CannibalSmith",
"author_id": 113748,
"author_profile": "https://Stackoverflow.com/users/113748",
"pm_score": 0,
"selected": false,
"text": "<p>Just <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.documents.textelement.fontsize.aspx\" re... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55208/"
] | (Let me give you some context)
I am currently designing an application that is supposed to generate a printable A4 page based on some data.
Naturally, the device independent pixels of WPF (96 pixels/inch) are not a very natural unit of measurement in the paper world. Something like millimetres would be more appropriate... | For the outlined requirements you do not need to do anything special at all, just go ahead and use centimeters as unit of measurement for the WPF elements themselves (i.e. without any transform) - the very nature of WPF device independence allows you to to the following:
```
<Window x:Class="WpfApplication1.Window1"
... |
469,506 | <p>Here is the current state of my table:</p>
<pre><code>mysql> select * from page;
+----+----------+----------------+------+---------+
| id | title | body | page | visible |
+----+----------+----------------+------+---------+
| 1 | my title | my body | NULL | 1 |
| 2 | my title | my bo... | [
{
"answer_id": 469545,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 0,
"selected": false,
"text": "<p>You could do it with two statements. </p>\n\n<pre><code>Delete from page where id = 2\ninsert into page (id, title, body,... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Here is the current state of my table:
```
mysql> select * from page;
+----+----------+----------------+------+---------+
| id | title | body | page | visible |
+----+----------+----------------+------+---------+
| 1 | my title | my body | NULL | 1 |
| 2 | my title | my body edited | 1 ... | >
> insert into page (id, title, body, page, visible) Select 2, title, body, page, visible
>
>
>
Can be done (in MySQL only) without the DELETE by using an ON DUPLICATE KEY UPDATE:
```
INSERT
INTO page (id, title, body, page, visible)
SELECT 1, title, body, page, visible FROM page WHERE id=2
ON DUPLIC... |
469,508 | <p>The following code generates warning C4250. My question is, what's the best solution to it?</p>
<pre><code>class A
{
virtual void func1();
}
class B : public A
{
}
class C : public A
{
virtual void func1();
}
class D : public B, public C
{
}
int main()
{
D d;
d.func1(); // Causes warning
}
</code></pre>... | [
{
"answer_id": 469632,
"author": "Gal Goldman",
"author_id": 46418,
"author_profile": "https://Stackoverflow.com/users/46418",
"pm_score": 3,
"selected": false,
"text": "<p>Did you try to inherit public virtual from class A? I think it should solve it.</p>\n\n<pre><code>\n class B :pu... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469508",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/986/"
] | The following code generates warning C4250. My question is, what's the best solution to it?
```
class A
{
virtual void func1();
}
class B : public A
{
}
class C : public A
{
virtual void func1();
}
class D : public B, public C
{
}
int main()
{
D d;
d.func1(); // Causes warning
}
```
According to what I'v... | I had the same warning for the following code:
```
class Interface
{
public:
virtual void A() = 0;
};
class Implementation : public virtual Interface
{
public:
virtual void A() {};
};
class ExtendedInterface : public virtual Interface
{
virtual void B() = 0;
};
class ExtendedImplementation : public Exte... |
469,515 | <p>I have a file that contains a mish-mash of cities, states, and zip codes. Example:</p>
<blockquote>
<p>Munson 11010 Shelter Island Heights. . . .. 11965
Brentwood 11717 Halesite 11743 </p>
</blockquote>
<p>I need to grab all of the zip codes out of that text. They are only 5 digit (no 5+4), and there are no ... | [
{
"answer_id": 469534,
"author": "Serafina Brocious",
"author_id": 4977,
"author_profile": "https://Stackoverflow.com/users/4977",
"pm_score": 2,
"selected": false,
"text": "<pre><code>preg_match_all('[^0-9]([0-9]{5})[^0-9]', $input, $out);\nforeach($out as $val)\n echo $val[1] . \"\\... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a file that contains a mish-mash of cities, states, and zip codes. Example:
>
> Munson 11010 Shelter Island Heights. . . .. 11965
> Brentwood 11717 Halesite 11743
>
>
>
I need to grab all of the zip codes out of that text. They are only 5 digit (no 5+4), and there are no other numbers besides the zips. ... | The following code should send you in the right direction:
```
<?php
$str = 'Munson 11010 Shelter Island Heights. . . .. 11965 Brentwood 11717 Halesite 11743 ';
preg_match_all("/\d{5}/", $str, $matches);
print_r($matches);
?>
``` |
469,516 | <p>In a pretty typical scenario, I have a 'Search' text box on my web application which has user input passed directly to a stored procedure which then uses full text indexing to search on two fields in two tables, which are joined using appropriate keys.</p>
<p>I am using the CONTAINS predicate to search the fields. ... | [
{
"answer_id": 488619,
"author": "galuvian",
"author_id": 39755,
"author_profile": "https://Stackoverflow.com/users/39755",
"pm_score": 4,
"selected": true,
"text": "<p>Noise words are stripped out before the indexing is stored. So it is impossible to write a query that searches on a st... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36591/"
] | In a pretty typical scenario, I have a 'Search' text box on my web application which has user input passed directly to a stored procedure which then uses full text indexing to search on two fields in two tables, which are joined using appropriate keys.
I am using the CONTAINS predicate to search the fields. Before pas... | Noise words are stripped out before the indexing is stored. So it is impossible to write a query that searches on a stop word. If you REALLY want to enable this behavior, you need to edit the list of stop words. (<http://msdn.microsoft.com/en-us/library/ms142551.aspx>) and then re-build your index. |
469,542 | <p>I'm debugging my code on x86 and the problem tracks down to AND instruction
sometimes does not clear ZF flag if the result is not zero.
Here is the problematic piece of code:</p>
<pre>
0257A9F9 mov edx,dword ptr [ecx+18h]
0257A9FC and edx,80000h
0257AA02 int 3
0257AA03 je ... | [
{
"answer_id": 469559,
"author": "Serafina Brocious",
"author_id": 4977,
"author_profile": "https://Stackoverflow.com/users/4977",
"pm_score": 1,
"selected": false,
"text": "<p>According to the Intel instruction set reference, ZF is always set according to the result. Could something in... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57933/"
] | I'm debugging my code on x86 and the problem tracks down to AND instruction
sometimes does not clear ZF flag if the result is not zero.
Here is the problematic piece of code:
```
0257A9F9 mov edx,dword ptr [ecx+18h]
0257A9FC and edx,80000h
0257AA02 int 3
0257AA03 je 0257AA2... | You can easily examine the int 3 handler to see if it's returning with a `iret` (i.e. pop back the callers flags) or if it's returning with `retf 2` (i.e. preserve the flags from the handler). |
469,548 | <p>I'm developing a Desktop Search Engine in VB.NET
I'm using a ComboBox to specify the search query (string).
I want the ComboBox to remember and display recent queries.
I also want the ComboBox to try and Autocomplete the queries as the user is typing.</p>
<p>What is the best way to implement this?</p>
| [
{
"answer_id": 469755,
"author": "Geoff",
"author_id": 55487,
"author_profile": "https://Stackoverflow.com/users/55487",
"pm_score": 1,
"selected": false,
"text": "<p>This can no doubt be done more elegantly, but here's the basic principles (apologies for any syntax issues, I'm not much ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57175/"
] | I'm developing a Desktop Search Engine in VB.NET
I'm using a ComboBox to specify the search query (string).
I want the ComboBox to remember and display recent queries.
I also want the ComboBox to try and Autocomplete the queries as the user is typing.
What is the best way to implement this? | This can no doubt be done more elegantly, but here's the basic principles (apologies for any syntax issues, I'm not much of a VB guy):
In the KeyUp event:
1. Make sure the key in't a navigation key:
```
if e.KeyCode <> Keys.Back [...]
```
2. Search the items list for the text typed:
```
idx = myCombo.FindString(... |
469,564 | <p>I've looked at <a href="https://stackoverflow.com/questions/158968/changing-vim-indentation-behavior-by-file-type">this</a> but it wasn't too much help. Maybe I didn't read it too well.</p>
<p>Basically what I want is when I open a .txt file the settings:</p>
<pre><code>set wrap
set linebreak
</code></pre>
<p>ar... | [
{
"answer_id": 469576,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 6,
"selected": true,
"text": "<p>My answer to that question still applies:</p>\n\n<p>Put autocmd commands based on the file suffix in your ~/.vimrc</p... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469564",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41718/"
] | I've looked at [this](https://stackoverflow.com/questions/158968/changing-vim-indentation-behavior-by-file-type) but it wasn't too much help. Maybe I didn't read it too well.
Basically what I want is when I open a .txt file the settings:
```
set wrap
set linebreak
```
are turned on. How might I go about doing that?... | My answer to that question still applies:
Put autocmd commands based on the file suffix in your ~/.vimrc
```
autocmd BufRead,BufNewFile *.txt set wrap linebreak
```
As Luc says, you might prefer to
```
autocmd BufRead,BufNewFile *.txt setlocal wrap linebreak
```
if you're likely to open txt and non-txt file... |
469,588 | <p>I'm coding some c# against Active Directory and have tried endlessly to get this to work to no avail. The following code works and the code that follows it does not:</p>
<p>The code below is using "WinNT://" + Environment.MachineName + ",Computer" to make the connection and works fine.</p>
<pre><code> DirectoryE... | [
{
"answer_id": 469610,
"author": "Glennular",
"author_id": 14753,
"author_profile": "https://Stackoverflow.com/users/14753",
"pm_score": 0,
"selected": false,
"text": "<p>You need to pass it an authorized Username and password.<br>\ntry setting: DirectoryEntry.Username and DirectoryEntry... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12318/"
] | I'm coding some c# against Active Directory and have tried endlessly to get this to work to no avail. The following code works and the code that follows it does not:
The code below is using "WinNT://" + Environment.MachineName + ",Computer" to make the connection and works fine.
```
DirectoryEntry localMachine = n... | When connecting to AD using the .NET Framework, you can use "serverless" binding or you can specify a server to use everytime (server bound).
Here's an example of using both:
```
// serverless
DirectoryEntry rootConfig = new DirectoryEntry("LDAP://dc=domainname,dc=com");
// server bound
DirectoryEntry rootEntry = ne... |
469,594 | <p>I need to take an <strong>existing winforms application</strong> and drop into an <strong>event tracing mode</strong>, with hopefully as little friction as possible.</p>
<p>I would like to see every action the user takes as a simple stack trace-looking thing:</p>
<pre><code>MainForm.LaunchThing_Click
ThingWindow.N... | [
{
"answer_id": 469761,
"author": "Robert Venables",
"author_id": 39315,
"author_profile": "https://Stackoverflow.com/users/39315",
"pm_score": 0,
"selected": false,
"text": "<p>How many different control types do you have? If you only have a handful of control types that you are looking ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27614/"
] | I need to take an **existing winforms application** and drop into an **event tracing mode**, with hopefully as little friction as possible.
I would like to see every action the user takes as a simple stack trace-looking thing:
```
MainForm.LaunchThing_Click
ThingWindow.NameInput_Focus
ThingWindow.NameInput_TextChange... | How about an observer pattern? Create an EventLogger class with a bunch of overloaded Log methods (one for each event method signature) that do the logging. Instantiate it on application start and subscribe it to each of the UI events.
It should even be possible to do the subscribing automatically with reflection - th... |
469,629 | <p>I have a rather frustrating problem where the maximum number of available DatePicker's on one page seems to be twenty. I can't find any documentation referring to this.</p>
<p>If I had a page with 100 text boxes, and did the following:</p>
<pre><code>$(document).ready(function() {
$(".datepicker").datepicker(... | [
{
"answer_id": 469705,
"author": "Wookai",
"author_id": 56761,
"author_profile": "https://Stackoverflow.com/users/56761",
"pm_score": 2,
"selected": true,
"text": "<p>I tested the following code under Firefox 3 on Ubuntu, and all of the text boxes had a DatePicker associated with it. IMH... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39693/"
] | I have a rather frustrating problem where the maximum number of available DatePicker's on one page seems to be twenty. I can't find any documentation referring to this.
If I had a page with 100 text boxes, and did the following:
```
$(document).ready(function() {
$(".datepicker").datepicker({ duration: '', dateFo... | I tested the following code under Firefox 3 on Ubuntu, and all of the text boxes had a DatePicker associated with it. IMHO there shouldn't be any limit. Could you test my code on your setup and see if it works ?
```
<html>
<head>
<script type='text/javascript' src='jquery.js'></script>
<script type='text/javascript' s... |
469,640 | <p>I have this unordered list</p>
<pre><code><ul>
<li>two</li>
<li>three</li>
</ul>
</code></pre>
<p>Is there a way I can prepend to the unordered list so that it ends up like this?</p>
<pre><code><ul>
<li>ONE</li>
<li>two</li>
<li&g... | [
{
"answer_id": 469650,
"author": "dasony",
"author_id": 56995,
"author_profile": "https://Stackoverflow.com/users/56995",
"pm_score": 9,
"selected": true,
"text": "<pre><code>$(\"ul\").prepend(\"<li>ONE</li>\");\n</code></pre>\n"
},
{
"answer_id": 469652,
"author"... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have this unordered list
```
<ul>
<li>two</li>
<li>three</li>
</ul>
```
Is there a way I can prepend to the unordered list so that it ends up like this?
```
<ul>
<li>ONE</li>
<li>two</li>
<li>three</li>
</ul>
```
Notice the "ONE" is added to the FRONT/TOP of the list. | ```
$("ul").prepend("<li>ONE</li>");
``` |
469,657 | <p>Just wondering if anyone knew off the top of their heads if there was much difference in doing the following:</p>
<pre><code>String wibble = "<blah> blah blah </blah>.... <wibble> blah wibble blah </wibble> some more test here";
int i = wibble.lastIndexOf(">");
int j = wibble.lastIndexOf... | [
{
"answer_id": 469671,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 2,
"selected": false,
"text": "<p>Performance-wise, there might be a slight difference. For searching a single character, it's faster or equal to use <code>c... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] | Just wondering if anyone knew off the top of their heads if there was much difference in doing the following:
```
String wibble = "<blah> blah blah </blah>.... <wibble> blah wibble blah </wibble> some more test here";
int i = wibble.lastIndexOf(">");
int j = wibble.lastIndexOf('>');
``` | Opinions are great but data are better. I wrote a quick benchmark:
Test Code
---------
```
public static void main(String[] args)
{
System.out.println("Starting perfo test");
final long NUM_TESTS = 100000000L;
String wibble = "<blah> blah blah </blah>.... <wibble>"
+ " blah wibble blah </wibbl... |
469,707 | <p>I need to get 2 summed figures however im having issues as one will be for total orders and one is for orders incomplete. These use the same initial query however the orders incomplete has an additional where clause. Can these be put into a query so that i just get the 2 columns. I have done inner queries before but... | [
{
"answer_id": 469745,
"author": "Matt Rogish",
"author_id": 2590,
"author_profile": "https://Stackoverflow.com/users/2590",
"pm_score": 2,
"selected": true,
"text": "<pre><code>SELECT Count(TBL_PROPERTY.PROPREF) AS TotalOrders\n , SUM( CASE WHEN TBL_REPAIR_ORDER.STATUS <> 'C... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to get 2 summed figures however im having issues as one will be for total orders and one is for orders incomplete. These use the same initial query however the orders incomplete has an additional where clause. Can these be put into a query so that i just get the 2 columns. I have done inner queries before but i ... | ```
SELECT Count(TBL_PROPERTY.PROPREF) AS TotalOrders
, SUM( CASE WHEN TBL_REPAIR_ORDER.STATUS <> 'Completed' THEN 1 ELSE 0 END ) AS TotalNotCompleted
```
Remove the TBL\_REPAIR\_ORDER.STATUS <> 'Completed' from the WHERE clause, too. |
469,732 | <p>I am wondering if there is a way for me to list all 'files' containted in a tfs team project. What I am aiming to do is search for files of a particular name that dont have fixed paths within TFS caused by branching ($/MyTeamProject/Main/Build/instruction.xml and $/MyTeamProject/Branches/Release_1.0). Once a file wo... | [
{
"answer_id": 474399,
"author": "vengafoo",
"author_id": 12834,
"author_profile": "https://Stackoverflow.com/users/12834",
"pm_score": 3,
"selected": false,
"text": "<p>Here is how I've figured out how to list all the files of a TFS Project:</p>\n\n<p>Add Microsoft.TeamFoundation.Client... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] | I am wondering if there is a way for me to list all 'files' containted in a tfs team project. What I am aiming to do is search for files of a particular name that dont have fixed paths within TFS caused by branching ($/MyTeamProject/Main/Build/instruction.xml and $/MyTeamProject/Branches/Release\_1.0). Once a file woul... | This is not a different answer, but simply an upgrade of Vengafoo's code. The TeamFoundationServer class is obsolete in 2011 (not sure when this happened, I just know it is obsolete as of now). Vengafoo's code is from 2009, so that makes sense. Use the TfsTeamProjectCollection class with the TfsTeamProjectCollectionFac... |
469,735 | <p>I have two projects using legacy databases with no associations between the tables. In one, if I create associations in the DBML file, I can reference the associations in LINQ like this:</p>
<pre><code>From c In context.Cities Where c.city_name = "Portland" _
Select c.State.state_name
</code></pre>
<p>(assuming I ... | [
{
"answer_id": 520106,
"author": "Neil Barnwell",
"author_id": 26414,
"author_profile": "https://Stackoverflow.com/users/26414",
"pm_score": 3,
"selected": false,
"text": "<p>Check your <a href=\"http://msdn.microsoft.com/en-us/library/33df3b7a(VS.80).aspx\" rel=\"noreferrer\">Error List... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469735",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23935/"
] | I have two projects using legacy databases with no associations between the tables. In one, if I create associations in the DBML file, I can reference the associations in LINQ like this:
```
From c In context.Cities Where c.city_name = "Portland" _
Select c.State.state_name
```
(assuming I added the link from `City.... | It looks like my problem was my tables didn't have primary keys in the second project. Like I stated, these are legacy tables, so I had to do the linking and primary key stuff in the Database Context instead of the database itself, and I just forgot to specify the primary keys the second time around. Frustrating when y... |
469,742 | <p>I'm wondering what is the magic behind .settings files in .NET.
Imagine you create an assembly called in this example <code>SettingsHolder</code>, you create your settings class which is public with a string inside in user mode , then you compile.</p>
<p>Now you reference your assembly in MyApp, you compile then yo... | [
{
"answer_id": 469747,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": -1,
"selected": false,
"text": "<p>The settings file is contained inside the compiled assembly.</p>\n<h3>Edit:</h3>\n<p>Just to clarify a bit. The c... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19803/"
] | I'm wondering what is the magic behind .settings files in .NET.
Imagine you create an assembly called in this example `SettingsHolder`, you create your settings class which is public with a string inside in user mode , then you compile.
Now you reference your assembly in MyApp, you compile then you can change the valu... | The setting files are stored in a different place for each user. To find them, click the start menu, click run, and paste:
```
%USERPROFILE%\Local Settings\Application Data\
```
and press enter. There will be a folder with your "Company Name" (whatever it is set to in your assembly) and then some more subfolders. Th... |
469,764 | <p>I am trying to capture the contents of a UIWebView including that which is not visible to the user. i.e. The whole web page even though the user is only looking at the top.</p>
<p>Looking around I found the best way to capture a UIView is to retrieve its layer and use renderInContext.</p>
<p>However, UIWebView see... | [
{
"answer_id": 471202,
"author": "Brad Larson",
"author_id": 19679,
"author_profile": "https://Stackoverflow.com/users/19679",
"pm_score": 1,
"selected": false,
"text": "<p>It looks to me like UIWebView renders on demand (witness the checkerboard as you scroll downwards rapidly on a larg... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57948/"
] | I am trying to capture the contents of a UIWebView including that which is not visible to the user. i.e. The whole web page even though the user is only looking at the top.
Looking around I found the best way to capture a UIView is to retrieve its layer and use renderInContext.
However, UIWebView seems to be using it... | I've released an app ([Web2Pic](http://itunes.apple.com/us/app/mammoth-web2pic-webpage-full/id450749975?mt=8)) doing that, and please trust me that ***UIGraphicsBeginImageContext(webView.frame.size);***
can do nothing except getting a small image from the visible area in our UIWebView ;-(
The right way is a bit compl... |
469,798 | <p>I am looking to have a C# application implement the Konami Code to display an Easter Egg.
<a href="http://en.wikipedia.org/wiki/Konami_Code" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Konami_Code</a></p>
<p>What is the best way to do this?</p>
<p>This is in a standard C# windows forms app.</p>
| [
{
"answer_id": 469869,
"author": "user54650",
"author_id": 54650,
"author_profile": "https://Stackoverflow.com/users/54650",
"pm_score": 3,
"selected": false,
"text": "<p>Catch keypresses into a 13(or whatever subset of the code, since you probably don't want to include the START key)-ch... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469798",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52622/"
] | I am looking to have a C# application implement the Konami Code to display an Easter Egg.
<http://en.wikipedia.org/wiki/Konami_Code>
What is the best way to do this?
This is in a standard C# windows forms app. | In windows forms I would have a class that knows what the sequence is and holds the state of where you are in the sequence. Something like this should do it.
```
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace WindowsFormsApplication3 {
public class KonamiSequence {
... |
469,802 | <p>In my last development environment, I was able to easily interact with COM, calling methods on COM objects. Here is the original code, translated into C# style code (to mask the original language):</p>
<pre><code>public static void SpawnIEWithSource(String szSourceHTML)
{
OleVariant ie; //IWebBrowser2
OleVa... | [
{
"answer_id": 471852,
"author": "el2iot2",
"author_id": 8668,
"author_profile": "https://Stackoverflow.com/users/8668",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p><strong>Update:</strong> Based on question updates, I have removed the portions of my answer that are no ... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | In my last development environment, I was able to easily interact with COM, calling methods on COM objects. Here is the original code, translated into C# style code (to mask the original language):
```
public static void SpawnIEWithSource(String szSourceHTML)
{
OleVariant ie; //IWebBrowser2
OleVariant ie = new... | Late bound IDispatch called is relativly easy in .NET, although piss-poor:
```
public static void SpawnIEWithSource(String szHtml)
{
// Get the class type and instantiate Internet Explorer.
Type ieType = Type.GetTypeFromProgID("InternetExplorer.Application");
object ie = Activator.CreateInstance(ieType);
... |
469,803 | <pre>function getTemplate($tpl if ($vars) echo ", $vars";)...function</pre>
<p>Is this possible somehow?
The above wont work.</p>
<p>Thanks</p>
| [
{
"answer_id": 469809,
"author": "cjk",
"author_id": 52201,
"author_profile": "https://Stackoverflow.com/users/52201",
"pm_score": 0,
"selected": false,
"text": "<pre><code>if ($vars) { getTemplate($tpl, $vars); }\nelse {{ getTemplate($tpl, null); }\n</code></pre>\n\n<p>(semi-pseudo code... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
function getTemplate($tpl if ($vars) echo ", $vars";)...function
```
Is this possible somehow?
The above wont work.
Thanks | Optional arguments with default values
--------------------------------------
It looks like you want an optional argument, which you can accomplish by defining a default value in the function definition:
```
function getTemplate($tpl, $vars=null)
{
}
```
You can call this function as getTemplate($foo) or getTem... |
469,806 | <p>Can anyone help me with the trying to write SQL (MS SqlServer) - I must admit this is not by best skill.</p>
<p>What I want to do is exactly the same functionality as appears for the search boxes for the <a href="http://www.yell.com/" rel="nofollow noreferrer">Yell website</a> i.e.</p>
<ul>
<li><p>Search for comp... | [
{
"answer_id": 469811,
"author": "Ryan Guill",
"author_id": 7186,
"author_profile": "https://Stackoverflow.com/users/7186",
"pm_score": 0,
"selected": false,
"text": "<p>Can you provide the database layout (schema) that the sql would run against? It would be necessary to give you an exa... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5175/"
] | Can anyone help me with the trying to write SQL (MS SqlServer) - I must admit this is not by best skill.
What I want to do is exactly the same functionality as appears for the search boxes for the [Yell website](http://www.yell.com/) i.e.
* Search for company type
* AND/OR company name
* AND/OR enter a company name
*... | Typically, one does something like this:
```
-- All these are NULL unless provided
DECLARE @CompanyType AS varchar
DECLARE @CompanyName AS varchar
DECLARE @Town AS varchar
SELECT *
FROM TABLE_NAME
WHERE (@CompanyType IS NULL OR COMPANY_TYPE_COLUMN LIKE '%' + @CompanyType + '%')
AND (@CompanyName IS NULL OR COMPA... |
469,810 | <p>I'm using the following xaml to fill the dataContext:</p>
<pre><code>DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
</code></pre>
<p>The application works fine, but Cider complains that I must set the Path property.
I'm interested in the entire object, and not a specific property though.</... | [
{
"answer_id": 469848,
"author": "Ryan Lundy",
"author_id": 5486,
"author_profile": "https://Stackoverflow.com/users/5486",
"pm_score": 3,
"selected": true,
"text": "<p>Have a look at section 2.3.8.7 here (you'll need to scroll down a bit):</p>\n\n<p><a href=\"http://download.microsoft.c... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48953/"
] | I'm using the following xaml to fill the dataContext:
```
DataContext="{Binding RelativeSource={RelativeSource TemplatedParent}}"
```
The application works fine, but Cider complains that I must set the Path property.
I'm interested in the entire object, and not a specific property though.
I hope there's a way to ge... | Have a look at section 2.3.8.7 here (you'll need to scroll down a bit):
[Visual Studio 2008 Service Pack 1 (SP1) Readme](http://download.microsoft.com/download/A/2/8/A2807F78-C861-4B66-9B31-9205C3F22252/VS2008SP1Readme.htm#Windows%20Presentation%20Foundation%20(WPF)%20Designer%20for%20Visual%20Studio)
Try changing yo... |
469,844 | <p>i would like to <strong>convert xhtml to dokuwiki syntax using xslt</strong>.</p>
<p>now, one thing i can not seem to work my head around is how to handle nested lists. the dokuwiki syntax uses an asterisk (*) for a list item which is prepended by two white spaces per nesting level (c.f. <a href="http://www.dokuwik... | [
{
"answer_id": 470151,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>Here is how I got it to work:</p>\n\n<pre><code><?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xsl:styleshee... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1532/"
] | i would like to **convert xhtml to dokuwiki syntax using xslt**.
now, one thing i can not seem to work my head around is how to handle nested lists. the dokuwiki syntax uses an asterisk (\*) for a list item which is prepended by two white spaces per nesting level (c.f. [wiki syntax](http://www.dokuwiki.org/syntax#list... | **The following transformation**:
```
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:strip-space elements="*"/>
<xsl:variable name="vBlanks"
select="' '"/>
<xsl:variable name="vnNestSpaces" select="2"/>
... |
469,846 | <p>Date and time in MySQL can be stored as DATETIME, TIMESTAMP, and INTEGER (number of seconds since 01/01/1970). What are the benefits and drawbacks of each, particularly when developing under a LAMP stack?</p>
| [
{
"answer_id": 469878,
"author": "Toby Allen",
"author_id": 6244,
"author_profile": "https://Stackoverflow.com/users/6244",
"pm_score": 2,
"selected": false,
"text": "<p>Well I guess the following would help clarify.</p>\n\n<p>Date and time can be stored in a DATETIME field in mysql.</p>... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24010/"
] | Date and time in MySQL can be stored as DATETIME, TIMESTAMP, and INTEGER (number of seconds since 01/01/1970). What are the benefits and drawbacks of each, particularly when developing under a LAMP stack? | * TIMESTAMP is stored in a MySQL proprietary method (though it's basically just a string consisting of year, month, day, hour, minutes and seconds) and additionally, a field of type TIMESTAMP is automatically updated whenever the record is inserted or changed and no explicit field value is given:
```
mysql> create tab... |
469,849 | <p>I would like to do something like this:</p>
<pre><code>container::iterator it = NULL;
switch ( eSomeEnum )
{
case Container1:
it = vecContainer1.begin();
break;
case Container2:
it = vecContainer2.begin();
break;
...
}
for( ; it != itEnd ; ++it )
{
..
}
</code></pre>
<p>But I can't create and initialise an i... | [
{
"answer_id": 469861,
"author": "jpalecek",
"author_id": 51831,
"author_profile": "https://Stackoverflow.com/users/51831",
"pm_score": 5,
"selected": true,
"text": "<p>You just needn't initialize it at all, because iterators are DefaultConstructible.</p>\n"
},
{
"answer_id": 469... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469849",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18664/"
] | I would like to do something like this:
```
container::iterator it = NULL;
switch ( eSomeEnum )
{
case Container1:
it = vecContainer1.begin();
break;
case Container2:
it = vecContainer2.begin();
break;
...
}
for( ; it != itEnd ; ++it )
{
..
}
```
But I can't create and initialise an iterator to NULL. Is there s... | You just needn't initialize it at all, because iterators are DefaultConstructible. |
469,852 | <p>I am trying to load the Flexigrid by using a JSON String which is returned by a WCF Service.</p>
<p>My Service has a <code>public string GetContacts(string CustomerID)</code> method and it returns a Json string.</p>
<p>That JSON string is created from a List object by using
<code>System.Web.Script.Serialization.J... | [
{
"answer_id": 677674,
"author": "almog.ori",
"author_id": 104424,
"author_profile": "https://Stackoverflow.com/users/104424",
"pm_score": 4,
"selected": false,
"text": "<p>Flexigrid requires a format as follows in json</p>\n\n<p><strong>EDIT</strong> Thanks to EAMann for the format upda... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to load the Flexigrid by using a JSON String which is returned by a WCF Service.
My Service has a `public string GetContacts(string CustomerID)` method and it returns a Json string.
That JSON string is created from a List object by using
`System.Web.Script.Serialization.JavaScriptSerializer` class. So, m... | Flexigrid requires a format as follows in json
**EDIT** Thanks to EAMann for the format update.
```
total: (no of rec)
page : (page no)
rows : [{cell: [ (col1 value) , (col2 value) ,.. ] },
{cell: [ (col1 value) , (col2 value) ,.. ] }]
```
in order to bind the data to the grid i prefer sending the data a... |
469,854 | <p>I have a div that has it's <code>opacity</code> set to 60. Inside the div, I have an asp:Image. It looks like the opacity of the <code>div</code> is also setting the opacity of the image. I tried creating a separate class for the image and setting the <code>opacity</code> to 100, but this doesn't seem to work. Do... | [
{
"answer_id": 469866,
"author": "Crescent Fresh",
"author_id": 45433,
"author_profile": "https://Stackoverflow.com/users/45433",
"pm_score": 3,
"selected": true,
"text": "<p>That's just how css inheritance works. Your image is getting its opacity setting inherited from its parent div. S... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33690/"
] | I have a div that has it's `opacity` set to 60. Inside the div, I have an asp:Image. It looks like the opacity of the `div` is also setting the opacity of the image. I tried creating a separate class for the image and setting the `opacity` to 100, but this doesn't seem to work. Does anyone have a solution?
```
<div id... | That's just how css inheritance works. Your image is getting its opacity setting inherited from its parent div. So 100% of 60% is still 60%.
See <http://www.hedgerwow.com/360/dhtml/css-opacity-inherit.html> for the general workaround (view source). The basic trick is to stack the elements, the one with opacity underne... |
469,860 | <p>The .NET <code>Console</code> class and its default <code>TextWriter</code> implementation (available as <code>Console.Out</code> and implicitly in e.g. <code>Console.WriteLine()</code>) does not signal any error when the application is having its output piped to another program, and the other program terminates or ... | [
{
"answer_id": 470344,
"author": "EnocNRoll - AnandaGopal Pardue",
"author_id": 54289,
"author_profile": "https://Stackoverflow.com/users/54289",
"pm_score": 1,
"selected": false,
"text": "<p>I agree that without the reporting of the ERROR_BROKEN_PIPE and ERROR_NO_DATA errors, __ConsoleS... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3712/"
] | The .NET `Console` class and its default `TextWriter` implementation (available as `Console.Out` and implicitly in e.g. `Console.WriteLine()`) does not signal any error when the application is having its output piped to another program, and the other program terminates or closes the pipe before the application has fini... | To solve this one, I had to write my own basic stream implementation over Win32 file handles. This wasn't terribly difficult, as I didn't need to implement asynchronous support, buffering or seeking.
Unfortunately, unsafe code needs to be used, but that generally isn't a problem for console applications that will be r... |
469,865 | <p>I tried everything possible, but still failed. I thought I got it at the point which I'll post<br>
as my final attempt, but still isn't good [enough].</p>
<p>A script is being passed three arguments. Domain name, username and password.<br>
But the probles is that I need domain separated in "domain" + ".com" format.... | [
{
"answer_id": 470344,
"author": "EnocNRoll - AnandaGopal Pardue",
"author_id": 54289,
"author_profile": "https://Stackoverflow.com/users/54289",
"pm_score": 1,
"selected": false,
"text": "<p>I agree that without the reporting of the ERROR_BROKEN_PIPE and ERROR_NO_DATA errors, __ConsoleS... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469865",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I tried everything possible, but still failed. I thought I got it at the point which I'll post
as my final attempt, but still isn't good [enough].
A script is being passed three arguments. Domain name, username and password.
But the probles is that I need domain separated in "domain" + ".com" format. Two variabl... | To solve this one, I had to write my own basic stream implementation over Win32 file handles. This wasn't terribly difficult, as I didn't need to implement asynchronous support, buffering or seeking.
Unfortunately, unsafe code needs to be used, but that generally isn't a problem for console applications that will be r... |
469,874 | <p>Suppose I have:</p>
<pre><code><a href="http://www.yahoo.com/" target="_yahoo"
title="Yahoo!&#8482;" onclick="return gateway(this);">Yahoo!</a>
<script type="text/javascript">
function gateway(lnk) {
window.open(SERVLET +
'?external_link=' + encodeURIComponent(lnk.href) +
... | [
{
"answer_id": 470013,
"author": "jacobangel",
"author_id": 31318,
"author_profile": "https://Stackoverflow.com/users/31318",
"pm_score": 0,
"selected": false,
"text": "<p>You could always use javascript to manipulate the text further. </p>\n\n<pre><code><div id=\"test\">a</div&... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9254/"
] | Suppose I have:
```
<a href="http://www.yahoo.com/" target="_yahoo"
title="Yahoo!™" onclick="return gateway(this);">Yahoo!</a>
<script type="text/javascript">
function gateway(lnk) {
window.open(SERVLET +
'?external_link=' + encodeURIComponent(lnk.href) +
'&external_target=' + encodeURIC... | You are nearly there. EncodeURIComponent correctly encodes to UTF-8, which is what you should always use in a URL today.
The problem is that the submitted query string is getting mutilated on the way into your server-side script, because getParameter() uses ISO-8559-1 instead of UTF-8. This stems from Ancient Times be... |
469,883 | <p>I'm trying to find the index of a row in a table. I'm trying to use the following code, but I seem to get an index of -1.</p>
<pre><code>$(document).ready(function()
{
$("tr").click(function (){
var index = $("table").index($(this));
$("span").text("That was row index #" + index);
});
});
</... | [
{
"answer_id": 469910,
"author": "Ates Goral",
"author_id": 23501,
"author_profile": "https://Stackoverflow.com/users/23501",
"pm_score": 4,
"selected": false,
"text": "<p>Try:</p>\n\n<pre><code>var index = $(\"table tr\").index(this);\n</code></pre>\n\n<p>The documentation for <code>ind... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48886/"
] | I'm trying to find the index of a row in a table. I'm trying to use the following code, but I seem to get an index of -1.
```
$(document).ready(function()
{
$("tr").click(function (){
var index = $("table").index($(this));
$("span").text("That was row index #" + index);
});
});
```
With html ... | Have you tried:
```
$("tr").index(this)
```
The documentation shows just passing this and that the preceding selection should be where the node is found. If you need to find it in a specific table (and there are multiple), you may need to provide some context:
```
// haven't tested this
$("tr", $(this).closest("tab... |
469,892 | <pre><code>void pushSynonyms (string synline, char matrizSinonimos [1024][1024]){
stringstream synstream(synline);
vector<int> synsAux;
int num;
while (synstream >> num) {synsAux.push_back(num);}
int index=0;
while (inde... | [
{
"answer_id": 469920,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 2,
"selected": false,
"text": "<p>Arrays are passed as pointers - there's no need to do a pass-by-reference to them. If you declare your function t... | 2009/01/22 | [
"https://Stackoverflow.com/questions/469892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45963/"
] | ```
void pushSynonyms (string synline, char matrizSinonimos [1024][1024]){
stringstream synstream(synline);
vector<int> synsAux;
int num;
while (synstream >> num) {synsAux.push_back(num);}
int index=0;
while (index<(synsAux.size()-1)){... | ### What's wrong with it
The code as you have it there - i can't find a bug. The only problem i spot is that if you provide no number at all, then this part will cause harm:
```
(synsAux.size()-1)
```
It will subtract one from 0u . That will wrap around, because `size()` returns an unsigned integer type. You will e... |