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 |
|---|---|---|---|---|---|---|
189,830 | <p>I am encountering error like </p>
<pre><code>test(10)[1].csv file cannot be found at
C:\Documents and Settings\Ron\Local Settings\Temporary Internet Files\Content.IE5\PQ0STUVW
</code></pre>
<p>When trying to do export of CSV file using the following codes.
Anyone have any idea what could be wrong? This issue doe... | [
{
"answer_id": 204430,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Are there \"special\" characters in your \"fileFullName\"? You cold also try to check the length of your file name, I once ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25368/"
] | I am encountering error like
```
test(10)[1].csv file cannot be found at
C:\Documents and Settings\Ron\Local Settings\Temporary Internet Files\Content.IE5\PQ0STUVW
```
When trying to do export of CSV file using the following codes.
Anyone have any idea what could be wrong? This issue does not occur in IE7 / Firefo... | I've already got that problem and asked the [question that as a correct answer](https://stackoverflow.com/questions/120497/how-to-work-around-the-1-ie-bug-while-saving-an-excel-file-from-a-web-server) (or, shall I say, a good workaround for IE). |
189,855 | <p>Which would be a neat implemenation of a N-ary tree in C language?</p>
<p>Particulary, I want to implement an n-ary tree, not self-ballancing, with an unbound number of children in each node, in which each node holds an already defined struct, like this for example:</p>
<pre><code>struct task {
char command[MAX_... | [
{
"answer_id": 189900,
"author": "Matt J",
"author_id": 18528,
"author_profile": "https://Stackoverflow.com/users/18528",
"pm_score": 5,
"selected": true,
"text": "<p>As a first pass, you could simply create a <em>struct</em> (let's call it <em>TreeNode</em>) which holds a <em>task</em>,... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26699/"
] | Which would be a neat implemenation of a N-ary tree in C language?
Particulary, I want to implement an n-ary tree, not self-ballancing, with an unbound number of children in each node, in which each node holds an already defined struct, like this for example:
```
struct task {
char command[MAX_LENGTH];
int requir... | As a first pass, you could simply create a *struct* (let's call it *TreeNode*) which holds a *task*, as well as a set of pointers to *TreeNode*s. This set could either be an array (if **N** is fixed) or a linked list (if **N** is variable). The linked list would require you to declare an additional *struct* (let's call... |
189,878 | <p>I'm looking for a regex that will allow me to validate whether or not a string is the reference to a website address, or a specific page in that website. </p>
<p>So it would match:</p>
<pre><code>http://google.com
ftp://google.com
http://google.com/
http://lots.of.subdomains.google.com
</code></pre>
<p>But not:</... | [
{
"answer_id": 189941,
"author": "Paige Ruten",
"author_id": 813,
"author_profile": "https://Stackoverflow.com/users/813",
"pm_score": 4,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>(http|ftp|https)://([a-zA-Z0-9\\-\\.]+)/?\n</code></pre>\n"
},
{
"answer_id": 190053... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4965/"
] | I'm looking for a regex that will allow me to validate whether or not a string is the reference to a website address, or a specific page in that website.
So it would match:
```
http://google.com
ftp://google.com
http://google.com/
http://lots.of.subdomains.google.com
```
But not:
```
http://google.com/search.what... | Try this:
```
(http|ftp|https)://([a-zA-Z0-9\-\.]+)/?
``` |
189,887 | <p>is there an if statement when it comes to mysql query statements?</p>
<p>when i am updating a table record, i want to only update certain columns if they have a value to be updated.</p>
<p>for example, i want an update table function, and there is a table for volunteers and a table for people who just want email u... | [
{
"answer_id": 190011,
"author": "Darryl Hein",
"author_id": 5441,
"author_profile": "https://Stackoverflow.com/users/5441",
"pm_score": 3,
"selected": true,
"text": "<p>I think this should work:</p>\n\n<pre><code>UPDATE volunteer, people\nSET volunteer.email = 'me@email.com',\n peopl... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] | is there an if statement when it comes to mysql query statements?
when i am updating a table record, i want to only update certain columns if they have a value to be updated.
for example, i want an update table function, and there is a table for volunteers and a table for people who just want email updates.
i want t... | I think this should work:
```
UPDATE volunteer, people
SET volunteer.email = 'me@email.com',
people.email = 'other@gmail.com',
people.first_name = 'first',
WHERE people.id = 2 AND volunteer.id = 5;
```
I got this from the [update syntax](http://dev.mysql.com/doc/refman/5.1/en/update.html) on the MySQL websit... |
189,889 | <p>I'm having a problem using the java.text.MessageFormat object.</p>
<p>I'm trying to create SQL insert statements. The problem is, when I do something like this:</p>
<pre><code>MessageFormat messageFormat = "insert into {0} values ( '{1}', '{2}', '{3}', {4} )";
Object[] args = { str0, str1, str2, str3, str4 };
St... | [
{
"answer_id": 189895,
"author": "billjamesdev",
"author_id": 13824,
"author_profile": "https://Stackoverflow.com/users/13824",
"pm_score": 0,
"selected": false,
"text": "<p>First thing that came to mind was to change str1, str2, str3 to have the single quotes around them.</p>\n\n<pre>\n... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12983/"
] | I'm having a problem using the java.text.MessageFormat object.
I'm trying to create SQL insert statements. The problem is, when I do something like this:
```
MessageFormat messageFormat = "insert into {0} values ( '{1}', '{2}', '{3}', {4} )";
Object[] args = { str0, str1, str2, str3, str4 };
String result = messageFo... | I just tried double quotes and it worked fine for me:
```
MessageFormat messageFormat = new MessageFormat("insert into {0} values ( ''{1}'', ''{2}'', ''{3}'', {4} )");
Object[] args = {"000", "111", "222","333","444","555"};
String result = messageFormat.format(args);
```
The result is:
```
insert into 000 values (... |
189,892 | <p>If I have an array of a fixed size depending on how it is defined and used, I typically use one of two ways to reference it.</p>
<p>Array type 1: Since it is a fixed size based on a define, I just use that define in all my loops referencing it.</p>
<pre><code>#define MAXPLAYERS 4
int playerscores[MAXPLAYERS];
fo... | [
{
"answer_id": 189907,
"author": "Alex B",
"author_id": 23643,
"author_profile": "https://Stackoverflow.com/users/23643",
"pm_score": 4,
"selected": true,
"text": "<p>This will work for both of your cases, regardless of array element type:</p>\n\n<pre><code>#define ARRAY_COUNT(x) (sizeof... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13676/"
] | If I have an array of a fixed size depending on how it is defined and used, I typically use one of two ways to reference it.
Array type 1: Since it is a fixed size based on a define, I just use that define in all my loops referencing it.
```
#define MAXPLAYERS 4
int playerscores[MAXPLAYERS];
for(i=0;i<MAXPLAYERS;++... | This will work for both of your cases, regardless of array element type:
```
#define ARRAY_COUNT(x) (sizeof(x)/sizeof((x)[0]))
...
struct foo arr[100];
...
for (i = 0; i < ARRAY_COUNT(arr); ++i) {
/* do stuff to arr[i] */
}
``` |
189,906 | <p>I'm trying to upgrade my subversion server (I have it hosted with Dreamhost)</p>
<p>This is what I run:</p>
<ul>
<li>wget <a href="http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2" rel="nofollow noreferrer">http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2</a></li>
<li>wget <a href="ht... | [
{
"answer_id": 189948,
"author": "Aupajo",
"author_id": 10407,
"author_profile": "https://Stackoverflow.com/users/10407",
"pm_score": 3,
"selected": false,
"text": "<p>You'll need to build your own copy under your own account.</p>\n\n<pre><code>mkdir ~/src\ncd ~/src\nwget http://subversi... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18274/"
] | I'm trying to upgrade my subversion server (I have it hosted with Dreamhost)
This is what I run:
* wget <http://subversion.tigris.org/downloads/subversion-1.5.2.tar.bz2>
* wget <http://subversion.tigris.org/downloads/subversion-deps-1.5.2.tar.bz2>
* tar -xjf subversion-1.5.2.tar.bz2
* tar -xjf subversion-deps-1.5.2.t... | If you're using openssl with SVN then you need to configure SVN with
```
./configure .... --with-openssl=/path/to/openssl
```
When I've done this in the past I've had issues building other binaries that use this lib if I don't specify the `-fPIC` flag. So it's best to run make with that parameter (if you have that i... |
189,921 | <p>I'm trying to port an old library (that doesn't use namespaces as far as I can tell) to modern compilers. One of my targets can't tell the difference between System::TObject and ::TObject (without a namespace). System::TObject is native to the compiler.</p>
<p>I've tried a using directive, i.e. using ::TObject;</p>... | [
{
"answer_id": 189957,
"author": "Jim Buck",
"author_id": 2666,
"author_profile": "https://Stackoverflow.com/users/2666",
"pm_score": 0,
"selected": false,
"text": "<p>If you have the source to the library, maybe include a header file at the top of each source where that header file has ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22885/"
] | I'm trying to port an old library (that doesn't use namespaces as far as I can tell) to modern compilers. One of my targets can't tell the difference between System::TObject and ::TObject (without a namespace). System::TObject is native to the compiler.
I've tried a using directive, i.e. using ::TObject;
But that doe... | You can do as Dib suggested, with a slight modification:
```
// In a wrapper header, eg: include_oldlib.h...
namespace oldlib
{
#include "oldlib.h"
};
#ifndef DONT_AUTO_INCLUDE_OLD_NAMESPACE
using namespace oldlib;
#endif
```
This allows you to #define the exclusion in only the files where you're getting confli... |
189,934 | <p>I'm trying to convert some code that worked great in VB, but I can't figure out what objects to use in .Net. </p>
<pre><code> Dim oXMLHttp As XMLHTTP
oXMLHttp = New XMLHTTP
oXMLHttp.open "POST", "https://www.server.com/path", False
oXMLHttp.setRequestHeader "Content-Type", "application/x-www-form-ur... | [
{
"answer_id": 189966,
"author": "Booji Boy",
"author_id": 1433,
"author_profile": "https://Stackoverflow.com/users/1433",
"pm_score": 2,
"selected": true,
"text": "<p>See the following for a sample which does this: <a href=\"http://www.codeproject.com/KB/dotnet/NET_Interact_j2EE.aspx\" ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/232/"
] | I'm trying to convert some code that worked great in VB, but I can't figure out what objects to use in .Net.
```
Dim oXMLHttp As XMLHTTP
oXMLHttp = New XMLHTTP
oXMLHttp.open "POST", "https://www.server.com/path", False
oXMLHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
o... | See the following for a sample which does this: <http://www.codeproject.com/KB/dotnet/NET_Interact_j2EE.aspx>
I have put the sample below. Sorry, I know it's big, but you never know how long links like this will stay valid.
NOTE: the first version of the question didn't say in C# .NET - it just said "in .NET". (perhap... |
189,943 | <p>Here's what I would like to do:</p>
<p>I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much <em>looks</em> the same, I don't want to store the latest snapshot.</p>
<p>I imagine there's some way of quantif... | [
{
"answer_id": 189960,
"author": "keparo",
"author_id": 19468,
"author_profile": "https://Stackoverflow.com/users/19468",
"pm_score": 6,
"selected": false,
"text": "<p><strong>A simple solution:</strong></p>\n\n<p>Encode the image as a <strong>jpeg</strong> and look for a substantial cha... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20498/"
] | Here's what I would like to do:
I'm taking pictures with a webcam at regular intervals. Sort of like a time lapse thing. However, if nothing has really changed, that is, the picture pretty much *looks* the same, I don't want to store the latest snapshot.
I imagine there's some way of quantifying the difference, and I... | General idea
------------
Option 1: Load both images as arrays (`scipy.misc.imread`) and calculate an element-wise (pixel-by-pixel) difference. Calculate the norm of the difference.
Option 2: Load both images. Calculate some feature vector for each of them (like a histogram). Calculate distance between feature vector... |
189,947 | <p>Have a n-tire web application and search often times out after 30 secs. How to detect the root cause of the problem?</p>
| [
{
"answer_id": 189960,
"author": "keparo",
"author_id": 19468,
"author_profile": "https://Stackoverflow.com/users/19468",
"pm_score": 6,
"selected": false,
"text": "<p><strong>A simple solution:</strong></p>\n\n<p>Encode the image as a <strong>jpeg</strong> and look for a substantial cha... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26365/"
] | Have a n-tire web application and search often times out after 30 secs. How to detect the root cause of the problem? | General idea
------------
Option 1: Load both images as arrays (`scipy.misc.imread`) and calculate an element-wise (pixel-by-pixel) difference. Calculate the norm of the difference.
Option 2: Load both images. Calculate some feature vector for each of them (like a histogram). Calculate distance between feature vector... |
189,976 | <p>This is more of a design question. </p>
<p>I am building a tool that displays business objects in various ways (ie Tree Nodes, List View Items, Combo Boxes, Text Fields, etc). Anytime the user changes any of one of them, an event is raised that signals that that business object has been changed or the collection ... | [
{
"answer_id": 189991,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>Use a messaging system. Create a delegate like this:</p>\n\n<pre><code>public delegate void ObjectRefresh(BusinessObject ob... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189976",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is more of a design question.
I am building a tool that displays business objects in various ways (ie Tree Nodes, List View Items, Combo Boxes, Text Fields, etc). Anytime the user changes any of one of them, an event is raised that signals that that business object has been changed or the collection that it belo... | Use a messaging system. Create a delegate like this:
```
public delegate void ObjectRefresh(BusinessObject obj);
```
Then, in your BusinessObject class:
```
public event ObjectRefresh;
```
And when a property is changed:
```
if (ObjectRefresh)
ObjectRefresh(this);
```
And on all of your uis:
```
BusinessO... |
189,988 | <p>An idiom commonly used in OO languages like Python and Ruby is instantiating an object and chaining methods that return a reference to the object itself, such as:</p>
<pre><code>s = User.new.login.get_db_data.get_session_data
</code></pre>
<p>In PHP, it is possible to replicate this behavior like so:</p>
<pre><co... | [
{
"answer_id": 190014,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "<pre><code><?php\n\n class User\n {\n function __construct()\n {\n }\n\n function Login()... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16034/"
] | An idiom commonly used in OO languages like Python and Ruby is instantiating an object and chaining methods that return a reference to the object itself, such as:
```
s = User.new.login.get_db_data.get_session_data
```
In PHP, it is possible to replicate this behavior like so:
```
$u = new User();
$s = $u->login()-... | All of these proposed solutions complicate your code in order to bend PHP to accomplish some syntactic nicety. Wanting PHP to be something it's not (like good) is the path to madness.
I would just use:
```
$u = new User();
$s = $u->login()->get_db_data()->get_session_data();
```
It is clear, relatively concise and ... |
189,993 | <p>When I use ApacheBench to test https, the error is returned, "ssl handshake failed".</p>
<p>How can I use ApacheBench to test https?</p>
| [
{
"answer_id": 4149548,
"author": "naugtur",
"author_id": 173077,
"author_profile": "https://Stackoverflow.com/users/173077",
"pm_score": 3,
"selected": false,
"text": "<p>ApacheBench doesn't seem to be capable of ignoring certificate problems (at least some of them) so I wrote this scri... | 2008/10/10 | [
"https://Stackoverflow.com/questions/189993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When I use ApacheBench to test https, the error is returned, "ssl handshake failed".
How can I use ApacheBench to test https? | ApacheBench doesn't seem to be capable of ignoring certificate problems (at least some of them) so I wrote this script:
```
#!/bin/bash
K=200;
HTTPSA='https://192.168.1.103:443/'
date +%M-%S-%N>wgetres.txt
for (( c=1; c<=$K; c++ ))
do
wget --no-check-certificate --secure-protocol=SSLv3 --spider $HTTPSA
don... |
190,007 | <p>When developing Java applications, I often override Object methods (usually equals and hashCode). I would like some way to systematically check that I'm adhering to the contract for Object methods for every one of my classes. For example, I want tests that assert that for equal objects, the hash code is also equal... | [
{
"answer_id": 190112,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 1,
"selected": false,
"text": "<p>Just a some initial thoughts on that question (which may explain why there are still no answer after a full hour!? ;)</p>\n\... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8217/"
] | When developing Java applications, I often override Object methods (usually equals and hashCode). I would like some way to systematically check that I'm adhering to the contract for Object methods for every one of my classes. For example, I want tests that assert that for equal objects, the hash code is also equal. I'm... | ```
public static void checkObjectIdentity(Object a1, Object a2, Object b1) {
assertEquals(a1, a2);
assertEquals(a2, a1);
assertNotSame(a1, a2);
assertEquals(a1.hashCode(), a2.hashCode());
assertFalse(a1.equals(b1));
assertFalse(a2.equals(b1));
assertFalse(b1... |
190,045 | <p>I have a large int[] array and a much smaller int[] array. I want to fill up the large array with values from the small array, by repeat copying the small array into the large array until it is full (so that large[0] = large[13] = large[26] ... = small[0] etc.). I already have a simple method:</p>
<pre><code>int ... | [
{
"answer_id": 190017,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 10,
"selected": true,
"text": "<p>Some threads do background tasks, like sending keepalive packets, or performing periodic garbage collection, or whatever.... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14606/"
] | I have a large int[] array and a much smaller int[] array. I want to fill up the large array with values from the small array, by repeat copying the small array into the large array until it is full (so that large[0] = large[13] = large[26] ... = small[0] etc.). I already have a simple method:
```
int iSource = 0;
for... | Some threads do background tasks, like sending keepalive packets, or performing periodic garbage collection, or whatever. These are only useful when the main program is running, and it's okay to kill them off once the other, non-daemon, threads have exited.
Without daemon threads, you'd have to keep track of them, and... |
190,049 | <p>Given a table structure like this:</p>
<pre><code>CREATE TABLE `user` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`username` varchar(16) NOT NULL,
`password` char(32) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
);
</code></pre>
<p>Is there any use... | [
{
"answer_id": 190067,
"author": "Mike Thompson",
"author_id": 2754,
"author_profile": "https://Stackoverflow.com/users/2754",
"pm_score": 1,
"selected": false,
"text": "<p>The sql query optimizer should be smart enough to figure this out.</p>\n"
},
{
"answer_id": 190079,
"au... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | Given a table structure like this:
```
CREATE TABLE `user` (
`id` int(10) unsigned NOT NULL auto_increment,
`name` varchar(32) NOT NULL,
`username` varchar(16) NOT NULL,
`password` char(32) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `username` (`username`)
);
```
Is there any use in using the LIMIT keywor... | I've always been told and read that you should include the `LIMIT` everytime you only want 1 result. This just tells the DB that it should stop so matter what. In your case, you're probably right it doesn't make a difference, but I think it's better just to always do than always deciding and leaving it out one time whe... |
190,054 | <p>I've been refactoring my models and controllers in an effort to remove code duplication, and so far it seems to be all peachy creamy. Currently I've got a bit of code that is common to two of my controllers, like so:</p>
<pre><code>def process_filters
# Filter hash we're going to pass to the model
filter_to_use ... | [
{
"answer_id": 190067,
"author": "Mike Thompson",
"author_id": 2754,
"author_profile": "https://Stackoverflow.com/users/2754",
"pm_score": 1,
"selected": false,
"text": "<p>The sql query optimizer should be smart enough to figure this out.</p>\n"
},
{
"answer_id": 190079,
"au... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/841/"
] | I've been refactoring my models and controllers in an effort to remove code duplication, and so far it seems to be all peachy creamy. Currently I've got a bit of code that is common to two of my controllers, like so:
```
def process_filters
# Filter hash we're going to pass to the model
filter_to_use = {}
# To pr... | I've always been told and read that you should include the `LIMIT` everytime you only want 1 result. This just tells the DB that it should stop so matter what. In your case, you're probably right it doesn't make a difference, but I think it's better just to always do than always deciding and leaving it out one time whe... |
190,066 | <p>Does anyone have some good information on the usage of the .SaveChanges() method?</p>
<p>I am experiencing a variety of issues when attempting to use the .SaveChanges() method on my data context object. I am taking data from an existing data source, creating the appropriate EntityFramework/DataService objects, pop... | [
{
"answer_id": 261984,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>I am using EntityFramework on a small project also so I am very interested in the question also. \nTwo quick questions:\n ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25719/"
] | Does anyone have some good information on the usage of the .SaveChanges() method?
I am experiencing a variety of issues when attempting to use the .SaveChanges() method on my data context object. I am taking data from an existing data source, creating the appropriate EntityFramework/DataService objects, populating tho... | I have no big experience in using EntityFramework (just some random experiment), have you tried calling .SaveChanges() every n iterations?
I mean something like this:
```
int i = 0;
foreach (var item in collection)
{
// do something with your data
if ((i++ % 10) == 0)
context.SaveChanges();
}
context.... |
190,102 | <p>I want to use data binding with an XML document to populate a simple form that shows details about a list of people. I've got it all set up and working like so right now:</p>
<pre><code><Window x:Class="DataBindingSample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://s... | [
{
"answer_id": 191467,
"author": "aogan",
"author_id": 4795,
"author_profile": "https://Stackoverflow.com/users/4795",
"pm_score": 2,
"selected": true,
"text": "<p>You could use local names in your XPath queries like this: </p>\n\n<pre><code> <TextBox Name=\"nameText\">\n <T... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25968/"
] | I want to use data binding with an XML document to populate a simple form that shows details about a list of people. I've got it all set up and working like so right now:
```
<Window x:Class="DataBindingSample.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.... | You could use local names in your XPath queries like this:
```
<TextBox Name="nameText">
<TextBox.Text>
<Binding XPath="*[local-name()='Name']" />
</TextBox.Text>
</TextBox>
``` |
190,108 | <p>I am having trouble grabbing the values from the form once processed. I need your help.</p>
<pre><code>function updateUser($table, $id) {
if($_POST) {
processUpdate($table, $id);
} else {
updateForm($table, $id);
}
}
function processUpdate($table, $id) {
print $table; //testing
... | [
{
"answer_id": 190120,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": true,
"text": "<p>Is the method attribute of the form set to post?</p>\n\n<pre><code><form method = \"post\" action = \"...\">\n</code><... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26130/"
] | I am having trouble grabbing the values from the form once processed. I need your help.
```
function updateUser($table, $id) {
if($_POST) {
processUpdate($table, $id);
} else {
updateForm($table, $id);
}
}
function processUpdate($table, $id) {
print $table; //testing
print $id; //... | Is the method attribute of the form set to post?
```
<form method = "post" action = "...">
```
And are all of the input's name attribute set right?
Have you looked at the html output to make sure that there were no syntax errors? Also, try using
`$_POST`
instead of
`$HTTP_POST_VARS` |
190,138 | <p>I want to create a collection in VB.NET, but I only want it to accept objects of a certain type. For example, I want to create a class called "FooCollection" that acts like a collection in every way, but only accepts objects of type "Foo".</p>
<p>I thought I could do this using generics, using the following syntax:... | [
{
"answer_id": 190153,
"author": "Andrew Moore",
"author_id": 26210,
"author_profile": "https://Stackoverflow.com/users/26210",
"pm_score": 4,
"selected": true,
"text": "<p>Why don't you just use a <code>List(Of Foo)</code>... It is already in VB.NET under <code>System.Collections.Generi... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8114/"
] | I want to create a collection in VB.NET, but I only want it to accept objects of a certain type. For example, I want to create a class called "FooCollection" that acts like a collection in every way, but only accepts objects of type "Foo".
I thought I could do this using generics, using the following syntax:
```
... | Why don't you just use a `List(Of Foo)`... It is already in VB.NET under `System.Collections.Generic`. To use, simply declare as such:
```
Private myList As New List(Of Foo) 'Creates a Foo List'
Private myIntList As New List(Of Integer) 'Creates an Integer List'
```
See `[MSDN > List(T) Class (System.Collections.Gen... |
190,145 | <p>I know it's a long shot, but is there some package or means to insert emoticons into a LaTeX document?</p>
| [
{
"answer_id": 190195,
"author": "freespace",
"author_id": 8297,
"author_profile": "https://Stackoverflow.com/users/8297",
"pm_score": 3,
"selected": false,
"text": "<p>Unicode's \"miscellaneous symbols\" include 3 simple emoticons: <code>0x2639</code>-<code>0x263B</code>. You can possib... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630/"
] | I know it's a long shot, but is there some package or means to insert emoticons into a LaTeX document? | I know at least two partial ways:
First:
```
$\ddot\smile$
```
Second:
```
\usepackage{wasysym}
\smiley
\frownie
```
Or you can use images (as mentioned in other replies). |
190,168 | <p>I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script <code>set_abc_env.rb</code> to set environment variable 'ABC' to 'blah', I expect to run the following:</p>
<pre><code>C:> echo %ABC%
C:> set_abc_env.rb
C:> echo %ABC% bl... | [
{
"answer_id": 190437,
"author": "Alexander Prokofyev",
"author_id": 11256,
"author_profile": "https://Stackoverflow.com/users/11256",
"pm_score": 6,
"selected": true,
"text": "<p>You can access environment variables via Ruby ENV object:</p>\n\n<pre><code>i = ENV['ABC']; # nil\nENV['ABC'... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24560/"
] | I am trying to set my DOS environment variable in Ruby, and have it persist after the script exits. For example, if I want a ruby script `set_abc_env.rb` to set environment variable 'ABC' to 'blah', I expect to run the following:
```
C:> echo %ABC%
C:> set_abc_env.rb
C:> echo %ABC% blah
```
How do I do this? | You can access environment variables via Ruby ENV object:
```
i = ENV['ABC']; # nil
ENV['ABC'] = '123';
i = ENV['ABC']; # '123'
```
Bad news is, as MSDN [says](http://msdn.microsoft.com/en-us/library/ms682009(VS.85).aspx), a process can never directly change the environment variables of another process that is not a... |
190,184 | <p>I often use the <code>execv()</code> function in C++, but if some of the arguments are in C++ strings, it annoys me that I cannot do this:</p>
<pre><code>const char *args[4];
args[0] = "/usr/bin/whatever";
args[1] = filename.c_str();
args[2] = someparameter.c_str();
args[3] = 0;
execv(args[0], args);
</c... | [
{
"answer_id": 190197,
"author": "Jonathan",
"author_id": 14850,
"author_profile": "https://Stackoverflow.com/users/14850",
"pm_score": 2,
"selected": false,
"text": "<p>const is a C++ thing - execv has taken char * arguments since before C++ existed.</p>\n\n<p>You can use const_cast ins... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5324/"
] | I often use the `execv()` function in C++, but if some of the arguments are in C++ strings, it annoys me that I cannot do this:
```
const char *args[4];
args[0] = "/usr/bin/whatever";
args[1] = filename.c_str();
args[2] = someparameter.c_str();
args[3] = 0;
execv(args[0], args);
```
This doesn't compile because `e... | The Open Group Base Specifications explains why this is: for compatibility with existing C code. Neither the pointers nor the string contents themselves are intended to be changed, though. Thus, in this case, you can get away with `const_cast`-ing the result of `c_str()`.
[Quote:](http://pubs.opengroup.org/onlinepubs/... |
190,188 | <p>I have this Document table with some meta data for the document in it and also the document content as a blob.</p>
<p>then I use lucene.Net to query my documents; which in return gives me a list of Guids to my Document table and also two fields containing the highlighted html versions of the document name and extra... | [
{
"answer_id": 196015,
"author": "Joel Mueller",
"author_id": 24380,
"author_profile": "https://Stackoverflow.com/users/24380",
"pm_score": 0,
"selected": false,
"text": "<p>Would it help to create a View in your database that excludes the blob, and then generate your dbml from the view?... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190188",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24351/"
] | I have this Document table with some meta data for the document in it and also the document content as a blob.
then I use lucene.Net to query my documents; which in return gives me a list of Guids to my Document table and also two fields containing the highlighted html versions of the document name and extract with th... | You can specify that a field is delay loaded. Its one of the properties available for table fields in the DBML designer. |
190,194 | <p>How do you create a database backup of a mysql database in VB.Net? </p>
| [
{
"answer_id": 190505,
"author": "Osama Al-Maadeed",
"author_id": 25544,
"author_profile": "https://Stackoverflow.com/users/25544",
"pm_score": 1,
"selected": false,
"text": "<p>you could invoke mysqldump, but you may need to be running your VB.NET on the Mysql server.</p>\n"
},
{
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25078/"
] | How do you create a database backup of a mysql database in VB.Net? | You can use **MySqlBackup.NET**, which is an alternative to mysqldump.
Official Website & Documentation > <https://github.com/MySqlBackupNET/MySqlBackup.Net>
Examples:
**Backup a MySql Database**
```
Dim conn As MySqlConnection = New MySqlConnection(constr)
Dim cmd As MySqlCommand = New MySqlCommand
cmd.Connection ... |
190,198 | <p>I am trying to generate equivalent MD5 hashes in both JavaScript and .Net. Not having done either, I decided to use against a third party calculation - this <a href="http://www.johnmaguire.us/tools/hashcalc/index.php?strtohash=password&mode=hash" rel="nofollow noreferrer">web site</a> for the word "password". ... | [
{
"answer_id": 190206,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 0,
"selected": false,
"text": "<p>I get the same value as that web site for the word \"password\":</p>\n\n<pre><code>$ echo -n password | md5\n5f4dcc3b5... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/525/"
] | I am trying to generate equivalent MD5 hashes in both JavaScript and .Net. Not having done either, I decided to use against a third party calculation - this [web site](http://www.johnmaguire.us/tools/hashcalc/index.php?strtohash=password&mode=hash) for the word "password". I will add in salts later, but at the moment, ... | Running the code from the MSDN site you quote:
```
// Hash an input string and return the hash as
// a 32 character hexadecimal string.
static string getMd5Hash(string input)
{
// Create a new instance of the MD5CryptoServiceProvider object.
MD5 md5Hasher = MD5.Create();
... |
190,224 | <p>I've made some unit tests (in test class). The tutorial I've read said that I should make a TestSuite for the unittests.</p>
<p>Odd is that when I'm running the unit test directly (selecting the test class - Run as jUnit test) everything is working fine, altough when I'm trying the same thing with the test suite th... | [
{
"answer_id": 190278,
"author": "gizmo",
"author_id": 9396,
"author_profile": "https://Stackoverflow.com/users/9396",
"pm_score": 0,
"selected": false,
"text": "<p>For sure, it won't work since you're not telling the test suite what are your test classes.</p>\n\n<p>But I'm wondering why... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3056/"
] | I've made some unit tests (in test class). The tutorial I've read said that I should make a TestSuite for the unittests.
Odd is that when I'm running the unit test directly (selecting the test class - Run as jUnit test) everything is working fine, altough when I'm trying the same thing with the test suite there's alwa... | I'm not experienced in ant - so I'm not using it for testing it right now.
Searching the internet it seems like I'm mixing up the old jUnit 3.8 and jUnit 4.0 behavior.
Trying now a way to use the "new behavior"
edited:
now it works:
AllTest changed to:
```
import org.junit.runner.RunWith;
import org.junit.runne... |
190,227 | <p>Assume my objects are in perfect working order (i.e. TDD makes me think they work).</p>
<p>I have a list that I create like this (except indented properly):</p>
<pre><code>var result = from v in vendors
from p in v.Products
orderby p.Name
select p;
</code></pre>
<p>This work... | [
{
"answer_id": 190234,
"author": "Omer van Kloeten",
"author_id": 4979,
"author_profile": "https://Stackoverflow.com/users/4979",
"pm_score": 3,
"selected": false,
"text": "<pre><code>var result = from v in vendors\n from p in v.Products\n where requiredAttributes... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2122/"
] | Assume my objects are in perfect working order (i.e. TDD makes me think they work).
I have a list that I create like this (except indented properly):
```
var result = from v in vendors
from p in v.Products
orderby p.Name
select p;
```
This works - I get all products from all v... | (Edited for clarity.)
The problem is the foreach loop, and the fact that the "a" variable is being captured and then changed each time. Here's a modification which will work, by effectively introducing a "new" variable for each iteration of the loop, and capturing that new variable.
```
foreach (Attribute a in requir... |
190,229 | <p><code>itoa()</code> is a really handy function to convert a number to a string. Linux does not seem to have <code>itoa()</code>, is there an equivalent function or do I have to use <code>sprintf(str, "%d", num)</code>?</p>
| [
{
"answer_id": 190235,
"author": "Matt J",
"author_id": 18528,
"author_profile": "https://Stackoverflow.com/users/18528",
"pm_score": 8,
"selected": true,
"text": "<p>EDIT: Sorry, I should have remembered that this machine is decidedly non-standard, having plugged in various non-standard... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5324/"
] | `itoa()` is a really handy function to convert a number to a string. Linux does not seem to have `itoa()`, is there an equivalent function or do I have to use `sprintf(str, "%d", num)`? | EDIT: Sorry, I should have remembered that this machine is decidedly non-standard, having plugged in various non-standard `libc` implementations for academic purposes ;-)
As `itoa()` is indeed non-standard, as mentioned by several helpful commenters, it is best to use `sprintf(target_string,"%d",source_int)` or (bette... |
190,232 | <pre><code>inline int factorial(int n)
{
if(!n) return 1;
else return n*factorial(n-1);
}
</code></pre>
<p>As I was reading <a href="https://rads.stackoverflow.com/amzn/click/com/0201543303" rel="noreferrer" rel="nofollow noreferrer">this</a>, found that the above code would lead to "infinite compilation" if n... | [
{
"answer_id": 190245,
"author": "mattlant",
"author_id": 14642,
"author_profile": "https://Stackoverflow.com/users/14642",
"pm_score": 1,
"selected": false,
"text": "<p>The compiler will make a call graph to detect these sorts of things and prevent them. So it would see that the functio... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26724/"
] | ```
inline int factorial(int n)
{
if(!n) return 1;
else return n*factorial(n-1);
}
```
As I was reading [this](https://rads.stackoverflow.com/amzn/click/com/0201543303), found that the above code would lead to "infinite compilation" if not handled by compiler correctly.
How does the compiler decide whether t... | First, the `inline` specification on a function is just a hint. The compiler can (and often does) completely ignore the presence or absence of an `inline` qualifier. With that said, a compiler *can* inline a recursive function, much as it can unroll an infinite loop. It simply has to place a limit on the level to which... |
190,236 | <p>I have found no way of dumping the stack on all threads in .NET. Neither a signal to be send to the process nor programatic access to all the threads. I can only get access to the current thread via Thread.CurrentThread.</p>
<p>Any tricks ?</p>
| [
{
"answer_id": 190247,
"author": "smaclell",
"author_id": 22914,
"author_profile": "https://Stackoverflow.com/users/22914",
"pm_score": 0,
"selected": false,
"text": "<p>There is a variety of handy classes in the System.Diagnostics that can help you with debugging and gathering various t... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190236",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have found no way of dumping the stack on all threads in .NET. Neither a signal to be send to the process nor programatic access to all the threads. I can only get access to the current thread via Thread.CurrentThread.
Any tricks ? | If you're trying to get a stack dump while the process is already running (a la jstack), there are two methods as described [here](http://www.tomergabel.com/NETProductionDebugging101.aspx):
### Using Managed Stack Explorer
There is a little-known but effective tool called the [Managed Stack Explorer](http://www.tomer... |
190,243 | <p>One of our internally written tool is fed a cvs commit trace of the form:</p>
<pre><code>Checking in src/com/package/AFile.java;
/home/cvs/src/com/package/AFile.java,v <-- Afile.java
new revision: 1.1.2.56; previous revision: 1.1.2.55
done
</code></pre>
<p>The tool then acquires the file from cvs by... | [
{
"answer_id": 190301,
"author": "Jason Etheridge",
"author_id": 2193,
"author_profile": "https://Stackoverflow.com/users/2193",
"pm_score": 1,
"selected": false,
"text": "<p>One solution would be to change the tool to issue a \"cvs co\" for the file, specifying the revision as is being ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18027/"
] | One of our internally written tool is fed a cvs commit trace of the form:
```
Checking in src/com/package/AFile.java;
/home/cvs/src/com/package/AFile.java,v <-- Afile.java
new revision: 1.1.2.56; previous revision: 1.1.2.55
done
```
The tool then acquires the file from cvs by issuing a `cvs update -r 1.1... | It is not clear what is your final goal: to bring whole repository into required state (choosen revision of the choosen branch) or to acquire the single file from the repository for further processing. I assume it is the latter.
Then, you need this command:
```
cvs checkout -r <revision> -p filename.ext > ~/tmp/filen... |
190,251 | <p>I have a multi-table query, similar to this (simplified version)</p>
<pre><code>SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating
FROM table1
LEFT JOIN table2
ON table1.dom_id = table2.rev_domain_from
WHERE dom_lastreview != 0 AND rev_status = 1
GROUP BY dom_url
ORDER B... | [
{
"answer_id": 190319,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 1,
"selected": false,
"text": "<p>my mysql is rusty; you might try</p>\n\n<pre><code>SELECT columns, count(table2.rev_id) As rev_count, \n sum(ta... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a multi-table query, similar to this (simplified version)
```
SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating
FROM table1
LEFT JOIN table2
ON table1.dom_id = table2.rev_domain_from
WHERE dom_lastreview != 0 AND rev_status = 1
GROUP BY dom_url
ORDER BY sum_rev_rati... | You're not able to do calculations with aliases. One way of doing this would be to simply create another alias and order by that.
```
SELECT columns, count(table2.rev_id) As rev_count, sum(table2.rev_rating) As sum_rev_rating, sum(table2.rev_rating)/count(table2.rev_id) as avg_rev_rating
FROM table1
LEFT JOIN table2
O... |
190,253 | <p>I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.</p>
<p>I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the syntax is?</p>
<p>EDIT: The a... | [
{
"answer_id": 190255,
"author": "Xenph Yan",
"author_id": 264,
"author_profile": "https://Stackoverflow.com/users/264",
"pm_score": 9,
"selected": true,
"text": "<p>James Padolsey created a <a href=\"http://james.padolsey.com/javascript/regex-selector-for-jquery/\" rel=\"noreferrer\">wo... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5360/"
] | I am after documentation on using wildcard or regular expressions (not sure on the exact terminology) with a jQuery selector.
I have looked for this myself but have been unable to find information on the syntax and how to use it. Does anyone know where the documentation for the syntax is?
EDIT: The attribute filters ... | James Padolsey created a [wonderful filter](http://james.padolsey.com/javascript/regex-selector-for-jquery/) that allows regex to be used for selection.
Say you have the following `div`:
```
<div class="asdf">
```
Padolsey's `:regex` filter can select it like so:
```
$("div:regex(class, .*sd.*)")
```
Also, check... |
190,263 | <p>We are trying to look at optimizing our localization testing. </p>
<p>Our QA group had a suggestion of a special mode to force all strings from the resources to be entirely contained of X. We already API hijack LoadString, and the MFC implementation of it, so doing it should not be a major hurdle. </p>
<p>My quest... | [
{
"answer_id": 190316,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 0,
"selected": false,
"text": "<p>You can apply compiler theory here and generate your scanner and parser using <a href=\"http://dinosaur.compilertoo... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190263",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2387/"
] | We are trying to look at optimizing our localization testing.
Our QA group had a suggestion of a special mode to force all strings from the resources to be entirely contained of X. We already API hijack LoadString, and the MFC implementation of it, so doing it should not be a major hurdle.
My question is how would ... | If this approach is to highlight formatted strings (or format sequences) in the application (i.e. all text appearing other than XXXX), you could locate the escape sequence (using regex perhaps) and insert block quotes around the formatted (substituted) values,
e.g. Some\ntext -> Some[\n]text
You get readability (al... |
190,270 | <p>I just got a dedicated server from a hosting company, and for some reason, it didn't have IIS installed.
It did have .Net 2.0, though.</p>
<p>So I installed IIS, but now my ASP.net websites won't work.
I just get a 404, no event log entries, nothing...</p>
<p>I noticed in the redistributable package information th... | [
{
"answer_id": 190276,
"author": "WebDude",
"author_id": 15360,
"author_profile": "https://Stackoverflow.com/users/15360",
"pm_score": 5,
"selected": true,
"text": "<p>run from the command line</p>\n\n<pre><code>aspnet_regiis -i\n</code></pre>\n\n<p>You may have to navigate to the folder... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3314/"
] | I just got a dedicated server from a hosting company, and for some reason, it didn't have IIS installed.
It did have .Net 2.0, though.
So I installed IIS, but now my ASP.net websites won't work.
I just get a 404, no event log entries, nothing...
I noticed in the redistributable package information that:
"To access th... | run from the command line
```
aspnet_regiis -i
```
You may have to navigate to the folder it was installed.
Mine and the default is
```
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727
``` |
190,292 | <p>I'm currently working with PHPUnit to try and develop tests alongside what I'm writing, however, I'm currently working on writing the Session Manager, and am having issues doing so...</p>
<p>The constructor for the Session handling class is</p>
<pre><code>private function __construct()
{
if (!headers_sent())
... | [
{
"answer_id": 190307,
"author": "pilsetnieks",
"author_id": 6615,
"author_profile": "https://Stackoverflow.com/users/6615",
"pm_score": 0,
"selected": false,
"text": "<p>Can't you use output buffering before starting the test? If you buffer everything that is output, you shouldn't have ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20010/"
] | I'm currently working with PHPUnit to try and develop tests alongside what I'm writing, however, I'm currently working on writing the Session Manager, and am having issues doing so...
The constructor for the Session handling class is
```
private function __construct()
{
if (!headers_sent())
{
session_... | Well, your session manager is basically broken by design. To be able to test something, it must be possible to isolate it from side effects. Unfortunately, PHP is designed in such a way, that it encourages liberal use of global state (`echo`, `header`, `exit`, `session_start` etc. etc.).
The best thing you can do, is ... |
190,295 | <p>How do I test the concrete methods of an abstract class with PHPUnit?</p>
<p>I'd expect that I'd have to create some sort of object as part of the test. Though, I've no idea the best practice for this or if PHPUnit allows for this.</p>
| [
{
"answer_id": 284929,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Eran, your method should work, but it goes against the tendency of writing the test before the actual code.</p>\n\n<p>What ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20010/"
] | How do I test the concrete methods of an abstract class with PHPUnit?
I'd expect that I'd have to create some sort of object as part of the test. Though, I've no idea the best practice for this or if PHPUnit allows for this. | Unit testing of abstract classes doesn't necessary mean testing the interface, as abstract classes can have concrete methods, and this concrete methods can be tested.
It is not so uncommon, when writing some library code, to have certain base class that you expect to extend in your application layer. And if you want ... |
190,296 | <p>What are the best practices for modeling inheritance in databases?</p>
<p>What are the trade-offs (e.g. queriability)?</p>
<p>(I'm most interested in SQL Server and .NET, but I also want to understand how other platforms address this issue.)</p>
| [
{
"answer_id": 190300,
"author": "Per Hornshøj-Schierbeck",
"author_id": 11619,
"author_profile": "https://Stackoverflow.com/users/11619",
"pm_score": 1,
"selected": false,
"text": "<p>You would normalize of your database and that would actually mirror your inheritance.\nIt might have pe... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/73794/"
] | What are the best practices for modeling inheritance in databases?
What are the trade-offs (e.g. queriability)?
(I'm most interested in SQL Server and .NET, but I also want to understand how other platforms address this issue.) | There are several ways to model inheritance in a database. Which you choose depends on your needs. Here are a few options:
**Table-Per-Type (TPT)**
Each class has its own table. The base class has all the base class elements in it, and each class which derives from it has its own table, with a primary key which is al... |
190,335 | <p>This is my first Latex doc. Using Latex8.sty I'm trying to include a 5 column table. I've commented out everything but the introdution and the table. When I make the pdf it shows the introduction but no table. Any tips? </p>
<pre><code>\begin{tabular}{|ll||l|c|r|rr}
Mass&a1&a2&Fprime1&Fprime2\\
\h... | [
{
"answer_id": 190337,
"author": "PW.",
"author_id": 927,
"author_profile": "https://Stackoverflow.com/users/927",
"pm_score": 2,
"selected": true,
"text": "<p>with gnome, you have <a href=\"http://ekiga.org\" rel=\"nofollow noreferrer\">ekiga</a>. You can cross compile it for win32 too.... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is my first Latex doc. Using Latex8.sty I'm trying to include a 5 column table. I've commented out everything but the introdution and the table. When I make the pdf it shows the introduction but no table. Any tips?
```
\begin{tabular}{|ll||l|c|r|rr}
Mass&a1&a2&Fprime1&Fprime2\\
\hline
70g&0.988m/s^2&-2.79m/s^... | with gnome, you have [ekiga](http://ekiga.org). You can cross compile it for win32 too. It uses OPAL (Open Phone Abstraction Library) underneath. Maybe the tool itself will suit your needs, otherwise you can adapt it (OSS) or you can only keep low level API |
190,368 | <p>In Scala, is it possible to get the string representation of a type at runtime? I am trying to do something along these lines:</p>
<pre><code>def printTheNameOfThisType[T]() = {
println(T.toString)
}
</code></pre>
| [
{
"answer_id": 190574,
"author": "svrist",
"author_id": 86,
"author_profile": "https://Stackoverflow.com/users/86",
"pm_score": 4,
"selected": true,
"text": "<h1>Note: this answer is out of date!</h1>\n\n<p><em>Please see answer using TypeTag for Scala 2.10 and above</em></p>\n\n<p>May I... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10475/"
] | In Scala, is it possible to get the string representation of a type at runtime? I am trying to do something along these lines:
```
def printTheNameOfThisType[T]() = {
println(T.toString)
}
``` | Note: this answer is out of date!
=================================
*Please see answer using TypeTag for Scala 2.10 and above*
May I recommend #Scala on freenode
```
10:48 <seet_> http://stackoverflow.com/questions/190368/getting-the-string-representation-of-a-type-at-runtime-in-scala <-- isnt this posible?
10:48 <s... |
190,380 | <p>I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more?</p>
<p>For example, using the Collections API to store an integer I would do the following:</p>
<pr... | [
{
"answer_id": 190390,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>Use a structure.</p>\n\n<p>For example:</p>\n\n<pre><code>private struct Node\n{\n int Num1;\n int Num2;\n int Num... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14013/"
] | I am trying to store more than 1 data item at a single index in my linked-list. All of the examples in my textbook seem to illustrate adding only 1 piece of data per index. I'm assuming it is possible to add more?
For example, using the Collections API to store an integer I would do the following:
```
LinkedList <Int... | There seems to be a little confusion about how linked lists work. Essentially, a linked list is composed of nodes, each of which contains one datum (an object, which itself can contain several member variables, to be precise), and a link to the next node in the list (or a null pointer if there is no such next node). Yo... |
190,396 | <p>How do you use the <strong>CSS</strong> <code>content</code> property to add <strong>HTML</strong> entities?</p>
<p>Using something like this just prints <code>&nbsp;</code> to the screen instead of the non-breaking space:</p>
<pre class="lang-css prettyprint-override"><code>.breadcrumbs a:before {
content: '&... | [
{
"answer_id": 190406,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 5,
"selected": false,
"text": "<p>Use the hex code for a non-breaking space. Something like this:</p>\n<pre class=\"lang-css prettyprint-override\"><... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190396",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | How do you use the **CSS** `content` property to add **HTML** entities?
Using something like this just prints ` ` to the screen instead of the non-breaking space:
```css
.breadcrumbs a:before {
content: ' ';
}
``` | You have to use the escaped unicode :
Like
```css
.breadcrumbs a:before {
content: '\0000a0';
}
```
More info on : <http://www.evotech.net/blog/2007/04/named-html-entities-in-numeric-order/> |
190,421 | <p>Is there a PHP function to find out the name of the caller function in a given function?</p>
| [
{
"answer_id": 190425,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 4,
"selected": false,
"text": "<p><a href=\"http://www.php.net/debug_backtrace\" rel=\"nofollow noreferrer\"><code>debug_backtrace()</code></a... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a PHP function to find out the name of the caller function in a given function? | See [debug\_backtrace](http://php.net/manual/en/function.debug-backtrace.php) - this can trace your call stack all the way to the top.
Here's how you'd get your caller:
```
$trace = debug_backtrace();
$caller = $trace[1];
echo "Called by {$caller['function']}";
if (isset($caller['class']))
echo " in {$caller['cl... |
190,431 | <p>My motivation for trying out git-svn is the effortless merging and branching. Then I noticed that man git-svn(1) says: </p>
<blockquote>
<p>Running git-merge or git-pull is NOT recommended on a branch you plan
to dcommit from. Subversion does not represent merges in any
reasonable or useful fashion; so users ... | [
{
"answer_id": 190447,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 6,
"selected": false,
"text": "<p>Creating local branches is definitely possible with git-svn. As long as you're just using local branches for yourself,... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5179/"
] | My motivation for trying out git-svn is the effortless merging and branching. Then I noticed that man git-svn(1) says:
>
> Running git-merge or git-pull is NOT recommended on a branch you plan
> to dcommit from. Subversion does not represent merges in any
> reasonable or useful fashion; so users using Subversion c... | Actually, I found an even better way with the `--no-ff` option on git merge.
All this squash technic I used before is no longer required.
My new workflow is now as follows:
* I have a "master" branch that is the only branch that I dcommit from and that clone the SVN repository (`-s` assume you have a standard SVN l... |
190,450 | <p>Up until recently, I've been storing multiple values into different hashes with the same keys as follows:</p>
<pre><code>%boss = (
"Allan" => "George",
"Bob" => "George",
"George" => "lisa" );
%status = (
"Allan" => "Contractor",
"Bob" => "Part-time",
"George" => "... | [
{
"answer_id": 190467,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 6,
"selected": true,
"text": "<p>This is the standard way, as per <a href=\"http://perldoc.perl.org/perldsc.html\" rel=\"noreferrer\" title=\"Perl ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14860/"
] | Up until recently, I've been storing multiple values into different hashes with the same keys as follows:
```
%boss = (
"Allan" => "George",
"Bob" => "George",
"George" => "lisa" );
%status = (
"Allan" => "Contractor",
"Bob" => "Part-time",
"George" => "Full-time" );
```
and then I c... | This is the standard way, as per [perldoc perldsc](http://perldoc.perl.org/perldsc.html "Perl Data Structure Cookbook").
```
~> more test.pl
%chums = ( "Allan" => {"Boss" => "George", "Status" => "Contractor"},
"Bob" => {"Boss" => "Peter", "Status" => "Part-time"} );
print $chums{"Allan"}{"Boss"}."\n";
pri... |
190,476 | <p>I have those maps in my repository. </p>
<pre><code>public IQueryable<AwType> GetAwTypes()
{
return from awt in _db.AwTypes
select new AwType
{
Id = awt.Id,
Header = awt.Header,
Description = awt.Description
};
}
public IQuerya... | [
{
"answer_id": 190487,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 0,
"selected": false,
"text": "<p>You can group by an anonymous type, eg new { Foo, Bar }</p>\n"
},
{
"answer_id": 198446,
"author": "Amy B",
... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11374/"
] | I have those maps in my repository.
```
public IQueryable<AwType> GetAwTypes()
{
return from awt in _db.AwTypes
select new AwType
{
Id = awt.Id,
Header = awt.Header,
Description = awt.Description
};
}
public IQueryable<Aw> GetAws()
{
... | AwType is a reference type. It would be a bad idea to group on that reference type... Each AwType in that query is a unique reference, so n elements would yield n groups.
Try this:
```
var awGroups = from aw in _repository.GetAws()
group aw by aw.AwType.ID into newGroup //changed to group on ID
select newGroup;
Lis... |
190,480 | <p>How to to configure apache + mod_lisp + clisp and set up a "Hello World!"? I couldn't find any complete howto on the subject. Thanks.</p>
<p>Edit: Vebjorn's solution works, but then I don't how to code the "hello world!". Can anyone tell me how to proceed? There's something like SWANKing the clisp, then connect to ... | [
{
"answer_id": 190533,
"author": "ConroyP",
"author_id": 2287,
"author_profile": "https://Stackoverflow.com/users/2287",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.newartisans.com/blog_files/common.lisp.with.apache.php\" rel=\"nofollow noreferrer\">This article</a... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26416/"
] | How to to configure apache + mod\_lisp + clisp and set up a "Hello World!"? I couldn't find any complete howto on the subject. Thanks.
Edit: Vebjorn's solution works, but then I don't how to code the "hello world!". Can anyone tell me how to proceed? There's something like SWANKing the clisp, then connect to it with S... | 1. Download <http://www.fractalconcept.com:8000/public/open-source/mod_lisp/mod_lisp.c>
* Compile and install Apache module with `sudo apxs -i -c mod_lisp.c`
* Add the following to your `httpd.conf`:
```
LoadModule lisp_module libexec/httpd/mod_lisp.so
AddModule mod_lisp.c
LispServer 127.0.0.1 3000 "foo"
<Loca... |
190,493 | <p>I am trying to figure out how to add a custom control to the iPhone MoviePlayer.
For an example of what I am trying to do see the following image.</p>
<p><img src="https://i.stack.imgur.com/Zt5MG.jpg" alt="alt text"></p>
<p>I am trying to add something like the controls on the right and left of the basic movie con... | [
{
"answer_id": 191266,
"author": "Martin Gordon",
"author_id": 2481,
"author_profile": "https://Stackoverflow.com/users/2481",
"pm_score": 3,
"selected": false,
"text": "<p><a href=\"http://developer.apple.com/iphone/library/samplecode/MoviePlayer_iPhone/index.html\" rel=\"noreferrer\">T... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26728/"
] | I am trying to figure out how to add a custom control to the iPhone MoviePlayer.
For an example of what I am trying to do see the following image.

I am trying to add something like the controls on the right and left of the basic movie controls.
I had done this in the ... | I found the BEST way to do this!
You create your movie player like normal and then do the following:
```
id vvController = [theMovie videoViewController];
[[vvController _overlayView] addSubview:mainView];
```
Where 'mainView' is your custom overlay. Doing this makes it so your custom overlay will show and hide wit... |
190,524 | <p>I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to use this property in a lambda expression or in general in a query it either throws ... | [
{
"answer_id": 190655,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "<p>When accessed individually, I suspect that having a query that returns IQueryable would work - however, I expect th... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26746/"
] | I have created some extra functionality on my Linq-to-SQL classes to make things easier as I develop my applications. For example I have defined a property that retrieves active contracts from a list of contracts. However if I try to use this property in a lambda expression or in general in a query it either throws an ... | When accessed individually, I suspect that having a query that returns IQueryable would work - however, I expect that when this is part of a larger Expression, the expression interpreter will complain (which seems like what you are describing).
However, I suspect that you might be able to break it down a bit. Try addi... |
190,525 | <p>I'm not sure how familiar people are with the hobbit monitoring system - <a href="http://hobbitmon.sourceforge.net/" rel="nofollow noreferrer">http://hobbitmon.sourceforge.net/</a> - but I've got a tricky question.</p>
<p>I've got a custom test, which returns two NCV values. One value normally returns ~300 millisec... | [
{
"answer_id": 190655,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "<p>When accessed individually, I suspect that having a query that returns IQueryable would work - however, I expect th... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18673/"
] | I'm not sure how familiar people are with the hobbit monitoring system - <http://hobbitmon.sourceforge.net/> - but I've got a tricky question.
I've got a custom test, which returns two NCV values. One value normally returns ~300 milliseconds, the other one returns 500 000 euro. Obviously, these two values don't graph ... | When accessed individually, I suspect that having a query that returns IQueryable would work - however, I expect that when this is part of a larger Expression, the expression interpreter will complain (which seems like what you are describing).
However, I suspect that you might be able to break it down a bit. Try addi... |
190,542 | <p>I'm using Java for accessing Alfresco content server via it's web service API for importing some content into it. Content should have some NamedValue properties set to UTF-8(cyrillic) string. I keep getting the Sax parser exception:</p>
<pre><code>org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x... | [
{
"answer_id": 196300,
"author": "Damien B",
"author_id": 3069,
"author_profile": "https://Stackoverflow.com/users/3069",
"pm_score": 0,
"selected": false,
"text": "<p>The easiest way to get around it is I think to escape cyrillicString, for instance with <a href=\"http://commons.apache.... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26747/"
] | I'm using Java for accessing Alfresco content server via it's web service API for importing some content into it. Content should have some NamedValue properties set to UTF-8(cyrillic) string. I keep getting the Sax parser exception:
```
org.xml.sax.SAXParseException: An invalid XML character (Unicode: 0x1b) was found ... | The problem was that `alfresco-web-service-client.jar` library I used was from 2.9B distribution (I am hitting 2.9B community content server), and dependency libs `bcprov-jdk15-136.jar` and `xmlsec-1.4.0.jar` were not adequate (remained old from 2.1 verison). I should have used `bcprov-jdk15-137.jar` and `xmlsec-1.4.1.... |
190,553 | <p>In the following code, both <code>amp_swap()</code> and <code>star_swap()</code> seems to be doing the same thing. So why will someone prefer to use one over the other? Which one is the preferred notation and why? Or is it just a matter of taste?</p>
<pre><code>#include <iostream>
using namespace std;
void ... | [
{
"answer_id": 190563,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>They are the exact same thing to the computer. However, one is a reference (&) and the other is a pointer (*)</p>\n\n<p... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7205/"
] | In the following code, both `amp_swap()` and `star_swap()` seems to be doing the same thing. So why will someone prefer to use one over the other? Which one is the preferred notation and why? Or is it just a matter of taste?
```
#include <iostream>
using namespace std;
void amp_swap(int &x, int &y)
{
int temp = ... | One is using a reference, one is using a pointer.
I would use the one with references, because you can't pass a NULL reference (whereas you can pass a NULL pointer).
So if you do:
```
star_swap(NULL, NULL);
```
Your application will crash. Whereas if you try:
```
amp_swap(NULL, NULL); // This won't compile
```
... |
190,560 | <p>I am trying to animate a change in backgroundColor using jQuery on mouseover.</p>
<p>I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error.
The element I am working with is a div.</p>
<pre><code>$(".user... | [
{
"answer_id": 330133,
"author": "Donny V.",
"author_id": 1231,
"author_profile": "https://Stackoverflow.com/users/1231",
"pm_score": 4,
"selected": false,
"text": "<p>For anyone finding this. Your better off using the jQuery UI version because it works on all browsers. The color plugin ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6125/"
] | I am trying to animate a change in backgroundColor using jQuery on mouseover.
I have checked some example and I seem to have it right, it works with other properties like fontSize, but with backgroundColor I get and "Invalid Property" js error.
The element I am working with is a div.
```
$(".usercontent").mouseover(f... | The color plugin is only 4kb so much cheaper than the UI library. Of course you'll want to use a [decent version](http://github.com/jquery/jquery-color) of the plugin and not [some buggy old thing](http://plugins.jquery.com/project/color) which doesn't handle Safari and crashes when the transitions are too fast. Since ... |
190,590 | <p>Ruby has a wealth of conditional constructs, including <code>if</code>/<code>unless</code>, <code>while</code>/<code>until</code> etc.</p>
<p>The <code>while</code> block from C:</p>
<pre><code>while (condition) {
...
}
</code></pre>
<p>can be directly translated to Ruby:</p>
<pre><code>while condition
... | [
{
"answer_id": 190591,
"author": "Cristian Diaconescu",
"author_id": 11545,
"author_profile": "https://Stackoverflow.com/users/11545",
"pm_score": 6,
"selected": true,
"text": "<p>...The best I could come up with is the <code>loop</code> construct with a <code>break</code> at the end: </... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11545/"
] | Ruby has a wealth of conditional constructs, including `if`/`unless`, `while`/`until` etc.
The `while` block from C:
```
while (condition) {
...
}
```
can be directly translated to Ruby:
```
while condition
...
end
```
However, I can't seem to find a *built-in* equivalent in Ruby for a C-like `do ... wh... | ...The best I could come up with is the `loop` construct with a `break` at the end:
```
loop do
...
break unless condition
end
``` |
190,597 | <p>Say I have class A with</p>
<pre><code>class A {
final String foo() {
// .. computing result, contacting database, whatever ..
return "some computed value";
}
// ... and a bazillion other methods, some of them final.
}
</code></pre>
<p>Now I have class B with</p>
<pre><code>class B {
String method... | [
{
"answer_id": 190611,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 0,
"selected": false,
"text": "<p>I'd remove the \"final\" and just put in a comment \"Don't override this method!!\". If you can't trust coworkers n... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6583/"
] | Say I have class A with
```
class A {
final String foo() {
// .. computing result, contacting database, whatever ..
return "some computed value";
}
// ... and a bazillion other methods, some of them final.
}
```
Now I have class B with
```
class B {
String methodIWantToTest(A a) {
String outpu... | You can try the [JMockit](http://jmockit.org) mocking library. |
190,598 | <p>Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) * sizeof(char) . Sizeof(char) currently being 2. </p>
<p>What I am interested in is whether anyone knows of a way which on a characte... | [
{
"answer_id": 190604,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": true,
"text": "<p>You could check the value of the character:</p>\n\n<pre><code>if ord(c) < 128 then\n // is an ascii character\n</... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190598",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6244/"
] | Delphi 2009 has changed its string type to use 2 bytes to represent a character, which allows support for unicode char sets. Now when you get sizeof(string) you get length(String) \* sizeof(char) . Sizeof(char) currently being 2.
What I am interested in is whether anyone knows of a way which on a character by charact... | You could check the value of the character:
```
if ord(c) < 128 then
// is an ascii character
``` |
190,625 | <p>I have created the following stored procedure..</p>
<pre><code>CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP]
(
@CODE CHAR(5)
, @DESC VARCHAR(255) OUTPUT
)
AS
DECLARE @SERVERNAME nvarchar(30)
DECLARE @DBASE nvarchar(30)
DECLARE @SQL nvarchar(2000)
SET @SERVERNAME =
Convert(nvarchar,
(SELECT spData FRO... | [
{
"answer_id": 190648,
"author": "tpower",
"author_id": 18107,
"author_profile": "https://Stackoverflow.com/users/18107",
"pm_score": 0,
"selected": false,
"text": "<p>You can create a function (instead of a procedure) that returns a table.</p>\n\n<pre><code>CREATE FUNCTION [dbo].[my_fun... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/978/"
] | I have created the following stored procedure..
```
CREATE PROCEDURE [dbo].[UDSPRBHPRIMBUSTYPESTARTUP]
(
@CODE CHAR(5)
, @DESC VARCHAR(255) OUTPUT
)
AS
DECLARE @SERVERNAME nvarchar(30)
DECLARE @DBASE nvarchar(30)
DECLARE @SQL nvarchar(2000)
SET @SERVERNAME =
Convert(nvarchar,
(SELECT spData FROM dbSpecificDa... | Change the line:
```
SET @myDesc =
EXEC UDSPRBHPRIMBUSTYPESTARTUP @CODE = @myCode, @DESC = @@tempDesc OUTPUT
```
to
```
EXEC UDSPRBHPRIMBUSTYPESTARTUP @CODE = @myCode, @DESC = @tempDesc OUTPUT
```
And you have missed assigning `@DESC` in the stored procedure.
```
SET @SQL =
'SELECT @DESC = clnt_cat_desc FR... |
190,629 | <p>I am writing a drop-in replacement for a legacy application in Java. One of the requirements is that the ini files that the older application used have to be read as-is into the new Java Application. The format of this ini files is the common windows style, with header sections and key=value pairs, using # as the ... | [
{
"answer_id": 190633,
"author": "Mario Ortegón",
"author_id": 2309,
"author_profile": "https://Stackoverflow.com/users/2309",
"pm_score": 8,
"selected": true,
"text": "<p>The library I've used is <a href=\"http://ini4j.sourceforge.net/\" rel=\"noreferrer\">ini4j</a>. It is lightweight ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2309/"
] | I am writing a drop-in replacement for a legacy application in Java. One of the requirements is that the ini files that the older application used have to be read as-is into the new Java Application. The format of this ini files is the common windows style, with header sections and key=value pairs, using # as the chara... | The library I've used is [ini4j](http://ini4j.sourceforge.net/). It is lightweight and parses the ini files with ease. Also it uses no esoteric dependencies to 10,000 other jar files, as one of the design goals was to use only the standard Java API
This is an example on how the library is used:
```
Ini ini = new Ini(... |
190,642 | <p>The code below crashes IE6 for some reason. Much as IE is god-awful, i have never seen this before. Does anyone have any ideas?</p>
<pre><code><div id="edit">
<?php
$a = $_POST['category'];
if ($a == "")
{
$a = $_GET['category'];
}
$result = mysql_query("SELECT * FROM media WHERE related_page_id = $... | [
{
"answer_id": 190657,
"author": "Rimas Kudelis",
"author_id": 25804,
"author_profile": "https://Stackoverflow.com/users/25804",
"pm_score": 0,
"selected": false,
"text": "<p>The generated code doesn't crash IE6 for me. It could probably be one of your stylesheets or javascript though, o... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The code below crashes IE6 for some reason. Much as IE is god-awful, i have never seen this before. Does anyone have any ideas?
```
<div id="edit">
<?php
$a = $_POST['category'];
if ($a == "")
{
$a = $_GET['category'];
}
$result = mysql_query("SELECT * FROM media WHERE related_page_id = $a && type= 'copy'");
?... | I don't know if it's the reason for the crash, but the `td` tag in the line
```
echo "<td><a href='addimage.php?id=$row[id]&&category=$a'>Add image/file</a>";
```
is not closed. Also:
```
</div>
</div>
</div>
</table>
```
should be:
```
</table>
</div>
</div>
</div>
```
Furthermore - for security reasons - che... |
190,667 | <p>I'm using a CListCtrl control to display information in my MFC app. At the moment I have LVS_EX_CHECKBOXES set in SetExtendedStyle so all rows in the control have a checkbox next to them. What I would like however is that only some of the rows in the control have checkboxes. Is this possible ? If it is how is this d... | [
{
"answer_id": 190684,
"author": "David L Morris",
"author_id": 3137,
"author_profile": "https://Stackoverflow.com/users/3137",
"pm_score": 0,
"selected": false,
"text": "<p>Yes it is. What you would need to do is to create bitmaps of the check boxes and included those in the call back.... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3875/"
] | I'm using a CListCtrl control to display information in my MFC app. At the moment I have LVS\_EX\_CHECKBOXES set in SetExtendedStyle so all rows in the control have a checkbox next to them. What I would like however is that only some of the rows in the control have checkboxes. Is this possible ? If it is how is this do... | For each item which shouldn't have a checkbox:
```
LVITEM lvi;
lvi.stateMask = LVIS_STATEIMAGEMASK;
lvi.state = INDEXTOSTATEIMAGEMASK(0);
::SendMessage(m_hWnd, LVM_SETITEMSTATE, nItem, (LPARAM)&lvi);
```
To 'create' the check box for an item:
```
SetCheck(Item, true/false);
``` |
190,685 | <p>I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception:</p>
<pre><code>UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied."
</code></pre>
<p>I've been advised to use <a href="http://technet.microsoft.com/en-us/sysinternals/bb8... | [
{
"answer_id": 190763,
"author": "Samuel Kim",
"author_id": 437435,
"author_profile": "https://Stackoverflow.com/users/437435",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure why you would want to use Process Monitor for access problem in file system.</p>\n\n<p>Check that the dir... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] | I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception:
```
UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied."
```
I've been advised to use [Process Monitor](http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) to he... | When PM starts it displays a filter dialog. Just click 'Reset' to use the standard filtering. This will generate lots of messages, and you are only interested in very few of them. Under *Process Name*, select a line with the process you want to monitor. Richtclick it and choose *include* . That limits the reported even... |
190,691 | <p>I'm working with dRuby and basicly I'm calling a remote method that returns me an object.</p>
<p>In the clientside I have this code:</p>
<pre><code>handle_error(response) if response.is_a?(Error)
</code></pre>
<p>where response is the DRbObject. (I've developed this code before using dRuby and I'm returning an Er... | [
{
"answer_id": 195616,
"author": "Federico Builes",
"author_id": 161,
"author_profile": "https://Stackoverflow.com/users/161",
"pm_score": 2,
"selected": false,
"text": "<p>Although I'm not sure how DRb manages the remote objects, I'd expect it to modify #kind_of? to keep the class hie... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22083/"
] | I'm working with dRuby and basicly I'm calling a remote method that returns me an object.
In the clientside I have this code:
```
handle_error(response) if response.is_a?(Error)
```
where response is the DRbObject. (I've developed this code before using dRuby and I'm returning an Error object if something went wron... | Although I'm not sure how DRb manages the remote objects, I'd expect it to modify #kind\_of? to keep the class hierarchy on the remote object, so you could do:
```
response.kind_of?(Error)
```
If this doesn't work you can always ask it if it responds to an specific method and go from there
```
response.respond_to?(... |
190,701 | <p>I'm writing a small article on humanly readable alternatives to Guids/UIDs, for example those used on TinyURL for the url hashes (which are often printed in magazines, so need to be short).</p>
<p>The simple uid I'm generating is - 6 characters: either a lowercase letter (a-z) or 0-9. </p>
<p>"According to my calc... | [
{
"answer_id": 190715,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 3,
"selected": false,
"text": "<p>Look up the <a href=\"http://en.wikipedia.org/wiki/Birthday_paradox\" rel=\"nofollow noreferrer\">Birthday Paradox</a>... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21574/"
] | I'm writing a small article on humanly readable alternatives to Guids/UIDs, for example those used on TinyURL for the url hashes (which are often printed in magazines, so need to be short).
The simple uid I'm generating is - 6 characters: either a lowercase letter (a-z) or 0-9.
"According to my calculations captain"... | The probability of a collision against one specific ID is:
```
p = ( 0.5 * ( (0.5*1/10) + (0.5*1/26) ) )^6
```
which is around 1.7×10^-9.
The probability of a collision after generating n IDs is 1-p^n, so you'll have roughly a 0.17% chance of a collision for each new insertion after 1 million IDs have been inserte... |
190,702 | <p>Given this data set:</p>
<pre><code>ID Name City Birthyear
1 Egon Spengler New York 1957
2 Mac Taylor New York 1955
3 Sarah Connor Los Angeles 1959
4 Jean-Luc Picard La Barre 2305
5 Ellen Ripley Nostromo 2092
6 James T. Kirk Riverside... | [
{
"answer_id": 190735,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "<p>Something like that?</p>\n\n<pre><code>SELECT\n Id, Name, City, Birthyear\nFROM\n TheTable\nWHERE\n Id IN (SELECT TO... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/999/"
] | Given this data set:
```
ID Name City Birthyear
1 Egon Spengler New York 1957
2 Mac Taylor New York 1955
3 Sarah Connor Los Angeles 1959
4 Jean-Luc Picard La Barre 2305
5 Ellen Ripley Nostromo 2092
6 James T. Kirk Riverside 2233
7 ... | Probably not the most elegant of solutions, and the performance of `IN` may suffer on larger tables.
The nested query gets the minimum `Birthyear` for each city. Only records who have this `Birthyear` are matched in the outer query. Ordering by age then limiting to 3 results gets you the 3 oldest people who are also t... |
190,714 | <p>I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects.</p>
<p>Do I need to worry about the String Constant Pool for memory and performance?</p>
<p>Is there any way to see how big the pool is at any point?</p>
| [
{
"answer_id": 190723,
"author": "C. K. Young",
"author_id": 13,
"author_profile": "https://Stackoverflow.com/users/13",
"pm_score": 1,
"selected": false,
"text": "<p>I think you should profile your application, both with and without interning. You will then see exactly what the effect i... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2362/"
] | I have a Java application that's very String-heavy - it takes a feed of huge numbers of big, different String objects.
Do I need to worry about the String Constant Pool for memory and performance?
Is there any way to see how big the pool is at any point? | As Mario said, the constant pool is only relevant to intern()ed Strings, and to Strings that are constants in java code (these are implicitly interned).
But there is one more caveat that might apply to your case:
The `substring()` method will share the underlying `char[]` with the
original String. So the pattern
```... |
190,738 | <p>With the following piece of code:</p>
<pre><code>typedef struct
{
char fileName[ 1024];
time_t deleteTime;
} file_item_t;
....
....
setEntry(char *fileName)
{
file_item_t file;
memset( &file, 0x00, sizeof( file_item_t ));
memcpy( file.fileName,
fileName,
size... | [
{
"answer_id": 190744,
"author": "Timbo",
"author_id": 1810,
"author_profile": "https://Stackoverflow.com/users/1810",
"pm_score": 1,
"selected": false,
"text": "<p>Are you sure the string pointed to by <code>fileName</code> is really 1024 bytes in length? It somehow feels to me you shou... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | With the following piece of code:
```
typedef struct
{
char fileName[ 1024];
time_t deleteTime;
} file_item_t;
....
....
setEntry(char *fileName)
{
file_item_t file;
memset( &file, 0x00, sizeof( file_item_t ));
memcpy( file.fileName,
fileName,
sizeof( file.fileName ... | You already hit the nail on the head:
In your memcpy you're reading past the length of filename.
Also dirty that will often work if the memory behind the filename is readable. In most cases it is, but if you for example pass a string-literal as an argument, and the linker puts the string into the last kilobyte of th... |
190,740 | <p>I thought I understood what the default method does to a hash... </p>
<p>Give a default value for a key if it doesn't exist:</p>
<pre><code>irb(main):001:0> a = {}
=> {}
irb(main):002:0> a.default = 4
=> 4
irb(main):003:0> a[8]
=> 4
irb(main):004:0> a[9] += 1
=> 5
irb(main):005:0> a
=>... | [
{
"answer_id": 190801,
"author": "Aaron Hinni",
"author_id": 12086,
"author_profile": "https://Stackoverflow.com/users/12086",
"pm_score": 7,
"selected": true,
"text": "<p><code>Hash.default</code> is used to set the default value <strong>returned</strong> when you query a key that doesn... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26094/"
] | I thought I understood what the default method does to a hash...
Give a default value for a key if it doesn't exist:
```
irb(main):001:0> a = {}
=> {}
irb(main):002:0> a.default = 4
=> 4
irb(main):003:0> a[8]
=> 4
irb(main):004:0> a[9] += 1
=> 5
irb(main):005:0> a
=> {9=>5}
```
All good.
But if I set the default ... | `Hash.default` is used to set the default value **returned** when you query a key that doesn't exist. An entry in the collection is not created for you, just because queried it.
Also, the value you set `default` to is an instance of an object (an Array in your case), so when this is returned, it can be manipulated.
`... |
190,748 | <p>You can, obviously, put a variable declaration in a for loop:</p>
<pre><code>for (int i = 0; ...
</code></pre>
<p>and I've noticed that you can do the same thing in if and switch statements as well:</p>
<pre><code>if ((int i = f()) != 0) ...
switch (int ch = stream.get()) ...
</code></pre>
<p>But when I try to ... | [
{
"answer_id": 190753,
"author": "RB.",
"author_id": 15393,
"author_profile": "https://Stackoverflow.com/users/15393",
"pm_score": 2,
"selected": false,
"text": "<p>It might be because the contents of the while clause are evaluated each loop, thus it would try and declare \"ch\" multiple... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4086/"
] | You can, obviously, put a variable declaration in a for loop:
```
for (int i = 0; ...
```
and I've noticed that you can do the same thing in if and switch statements as well:
```
if ((int i = f()) != 0) ...
switch (int ch = stream.get()) ...
```
But when I try to do the same thing in a while loop:
```
while ((i... | The grammar for a condition in the '03 standard is defined as follows:
```
condition:
expression
type-specifier-seq declarator = assignment-expression
```
The above will therefore only allow conditions such as:
```
if ( i && j && k ) {}
if ( (i = j) ==0 ) {}
if ( int i = j ) {}
```
The standard allows the con... |
190,755 | <p>Any suggestion how I can document my Perl code? What do you use and what tools are available to help me?</p>
<p>Which module do you use to convert pod to html?</p>
| [
{
"answer_id": 190774,
"author": "GavinCattell",
"author_id": 21644,
"author_profile": "https://Stackoverflow.com/users/21644",
"pm_score": 4,
"selected": false,
"text": "<p><a href=\"http://perldoc.perl.org/perlpod.html\" rel=\"nofollow noreferrer\">Perl pod</a>.</p>\n\n<p>This is how M... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10523/"
] | Any suggestion how I can document my Perl code? What do you use and what tools are available to help me?
Which module do you use to convert pod to html? | Look inside almost any Perl module and you'll see the [Plain Old Documentation (POD)](http://perldoc.perl.org/perlpod.html) format. On [CPAN Search](http://search.cpan.org), when looking at a module you have the option of viewing the raw source, so that's one way you can look at the raw pod, but you can also use [perld... |
190,776 | <p>How do you build and use dynamic sql in a MySQL stored procedure?</p>
| [
{
"answer_id": 190962,
"author": "Jason Stevenson",
"author_id": 13368,
"author_profile": "https://Stackoverflow.com/users/13368",
"pm_score": 7,
"selected": true,
"text": "<p>I don't believe MySQL supports dynamic sql. You can do "prepared" statements which is similar, but di... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3747/"
] | How do you build and use dynamic sql in a MySQL stored procedure? | I don't believe MySQL supports dynamic sql. You can do "prepared" statements which is similar, but different.
Here is an example:
```
mysql> PREPARE stmt FROM
-> 'select count(*)
-> from information_schema.schemata
-> where schema_name = ? or schema_name = ?'
;
Query OK, 0 rows affected (0.00 sec)
Stat... |
190,809 | <p>I am trying to use cvs annotate. This is the what I run:</p>
<pre><code>cvs -d /mycvs/cvsroot/ annotate "projects/dg/SomeClass.java"
</code></pre>
<p>However, I get the following error:</p>
<pre><code>cvs annotate: failed to create lock directory for `/mycvs/cvsroot/projects/dg^M' (/mycvs/cvsroot/projects/dg^M/#c... | [
{
"answer_id": 190821,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 1,
"selected": false,
"text": "<p>From your description, I would guess that you've got it right with the stray ^M. What OS are you using? If Windows, ar... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17876/"
] | I am trying to use cvs annotate. This is the what I run:
```
cvs -d /mycvs/cvsroot/ annotate "projects/dg/SomeClass.java"
```
However, I get the following error:
```
cvs annotate: failed to create lock directory for `/mycvs/cvsroot/projects/dg^M' (/mycvs/cvsroot/projects/dg^M/#cvs.lock): No such file or directory
c... | From your description, I would guess that you've got it right with the stray ^M. What OS are you using? If Windows, are you using cygwin? I see you're using direct filesystem access to the repository. Might you consider setting up a server access mechanism like pserver to see if that helps? |
190,818 | <p>I want to create an <code>NSOpenPanel</code> that can select any kind of file, so I do this</p>
<pre><code>NSOpenPanel* panel = [NSOpenPanel openPanel];
if([panel runModalForTypes:nil] == NSOKButton) {
// process files here
}
</code></pre>
<p>which lets me select all files <em>except</em> symbolic links.<b... | [
{
"answer_id": 191978,
"author": "Mecki",
"author_id": 15809,
"author_profile": "https://Stackoverflow.com/users/15809",
"pm_score": 1,
"selected": false,
"text": "<p>I cannot reproduce this. I just tried it and it works just fine. If symlink points to a directory, it shows the directory... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22147/"
] | I want to create an `NSOpenPanel` that can select any kind of file, so I do this
```
NSOpenPanel* panel = [NSOpenPanel openPanel];
if([panel runModalForTypes:nil] == NSOKButton) {
// process files here
}
```
which lets me select all files *except* symbolic links.
They're simply not selectable and the obvi... | I cannot reproduce this. I just tried it and it works just fine. If symlink points to a directory, it shows the directory content when I select the symlink and if the symlink points to a file, I can select it as well.
Of course if the symlink points to a directory, you can only select it if choosing directories is all... |
190,852 | <p>See code: </p>
<pre><code>var file1 = "50.xsl";
var file2 = "30.doc";
getFileExtension(file1); //returns xsl
getFileExtension(file2); //returns doc
function getFileExtension(filename) {
/*TODO*/
}
</code></pre>
| [
{
"answer_id": 190864,
"author": "p4bl0",
"author_id": 12043,
"author_profile": "https://Stackoverflow.com/users/12043",
"pm_score": 2,
"selected": false,
"text": "<pre><code>return filename.replace(/\\.([a-zA-Z0-9]+)$/, \"$1\");\n</code></pre>\n\n<p>edit: Strangely (or maybe it's not) t... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] | See code:
```
var file1 = "50.xsl";
var file2 = "30.doc";
getFileExtension(file1); //returns xsl
getFileExtension(file2); //returns doc
function getFileExtension(filename) {
/*TODO*/
}
``` | **Newer Edit:** Lots of things have changed since this question was initially posted - there's a lot of really good information in [wallacer's revised answer](https://stackoverflow.com/a/1203361/23746) as well as [VisioN's excellent breakdown](https://stackoverflow.com/a/12900504/23746)
---
**Edit:** Just because thi... |
190,867 | <p>Is it possible to have multiple view of the same display object? (e.g. same-computer multi-player game using split screen)</p>
<p>The sample code that failed to work follows:</p>
<pre><code> var content: Sprite = new Sprite();
var v1: Sprite = new Sprite();
var v2: Sprite = new Sprite();
with(conte... | [
{
"answer_id": 191398,
"author": "Antti",
"author_id": 6037,
"author_profile": "https://Stackoverflow.com/users/6037",
"pm_score": 3,
"selected": true,
"text": "<p>The easiest way to do this is to have a bitmap that's updated with the original display object's contents, something like:</... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190867",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11238/"
] | Is it possible to have multiple view of the same display object? (e.g. same-computer multi-player game using split screen)
The sample code that failed to work follows:
```
var content: Sprite = new Sprite();
var v1: Sprite = new Sprite();
var v2: Sprite = new Sprite();
with(content.graphics) {
... | The easiest way to do this is to have a bitmap that's updated with the original display object's contents, something like:
```
var bitmap:Bitmap = new Bitmap(new BitmapData(1,1));
addChild(bitmap);
addEventListener(Event.ENTER_FRAME,enterFrameHandler);
function enterFrameHandler(event:Event):void {
bitmap.bitma... |
190,876 | <p>I have a few combo-boxes and double spin boxes on my Qt Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box).</p>
<p>How do i get it. Is there some way I can have a custom menu that comes up on right click or Is there a way i can add items to... | [
{
"answer_id": 190895,
"author": "PierreBdR",
"author_id": 7136,
"author_profile": "https://Stackoverflow.com/users/7136",
"pm_score": 4,
"selected": true,
"text": "<p>First, for Qt4, the simplest way is to create an action to reset the data, and add it the the widget using the <code>add... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11212/"
] | I have a few combo-boxes and double spin boxes on my Qt Dialog. Now I need a "ResetToDefault" item on a menu that comes up when you right click on the widget (spin box or combo box).
How do i get it. Is there some way I can have a custom menu that comes up on right click or Is there a way i can add items to the menu t... | First, for Qt4, the simplest way is to create an action to reset the data, and add it the the widget using the `addAction` method (or use the designer). Then, set the `contextMenuPolicy` attribute to `Qt::ActionsContextMenu`. The context menu will appear and the action will be triggered.
Code example:
```
QAction *re... |
190,908 | <p>When you tap a row in a <code>UITableView</code>, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing?</p>
| [
{
"answer_id": 191245,
"author": "Martin Gordon",
"author_id": 2481,
"author_profile": "https://Stackoverflow.com/users/2481",
"pm_score": 11,
"selected": false,
"text": "<p>All you have to do is set the selection style on the <code>UITableViewCell</code> instance using either:</p>\n\n<p... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2183/"
] | When you tap a row in a `UITableView`, the row is highlighted and selected. Is it possible to disable this so tapping a row does nothing? | For me, the following worked fine:
```
tableView.allowsSelection = false
```
This means `didSelectRowAt#` simply won't work. That is to say, touching a row of the table, as such, will do absolutely nothing. (And hence, obviously, there will never be a selected-animation.)
(Note that if, on the cells, you have `UIBu... |
190,914 | <p>I have a DataGridView which shows the content of a DataTable.</p>
<p>I want to set the backcolor of a row based on the value of a cell in this row.</p>
<p>Note that the cell in question is in a column which is not displayed in the DataGridView (Visible=False).</p>
| [
{
"answer_id": 190932,
"author": "Jason Stevenson",
"author_id": 13368,
"author_profile": "https://Stackoverflow.com/users/13368",
"pm_score": 2,
"selected": false,
"text": "<p>If you handle the RowDataBound event you can check the value of the data and modify the attributes of the cell ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190914",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15928/"
] | I have a DataGridView which shows the content of a DataTable.
I want to set the backcolor of a row based on the value of a cell in this row.
Note that the cell in question is in a column which is not displayed in the DataGridView (Visible=False). | If you handle the RowDataBound event you can check the value of the data and modify the attributes of the cell or apply a different style in that event handler.
```
protected void Page_Load(object sender, EventArgs e)
{
GridView g1 = new GridView();
g1.RowDataBound += new GridViewRowEventHandler(g1_RowDataBoun... |
190,915 | <p>I am writing a UDF for Excel 2007 which I want to pass a table to, and then reference parts of that table in the UDF. So, for instance my table called "Stock" may look something like this:</p>
<blockquote>
<p>Name Cost &nbs... | [
{
"answer_id": 190968,
"author": "Mike Woodhouse",
"author_id": 1060,
"author_profile": "https://Stackoverflow.com/users/1060",
"pm_score": 2,
"selected": true,
"text": "<p>This is very basic (no pun intended) but it will do what you describe. For larger tables it may become slow as unde... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/214/"
] | I am writing a UDF for Excel 2007 which I want to pass a table to, and then reference parts of that table in the UDF. So, for instance my table called "Stock" may look something like this:
>
> Name Cost Items in Stock
>
>
> Teddy Bear £10 10
>
>
> Lollipops 20p ... | This is very basic (no pun intended) but it will do what you describe. For larger tables it may become slow as under the hood it's going back and forth between the macro function and the worksheet, and that kind of activity adds up.
It assumes that you have one row of headers and one column of names (hence the For loo... |
190,936 | <p>When I type 'from' (in a <a href="http://en.wikipedia.org/wiki/Language_Integrated_Query" rel="nofollow noreferrer">LINQ</a> query) after importing <a href="http://msdn.microsoft.com/en-us/library/system.linq.aspx" rel="nofollow noreferrer">System.Linq namespace</a>, it is understood as a keyword. How does this magi... | [
{
"answer_id": 190945,
"author": "Nico",
"author_id": 22970,
"author_profile": "https://Stackoverflow.com/users/22970",
"pm_score": -1,
"selected": false,
"text": "<p>\"from\" is a language keyword (just like \"if\" or \"foreach\").</p>\n\n<p>You don't even need to import System.Linq to ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26788/"
] | When I type 'from' (in a [LINQ](http://en.wikipedia.org/wiki/Language_Integrated_Query) query) after importing [System.Linq namespace](http://msdn.microsoft.com/en-us/library/system.linq.aspx), it is understood as a keyword. How does this magic happen?
Is 'from' a extension method on some type? | In practice, yes - LINQ keywords map to extension methods. But actually, it is more interesting; it is literally as though the compiler substitutes directly for a few key methods, i.e.
```
var qry = from cust in db.Customers
where cust.IsActive
select cust;
```
becomes:
```
var qry = db.Customer... |
190,937 | <p>I'm looking for a way to create an "it will look cool" effect for a full screen WPF application I'm working on - a "screen glint" effect that animates or moves across the whole screen to give off a shiny display experience. I'm thinking of creating a large rectangle with a highlighted-gradient and transparent backgr... | [
{
"answer_id": 191146,
"author": "LBugnion",
"author_id": 12233,
"author_profile": "https://Stackoverflow.com/users/12233",
"pm_score": 2,
"selected": false,
"text": "<p>It's easy to place any transparent panel \"on top\" of the main Grid, and to animate an element placed in the panel. T... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190937",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6415/"
] | I'm looking for a way to create an "it will look cool" effect for a full screen WPF application I'm working on - a "screen glint" effect that animates or moves across the whole screen to give off a shiny display experience. I'm thinking of creating a large rectangle with a highlighted-gradient and transparent backgroun... | I came up with a solution that looks pretty good. Some sample XAML that I chalked up in Blend 2.0 SP1 looks like this:
```
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ScreenGlintApplication.Window1"
x:Name="Wi... |
190,940 | <p>I've just set up a new build server with the Windows 2008 .NET 3.5 SDK, and for some reason it hasn't installed c:\Program Files\Common Files\Microsoft Shared\TextTemplating so I can't run t4 templates on it. I had a look at the install options in add/remove programs and every single option is checked. </p>
<p>Any ... | [
{
"answer_id": 191146,
"author": "LBugnion",
"author_id": 12233,
"author_profile": "https://Stackoverflow.com/users/12233",
"pm_score": 2,
"selected": false,
"text": "<p>It's easy to place any transparent panel \"on top\" of the main Grid, and to animate an element placed in the panel. T... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190940",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2086/"
] | I've just set up a new build server with the Windows 2008 .NET 3.5 SDK, and for some reason it hasn't installed c:\Program Files\Common Files\Microsoft Shared\TextTemplating so I can't run t4 templates on it. I had a look at the install options in add/remove programs and every single option is checked.
Any ideas why ... | I came up with a solution that looks pretty good. Some sample XAML that I chalked up in Blend 2.0 SP1 looks like this:
```
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ScreenGlintApplication.Window1"
x:Name="Wi... |
190,956 | <p>Just wanted to get an idea for ways (web) developers get round the short fall of (most) WYSIWYG editors, whereby the users that are editing the text aren't always HTML literate enough to produce good/great results.</p>
<p>In the past we have resigned ourselves to either locking down the editor or simply not supplyi... | [
{
"answer_id": 191146,
"author": "LBugnion",
"author_id": 12233,
"author_profile": "https://Stackoverflow.com/users/12233",
"pm_score": 2,
"selected": false,
"text": "<p>It's easy to place any transparent panel \"on top\" of the main Grid, and to animate an element placed in the panel. T... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190956",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17540/"
] | Just wanted to get an idea for ways (web) developers get round the short fall of (most) WYSIWYG editors, whereby the users that are editing the text aren't always HTML literate enough to produce good/great results.
In the past we have resigned ourselves to either locking down the editor or simply not supplying one.
W... | I came up with a solution that looks pretty good. Some sample XAML that I chalked up in Blend 2.0 SP1 looks like this:
```
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
x:Class="ScreenGlintApplication.Window1"
x:Name="Wi... |
190,988 | <p>I have to use the <strong>XMLHttp object in classic ASP</strong> in order to send some data to another server via HTTP from server to server:</p>
<pre><code>sURL = SOME_URL
Set oXHttp = Server.CreateObject("Msxml2.XMLHTTP")
oXHttp.open "POST", sURL, false
oXHttp.setRequestHeader "Content-Type", "application/x-ww... | [
{
"answer_id": 191042,
"author": "Adam Byram",
"author_id": 25886,
"author_profile": "https://Stackoverflow.com/users/25886",
"pm_score": 6,
"selected": true,
"text": "<p>There is a keychain you can use - for code, the best bet is to check out the GenericKeychain sample application from ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/190988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6461/"
] | I have to use the **XMLHttp object in classic ASP** in order to send some data to another server via HTTP from server to server:
```
sURL = SOME_URL
Set oXHttp = Server.CreateObject("Msxml2.XMLHTTP")
oXHttp.open "POST", sURL, false
oXHttp.setRequestHeader "Content-Type", "application/x-www-form-urlencoded;charset:I... | There is a keychain you can use - for code, the best bet is to check out the GenericKeychain sample application from Apple:
[GenericKeychain sample](https://developer.apple.com/library/ios/DOCUMENTATION/Security/Conceptual/keychainServConcepts/iPhoneTasks/iPhoneTasks.html) |
191,010 | <pre><code>dir(re.compile(pattern))
</code></pre>
<p>does not return pattern as one of the lists's elements. Namely it returns:</p>
<pre><code>['__copy__', '__deepcopy__', 'findall', 'finditer', 'match', 'scanner', 'search', 'split', 'sub', 'subn']
</code></pre>
<p>According to the manual, it is supposed to contain... | [
{
"answer_id": 191029,
"author": "PierreBdR",
"author_id": 7136,
"author_profile": "https://Stackoverflow.com/users/7136",
"pm_score": 8,
"selected": true,
"text": "<p>For the <strong>complete</strong> list of attributes, the short answer is: no. The problem is that the attributes are ac... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985/"
] | ```
dir(re.compile(pattern))
```
does not return pattern as one of the lists's elements. Namely it returns:
```
['__copy__', '__deepcopy__', 'findall', 'finditer', 'match', 'scanner', 'search', 'split', 'sub', 'subn']
```
According to the manual, it is supposed to contain
>
> the object's attributes' names, th... | For the **complete** list of attributes, the short answer is: no. The problem is that the attributes are actually defined as the arguments accepted by the `getattr` built-in function. As the user can reimplement `__getattr__`, suddenly allowing any kind of attribute, there is no possible generic way to generate that li... |
191,013 | <p>Is it possible to have an anonymous type implement an interface?</p>
<p>I've got a piece of code that I would like to work, but don't know how to do this.</p>
<p>I've had a couple of answers that either say no, or create a class that implements the interface construct new instances of that. This isn't really ideal... | [
{
"answer_id": 191028,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "<p>No; an anonymous type can't be made to do anything except have a few properties. You will need to create your own ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191013",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5932/"
] | Is it possible to have an anonymous type implement an interface?
I've got a piece of code that I would like to work, but don't know how to do this.
I've had a couple of answers that either say no, or create a class that implements the interface construct new instances of that. This isn't really ideal, but I'm wonderi... | No, anonymous types cannot implement an interface. From the [C# programming guide](http://msdn.microsoft.com/en-us/library/bb397696.aspx):
>
> Anonymous types are class types that consist of one or more public read-only properties. No other kinds of class members such as methods or events are allowed. An anonymous ty... |
191,082 | <p>Ok sorry this might seem like a dumb question but I cannot figure this thing out :</p>
<p>I am trying to parse a string and simply want to check whether it only contains the following characters : '0123456789dD+ '</p>
<p>I have tried many things but just can't get to figure out the right regex to use!</p>
<pre><c... | [
{
"answer_id": 191104,
"author": "Manu",
"author_id": 2133,
"author_profile": "https://Stackoverflow.com/users/2133",
"pm_score": 4,
"selected": true,
"text": "<p>Try this: </p>\n\n<pre><code>@\"^[0-9dD+ ]+$\"\n</code></pre>\n\n<p>The <code>^</code> and <code>$</code> at the beginning an... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191082",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25152/"
] | Ok sorry this might seem like a dumb question but I cannot figure this thing out :
I am trying to parse a string and simply want to check whether it only contains the following characters : '0123456789dD+ '
I have tried many things but just can't get to figure out the right regex to use!
```
Regex oReg = new Rege... | Try this:
```
@"^[0-9dD+ ]+$"
```
The `^` and `$` at the beginning and end signify the beginning and end of the input string respectively. Thus between the beginning and then end only the stated characters are allowed. In your example, the regex matches if the string contains one of the characters even if it contai... |
191,159 | <p>You'd like to call a stored proc on MS SQL that has a parameter type of TIMESTAMP within T-SQL, not ADO.NET using a VARCHAR value (e.g. '0x0000000002C490C8').</p>
<p>What do you do?</p>
<p>UPDATE:
This is where you have a "Timestamp" value coming at you but exists only as VARCHAR. (Think OUTPUT variable on anothe... | [
{
"answer_id": 191169,
"author": "John Rudy",
"author_id": 14048,
"author_profile": "https://Stackoverflow.com/users/14048",
"pm_score": 2,
"selected": false,
"text": "<p>A TIMESTAMP is semantically equivalent to VARBINARY(8) (nullable) or BINARY(8) (non-nullable). So you should be able ... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/307/"
] | You'd like to call a stored proc on MS SQL that has a parameter type of TIMESTAMP within T-SQL, not ADO.NET using a VARCHAR value (e.g. '0x0000000002C490C8').
What do you do?
UPDATE:
This is where you have a "Timestamp" value coming at you but exists only as VARCHAR. (Think OUTPUT variable on another stored proc, but... | A timestamp datatype is managed by SQL Server. I've never seen it used anywhere other than as a table column type. In that capacity, the column of type timestamp will give you a rigorous ordinal of the last insert/update on the row in relation to all other updates in the database. To see the most recent ordinal across ... |
191,160 | <p>I am creating a new build process for a DotNet project which is to be held in Subversion.</p>
<p>For each dll/exe that I compile (via Nant) I would like to include 2 additional attibutes in the dlls that are built.</p>
<p>I already understand the workings of the 'asminfo' nant task. But I need help retrieving the ... | [
{
"answer_id": 191186,
"author": "Henry B",
"author_id": 6414,
"author_profile": "https://Stackoverflow.com/users/6414",
"pm_score": -1,
"selected": false,
"text": "<p>The entries in the .svn directory are not really meant to be accessed directly. I don't know much about what you're doin... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11356/"
] | I am creating a new build process for a DotNet project which is to be held in Subversion.
For each dll/exe that I compile (via Nant) I would like to include 2 additional attibutes in the dlls that are built.
I already understand the workings of the 'asminfo' nant task. But I need help retrieving the information which... | Firstly, you can use "svn info --xml >out.xml" to get the svn information to a text file. You can then use a Nant xml-peek to get a value out of the file into a variable.
```
<xmlpeek file="out.xml" xpath="/info/entry/url" property="svn.url" />
``` |
191,179 | <p>How can I find the font that the user has set in their Windows Display Properties using C# in .NET?</p>
<p>I want to display a form using the fonts that the user has selected. The fonts I want are those selected in the Windows Display Properties form for 3D-objects, menus and window title bars. But I cannot find a ... | [
{
"answer_id": 191186,
"author": "Henry B",
"author_id": 6414,
"author_profile": "https://Stackoverflow.com/users/6414",
"pm_score": -1,
"selected": false,
"text": "<p>The entries in the .svn directory are not really meant to be accessed directly. I don't know much about what you're doin... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191179",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26808/"
] | How can I find the font that the user has set in their Windows Display Properties using C# in .NET?
I want to display a form using the fonts that the user has selected. The fonts I want are those selected in the Windows Display Properties form for 3D-objects, menus and window title bars. But I cannot find a way to acc... | Firstly, you can use "svn info --xml >out.xml" to get the svn information to a text file. You can then use a Nant xml-peek to get a value out of the file into a variable.
```
<xmlpeek file="out.xml" xpath="/info/entry/url" property="svn.url" />
``` |
191,201 | <p>I do all my coding in vim and am quite happy with it (so, please, no "use a different editor" responses), but have an ongoing annoyance in that the smartindent feature wants to not indent comments beginning with # at all. e.g., I want</p>
<pre><code> # Do something
$x = $x + 1;
if ($y) {
# Do something el... | [
{
"answer_id": 191229,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 3,
"selected": false,
"text": "<p>I think \"smartindent\" is designed for C, so it thinks \"#\" is the start of a pre-processor directive instead of a... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191201",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18914/"
] | I do all my coding in vim and am quite happy with it (so, please, no "use a different editor" responses), but have an ongoing annoyance in that the smartindent feature wants to not indent comments beginning with # at all. e.g., I want
```
# Do something
$x = $x + 1;
if ($y) {
# Do something else
$y = $y ... | It looks like you're coding in Perl. Ensure that the following are set in your .vimrc:
```
filetype plugin indent on
syntax enable
```
These will tell Vim to set the filetype when opening a buffer and configure the indentation and syntax highlighting. No need to explicitly set smartindent since Vim's included Perl s... |
191,206 | <p>I need to programmatically get a list of running applications as shown in the "Applications" tab inside the Windows Task Manager using PowerShell or VBScript.</p>
<p>All I could find so far is how to list processes using VBScript and WMI.</p>
| [
{
"answer_id": 191343,
"author": "stahler",
"author_id": 26811,
"author_profile": "https://Stackoverflow.com/users/26811",
"pm_score": 4,
"selected": true,
"text": "<p>This should do the trick:</p>\n\n<pre><code>Set Word = CreateObject(\"Word.Application\")\nSet Tasks = Word.Tasks\nFor E... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191206",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26810/"
] | I need to programmatically get a list of running applications as shown in the "Applications" tab inside the Windows Task Manager using PowerShell or VBScript.
All I could find so far is how to list processes using VBScript and WMI. | This should do the trick:
```
Set Word = CreateObject("Word.Application")
Set Tasks = Word.Tasks
For Each Task in Tasks
If Task.Visible Then Wscript.Echo Task.Name
Next
Word.Quit
```
<http://msdn.microsoft.com/en-us/library/bb212832.aspx> |
191,250 | <p>I have the following code fragment that starts a <a href="http://en.wikipedia.org/wiki/Google_Earth" rel="nofollow noreferrer">Google Earth</a> process using a hardcoded path:</p>
<pre><code>var process =
new Process
{
StartInfo =
{
//TODO: Get location of... | [
{
"answer_id": 191281,
"author": "Iain",
"author_id": 5993,
"author_profile": "https://Stackoverflow.com/users/5993",
"pm_score": 2,
"selected": false,
"text": "<p>From the example given you can gauge that I'm actually trying to pass a KML file to Google Earth. Because of this, the simpl... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5993/"
] | I have the following code fragment that starts a [Google Earth](http://en.wikipedia.org/wiki/Google_Earth) process using a hardcoded path:
```
var process =
new Process
{
StartInfo =
{
//TODO: Get location of google earth executable from registry
... | Obviously if you're opening a specific file associated with the program then launching it via the file is preferable (for instance, the user might have a program associated with the file type they prefer to use).
Here is a method I've used in the past to launch an application associated with a particular file type, bu... |
191,260 | <p>We've recently completed phase 1 of a ASP.Net website in English and French. We went with using resource files to store language specific strings, but because the site used ASP.Net AJAX and javascript heavily we rigged up a solution to pass the right files through the ASP.Net pipeline where we could catch "tokens" a... | [
{
"answer_id": 191754,
"author": "Joe Scylla",
"author_id": 25771,
"author_profile": "https://Stackoverflow.com/users/25771",
"pm_score": 2,
"selected": true,
"text": "<p>In my main project (a RAD framework using PHP with gettext for translations) we're doing already alot of prepare oper... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22152/"
] | We've recently completed phase 1 of a ASP.Net website in English and French. We went with using resource files to store language specific strings, but because the site used ASP.Net AJAX and javascript heavily we rigged up a solution to pass the right files through the ASP.Net pipeline where we could catch "tokens" and ... | In my main project (a RAD framework using PHP with gettext for translations) we're doing already alot of prepare operations on javascript files like merging and minifying them. Within this preperations we parse for gettext-markers and replace them with the language specific text.
The result get save as javascript file... |
191,291 | <p>How would you manually trigger additional team builds from a team build? For example, when we were in CC.Net other builds would trigger if certain builds were successful. The second build could either be projects that use this component or additional, long running test libraries for the same component. </p>
| [
{
"answer_id": 191898,
"author": "Martin Woodward",
"author_id": 6438,
"author_profile": "https://Stackoverflow.com/users/6438",
"pm_score": 3,
"selected": true,
"text": "<p>One way you could do it is you could an an AfterEndToEndIteration target to your TFSBuild.proj file that would run... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18264/"
] | How would you manually trigger additional team builds from a team build? For example, when we were in CC.Net other builds would trigger if certain builds were successful. The second build could either be projects that use this component or additional, long running test libraries for the same component. | One way you could do it is you could an an AfterEndToEndIteration target to your TFSBuild.proj file that would runs the TfsBuild.exe command line to start you other builds. I'm thinking something like this (though I haven't tested it)
```
<Target Name="AfterEndToEndIteration">
<GetBuildProperties TeamFoundation... |
191,329 | <p>I am working through a book which gives examples of Ranges being converted to equivalent arrays using their "to_a" methods</p>
<p>When i run the code in irb I get the following warning</p>
<pre><code> warning: default `to_a' will be obsolete
</code></pre>
<p>What is the the correct alternative to using to_a?</p>
... | [
{
"answer_id": 191357,
"author": "Daniel Lucraft",
"author_id": 11951,
"author_profile": "https://Stackoverflow.com/users/11951",
"pm_score": 6,
"selected": false,
"text": "<p>This works for me in irb:</p>\n\n<pre><code>irb> (1..4).to_a\n=> [1, 2, 3, 4]\n</code></pre>\n\n<p>I notic... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24773/"
] | I am working through a book which gives examples of Ranges being converted to equivalent arrays using their "to\_a" methods
When i run the code in irb I get the following warning
```
warning: default `to_a' will be obsolete
```
What is the the correct alternative to using to\_a?
are there alternate ways to popula... | You can create an array with a range using splat,
```
>> a=*(1..10)
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
using `Kernel` `Array` method,
```
Array (1..10)
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
or using to\_a
```
(1..10).to_a
=> [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
``` |
191,339 | <p>I have a <code>DataGridView</code> bound to a <code>DataView</code>. The grid can be sorted by the user on any column.</p>
<p>I add a row to the grid by calling NewRow on the <code>DataView</code>'s underlying <code>DataTable</code>, then adding it to the <code>DataTable</code>'s Rows collection. How can I select t... | [
{
"answer_id": 209841,
"author": "Brendan Kendrick",
"author_id": 13473,
"author_profile": "https://Stackoverflow.com/users/13473",
"pm_score": 0,
"selected": false,
"text": "<p>Assuming you have some sort of unique identifier in your data source you could iterate over your collection of... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3012/"
] | I have a `DataGridView` bound to a `DataView`. The grid can be sorted by the user on any column.
I add a row to the grid by calling NewRow on the `DataView`'s underlying `DataTable`, then adding it to the `DataTable`'s Rows collection. How can I select the newly-added row in the grid?
I tried doing it by creating a `... | As soon as you update the bound DataTable, a "RowsAdded" event is fired by the DataGridView control, with the DataGridViewRowsAddedEventArgs.RowIndex property containing the index of the added row.
```
//local member
private int addedRowIndex;
private void AddMyRow()
{
//add the DataRow
MyDataSet.M... |
191,342 | <p>Is there a succinct way to retrieve a random record from a sql server table? </p>
<p>I would like to randomize my unit test data, so am looking for a simple way to select a random id from a table. In English, the select would be "Select one id from the table where the id is a random number between the lowest id i... | [
{
"answer_id": 191348,
"author": "Sklivvz",
"author_id": 7028,
"author_profile": "https://Stackoverflow.com/users/7028",
"pm_score": 8,
"selected": true,
"text": "<blockquote>\n <p>Is there a succinct way to retrieve a random record from a sql server table?</p>\n</blockquote>\n\n<p>Yes<... | 2008/10/10 | [
"https://Stackoverflow.com/questions/191342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10693/"
] | Is there a succinct way to retrieve a random record from a sql server table?
I would like to randomize my unit test data, so am looking for a simple way to select a random id from a table. In English, the select would be "Select one id from the table where the id is a random number between the lowest id in the table ... | >
> Is there a succinct way to retrieve a random record from a sql server table?
>
>
>
Yes
```
SELECT TOP 1 * FROM table ORDER BY NEWID()
```
Explanation
-----------
A `NEWID()` is generated for each row and the table is then sorted by it. The first record is returned (i.e. the record with the "lowest" GUID).
... |