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 |
|---|---|---|---|---|---|---|
212,715 | <p>I'm trying to use the giveio.sys driver which requires a "file" to be opened before you can access protected memory. I'm looking at a C example from WinAVR/AVRdude that uses the syntax:</p>
<pre class="lang-c prettyprint-override"><code> #define DRIVERNAME "\\\\.\\giveio"
HANDLE h = CreateFile(DRIVERNAME,
... | [
{
"answer_id": 214066,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>You're question is very confusing to say the least. </p>\n\n<p>1> The code you pasted is using a trick to communicate with ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28984/"
] | I'm trying to use the giveio.sys driver which requires a "file" to be opened before you can access protected memory. I'm looking at a C example from WinAVR/AVRdude that uses the syntax:
```c
#define DRIVERNAME "\\\\.\\giveio"
HANDLE h = CreateFile(DRIVERNAME,
GENERIC_READ,
0,
... | Solution: in python you have to use win32file.CreateFile() instead of open(). Thanks everyone for telling me what I was trying to do, it helped me find the answer! |
212,718 | <p>The NUnit documentation doesn't tell me when to use a method with a <code>TestFixtureSetup</code> and when to do the setup in the constructor.</p>
<pre><code>public class MyTest
{
private MyClass myClass;
public MyTest()
{
myClass = new MyClass();
}
[TestFixtureSetUp]
public void I... | [
{
"answer_id": 212769,
"author": "Sam Wessel",
"author_id": 4734,
"author_profile": "https://Stackoverflow.com/users/4734",
"pm_score": 6,
"selected": false,
"text": "<p>Why would you need to use a constructor in your test classes?</p>\n\n<p>I use <code>[SetUp]</code> and <code>[TearDown... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13376/"
] | The NUnit documentation doesn't tell me when to use a method with a `TestFixtureSetup` and when to do the setup in the constructor.
```
public class MyTest
{
private MyClass myClass;
public MyTest()
{
myClass = new MyClass();
}
[TestFixtureSetUp]
public void Init()
{
myCla... | I think this has been one of the issues that hasn't been addressed by the nUnit team. However, there is the excellent [xUnit project](http://www.codeplex.com/xunit) that saw this exact issue and decided that constructors were a good thing to use on [test fixture initialization](http://www.codeplex.com/xunit/Wiki/View.a... |
212,734 | <p>How do you automatically start a service after running an install from a Visual Studio Setup Project?</p>
<p>I just figured this one out and thought I would share the answer for the general good. Answer to follow. I am open to other and better ways of doing this.</p>
| [
{
"answer_id": 212736,
"author": "Jason Z",
"author_id": 2470,
"author_profile": "https://Stackoverflow.com/users/2470",
"pm_score": 7,
"selected": true,
"text": "<p>Add the following class to your project.</p>\n\n<pre><code>using System.ServiceProcess; \n\nclass ServInstaller : Service... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2470/"
] | How do you automatically start a service after running an install from a Visual Studio Setup Project?
I just figured this one out and thought I would share the answer for the general good. Answer to follow. I am open to other and better ways of doing this. | Add the following class to your project.
```
using System.ServiceProcess;
class ServInstaller : ServiceInstaller
{
protected override void OnCommitted(System.Collections.IDictionary savedState)
{
ServiceController sc = new ServiceController("YourServiceNameGoesHere");
sc.Start();
}
}
``... |
212,745 | <p>I'm on OS X 10.5.5 (though it does not matter much I guess)</p>
<p>I have a set of text files with fancy characters like double backquotes, ellipsises ("...") in one character etc. </p>
<p>I need to convert these files to good old plain 7-bit ASCII, preferably without losing character meaning (that is, convert tho... | [
{
"answer_id": 212875,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stackoverflow.com/users/28169",
"pm_score": 1,
"selected": false,
"text": "<p><a href=\"http://www.manpagez.com/man/1/iconv/\" rel=\"nofollow noreferrer\">iconv</a> should do it, as far as I know. N... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212745",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6236/"
] | I'm on OS X 10.5.5 (though it does not matter much I guess)
I have a set of text files with fancy characters like double backquotes, ellipsises ("...") in one character etc.
I need to convert these files to good old plain 7-bit ASCII, preferably without losing character meaning (that is, convert those ellipses to th... | The [Elinks](http://elinks.or.cz/) web browser will convert Unicode entities to their ASCII equivalents, giving things like "--" for "—" and "..." for "…", etc. There is a python module [python-elinks](http://code.google.com/p/python-elinks/) which uses the same conversion table, and it would be trivial to turn it into... |
212,762 | <p>I need generate <a href="https://stackoverflow.com/questions/27921/what-is-the-best-way-to-create-a-thumbnail-using-aspnet">thumbnails</a> for a bunch of jpegs (200,000+) but I want to make sure all of my thumbs have a equal height and width. However, I don't want to change the proportions of the image so I need to ... | [
{
"answer_id": 212791,
"author": "Vaibhav",
"author_id": 380,
"author_profile": "https://Stackoverflow.com/users/380",
"pm_score": 3,
"selected": true,
"text": "<p>How about this. Maybe you should draw a black (or whichever color) rectangle on the Bitmap first.</p>\n\n<p>And then when ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4796/"
] | I need generate [thumbnails](https://stackoverflow.com/questions/27921/what-is-the-best-way-to-create-a-thumbnail-using-aspnet) for a bunch of jpegs (200,000+) but I want to make sure all of my thumbs have a equal height and width. However, I don't want to change the proportions of the image so I need to add empty spac... | How about this. Maybe you should draw a black (or whichever color) rectangle on the Bitmap first.
And then when you are placing the resized image, just calculate the placement of the image based on whichever dimension is shorter, and then move that dimension by half the difference (and keep the other on 0).
Wouldn't ... |
212,763 | <p>My Win form app doesn't seem to like FormsAuthentication, I'm totally new to hashing so any help to convert this would be very welcome. Thanks.</p>
<pre><code>//Write hash
protected TextBox tbPassword;
protected Literal liHashedPassword;
{
string strHashedPassword = FormsAuthentication.HashPasswordForStoringInCo... | [
{
"answer_id": 212772,
"author": "Vaibhav",
"author_id": 380,
"author_profile": "https://Stackoverflow.com/users/380",
"pm_score": 1,
"selected": false,
"text": "<p>I think it should work. All you need to do is reference System.Web.Security in your code (and add it as a reference in your... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My Win form app doesn't seem to like FormsAuthentication, I'm totally new to hashing so any help to convert this would be very welcome. Thanks.
```
//Write hash
protected TextBox tbPassword;
protected Literal liHashedPassword;
{
string strHashedPassword = FormsAuthentication.HashPasswordForStoringInConfigFile(tbPas... | ```
using System.Security.Cryptography;
public static string EncodePasswordToBase64(string password)
{ byte[] bytes = Encoding.Unicode.GetBytes(password);
byte[] inArray = HashAlgorithm.Create("SHA1").ComputeHash(bytes);
return Convert.ToBase64String(inArray);
}
``` |
212,797 | <p>It seems</p>
<pre><code>import Queue
Queue.Queue().get(timeout=10)
</code></pre>
<p>is keyboard interruptible (ctrl-c) whereas</p>
<pre><code>import Queue
Queue.Queue().get()
</code></pre>
<p>is not. I could always create a loop;</p>
<pre><code>import Queue
q = Queue()
while True:
try:
q.get(time... | [
{
"answer_id": 212975,
"author": "Eli Courtwright",
"author_id": 1694,
"author_profile": "https://Stackoverflow.com/users/1694",
"pm_score": 4,
"selected": true,
"text": "<p><code>Queue</code> objects have this behavior because they lock using <code>Condition</code> objects form the <cod... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212797",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2010/"
] | It seems
```
import Queue
Queue.Queue().get(timeout=10)
```
is keyboard interruptible (ctrl-c) whereas
```
import Queue
Queue.Queue().get()
```
is not. I could always create a loop;
```
import Queue
q = Queue()
while True:
try:
q.get(timeout=1000)
except Queue.Empty:
pass
```
but thi... | `Queue` objects have this behavior because they lock using `Condition` objects form the `threading` module. So your solution is really the only way to go.
However, if you really want a `Queue` method that does this, you can monkeypatch the `Queue` class. For example:
```
def interruptable_get(self):
while True:
... |
212,805 | <pre><code>Object o = new Long[0]
System.out.println( o.getClass().isArray() )
System.out.println( o.getClass().getName() )
Class ofArray = ???
</code></pre>
<p>Running the first 3 lines emits;</p>
<pre><code>true
[Ljava.lang.Long;
</code></pre>
<p>How do I get ??? to be type long? I could parse the string and do ... | [
{
"answer_id": 212816,
"author": "ddimitrov",
"author_id": 18187,
"author_profile": "https://Stackoverflow.com/users/18187",
"pm_score": 5,
"selected": false,
"text": "<p><a href=\"http://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#getComponentType()\" rel=\"noreferrer\">h... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6580/"
] | ```
Object o = new Long[0]
System.out.println( o.getClass().isArray() )
System.out.println( o.getClass().getName() )
Class ofArray = ???
```
Running the first 3 lines emits;
```
true
[Ljava.lang.Long;
```
How do I get ??? to be type long? I could parse the string and do a Class.forname(), but thats grotty. What's ... | Just write
```
Class ofArray = o.getClass().getComponentType();
```
From [the JavaDoc](http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getComponentType--):
>
> `public Class<?> getComponentType()`
>
>
> Returns the `Class` representing the component type of an array. If this class does not represe... |
212,821 | <p>In this class for example, I want to force a limit of characters the first/last name can allow.</p>
<pre><code>public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
</code></pre>
<p>Is there a way to force the string limit restriction for the first or last nam... | [
{
"answer_id": 212836,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 0,
"selected": false,
"text": "<p>COnvert the property from an auto property and validate it yourself, you could then throw an argument exception... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/820/"
] | In this class for example, I want to force a limit of characters the first/last name can allow.
```
public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
```
Is there a way to force the string limit restriction for the first or last name, so **when the client se... | necro time... It worth mentioning though.
```
using System.ComponentModel.DataAnnotations;
public class Person
{
[StringLength(255, ErrorMessage = "Error")]
public string FirstName { get; set; }
[StringLength(255, ErrorMessage = "Error")]
public string LastName { get; set; }
}
``` |
212,896 | <p>With the recent announcement of .NET 4.0 and Visual Studio 2010, it is becoming ever more difficult to keep track of what .NET Framework versions build on what version of the CLR and belong with which version(s) of Visual Studio.</p>
<p>Is there a definitive table that shows these relationships?</p>
| [
{
"answer_id": 212912,
"author": "DOK",
"author_id": 27637,
"author_profile": "https://Stackoverflow.com/users/27637",
"pm_score": 3,
"selected": false,
"text": "<p>It's hard to find, isn't it? I believe these are the versions (ignoring service packs)</p>\n\n<ul>\n<li>Visual Studio versi... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1559/"
] | With the recent announcement of .NET 4.0 and Visual Studio 2010, it is becoming ever more difficult to keep track of what .NET Framework versions build on what version of the CLR and belong with which version(s) of Visual Studio.
Is there a definitive table that shows these relationships? | ```
Visual Studio CLR .NET Framework
----------------------------------------------------------------------------------------
Visual Studio .NET (Ranier) 1.0.3705 1.0
Visual Studio 2003 (Everett) 1.1.4322 1.1
Visual Studio 2005 (Whi... |
212,900 | <p>I've used lex and yacc (more usually bison) in the past for various projects, usually translators (such as a subset of EDIF streamed into an EDA app). Additionally, I've had to support code based on lex/yacc grammars dating back decades. So I know my way around the tools, though I'm no expert.</p>
<p>I've seen posi... | [
{
"answer_id": 212930,
"author": "Daniel Spiewak",
"author_id": 9815,
"author_profile": "https://Stackoverflow.com/users/9815",
"pm_score": 8,
"selected": true,
"text": "<h3>Update/warning: This answer may be out of date!</h3>\n<hr />\n<p>One major difference is that ANTLR generates an L... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3778/"
] | I've used lex and yacc (more usually bison) in the past for various projects, usually translators (such as a subset of EDIF streamed into an EDA app). Additionally, I've had to support code based on lex/yacc grammars dating back decades. So I know my way around the tools, though I'm no expert.
I've seen positive comme... | ### Update/warning: This answer may be out of date!
---
One major difference is that ANTLR generates an LL(\*) parser, whereas YACC and Bison both generate parsers that are LALR. This is an important distinction for a number of applications, the most obvious being operators:
```
expr ::= expr '+' expr
| expr ... |
212,906 | <p>My customer is replacing MS Office with OpenOffice in some workstations. My program export a file to Excel using the .xml extension (using open format) and opens it using the current associated program (using ShellExecute)</p>
<p>The problem is that OpenOffice does not register the .xml extension associated with it... | [
{
"answer_id": 212921,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 5,
"selected": true,
"text": "<p>The real association is stored in the key that <code>\"HKEY_CLASSES_ROOT\\.xml\"</code> points to.</p>\n\n<p>On my machi... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2385/"
] | My customer is replacing MS Office with OpenOffice in some workstations. My program export a file to Excel using the .xml extension (using open format) and opens it using the current associated program (using ShellExecute)
The problem is that OpenOffice does not register the .xml extension associated with it.
Manuall... | The real association is stored in the key that `"HKEY_CLASSES_ROOT\.xml"` points to.
On my machine, the default value of that key says `"xmlfile"`, most likely that is the same for yours.
So let's go to `"HKEY_CLASSES_ROOT\xmlfile"`. There you can see (and change) what command is going to be used to launch that type ... |
212,919 | <p>I need to change the permissions of a directory to be owned by the Everyone user with all access rights on this directory. I'm a bit new to the Win32 API, so I'm somewhat lost in the SetSecurity* functions.</p>
| [
{
"answer_id": 213716,
"author": "Jason",
"author_id": 26302,
"author_profile": "https://Stackoverflow.com/users/26302",
"pm_score": 2,
"selected": false,
"text": "<p>Ok, I figured it out:</p>\n\n<pre><code>SetSecurityInfo(hDir, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, NULL... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212919",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26302/"
] | I need to change the permissions of a directory to be owned by the Everyone user with all access rights on this directory. I'm a bit new to the Win32 API, so I'm somewhat lost in the SetSecurity\* functions. | Ok, I figured it out:
```
SetSecurityInfo(hDir, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION, NULL, NULL, NULL, NULL);
```
This will give all permissions to all users for the given directory handle. |
212,939 | <p>MySQL 5.0.45</p>
<p>What is the syntax to alter a table to allow a column to be null, alternately what's wrong with this:</p>
<pre><code>ALTER mytable MODIFY mycolumn varchar(255) null;
</code></pre>
<p>I interpreted the manual as just run the above and it would recreate the column, this time allowing null. The ... | [
{
"answer_id": 212947,
"author": "Daniel Spiewak",
"author_id": 9815,
"author_profile": "https://Stackoverflow.com/users/9815",
"pm_score": 11,
"selected": true,
"text": "<p>You want the following:</p>\n\n<pre><code>ALTER TABLE mytable MODIFY mycolumn VARCHAR(255);\n</code></pre>\n\n<p>C... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13285/"
] | MySQL 5.0.45
What is the syntax to alter a table to allow a column to be null, alternately what's wrong with this:
```
ALTER mytable MODIFY mycolumn varchar(255) null;
```
I interpreted the manual as just run the above and it would recreate the column, this time allowing null. The server is telling me I have syntac... | You want the following:
```
ALTER TABLE mytable MODIFY mycolumn VARCHAR(255);
```
Columns are nullable by default. As long as the column is not declared `UNIQUE` or `NOT NULL`, there shouldn't be any problems. |
212,965 | <p>What I want to do is the following:</p>
<ol>
<li>read in multiple line input from <code>stdin</code> into variable <code>A</code></li>
<li>make various operations on <code>A</code></li>
<li>pipe <code>A</code> without losing delimiter symbols (<code>\n</code>,<code>\r</code>,<code>\t</code>,etc) to another command<... | [
{
"answer_id": 212987,
"author": "Tanktalus",
"author_id": 23512,
"author_profile": "https://Stackoverflow.com/users/23512",
"pm_score": 7,
"selected": true,
"text": "<p>This is working for me:</p>\n\n<pre><code>myvar=`cat`\n\necho \"$myvar\"\n</code></pre>\n\n<p>The quotes around <code>... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What I want to do is the following:
1. read in multiple line input from `stdin` into variable `A`
2. make various operations on `A`
3. pipe `A` without losing delimiter symbols (`\n`,`\r`,`\t`,etc) to another command
The current problem is that, I can't read it in with `read` command, because it stops reading at newl... | This is working for me:
```
myvar=`cat`
echo "$myvar"
```
The quotes around `$myvar` are important. |
212,968 | <p>I have a scenario in a system which I've tried to simplify as best as I can. We have a table of (lets call them) artefacts, artefacts can be accessed by any number of security roles and security roles can access any number of artefacts. As such, we have 3 tables in the database - one describing artefacts, one descri... | [
{
"answer_id": 213065,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 0,
"selected": false,
"text": "<p>You could make a mapping for the association table, and then call delete on that table where the Role_id is the value you ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20524/"
] | I have a scenario in a system which I've tried to simplify as best as I can. We have a table of (lets call them) artefacts, artefacts can be accessed by any number of security roles and security roles can access any number of artefacts. As such, we have 3 tables in the database - one describing artefacts, one describin... | Since I was looking for this answer and found this thread on google (without an answer) I figured I'd post my solution to this. With three tables: Role, RolesToAccess(ManyToMany), Access.
Create the following mappings:
Access:
```
<bag name="Roles" table="RolesToAccess" cascade="none" lazy="false">
<key column=... |
212,988 | <p>I have created an item swapper control consisting in two listboxes and some buttons that allow me to swap items between the two lists. The swapping is done using javascript. I also move items up and down in the list. Basically when I move the items to the list box on the right I store the datakeys of the elements (... | [
{
"answer_id": 213169,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": "<p>It's complaining because the selected item in a list was not present in the list when it was rendered. Consider usi... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1360/"
] | I have created an item swapper control consisting in two listboxes and some buttons that allow me to swap items between the two lists. The swapping is done using javascript. I also move items up and down in the list. Basically when I move the items to the list box on the right I store the datakeys of the elements (GUID... | The first option will bring considerable overhead. I have defined my own custom listbox control derived from the listbox class and performed an override of the loadpostback data:
```
public class CustomListBox : ListBox
{
protected override bool LoadPostData(string postDataKey, System.Collections.Specialized.NameV... |
212,999 | <p>After using Hudson for continuous integration with a prior project, I want to set up a continuous integration server for the iPhone projects I'm working on now. After doing some research it looks like there aren't any CI engines designed specifically for Xcode, but one guy has had success <a href="http://www.pragmat... | [
{
"answer_id": 213101,
"author": "Colin Barrett",
"author_id": 23106,
"author_profile": "https://Stackoverflow.com/users/23106",
"pm_score": 3,
"selected": false,
"text": "<p>Adium is using <a href=\"http://buildbot.net\" rel=\"nofollow noreferrer\">buildbot</a> with Xcode quite effectiv... | 2008/10/17 | [
"https://Stackoverflow.com/questions/212999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17188/"
] | After using Hudson for continuous integration with a prior project, I want to set up a continuous integration server for the iPhone projects I'm working on now. After doing some research it looks like there aren't any CI engines designed specifically for Xcode, but one guy has had success [using Cruise Control combined... | I'm successfully using Hudson on the mac with xcodebuild. With the release of the 3.0 iPhone sdk you have compete control over the target, configuration and sdk that the project is to be built against.
It's as simple as creating a build step in hudson and telling xcodebuild to build the project:
```
xcodebuild -targ... |
213,002 | <p>I have some data grouped in a table by a certain criteria, and for each group it is computed an average —well, the real case is a bit more tricky— of the values from each of the detail rows that belong to that group. This average is shown in each group footer rows. Let's see this simple example:</p>
<p><img src="ht... | [
{
"answer_id": 217355,
"author": "Pulsehead",
"author_id": 2156,
"author_profile": "https://Stackoverflow.com/users/2156",
"pm_score": 1,
"selected": false,
"text": "<p>Unfortunately I'm away from my reporting development box at the moment but it's either:<br>\n=(sum(Fields!Column1 + sum... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1679/"
] | I have some data grouped in a table by a certain criteria, and for each group it is computed an average —well, the real case is a bit more tricky— of the values from each of the detail rows that belong to that group. This average is shown in each group footer rows. Let's see this simple example:
 don't support aggregates of aggregates directly.
Use a custom report assembly, code references and named objects (Report Properties, References) that allow you to aggregate the values yourself.
Your code could look like this:
```
Public Sub New()
m_valueTable = New Dat... |
213,015 | <p>I have over a TB of home movies with horrible file names. Finding what you want is impossible.
I would like to rename all files to the time they were originally recorded (not the file time they were placed on my computer).
Some applications (like Ulead Video Studio) can access this information, which I believe is e... | [
{
"answer_id": 213050,
"author": "Mayowa",
"author_id": 18593,
"author_profile": "https://Stackoverflow.com/users/18593",
"pm_score": 1,
"selected": false,
"text": "<p>Here is a bit of code that i found a while back that should get you started.</p>\n\n<p><a href=\"http://www.developerfus... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213015",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29027/"
] | I have over a TB of home movies with horrible file names. Finding what you want is impossible.
I would like to rename all files to the time they were originally recorded (not the file time they were placed on my computer).
Some applications (like Ulead Video Studio) can access this information, which I believe is embed... | Here is a hacky howto based on mplayer that works at least for the MOV files produced by my camera:
```
mplayer -vo null -ao null -frames 0 -identify myfile.MOV 2>/dev/null|grep creation_time:
```
I use it to batch-rename them:
```
for m in MVI*.MOV; do
t=$(mplayer -vo null -ao null -frames 0 -identify $m 2>/de... |
213,027 | <p>The following code was produced by a consultant working for my group. I'm not a C++ developer (worked in many languages, though) but would like some independent opinions on the following code. This is in Visual Studio C++ 6.0. I've got a gut reaction (not a good one, obviously), but I'd like some "gut reactions" ... | [
{
"answer_id": 213040,
"author": "Nick",
"author_id": 26240,
"author_profile": "https://Stackoverflow.com/users/26240",
"pm_score": 2,
"selected": false,
"text": "<p>CString has a Replace() method... (that was my 1st reaction)</p>\n\n<p>I have seen a lot of bad code, and lots worse than ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The following code was produced by a consultant working for my group. I'm not a C++ developer (worked in many languages, though) but would like some independent opinions on the following code. This is in Visual Studio C++ 6.0. I've got a gut reaction (not a good one, obviously), but I'd like some "gut reactions" from s... | hmm. I think
```
CString strColHeader;
strColHeader.Replace(",", "\\,")
```
would do just as well.
I don't like the code, I tend to break from the while loop instead of having an unnecessary bool 'continue' flag. That goes double when he could have used `while (occurenceInd != 0)` as his loop control variable ins... |
213,042 | <p>I tried "x = y ** e", but that didn't work.</p>
| [
{
"answer_id": 213043,
"author": "Evan Teran",
"author_id": 13430,
"author_profile": "https://Stackoverflow.com/users/13430",
"pm_score": 8,
"selected": true,
"text": "<p>use the <code>pow</code> function (it takes <code>float</code>s/<code>double</code>s though).</p>\n\n<p><code>man pow... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7598/"
] | I tried "x = y \*\* e", but that didn't work. | use the `pow` function (it takes `float`s/`double`s though).
`man pow`:
```
#include <math.h>
double pow(double x, double y);
float powf(float x, float y);
long double powl(long double x, long double y);
```
**EDIT**: For the special case of positive integer powers of `2`, you can use bit shifting: `(1... |
213,045 | <p>I have a class library with some extension methods written in C# and an old website written in VB.</p>
<p>I want to call my extension methods from the VB code but they don't appear in intelisense and I get compile errors when I visit the site.</p>
<p>I have got all the required <em>Import</em>s because other class... | [
{
"answer_id": 213066,
"author": "ICR",
"author_id": 214,
"author_profile": "https://Stackoverflow.com/users/214",
"pm_score": 2,
"selected": false,
"text": "<p>Extension methods are just syntactic sugar for static methods. So</p>\n\n<pre><code>public static string MyExtMethod(this strin... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1741868/"
] | I have a class library with some extension methods written in C# and an old website written in VB.
I want to call my extension methods from the VB code but they don't appear in intelisense and I get compile errors when I visit the site.
I have got all the required *Import*s because other classes contained in the same... | It works for me, although there are a couple of quirks. First, I created a C# class library targeting .NET 3.5. Here's the only code in the project:
```
using System;
namespace ExtensionLibrary
{
public static class Extensions
{
public static string CustomExtension(this string text)
{
char[] chars =... |
213,078 | <p>Alright so I'm essentialyl trying to code something that will combine two files together in VB and output a single file that when run, runs both of them. I've grabbed this source from several places online and am just trying to get it to work. We have the main program that combines them with a GUI</p>
<pre><code>... | [
{
"answer_id": 213234,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 0,
"selected": false,
"text": "<p>I would start by comparing the temporary files, are you successfully re-writing out the files where they are ex... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Alright so I'm essentialyl trying to code something that will combine two files together in VB and output a single file that when run, runs both of them. I've grabbed this source from several places online and am just trying to get it to work. We have the main program that combines them with a GUI
```
Const FileSplit ... | One major issue is that you are using String variables which terminate at the first null character (ASCII code 0)
Since executable files are binary, it is exceptionally likely that they are are not being copied into (or out of) the file in full.
As a result, I would suggest reading the files into a Byte array and enc... |
213,085 | <p>I'm working on a forums system. I'm trying to allow users to see the posts they've made. In order for this link to work, I'd need to jump to the <strong>page</strong> on the particular topic they posted in that contained their post, so the bookmarks could work, etc. Since this is a new feature on an old forum, I'd ... | [
{
"answer_id": 213099,
"author": "AndyG",
"author_id": 27678,
"author_profile": "https://Stackoverflow.com/users/27678",
"pm_score": 0,
"selected": false,
"text": "<p>The thing about databases is that there is no real \"order\" to them. You can use the SCOPE_IDENTITY operator to return t... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19521/"
] | I'm working on a forums system. I'm trying to allow users to see the posts they've made. In order for this link to work, I'd need to jump to the **page** on the particular topic they posted in that contained their post, so the bookmarks could work, etc. Since this is a new feature on an old forum, I'd like to code it s... | hmm this solution makes a few assumptions, but i think it should work for what you're trying to do if i understand it correctly:
```
SELECT count(post_id) FROM posts
WHERE thread_id = '{$thread_id}' AND date_posted <= '{$date_posted}'
```
this will get you the number of rows in a particular thread (which i assume ... |
213,118 | <p>In MFC I'm trying to set a null handler timer (ie. no windows). But I'm unable to process the WM_TIMER event in the CWinApp MESSAGE_MAP. Is this possible? If so, how?</p>
| [
{
"answer_id": 213155,
"author": "Adam Tegen",
"author_id": 4066,
"author_profile": "https://Stackoverflow.com/users/4066",
"pm_score": 2,
"selected": false,
"text": "<p>I've done this by making an invisible window and setting a timer on it.</p>\n"
},
{
"answer_id": 213776,
"... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In MFC I'm trying to set a null handler timer (ie. no windows). But I'm unable to process the WM\_TIMER event in the CWinApp MESSAGE\_MAP. Is this possible? If so, how? | As told by MSDN, there are two modes of operation for [`SetTimer()`](http://msdn.microsoft.com/en-us/library/ms644906.aspx): one that associates a timer with a window, and one that associates a timer with a thread's message queue. When you have a window, you can use the former; otherwise, you must use the latter. And `... |
213,121 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/2023977/c-difference-of-keywords-typename-and-class-in-templates">C++ difference of keywords ‘typename’ and ‘class’ in templates</a> </p>
</blockquote>
<p>When defining a function template or class template in ... | [
{
"answer_id": 213133,
"author": "Grant Limberg",
"author_id": 27314,
"author_profile": "https://Stackoverflow.com/users/27314",
"pm_score": 1,
"selected": false,
"text": "<p>As far as I know, it doesn't matter which one you use. They're equivalent in the eyes of the compiler. Use whic... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1175/"
] | >
> **Possible Duplicate:**
>
> [C++ difference of keywords ‘typename’ and ‘class’ in templates](https://stackoverflow.com/questions/2023977/c-difference-of-keywords-typename-and-class-in-templates)
>
>
>
When defining a function template or class template in C++, one can write this:
```
template <class T> ..... | Stan Lippman talked about this [here](https://learn.microsoft.com/archive/blogs/slippman/why-c-supports-both-class-and-typename-for-type-parameters). I thought it was interesting.
*Summary*: Stroustrup originally used `class` to specify types in templates to avoid introducing a new keyword. Some in the committee worri... |
213,128 | <p>We're running into issues with how we specify font sizes. If we specify the font sizes using pt, they don't always look the same across browsers/platforms. If we specify font sizes using px, IE6 users can't resize the text.</p>
| [
{
"answer_id": 213137,
"author": "John Topley",
"author_id": 1450,
"author_profile": "https://Stackoverflow.com/users/1450",
"pm_score": 1,
"selected": false,
"text": "<p>You should always use relative units for font sizes, such as em.</p>\n"
},
{
"answer_id": 213141,
"author... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213128",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1538/"
] | We're running into issues with how we specify font sizes. If we specify the font sizes using pt, they don't always look the same across browsers/platforms. If we specify font sizes using px, IE6 users can't resize the text. | [An article on A List Apart](http://www.alistapart.com/articles/howtosizetextincss/) (November 2007) explored this in depth in various browsers and concluded:
>
> Sizing text and line-height in ems, with a percentage specified on the body (and an optional caveat for Safari 2), was shown to provide accurate, resizable... |
213,148 | <p>Can anyone tell the function to sort the columns of a gridview in c# asp.net.</p>
<p>The databound to gridview is from datacontext created using linq. I wanted to click the header of the column to sort the data.</p>
<p>Thanks!</p>
| [
{
"answer_id": 213154,
"author": "Kon",
"author_id": 22303,
"author_profile": "https://Stackoverflow.com/users/22303",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/ms745786.aspx\" rel=\"nofollow noreferrer\">http://msdn.microsoft.com/en-... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can anyone tell the function to sort the columns of a gridview in c# asp.net.
The databound to gridview is from datacontext created using linq. I wanted to click the header of the column to sort the data.
Thanks! | There are 2 things you need to do to get this right.
1. Keep the sorting state is viewstate(SortDirection and SortExpression)
2. You generate the correct linq expression based on the current sorting state.
Manually handle the **Sorting** event in the grid and use this helper I wrote to sort by SortExpression and Sort... |
213,151 | <p>EDIT: It seems to be something with having the two queues in the same schema.</p>
<p>I’m trying to experiment with queue propagation but I’m not seeing records in the destination queue. But that could easily be because I don’t have all the pieces in place.</p>
<p>Does anyone have a test case they could post? I’ll ... | [
{
"answer_id": 215092,
"author": "TheSoftwareJedi",
"author_id": 18941,
"author_profile": "https://Stackoverflow.com/users/18941",
"pm_score": 1,
"selected": false,
"text": "<p>Perhaps you need to enable it?</p>\n\n<pre><code>DBMS_AQADM.ENABLE_PROPAGATION_SCHEDULE(queue_name => 'Test_... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | EDIT: It seems to be something with having the two queues in the same schema.
I’m trying to experiment with queue propagation but I’m not seeing records in the destination queue. But that could easily be because I don’t have all the pieces in place.
Does anyone have a test case they could post? I’ll include what I tr... | You Need to have a default subscriber to the destination queue of the propagation. Something needs to be there to listen |
213,167 | <p>I'm looking at the code for a phase accumulator, and I must be a simpleton because I don't get it.
The code is simple enough:</p>
<pre>
Every Clock Tick do:
accum = accum + NCO_param;
return accum;
</pre>
<p>accum is a 32-bit register. Obviously, at some point it will roll-over.</p>
<p>My question real... | [
{
"answer_id": 213372,
"author": "Eli Bendersky",
"author_id": 8206,
"author_profile": "https://Stackoverflow.com/users/8206",
"pm_score": 3,
"selected": true,
"text": "<p><a href=\"http://en.wikipedia.org/wiki/Direct_digital_synthesis\" rel=\"nofollow noreferrer\">This article</a> may h... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10703/"
] | I'm looking at the code for a phase accumulator, and I must be a simpleton because I don't get it.
The code is simple enough:
```
Every Clock Tick do:
accum = accum + NCO_param;
return accum;
```
accum is a 32-bit register. Obviously, at some point it will roll-over.
My question really is: How does this ... | [This article](http://en.wikipedia.org/wiki/Direct_digital_synthesis) may help.
In the running step, the counter (properly called the phase accumulator) is instructed to advance by a certain increment on each pulse from the frequency reference. The output of the phase accumulator (the phase) is used to select each it... |
213,173 | <p>I have a single image with 9 different states and the appropriate background-position rules set up as classes to show the different states. I can't use the :hover pseudo-selector because the background image being changed is not the same element that is being hovered over. I have defined the classes this way:</p>
<... | [
{
"answer_id": 213213,
"author": "Kornel",
"author_id": 27009,
"author_profile": "https://Stackoverflow.com/users/27009",
"pm_score": 0,
"selected": false,
"text": "<p>Use <code>className</code> DOM property. <code>setAttribute()</code> is utterly broken in IE < 8.</p>\n"
},
{
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9414/"
] | I have a single image with 9 different states and the appropriate background-position rules set up as classes to show the different states. I can't use the :hover pseudo-selector because the background image being changed is not the same element that is being hovered over. I have defined the classes this way:
```
#cho... | Guess one: Rendering bug 1
Make sure that you have triggered hasLayout on the elements. You can do this by giving them a height or, if that isn't a posibility then position = relative & z-index = 1, will also trigger hasLayout. Try it for these elements + suspect parent elements.
```
/* fix hasLayout bug for IE */
di... |
213,181 | <p>Umm, I guess my questions in the title:</p>
<p>How do I turn on Option Strict / Infer in a VB.NET aspx page without a code behind file?</p>
<pre><code><%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
</scr... | [
{
"answer_id": 213190,
"author": "IAmCodeMonkey",
"author_id": 27613,
"author_profile": "https://Stackoverflow.com/users/27613",
"pm_score": 5,
"selected": true,
"text": "<pre><code><%@ Page Language=\"VB\" Strict=\"true\" %>\n</code></pre>\n"
},
{
"answer_id": 213198,
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213181",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26/"
] | Umm, I guess my questions in the title:
How do I turn on Option Strict / Infer in a VB.NET aspx page without a code behind file?
```
<%@ Page Language="VB" %>
<script runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
End Sub
</script>
``` | ```
<%@ Page Language="VB" Strict="true" %>
``` |
213,192 | <p>In my ideal world, what I'm looking for would exist as something along the lines of this:</p>
<pre><code>public string UserDefinedField
{
get { return _userDefinedField; }
internal set { _userDefinedField = value; }
set { _userDefinedField = value; ChangedFields.Add(Fields.UserDefinedField); }
}... | [
{
"answer_id": 213207,
"author": "Isak Savo",
"author_id": 8521,
"author_profile": "https://Stackoverflow.com/users/8521",
"pm_score": 3,
"selected": true,
"text": "<pre><code>public string UserDefinedField\n{\n get { return _userDefinedField; }\n set { SetField(value); ChangedFiel... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13412/"
] | In my ideal world, what I'm looking for would exist as something along the lines of this:
```
public string UserDefinedField
{
get { return _userDefinedField; }
internal set { _userDefinedField = value; }
set { _userDefinedField = value; ChangedFields.Add(Fields.UserDefinedField); }
}
```
Where o... | ```
public string UserDefinedField
{
get { return _userDefinedField; }
set { SetField(value); ChangedFields.Add(Fields.UserDefinedField); }
}
// Call this from internal methods and use the public property for other cases
internal string SetField(string userValue)
{
_userDefinedField = userValue;
}
```
Yo... |
213,195 | <p>When I try to login to this site using my yahoo openid, it takes me to the yahoo site, I click "continue" meaning that i <em>want</em> to send my authentication details to stackoverflow.com and stackoverflow.com gives me the following error underneath the login text field:</p>
<p>Unable to log in with your OpenID p... | [
{
"answer_id": 213207,
"author": "Isak Savo",
"author_id": 8521,
"author_profile": "https://Stackoverflow.com/users/8521",
"pm_score": 3,
"selected": true,
"text": "<pre><code>public string UserDefinedField\n{\n get { return _userDefinedField; }\n set { SetField(value); ChangedFiel... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29049/"
] | When I try to login to this site using my yahoo openid, it takes me to the yahoo site, I click "continue" meaning that i *want* to send my authentication details to stackoverflow.com and stackoverflow.com gives me the following error underneath the login text field:
Unable to log in with your OpenID provider:
failed ... | ```
public string UserDefinedField
{
get { return _userDefinedField; }
set { SetField(value); ChangedFields.Add(Fields.UserDefinedField); }
}
// Call this from internal methods and use the public property for other cases
internal string SetField(string userValue)
{
_userDefinedField = userValue;
}
```
Yo... |
213,214 | <p>I'm in a 10 person team working on a large legacy code base with a less than ideal product owner. Our backlog is in pretty bad shape and large epics have frequently been breaking our sprints. The team also struggles with its definition of done - some members write unit test religiously, others don't, sometimes depen... | [
{
"answer_id": 213289,
"author": "MojoFilter",
"author_id": 93,
"author_profile": "https://Stackoverflow.com/users/93",
"pm_score": 3,
"selected": true,
"text": "<p>This is recognized around our office as the \"Ah, crap! I forgot about that.\" burndown:</p>\n\n<pre><code> # # #\n ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13041/"
] | I'm in a 10 person team working on a large legacy code base with a less than ideal product owner. Our backlog is in pretty bad shape and large epics have frequently been breaking our sprints. The team also struggles with its definition of done - some members write unit test religiously, others don't, sometimes dependin... | This is recognized around our office as the "Ah, crap! I forgot about that." burndown:
```
# # #
# # # #
# # # # #
# # # # # #
# # # # # # #
# # # # # # # #
# # # # # # # #
``` |
213,237 | <p>In Django, given excerpts from an application <em>animals</em> likeso:</p>
<p>A <em>animals/models.py</em> with: </p>
<pre><code>from django.db import models
from django.contrib.contenttypes.models import ContentType
class Animal(models.Model):
content_type = models.ForeignKey(ContentType,editable=False,null=Tr... | [
{
"answer_id": 213393,
"author": "Javier",
"author_id": 11649,
"author_profile": "https://Stackoverflow.com/users/11649",
"pm_score": 0,
"selected": false,
"text": "<p>AFAICT, cats and dogs are on different DB tables, and maybe there's no Animal table. but you're using one URL pattern f... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19212/"
] | In Django, given excerpts from an application *animals* likeso:
A *animals/models.py* with:
```
from django.db import models
from django.contrib.contenttypes.models import ContentType
class Animal(models.Model):
content_type = models.ForeignKey(ContentType,editable=False,null=True)
name = models.CharField()
cl... | Alright, here's what I've done, and it seems to work and be a sensible design (though I stand to be corrected!).
In a core library (e.g. mysite.core.views.create\_update), I've written a decorator:
```
from django.contrib.contenttypes.models import ContentType
from django.views.generic import create_update
def updat... |
213,238 | <p>Just playing around with the now released Silverlight 2.0. I'm trying to put a simple Calendar in a control. However the project doesn't seem to know what I'm talking about:-</p>
<pre><code><UserControl x:Class="MyFirstSL2.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http... | [
{
"answer_id": 213304,
"author": "MojoFilter",
"author_id": 93,
"author_profile": "https://Stackoverflow.com/users/93",
"pm_score": 0,
"selected": false,
"text": "<p>I'm pretty sure there's no calendar control in Silverlight that is analogous to the ASP.Net control or the windows forms c... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17516/"
] | Just playing around with the now released Silverlight 2.0. I'm trying to put a simple Calendar in a control. However the project doesn't seem to know what I'm talking about:-
```
<UserControl x:Class="MyFirstSL2.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsof... | The calendar control is an SDK control in the assembly System.Windows.Controls namespace -- look at %program files%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client add a namespace to your xaml (after you add a reference):
```
xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls"
```
... |
213,249 | <p>I am wondering - What's the most effective way of parsing something like:</p>
<pre><code>{{HEADER}}
Hello my name is {{NAME}}
{{#CONTENT}}
This is the content ...
{{#PERSONS}}
<p>My name is {{NAME}}.</p>
{{/PERSONS}}
{{/CONTENT}}
{{FOOTER}}
</code></pre>
<p>Of course this is ... | [
{
"answer_id": 213270,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": 0,
"selected": false,
"text": "<p>You would bet better off using something with an existing parser like XML or JSON so you don't have to write your own pars... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20538/"
] | I am wondering - What's the most effective way of parsing something like:
```
{{HEADER}}
Hello my name is {{NAME}}
{{#CONTENT}}
This is the content ...
{{#PERSONS}}
<p>My name is {{NAME}}.</p>
{{/PERSONS}}
{{/CONTENT}}
{{FOOTER}}
```
Of course this is intended to be somewhat of a templatin... | Is the expected output of this something like:
This is a header
Hello my name is David
```
This is the content ...
My name is Heino.
My name is Sebastian.
```
This is the footer
---
How are you managing the relationship of nested arrays in the hash map to repeatable sections in the template? What is the actua... |
213,251 | <p>I've been reading that Adobe has made crossdomain.xml stricter in flash 9-10 and I'm wondering of someone can paste me a copy of one that they know works. Having some trouble finding a recent sample on Adobe's site.</p>
| [
{
"answer_id": 213272,
"author": "Mitch Haile",
"author_id": 28807,
"author_profile": "https://Stackoverflow.com/users/28807",
"pm_score": 8,
"selected": true,
"text": "<p>This is what I've been using for development:</p>\n\n<pre><code><?xml version=\"1.0\" ?>\n<cross-domain-pol... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18309/"
] | I've been reading that Adobe has made crossdomain.xml stricter in flash 9-10 and I'm wondering of someone can paste me a copy of one that they know works. Having some trouble finding a recent sample on Adobe's site. | This is what I've been using for development:
```
<?xml version="1.0" ?>
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
```
This is a very liberal approach, but is fine for my application.
**As others have pointed out below, beware the risks of this.** |
213,266 | <p>How do I go about positioning a JDialog at the center of the screen?</p>
| [
{
"answer_id": 213291,
"author": "johnstok",
"author_id": 27929,
"author_profile": "https://Stackoverflow.com/users/27929",
"pm_score": 8,
"selected": true,
"text": "<p>In Java 1.4+ you can do:</p>\n\n<pre><code>final JDialog d = new JDialog();\nd.setSize(200,200);\nd.setLocationRelative... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | How do I go about positioning a JDialog at the center of the screen? | In Java 1.4+ you can do:
```
final JDialog d = new JDialog();
d.setSize(200,200);
d.setLocationRelativeTo(null);
d.setVisible(true);
```
Or perhaps (pre 1.4):
```
final JDialog d = new JDialog();
d.setSize(200, 200);
final Toolkit toolkit = Toolkit.getDefaultToolkit();
final Dimension screenSize = toolkit.getScreen... |
213,267 | <p>I'm trying to pass one method to another in elisp, and then
have that method execute it. Here is an example:</p>
<pre><code>(defun t1 ()
"t1")
(defun t2 ()
"t1")
(defun call-t (t)
; how do I execute "t"?
(t))
; How do I pass in method reference?
(call-t 't1)
</code></pre>
| [
{
"answer_id": 213511,
"author": "Timo Geusch",
"author_id": 29068,
"author_profile": "https://Stackoverflow.com/users/29068",
"pm_score": 6,
"selected": true,
"text": "<p>First, I'm not sure that naming your function <code>t</code> is helping as 't' is used as the <a href=\"http://www.m... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9435/"
] | I'm trying to pass one method to another in elisp, and then
have that method execute it. Here is an example:
```
(defun t1 ()
"t1")
(defun t2 ()
"t1")
(defun call-t (t)
; how do I execute "t"?
(t))
; How do I pass in method reference?
(call-t 't1)
``` | First, I'm not sure that naming your function `t` is helping as 't' is used as the [truth value](http://www.mcs.vuw.ac.nz/cgi-bin/info2www?(elisp)nil+and+t) in lisp.
That said, the following code works for me:
```
(defun test-func-1 () "test-func-1"
(interactive "*")
(insert-string "testing callers"))
(defun ... |
213,271 | <p>window.scrollMaxY can be set via that property in IE and older versions of Firefox, but when trying in FF3 it says "Cannot set this property as it only has a getter".</p>
<p>What is my alternative?</p>
<p>EDIT:</p>
<p>The reason why I'm asking is that I'm fixing some very horrible JS written by someone else, it h... | [
{
"answer_id": 213511,
"author": "Timo Geusch",
"author_id": 29068,
"author_profile": "https://Stackoverflow.com/users/29068",
"pm_score": 6,
"selected": true,
"text": "<p>First, I'm not sure that naming your function <code>t</code> is helping as 't' is used as the <a href=\"http://www.m... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] | window.scrollMaxY can be set via that property in IE and older versions of Firefox, but when trying in FF3 it says "Cannot set this property as it only has a getter".
What is my alternative?
EDIT:
The reason why I'm asking is that I'm fixing some very horrible JS written by someone else, it has a function to keep a ... | First, I'm not sure that naming your function `t` is helping as 't' is used as the [truth value](http://www.mcs.vuw.ac.nz/cgi-bin/info2www?(elisp)nil+and+t) in lisp.
That said, the following code works for me:
```
(defun test-func-1 () "test-func-1"
(interactive "*")
(insert-string "testing callers"))
(defun ... |
213,295 | <p>I'm storing an ArrayList of Ids in a processing script that I want to spit out as a comma delimited list for output to the debug log. Is there a way I can get this easily without looping through things?</p>
<p>EDIT: Thanks to Joel for pointing out the List(Of T) that is available in .net 2.0 and above. That makes t... | [
{
"answer_id": 213305,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": 8,
"selected": true,
"text": "<p>Yes, I'm answering my own question, but I haven't found it here yet and thought this was a rather slick thing:</p>\n\n<p>...i... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/71/"
] | I'm storing an ArrayList of Ids in a processing script that I want to spit out as a comma delimited list for output to the debug log. Is there a way I can get this easily without looping through things?
EDIT: Thanks to Joel for pointing out the List(Of T) that is available in .net 2.0 and above. That makes things TONS... | Yes, I'm answering my own question, but I haven't found it here yet and thought this was a rather slick thing:
...in VB.NET:
```
String.Join(",", CType(TargetArrayList.ToArray(Type.GetType("System.String")), String()))
```
...in C#
```
string.Join(",", (string[])TargetArrayList.ToArray(Type.GetType("System.String"... |
213,299 | <p>I've implemented a .NET Web control that uses the callback structure implemented in ASP.Net 2.0. It's an autodropdown control, and it works correctly in IE 6.0/7.0 and Google Chrome. Here's the relevant callback function:</p>
<pre><code>function ReceiveServerData(args, context)
{
document.getElementById(context).... | [
{
"answer_id": 220090,
"author": "Atanas Korchev",
"author_id": 10141,
"author_profile": "https://Stackoverflow.com/users/10141",
"pm_score": 0,
"selected": false,
"text": "<p>I am not sure if this would help but I have patched the ASP.NET 2.0 callbacks like this (minified code):</p>\n\n... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11947/"
] | I've implemented a .NET Web control that uses the callback structure implemented in ASP.Net 2.0. It's an autodropdown control, and it works correctly in IE 6.0/7.0 and Google Chrome. Here's the relevant callback function:
```
function ReceiveServerData(args, context)
{
document.getElementById(context).style.zIndex = 3... | For what it's worth, the MS AJAX Function.createCallback() doesn't seem to work correctly in FireFox. See this post here, with repro code:
[Function.createCallback doesn't pass context correctly in FireFox](https://stackoverflow.com/questions/969326/function-createcallback-doesnt-pass-context-correctly-in-firefox/9693... |
213,303 | <p>There are many tools out there for writing and managing requirements, but are there any good ones for reviewing them? </p>
<p>I'm not talking about <strong><em>managing</em></strong> reviews, but automation tools that look for common requirement blunders (such as using negative requirements, or ones that are worde... | [
{
"answer_id": 213452,
"author": "kenny",
"author_id": 3225,
"author_profile": "https://Stackoverflow.com/users/3225",
"pm_score": 3,
"selected": true,
"text": "<p>I'm working on a console application that takes a xml configuration file like this:</p>\n\n<pre><code><?xml version=\"1.0... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213303",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2382102/"
] | There are many tools out there for writing and managing requirements, but are there any good ones for reviewing them?
I'm not talking about ***managing*** reviews, but automation tools that look for common requirement blunders (such as using negative requirements, or ones that are worded in a way that makes testing d... | I'm working on a console application that takes a xml configuration file like this:
```
<?xml version="1.0" encoding="utf-8"?>
<ReqCheck>
<Categories name="Reconsider wording">
<Keyword>may</Keyword>
<Keyword>should</Keyword>
</Categories>
<Categories name="Potential logic problem" format="{0}: consider ... |
213,309 | <p>Is it possible to create, for instance, a box model hack while using in-line CSS?</p>
<p>For example:</p>
<p><code><div id="blah" style="padding: 5px; margin: 5px; width: 30px; /*IE5-6 Equivalent here*/"></code></p>
<p>Thanks! </p>
| [
{
"answer_id": 213342,
"author": "eyelidlessness",
"author_id": 17964,
"author_profile": "https://Stackoverflow.com/users/17964",
"pm_score": 0,
"selected": false,
"text": "<p>The most appropriate answer is <strong>don't</strong>. (Edit: to be clear, I mean don't do it inline, I don't me... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to create, for instance, a box model hack while using in-line CSS?
For example:
`<div id="blah" style="padding: 5px; margin: 5px; width: 30px; /*IE5-6 Equivalent here*/">`
Thanks! | You can use the "prefixing" hack in inline styles as well:
```
<div style="*background:red"></div>
```
Just make sure you put the IE hacks at the end of the style attribute. However I second the opinion that inline styles should be avoided when possible. Conditional comments and a separate CSS file for Internet Expl... |
213,333 | <p>I have a generic class in C# with 2 constructors:</p>
<pre><code>public Houses(params T[] InitialiseElements)
{}
public Houses(int Num, T DefaultValue)
{}
</code></pre>
<p>Constructing an object using int as the generic type and passing in two ints as arguments causes the 'incorrect' constructor to be called (from... | [
{
"answer_id": 213354,
"author": "Jon B",
"author_id": 27414,
"author_profile": "https://Stackoverflow.com/users/27414",
"pm_score": 2,
"selected": false,
"text": "<p>Perhaps instead of Params you could pass in IEnumerable</p>\n\n<pre><code>public Houses(IEnumerable<T> InitialiseEl... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29059/"
] | I have a generic class in C# with 2 constructors:
```
public Houses(params T[] InitialiseElements)
{}
public Houses(int Num, T DefaultValue)
{}
```
Constructing an object using int as the generic type and passing in two ints as arguments causes the 'incorrect' constructor to be called (from my point of view).
E.g. ... | A clearer solution would be to have two static factory methods. If you put these into a nongeneric class, you can also benefit from type inference:
```
public static class Houses
{
public static Houses<T> CreateFromElements<T>(params T[] initialElements)
{
return new Houses<T>(initialElements);
}
... |
213,360 | <p>I have a Dictionary where I hold data for movieclips, and I want the data to be garbage collected if I stop using the movieclips. I'm using the weak keys parameters, and it works perfectly with other data, however I've run into a problem. </p>
<p>This code works great:</p>
<pre><code>var mc = new MovieClip();
var ... | [
{
"answer_id": 213513,
"author": "Aaron H.",
"author_id": 16258,
"author_profile": "https://Stackoverflow.com/users/16258",
"pm_score": 2,
"selected": true,
"text": "<p>I believe that the problem is one of timing. I think that when you call remove child, the reference count isn't getting... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1815/"
] | I have a Dictionary where I hold data for movieclips, and I want the data to be garbage collected if I stop using the movieclips. I'm using the weak keys parameters, and it works perfectly with other data, however I've run into a problem.
This code works great:
```
var mc = new MovieClip();
var dic = new Dictionary(... | I believe that the problem is one of timing. I think that when you call remove child, the reference count isn't getting updated until later in the "frame". (I think this is what is happening anyway.)
The code below demonstrates why I think this is true. (I'm using flex, but it appears to reproduce your issue.)
The co... |
213,368 | <p>I want to write a script, to be packaged into a gem, which will modify its parameters and then <code>exec</code> a new ruby process with the modified params. In other words, something similar to a shell script which modifies its params and then does an <code>exec $SHELL $*</code>. In order to do this, I need a rob... | [
{
"answer_id": 216242,
"author": "Vitalie",
"author_id": 27913,
"author_profile": "https://Stackoverflow.com/users/27913",
"pm_score": 3,
"selected": false,
"text": "<p>If you want to check on linux: read files:</p>\n\n<ul>\n<li>/proc/PID/exe </li>\n<li>/proc/PID/cmdline</li>\n</ul>\n\n<... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20487/"
] | I want to write a script, to be packaged into a gem, which will modify its parameters and then `exec` a new ruby process with the modified params. In other words, something similar to a shell script which modifies its params and then does an `exec $SHELL $*`. In order to do this, I need a robust way of discovering the ... | The Rake source code does it like this:
```
RUBY = File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name']).
sub(/.*\s.*/m, '"\&"')
``` |
213,375 | <p>I am trying to create a new instance of Excel using VBA using:</p>
<pre class="lang-vb prettyprint-override"><code>Set XlApp = New Excel.Application
</code></pre>
<p>The problem is that this new instance of Excel doesn't load all the addins that load when I open Excel normally...Is there anything in the Excel Appl... | [
{
"answer_id": 214006,
"author": "Mike Rosenblum",
"author_id": 10429,
"author_profile": "https://Stackoverflow.com/users/10429",
"pm_score": 3,
"selected": false,
"text": "<p>Using <code>CreateObject(\"Excel.Application\")</code> would have the same result as using <code>New Excel.Appli... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5106/"
] | I am trying to create a new instance of Excel using VBA using:
```vb
Set XlApp = New Excel.Application
```
The problem is that this new instance of Excel doesn't load all the addins that load when I open Excel normally...Is there anything in the Excel Application object for loading in all the user-specified addins?
... | I looked into this problem again, and the Application.Addins collection seems to have all the addins listed in the Tools->Addins menu, with a boolean value stating whether or not an addin is installed. So what seems to work for me now is to loop through all addins and if .Installed = true then I set .Installed to False... |
213,411 | <p>I have tree tables, Customer, Invoice and InvoiceRow with the standard relations. </p>
<p>These I have to export in one fixed field length file with the first two characters of each row identifying the row type. The row types have different specifications.</p>
<p>I could probably do it with a nested loop in a scri... | [
{
"answer_id": 213432,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 0,
"selected": false,
"text": "<p>Process your three tables so that the outputs are all appropriate for your output file (including the row type de... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21761/"
] | I have tree tables, Customer, Invoice and InvoiceRow with the standard relations.
These I have to export in one fixed field length file with the first two characters of each row identifying the row type. The row types have different specifications.
I could probably do it with a nested loop in a script block, but thi... | Your gut feeling on doing this using a Script Destination component is correct. Unfortunately, this scenario doesn't jive with SSIS well. I don't consider this a beginner package. If you must use SSIS then I'd start by inner joining all the data so there is one row for each InvoiceRow, containing the data needed from a... |
213,421 | <p>Dependency injection seems to be a good thing. In general, should dependencies be injected at the methods that require them, or should they be injected in the contructor of the class?</p>
<p>See the samples below to demonstrate the two ways to inject the same dependency.</p>
<pre><code>//Inject the dependency int... | [
{
"answer_id": 213425,
"author": "johnstok",
"author_id": 27929,
"author_profile": "https://Stackoverflow.com/users/27929",
"pm_score": 5,
"selected": true,
"text": "<p>The major benefit of constructor injection is that it allows your fields to be marked final. For example:</p>\n\n<pre><... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/681/"
] | Dependency injection seems to be a good thing. In general, should dependencies be injected at the methods that require them, or should they be injected in the contructor of the class?
See the samples below to demonstrate the two ways to inject the same dependency.
```
//Inject the dependency into the methods that req... | The major benefit of constructor injection is that it allows your fields to be marked final. For example:
```
class Foo {
private final Bar _bar;
Foo(Bar bar) {
_bar=bar;
}
}
```
The following page has a great list of the pro's and con's: [Guice Best Practices](http://code.google.com/p/google-gu... |
213,427 | <p>Is it currently possible to translate C# code into an Abstract Syntax Tree?</p>
<p>Edit: some clarification; I don't necessarily expect the compiler to generate the AST for me - a parser would be fine, although I'd like to use something "official." Lambda expressions are unfortunately not going to be sufficient giv... | [
{
"answer_id": 213484,
"author": "Rob Walker",
"author_id": 3631,
"author_profile": "https://Stackoverflow.com/users/3631",
"pm_score": 3,
"selected": false,
"text": "<p>Check out .NET <a href=\"https://learn.microsoft.com/en-us/dotnet/framework/reflection-and-codedom/using-the-codedom\"... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16942/"
] | Is it currently possible to translate C# code into an Abstract Syntax Tree?
Edit: some clarification; I don't necessarily expect the compiler to generate the AST for me - a parser would be fine, although I'd like to use something "official." Lambda expressions are unfortunately not going to be sufficient given they do... | The [Roslyn](http://msdn.microsoft.com/en-us/roslyn) project is in Visual Studio 2010 and gives you programmatic access to the [Syntax Tree](http://msdn.microsoft.com/en-us/hh543916), among other things.
```
SyntaxTree tree = SyntaxTree.ParseCompilationUnit(
@" C# code here ");
var root = (CompilationUnitSyntax)t... |
213,429 | <p>I'm having trouble dynamically adding controls inside an update panel with partial postbacks. I've read many articles on dynamic controls and I understand how to add and maintain them with postbacks but most of that information doesn't apply and won't work for partial postbacks. I can't find any useful information a... | [
{
"answer_id": 214854,
"author": "sven",
"author_id": 46,
"author_profile": "https://Stackoverflow.com/users/46",
"pm_score": 5,
"selected": true,
"text": "<p>This is, I think, one of the common pitfalls for asp.net programmers but isn't actually that hard to get it right when you know w... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18785/"
] | I'm having trouble dynamically adding controls inside an update panel with partial postbacks. I've read many articles on dynamic controls and I understand how to add and maintain them with postbacks but most of that information doesn't apply and won't work for partial postbacks. I can't find any useful information abou... | This is, I think, one of the common pitfalls for asp.net programmers but isn't actually that hard to get it right when you know what is going on (always remember your viewstate!).
the following piece of code explains how things can be done. It's a simple page where a user can click on a menu which will trigger an acti... |
213,430 | <p>So, I've started to create some Ruby unit tests that use <a href="http://selenium-rc.openqa.org/" rel="nofollow noreferrer">Selenium RC</a> to test my web app directly in the browser. I'm using the <a href="http://github.com/ph7/selenium-client/tree/master" rel="nofollow noreferrer">Selenum-Client</a> for ruby. I'... | [
{
"answer_id": 216472,
"author": "Dan Fitch",
"author_id": 27614,
"author_profile": "https://Stackoverflow.com/users/27614",
"pm_score": 0,
"selected": false,
"text": "<p><em>Disclaimer: Not a selenium expert.</em></p>\n\n<p>Do you just want to know which browser failed, or do you want t... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13216/"
] | So, I've started to create some Ruby unit tests that use [Selenium RC](http://selenium-rc.openqa.org/) to test my web app directly in the browser. I'm using the [Selenum-Client](http://github.com/ph7/selenium-client/tree/master) for ruby. I've created a base class for all my other selenium tests to inherit from.
This ... | Did you try [Selenium Grid](http://selenium-grid.openqa.org/how_it_works.html)? I think it creates pretty good summary report which shows details you need. I may be wrong, as I didn't use it for quite a while. |
213,461 | <p>Is there a maximum length when using window.returnValue (variant) in a modal? </p>
<p>I am calling a modal window using showModalDialog() and returning a comma delimited string. After selecting a group of users, I am putting them into a stringbuilder to display in a literal.</p>
<pre><code>Dim strReturn As New S... | [
{
"answer_id": 213591,
"author": "Jason Bunting",
"author_id": 1790,
"author_profile": "https://Stackoverflow.com/users/1790",
"pm_score": 3,
"selected": true,
"text": "<p>First, in what browser are you having problems? <code>window.returnValue</code> isn't even supported in Firefox, may... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3256/"
] | Is there a maximum length when using window.returnValue (variant) in a modal?
I am calling a modal window using showModalDialog() and returning a comma delimited string. After selecting a group of users, I am putting them into a stringbuilder to display in a literal.
```
Dim strReturn As New StringBuilder
strReturn.... | First, in what browser are you having problems? `window.returnValue` isn't even supported in Firefox, maybe not even other browsers.
Second, have you looked the value of `strUsers` after building it to make sure there are no single or double quotes in that string?
I would guess that the maximum size/length of that pr... |
213,465 | <p>Before you answer, this question is complicated:</p>
<ol>
<li>We are developing in asp.net / asp.net mvc / jQuery but I'm open to solutions on any platform using any framework</li>
<li>I think logic like sorting / hiding columns / re-arranging columns / validation (where it makes sense) should be on the client-side... | [
{
"answer_id": 213517,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<p>On two; you should always have server side validation as well as client side validation</p>\n\n<p>On three; if you can find ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8360/"
] | Before you answer, this question is complicated:
1. We are developing in asp.net / asp.net mvc / jQuery but I'm open to solutions on any platform using any framework
2. I think logic like sorting / hiding columns / re-arranging columns / validation (where it makes sense) should be on the client-side
3. I think logic l... | On two; you should always have server side validation as well as client side validation
On three; if you can find a way to manipulate the DB on the client side that would be impressive ;)
I don't know how ASP.net works though, so I am solely speaking from my PHP experience.
I would write controls that are paired by ... |
213,476 | <p>I'm working on trying to generate a report from a couple of database tables. The simplified version looks like this</p>
<pre><code>Campaign
----------
CampaignID
Source
-----------------------
Source_ID | Campaign_ID
Content
---------------------------------------------------------
Content_ID | Campaign_ID | Cont... | [
{
"answer_id": 213578,
"author": "Barry Brown",
"author_id": 17312,
"author_profile": "https://Stackoverflow.com/users/17312",
"pm_score": 2,
"selected": true,
"text": "<p>This is my first stab at it. Refinement coming once I know more about the contents of the Content table.</p>\n\n<p>F... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5590/"
] | I'm working on trying to generate a report from a couple of database tables. The simplified version looks like this
```
Campaign
----------
CampaignID
Source
-----------------------
Source_ID | Campaign_ID
Content
---------------------------------------------------------
Content_ID | Campaign_ID | Content_Row_ID | C... | This is my first stab at it. Refinement coming once I know more about the contents of the Content table.
First, you need a temporary table:
```
CREATE TABLE pivot (count integer);
INSERT INTO pivot VALUES (1);
INSERT INTO pivot VALUES (2);
```
Now we're ready to query.
```
SELECT campaignid, sourceid, a.contentval... |
213,480 | <p>How can I bring a console application window to front in C# (especially when running the Visual Studio debugger)?</p>
| [
{
"answer_id": 213582,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "<p>It's hacky, it's horrible, but it works for me (thanks, <a href=\"http://pinvoke.net/\" rel=\"noreferrer\">pinvoke.net... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213480",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25571/"
] | How can I bring a console application window to front in C# (especially when running the Visual Studio debugger)? | It's hacky, it's horrible, but it works for me (thanks, [pinvoke.net](http://pinvoke.net/)!):
```
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
public class Test
{
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool... |
213,506 | <p>I get the following warning when using <code>java.net.URLEncoder.encode</code>:</p>
<pre>warning: [deprecation] encode(java.lang.String)
in java.net.URLEncoder has been deprecated</pre>
<p>What should I be using instead?</p>
| [
{
"answer_id": 213519,
"author": "Will Wagner",
"author_id": 25468,
"author_profile": "https://Stackoverflow.com/users/25468",
"pm_score": 9,
"selected": true,
"text": "<p>Use the other <code>encode</code> method in <a href=\"http://docs.oracle.com/javase/8/docs/api/java/net/URLEncoder.h... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/338/"
] | I get the following warning when using `java.net.URLEncoder.encode`:
```
warning: [deprecation] encode(java.lang.String)
in java.net.URLEncoder has been deprecated
```
What should I be using instead? | Use the other `encode` method in [URLEncoder](http://docs.oracle.com/javase/8/docs/api/java/net/URLEncoder.html#encode-java.lang.String-java.lang.String-):
```
URLEncoder.encode(String, String)
```
The first parameter is the text to encode; the second is the name of the character encoding to use (e.g., `UTF-8`). For... |
213,543 | <p>My MySQL database contains several tables using different storage engines
(specifically myisam and innodb). How can I find out which tables are
using which engine?</p>
| [
{
"answer_id": 213545,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 10,
"selected": true,
"text": "<pre><code>SHOW TABLE STATUS WHERE Name = 'xxx'\n</code></pre>\n<p>This will give you (among other things) an <code>Engine</c... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213543",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9435/"
] | My MySQL database contains several tables using different storage engines
(specifically myisam and innodb). How can I find out which tables are
using which engine? | ```
SHOW TABLE STATUS WHERE Name = 'xxx'
```
This will give you (among other things) an `Engine` column, which is what you want. |
213,568 | <p>Backstory: I have a PKCS#12 (p12) certificate with a symmetric cipher (password) that I used OpenSSL to convert to a PEM; opening that as text I see it contains both a <code>BEGIN/END CERTIFICATE</code> section as well as <code>BEGIN/END RSA PRIVATE KEY</code>. The .NET Framework <code>X509Certificate</code> class ... | [
{
"answer_id": 213579,
"author": "nsayer",
"author_id": 13757,
"author_profile": "https://Stackoverflow.com/users/13757",
"pm_score": 0,
"selected": false,
"text": "<p>Certificates and keys are generally stored separately. Cut the PEM file into two files, one with the certificate and one... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9642/"
] | Backstory: I have a PKCS#12 (p12) certificate with a symmetric cipher (password) that I used OpenSSL to convert to a PEM; opening that as text I see it contains both a `BEGIN/END CERTIFICATE` section as well as `BEGIN/END RSA PRIVATE KEY`. The .NET Framework `X509Certificate` class only supports the "ASN.1 DER" format,... | Oops, I'm behind the times! Looks like `X509Certificate2` can read PKCS#12 files so there's no need for any conversion. |
213,584 | <p>I have written an Excel VBA macro which imports data from a HTML file (stored locally) before performing calculations on the data.</p>
<p>At the moment the HTML file is referred to with an absolute path:</p>
<pre><code>Workbooks.Open FileName:="C:\Documents and Settings\Senior Caterer\My Documents\Endurance Calcul... | [
{
"answer_id": 213602,
"author": "yalestar",
"author_id": 2177,
"author_profile": "https://Stackoverflow.com/users/2177",
"pm_score": 4,
"selected": false,
"text": "<p>You could use one of these for the relative path root:</p>\n\n<pre><code>ActiveWorkbook.Path\nThisWorkbook.Path\nApp.Pat... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29070/"
] | I have written an Excel VBA macro which imports data from a HTML file (stored locally) before performing calculations on the data.
At the moment the HTML file is referred to with an absolute path:
```
Workbooks.Open FileName:="C:\Documents and Settings\Senior Caterer\My Documents\Endurance Calculation\TRICATEndurance... | Just to clarify what yalestar said, this will give you the relative path:
```
Workbooks.Open FileName:= ThisWorkbook.Path & "\TRICATEndurance Summary.html"
``` |
213,628 | <p>I have embedded a Python interpreter in a C program. Suppose the C program reads some bytes from a file into a char array and learns (somehow) that the bytes represent text with a certain encoding (e.g., ISO 8859-1, Windows-1252, or UTF-8). How do I decode the contents of this char array into a Python string?</p>
... | [
{
"answer_id": 213639,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 2,
"selected": false,
"text": "<p>You don't want to decode the string into a Unicode representation, you just want to treat it as an array of bytes, r... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17498/"
] | I have embedded a Python interpreter in a C program. Suppose the C program reads some bytes from a file into a char array and learns (somehow) that the bytes represent text with a certain encoding (e.g., ISO 8859-1, Windows-1252, or UTF-8). How do I decode the contents of this char array into a Python string?
The Pyth... | PyString\_Decode does this:
```
PyObject *PyString_Decode(const char *s,
Py_ssize_t size,
const char *encoding,
const char *errors)
{
PyObject *v, *str;
str = PyString_FromStringAndSize(s, size);
if (str == NULL)
return NULL;
v = PyString_AsDecodedString(s... |
213,630 | <p>I'm writing a sample console service host and I want to plug into WCF stack to be able to print a message to console when new message arrives, even if it won't get processed by the service at the moment (because service is working on previous calls).
This is based on my assumption that messages arriving get queued b... | [
{
"answer_id": 213639,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 2,
"selected": false,
"text": "<p>You don't want to decode the string into a Unicode representation, you just want to treat it as an array of bytes, r... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13163/"
] | I'm writing a sample console service host and I want to plug into WCF stack to be able to print a message to console when new message arrives, even if it won't get processed by the service at the moment (because service is working on previous calls).
This is based on my assumption that messages arriving get queued by t... | PyString\_Decode does this:
```
PyObject *PyString_Decode(const char *s,
Py_ssize_t size,
const char *encoding,
const char *errors)
{
PyObject *v, *str;
str = PyString_FromStringAndSize(s, size);
if (str == NULL)
return NULL;
v = PyString_AsDecodedString(s... |
213,638 | <p>I'm using C#, .NET 3.5. I understand how to utilize events, how to declare them in my class, how to hook them from somewhere else, etc. A contrived example:</p>
<pre><code>public class MyList
{
private List<string> m_Strings = new List<string>();
public EventHandler<EventArgs> ElementAdd... | [
{
"answer_id": 213651,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "<p>I've written this up in a fair amount of detail in <a href=\"http://pobox.com/~skeet/csharp/events.html\" rel=\"norefe... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17803/"
] | I'm using C#, .NET 3.5. I understand how to utilize events, how to declare them in my class, how to hook them from somewhere else, etc. A contrived example:
```
public class MyList
{
private List<string> m_Strings = new List<string>();
public EventHandler<EventArgs> ElementAddedEvent;
public void Add(stri... | I've written this up in a fair amount of detail in [an article](http://pobox.com/~skeet/csharp/events.html), but here's the summary, assuming you're reasonably happy with [delegates](http://msdn.microsoft.com/en-us/library/ms173171.aspx) themselves:
* An event is just an "add" method and a "remove" method, in the same... |
213,644 | <p>How many can relate do this?</p>
<blockquote>
<h1>Server Error in / Application</h1>
<hr>
<h2><em>Object reference not set to an object</em></h2>
<p><strong>Description:</strong> Object reference not set to an object.</p>
<p><strong>Exception Details:</strong> <code>System.NullReferenceExcepti... | [
{
"answer_id": 213667,
"author": "UnhipGlint",
"author_id": 13010,
"author_profile": "https://Stackoverflow.com/users/13010",
"pm_score": 1,
"selected": false,
"text": "<p>If I'm unable to identify/resolve the issue using the error message that the page presents to me, I will typically t... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How many can relate do this?
>
> Server Error in / Application
> =============================
>
>
>
>
> ---
>
>
> *Object reference not set to an object*
> ---------------------------------------
>
>
> **Description:** Object reference not set to an object.
>
>
> **Exception Details:** `System.NullReferenc... | If I'm unable to identify/resolve the issue using the error message that the page presents to me, I will typically try to use the Windows Event Viewer to help me identify what is causing the issue.
For example, SharePoint errors are sometimes far less than descriptive. So, I'll combine what I'm seeing on the Y.S.O.D. ... |
213,657 | <p>I am using an ASP page where I have to read a CSV file and insert it into DB table "Employee". I am creating an object of TestReader. How can I write a loop to execute up to the number of rows/records of the CSV file which is being read?</p>
| [
{
"answer_id": 213739,
"author": "jeff.willis",
"author_id": 9829,
"author_profile": "https://Stackoverflow.com/users/9829",
"pm_score": 4,
"selected": false,
"text": "<p>Do not try to parse the file yourself, you'll just give yourself a headache. There's quite a bit more to it than spl... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using an ASP page where I have to read a CSV file and insert it into DB table "Employee". I am creating an object of TestReader. How can I write a loop to execute up to the number of rows/records of the CSV file which is being read? | Do not try to parse the file yourself, you'll just give yourself a headache. There's quite a bit more to it than splitting on newline and commas.
You can use OLEDB to open up the file in a recordset and read it just as you would a db table. Something like this:
```
Dim strConn, conn, rs
strConn = "Provider=Microsof... |
213,661 | <p>My application is a vb6 executable, but some newer forms in the system are written in C#. I would like to be able to set the C# form's Owner property using a handle to the main application window, so that the dialogs remain on top when tabbing back and forth between my app and other apps.</p>
<p>I can get the hwnd... | [
{
"answer_id": 213751,
"author": "Scott Dorman",
"author_id": 1559,
"author_profile": "https://Stackoverflow.com/users/1559",
"pm_score": 4,
"selected": true,
"text": "<p>So you are calling a C# Windows Form class from VB6, which means you are probably using either <code>Show()</code> or... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3782/"
] | My application is a vb6 executable, but some newer forms in the system are written in C#. I would like to be able to set the C# form's Owner property using a handle to the main application window, so that the dialogs remain on top when tabbing back and forth between my app and other apps.
I can get the hwnd of the mai... | So you are calling a C# Windows Form class from VB6, which means you are probably using either `Show()` or `ShowDialog()`, correct? Both of those methods also take an IWin32Window parameter, which simply defines an object that returns an IntPtr property named Handle.
So...you need to add an overloaded constructor (or ... |
213,671 | <p>Does anyone know of an easy way to import a legacy project, whose "version control system" is a series of dated folders, into SVN, so that the history of the revisions is preserved?</p>
<p>The project I inherited was not under version control, and there are hundreds of folders, each dated like: 2006-11-26, 2006-11-... | [
{
"answer_id": 213753,
"author": "Leigh Caldwell",
"author_id": 3267,
"author_profile": "https://Stackoverflow.com/users/3267",
"pm_score": 2,
"selected": false,
"text": "<p>I think the shell script solution would not be too hard. Something like this:</p>\n\n<pre><code>for d in 200*\ndo\... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28574/"
] | Does anyone know of an easy way to import a legacy project, whose "version control system" is a series of dated folders, into SVN, so that the history of the revisions is preserved?
The project I inherited was not under version control, and there are hundreds of folders, each dated like: 2006-11-26, 2006-11-27, etc...... | I think the shell script solution would not be too hard. Something like this:
```
for d in 200*
do
cp -a $d/* svndir/
cd svndir
svn add *
svn commit
cd ..
done
```
Rather naive code I know, but I would think that something a bit like this would do the job (subject to there already being a reposit... |
213,680 | <p>I'm trying to use jcarousel to build a container with multiple rows, I've tried a few things but have had no luck. Can anyone make any suggestions on how to create it?</p>
| [
{
"answer_id": 242866,
"author": "Sike",
"author_id": 32025,
"author_profile": "https://Stackoverflow.com/users/32025",
"pm_score": 4,
"selected": true,
"text": "<p>We have had to make a similar modifiaction. We do this by extending the default options, to include a rows value, and the ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16195/"
] | I'm trying to use jcarousel to build a container with multiple rows, I've tried a few things but have had no luck. Can anyone make any suggestions on how to create it? | We have had to make a similar modifiaction. We do this by extending the default options, to include a rows value, and the width of each item (we call them modules) then divide the width by the number of rows.
Code added to jCarousel function...
Add to default options:
```
moduleWidth: null,
rows:null,
```
Then se... |
213,683 | <p>I'm doing something like the following:</p>
<pre><code>SELECT * FROM table WHERE user='$user';
$myrow = fetchRow() // previously I inserted a pass to the db using base64_encode ex: WRM2gt3R=
$somepass = base64_encode($_POST['password']);
if($myrow[1] != $somepass) echo 'error';
else echo 'welcome';
</code></pre>
... | [
{
"answer_id": 213696,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 3,
"selected": true,
"text": "<p>Try using <code>var_dump</code> instead of echo - maybe one of them has a space or newline at the start/end.</p>\n\n<p>Edit... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm doing something like the following:
```
SELECT * FROM table WHERE user='$user';
$myrow = fetchRow() // previously I inserted a pass to the db using base64_encode ex: WRM2gt3R=
$somepass = base64_encode($_POST['password']);
if($myrow[1] != $somepass) echo 'error';
else echo 'welcome';
```
Im always getting erro... | Try using `var_dump` instead of echo - maybe one of them has a space or newline at the start/end.
Edit:
You must be storing it as CHAR(40): `A fixed-length string that is always right-padded with spaces to the specified length when stored`
Use VARCHAR or `trim()` |
213,691 | <p>I intermittently get this in error in my .NET 1.1 C# Windows Forms application. Someone indicated that this is due to a bug in the 1.1 framework and suggests putting the following code into any custom controls.</p>
<pre><code>protected override void OnParentChanged(EventArgs e)
{
if (this.Parent != null)
{
... | [
{
"answer_id": 213740,
"author": "TimothyP",
"author_id": 28149,
"author_profile": "https://Stackoverflow.com/users/28149",
"pm_score": 0,
"selected": false,
"text": "<p>Hey, I'm not sure about your problem as I haven't used .NET 1.1 in ages,\nand I hate to state the obvious... but what ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213691",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I intermittently get this in error in my .NET 1.1 C# Windows Forms application. Someone indicated that this is due to a bug in the 1.1 framework and suggests putting the following code into any custom controls.
```
protected override void OnParentChanged(EventArgs e)
{
if (this.Parent != null)
{
this.CreatePar... | From the title it seems that your code is trying to access an already disposed object. This can happen in finalizer if you try to access a managed reference field. The order CLR finalizes managed objects is non-deterministic. |
213,702 | <p>I am working with a set of data that looks something like the following.</p>
<blockquote>
<pre><code>StudentName | AssignmentName | Grade
---------------------------------------
StudentA | Assignment 1 | 100
StudentA | Assignment 2 | 80
StudentA | Total | 180
StudentB | Assignment 1 ... | [
{
"answer_id": 213713,
"author": "BoltBait",
"author_id": 20848,
"author_profile": "https://Stackoverflow.com/users/20848",
"pm_score": 1,
"selected": false,
"text": "<p>The only way I've found to do this is to use dynamic SQL and put the column labels into a variable.</p>\n"
},
{
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13279/"
] | I am working with a set of data that looks something like the following.
>
>
> ```
> StudentName | AssignmentName | Grade
> ---------------------------------------
> StudentA | Assignment 1 | 100
> StudentA | Assignment 2 | 80
> StudentA | Total | 180
> StudentB | Assignment 1 | 100
... | I know you said no dynamic `SQL`, but I don't see any way to do it in straight `SQL`.
If you check out my answers to similar problems at [Pivot Table and Concatenate Columns](https://stackoverflow.com/questions/159456/pivot-table-and-concatenate-columns-sql-problem#159803) and [PIVOT in sql 2005](https://stackoverflow... |
213,719 | <p>I'm using VisualSVN client and server and one of the requirements for web projects to work as expected is to have the .sln in the same directory (root) as the other files.</p>
<p>I thought it was as simple as removing all the extra parent paths ../ and other relative paths and saving it. However when I try to open ... | [
{
"answer_id": 213741,
"author": "Jeremy B.",
"author_id": 28567,
"author_profile": "https://Stackoverflow.com/users/28567",
"pm_score": 3,
"selected": false,
"text": "<p>the following steps should work.</p>\n\n<ol>\n<li>make a blank solution, nothing in it.</li>\n<li>Move the solution t... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3747/"
] | I'm using VisualSVN client and server and one of the requirements for web projects to work as expected is to have the .sln in the same directory (root) as the other files.
I thought it was as simple as removing all the extra parent paths ../ and other relative paths and saving it. However when I try to open it just lo... | THe other option is when you create the project simply uncheck the default box for "create directory for solution" |
213,729 | <p>For example:</p>
<pre><code>from datetime import <c-x><c-o>{list of modules inside datetime package}
</code></pre>
| [
{
"answer_id": 213741,
"author": "Jeremy B.",
"author_id": 28567,
"author_profile": "https://Stackoverflow.com/users/28567",
"pm_score": 3,
"selected": false,
"text": "<p>the following steps should work.</p>\n\n<ol>\n<li>make a blank solution, nothing in it.</li>\n<li>Move the solution t... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1367022/"
] | For example:
```
from datetime import <c-x><c-o>{list of modules inside datetime package}
``` | THe other option is when you create the project simply uncheck the default box for "create directory for solution" |
213,761 | <p>I've seen some examples of C++ using template template parameters (that is templates which take templates as parameters) to do policy-based class design. What other uses does this technique have?</p>
| [
{
"answer_id": 213811,
"author": "Evan Teran",
"author_id": 13430,
"author_profile": "https://Stackoverflow.com/users/13430",
"pm_score": 9,
"selected": true,
"text": "<p>I think you need to use template template syntax to pass a parameter whose type is a template dependent on another te... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4086/"
] | I've seen some examples of C++ using template template parameters (that is templates which take templates as parameters) to do policy-based class design. What other uses does this technique have? | I think you need to use template template syntax to pass a parameter whose type is a template dependent on another template like this:
```
template <template<class> class H, class S>
void f(const H<S> &value) {
}
```
Here, `H` is a template, but I wanted this function to deal with all specializations of `H`.
**NOTE... |
213,784 | <p>I have the following in my web.config:</p>
<pre><code><location path="RestrictedPage.aspx">
<system.web>
<authorization>
<allow roles="Group1Admin, Group3Admin, Group7Admin"/>
<deny users="*"/>
</authorization>
</system.web>
&... | [
{
"answer_id": 213815,
"author": "Kolten",
"author_id": 13959,
"author_profile": "https://Stackoverflow.com/users/13959",
"pm_score": 0,
"selected": false,
"text": "<pre><code>if {User.IsInRole(\"Group1Admin\"){//do stuff}\n</code></pre>\n\n<p>Is that what your asking?</p>\n"
},
{
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27482/"
] | I have the following in my web.config:
```
<location path="RestrictedPage.aspx">
<system.web>
<authorization>
<allow roles="Group1Admin, Group3Admin, Group7Admin"/>
<deny users="*"/>
</authorization>
</system.web>
</location>
```
Within RestrictedPage.aspx.cs, how do I... | ```
// set the configuration path to your config file
string configPath = "??";
Configuration config = WebConfigurationManager.OpenWebConfiguration(configPath);
// Get the object related to the <identity> section.
AuthorizationSection section = (AuthorizationSection)config.GetSection("system.web/authorization");
```... |
213,801 | <p>I need to get a list of all documents in a site collection, which I believe I can do with either the alldocs table or the alluserdata table (MOSS 2007 SP1) but do not see how I can get the author information for the document. I do not need the contents of the document (e.g. AllDocStreams content)</p>
<p><strong>S... | [
{
"answer_id": 213848,
"author": "cciotti",
"author_id": 16834,
"author_profile": "https://Stackoverflow.com/users/16834",
"pm_score": 0,
"selected": false,
"text": "<p>MOSS provides many <a href=\"http://www.infoq.com/articles/swanson-moss-web-services\" rel=\"nofollow noreferrer\">webs... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213801",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25642/"
] | I need to get a list of all documents in a site collection, which I believe I can do with either the alldocs table or the alluserdata table (MOSS 2007 SP1) but do not see how I can get the author information for the document. I do not need the contents of the document (e.g. AllDocStreams content)
**Something like this... | People that claim that you cannot query SharePoint databases because it is not supported are wrong. From reading the documentation, it is fine to query the database as long as you use the 'With(NoLock)' clause. It is clearly not supported to update, delete, or insert records.
The below query is supported:
```
Select ... |
213,814 | <p>I'm writing an intranet application for a client and I want to give them the ability to configure through an admin interface, which users and user groups can access certain areas. What I'd like to know is the best way of storing the reference to the user or group that is assigned to an area of the intranet. </p>
<p... | [
{
"answer_id": 213848,
"author": "cciotti",
"author_id": 16834,
"author_profile": "https://Stackoverflow.com/users/16834",
"pm_score": 0,
"selected": false,
"text": "<p>MOSS provides many <a href=\"http://www.infoq.com/articles/swanson-moss-web-services\" rel=\"nofollow noreferrer\">webs... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29086/"
] | I'm writing an intranet application for a client and I want to give them the ability to configure through an admin interface, which users and user groups can access certain areas. What I'd like to know is the best way of storing the reference to the user or group that is assigned to an area of the intranet.
Should I ... | People that claim that you cannot query SharePoint databases because it is not supported are wrong. From reading the documentation, it is fine to query the database as long as you use the 'With(NoLock)' clause. It is clearly not supported to update, delete, or insert records.
The below query is supported:
```
Select ... |
213,816 | <p>I want to check for duplicated words right next to each other, but even if there is punctuation in between.</p>
<p>For example:</p>
<pre><code>Vivamus Vivamus diam, diam, Vivamus Vivamus diam, diam Vivamus
</code></pre>
<p>There should be four distinct hits here.</p>
<p>I can't figure out why this isn't working. Why... | [
{
"answer_id": 213824,
"author": "TJ L",
"author_id": 12605,
"author_profile": "https://Stackoverflow.com/users/12605",
"pm_score": 4,
"selected": true,
"text": "<p>The <code>(?:</code> is a non-capturing parenthesis, meaning it won't store the matches. You will need to use capturing pa... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/730/"
] | I want to check for duplicated words right next to each other, but even if there is punctuation in between.
For example:
```
Vivamus Vivamus diam, diam, Vivamus Vivamus diam, diam Vivamus
```
There should be four distinct hits here.
I can't figure out why this isn't working. Why? What should the correct code be?
... | The `(?:` is a non-capturing parenthesis, meaning it won't store the matches. You will need to use capturing parentheses.
```
(\w+)\W+\1
``` |
213,845 | <p>I have a HTML file that has code similar to the following.</p>
<pre><code><table>
<tr>
<td id="MyCell">Hello World</td>
</tr>
</table>
</code></pre>
<p>I am using javascript like the following to get the value</p>
<pre><code>document.getElementById(cell2.Element.id... | [
{
"answer_id": 213854,
"author": "Nick",
"author_id": 26161,
"author_profile": "https://Stackoverflow.com/users/26161",
"pm_score": 4,
"selected": true,
"text": "<p>HTML is white space insensititive which means your DOM is too. Would wrapping your \"Hello World\" in <b>pre</b> block wor... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13279/"
] | I have a HTML file that has code similar to the following.
```
<table>
<tr>
<td id="MyCell">Hello World</td>
</tr>
</table>
```
I am using javascript like the following to get the value
```
document.getElementById(cell2.Element.id).innerText
```
This returns the text "Hello World" with only 1 space b... | HTML is white space insensititive which means your DOM is too. Would wrapping your "Hello World" in **pre** block work at all? |
213,851 | <p>How can one programmatically sort a union query when pulling data from two tables? For example,</p>
<pre><code>SELECT table1.field1 FROM table1 ORDER BY table1.field1
UNION
SELECT table2.field1 FROM table2 ORDER BY table2.field1
</code></pre>
<p>Throws an exception</p>
<p>Note: this is being attempted on MS Acces... | [
{
"answer_id": 213862,
"author": "Curtis Inderwiesche",
"author_id": 3155,
"author_profile": "https://Stackoverflow.com/users/3155",
"pm_score": 0,
"selected": false,
"text": "<p>The second table cannot include the table name in the <code>ORDER BY</code> clause.</p>\n\n<p>So...</p>\n\n<p... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213851",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3155/"
] | How can one programmatically sort a union query when pulling data from two tables? For example,
```
SELECT table1.field1 FROM table1 ORDER BY table1.field1
UNION
SELECT table2.field1 FROM table2 ORDER BY table2.field1
```
Throws an exception
Note: this is being attempted on MS Access Jet database engine | Sometimes you need to have the `ORDER BY` in each of the sections that need to be combined with `UNION`.
In this case
```
SELECT * FROM
(
SELECT table1.field1 FROM table1 ORDER BY table1.field1
) DUMMY_ALIAS1
UNION ALL
SELECT * FROM
(
SELECT table2.field1 FROM table2 ORDER BY table2.field1
) DUMMY_ALIAS2
``` |
213,855 | <p>I have a file with fields separated by pipe characters and I want to print only the second field. This attempt fails:</p>
<pre><code>$ cat file | awk -F| '{print $2}'
awk: syntax error near line 1
awk: bailing out near line 1
bash: {print $2}: command not found
</code></pre>
<p>Is there a way to do this?</p>
| [
{
"answer_id": 213856,
"author": "Jon Ericson",
"author_id": 1438,
"author_profile": "https://Stackoverflow.com/users/1438",
"pm_score": 2,
"selected": false,
"text": "<p>The pipe character needs to be escaped so that the shell doesn't interpret it. A simple solution:</p>\n\n<pre><code>... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1438/"
] | I have a file with fields separated by pipe characters and I want to print only the second field. This attempt fails:
```
$ cat file | awk -F| '{print $2}'
awk: syntax error near line 1
awk: bailing out near line 1
bash: {print $2}: command not found
```
Is there a way to do this? | The key point here is that the pipe character (`|`) must be escaped to the shell. Use "`\|`" or "`'|'`" to protect it from shell interpertation and allow it to be passed to `awk` on the command line.
---
Reading the comments I see that the original poster presents a simplified version of the original problem which in... |
213,857 | <p>We have seen the following exceptions very frequently on IBM AIX when attempting to make an SSL connection to our server:</p>
<pre><code>java.net.SocketException: Socket closed
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275(Compiled Code))
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275... | [
{
"answer_id": 213916,
"author": "Steve B.",
"author_id": 19479,
"author_profile": "https://Stackoverflow.com/users/19479",
"pm_score": 0,
"selected": false,
"text": "<p>I have had issues with http client that were corrected by using a multithreaded connection. We fixed it by moving from... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1432/"
] | We have seen the following exceptions very frequently on IBM AIX when attempting to make an SSL connection to our server:
```
java.net.SocketException: Socket closed
at com.sun.net.ssl.internal.ssl.SSLSocketImpl.a(DashoA6275(Compiled Code))
at com.sun.net.ssl.internal.ssl.AppOutputStream.write(DashoA6275(Compiled Code... | "java.net.SocketException: Socket closed" means that your side closed the socket. You say that this happens when you attempt to make an SSL connection to your server. However, the stack trace suggests that this happens when HTTPClient attempts to write an HTTP request over an already established connection.
This could... |
213,875 | <p>using the Symbian S60 5th edition SDK released on October 2nd, I am compiling/running(on sim) the following code snippet:</p>
<pre><code>void test(wchar_t *dest, int size, const wchar_t *fmt, ...) {
va_list vl;
va_start(vl, fmt);
vswprintf(dest, size, fmt, vl);
va_end(vl);
}
...
wchar_t str[1024];... | [
{
"answer_id": 213955,
"author": "gbjbaanb",
"author_id": 13744,
"author_profile": "https://Stackoverflow.com/users/13744",
"pm_score": 0,
"selected": false,
"text": "<p>Change the %S to a %s - uppercase to lowercase.</p>\n\n<p>In MS-based printfs, %S means unicode characters, so this is... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27101/"
] | using the Symbian S60 5th edition SDK released on October 2nd, I am compiling/running(on sim) the following code snippet:
```
void test(wchar_t *dest, int size, const wchar_t *fmt, ...) {
va_list vl;
va_start(vl, fmt);
vswprintf(dest, size, fmt, vl);
va_end(vl);
}
...
wchar_t str[1024];
// this cras... | To me this looks like a job for stepping into the `vswprintf()` call. Even if you can only do assembly-level debugging, it should be clear what's more or less going on by keeping a watch on what's going into the the `str[]` memory. |
213,882 | <p>So far, in my research I have seen that it is unwise to set AllowUnsafeUpdates on GET request operation to avoid cross site scripting. But, if it is required to allow this, what is the proper way to handle the situation to mitigate any exposure? </p>
<p>Here is my best first guess on a reliable pattern if you absol... | [
{
"answer_id": 220182,
"author": "Nat",
"author_id": 13813,
"author_profile": "https://Stackoverflow.com/users/13813",
"pm_score": 1,
"selected": false,
"text": "<p>Not so sure it is worth remembering the previous value of allow unsafe updates.</p>\n\n<p>I would want to wrap the call aro... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13135/"
] | So far, in my research I have seen that it is unwise to set AllowUnsafeUpdates on GET request operation to avoid cross site scripting. But, if it is required to allow this, what is the proper way to handle the situation to mitigate any exposure?
Here is my best first guess on a reliable pattern if you absolutely need... | If you're performing any operations which modify something, then anyone that can convince the user to click on a link can perform that operation. For instance, let's assume that you have a GET request to a page which lets the user add an administrator to a site, and the user clicks a link to a page which does a Respons... |
213,901 | <p>I'd like to run a subcommand from Perl (or pipe it into a Perl script) and have the script process the command's output immediately, rather than waiting for a timeout, a newline, or a certain number of blocks. For example, let's say I want to surround each chunk of input with square brackets. When I run the script l... | [
{
"answer_id": 213923,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 0,
"selected": false,
"text": "<p>You didn't mention how you are reading input in your Perl script, but you might want to look at the <a href=\"http://p... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7598/"
] | I'd like to run a subcommand from Perl (or pipe it into a Perl script) and have the script process the command's output immediately, rather than waiting for a timeout, a newline, or a certain number of blocks. For example, let's say I want to surround each chunk of input with square brackets. When I run the script like... | From perlfaq5: [How can I read a single character from a file? From the keyboard?](http://perldoc.perl.org/perlfaq5.html#How-can-I-read-a-single-character-from-a-file%3f--From-the-keyboard%3f). You probably also want to read [How can I tell whether there's a character waiting on a filehandle?](http://perldoc.perl.org/p... |
213,907 | <p>Many C++ books contain example code like this...</p>
<pre><code>std::cout << "Test line" << std::endl;
</code></pre>
<p>...so I've always done that too. But I've seen a lot of code from working developers like this instead:</p>
<pre><code>std::cout << "Test line\n";
</code></pre>
<p>Is there a ... | [
{
"answer_id": 213914,
"author": "Martin Beckett",
"author_id": 10897,
"author_profile": "https://Stackoverflow.com/users/10897",
"pm_score": 6,
"selected": false,
"text": "<p>There might be performance issues, <code>std::endl</code> forces a flush of the output stream.</p>\n"
},
{
... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12193/"
] | Many C++ books contain example code like this...
```
std::cout << "Test line" << std::endl;
```
...so I've always done that too. But I've seen a lot of code from working developers like this instead:
```
std::cout << "Test line\n";
```
Is there a technical reason to prefer one over the other, or is it just a matt... | The varying line-ending characters don't matter, assuming the file is open in text mode, which is what you get unless you ask for binary. The compiled program will write out the correct thing for the system compiled for.
The only difference is that [`std::endl`](http://en.cppreference.com/w/cpp/io/manip/endl) flushes ... |
213,912 | <p>Why are inline closures so rarely used in Actionscript? They are very powerful and I think quite readable. I hardly ever see anyone using them so maybe I'm just looking at the wrong code. Google uses them in their Google Maps API for Flash samples, but I think thats the only place I've seen them.</p>
<p>I favor the... | [
{
"answer_id": 213928,
"author": "Mitch Haile",
"author_id": 28807,
"author_profile": "https://Stackoverflow.com/users/28807",
"pm_score": 3,
"selected": true,
"text": "<p>The biggest gotcha to watch out for is that often 'this' is not defined in the inline closure. Sometimes you can se... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213912",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24727/"
] | Why are inline closures so rarely used in Actionscript? They are very powerful and I think quite readable. I hardly ever see anyone using them so maybe I'm just looking at the wrong code. Google uses them in their Google Maps API for Flash samples, but I think thats the only place I've seen them.
I favor them because ... | The biggest gotcha to watch out for is that often 'this' is not defined in the inline closure. Sometimes you can set a 'this', but it's not always the right 'this' that you would have available to set, depending on how you're using them.
But I'd say most of the Flex code I've worked on has had inline closures rampantl... |
213,939 | <p>Does anyone know how to initiate a POST request in a Grails applications using javascript. Specifically, I would like to be able to POST when a the selected item in a drop-down box is changed.</p>
<p>I've tried using jQuery and the $.post() method. It successfully calls my controller action, but I'm not sure how t... | [
{
"answer_id": 213942,
"author": "Nick",
"author_id": 26161,
"author_profile": "https://Stackoverflow.com/users/26161",
"pm_score": 3,
"selected": true,
"text": "<p>Find the form object in the DOM you are looking for and cal .submit() on it. Do you have more than one form or multiples o... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21832/"
] | Does anyone know how to initiate a POST request in a Grails applications using javascript. Specifically, I would like to be able to POST when a the selected item in a drop-down box is changed.
I've tried using jQuery and the $.post() method. It successfully calls my controller action, but I'm not sure how to get the p... | Find the form object in the DOM you are looking for and cal .submit() on it. Do you have more than one form or multiples on your page? |
213,950 | <p>I'm trying to compile a program called ngrep, and when I ran configure, things seemed to go well, but when I run make, I get:</p>
<pre><code>ngrep.c: In function ‘process’:
ngrep.c:544: error: ‘struct udphdr’ has no member named ‘source’
ngrep.c:545: error: ‘struct udphdr’ has no member named ‘dest’
make: *** [ngre... | [
{
"answer_id": 213981,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 1,
"selected": false,
"text": "<p>Well, there is a struct called udphdr (probably short for udp header). And some part of the program assumes the st... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7598/"
] | I'm trying to compile a program called ngrep, and when I ran configure, things seemed to go well, but when I run make, I get:
```
ngrep.c: In function ‘process’:
ngrep.c:544: error: ‘struct udphdr’ has no member named ‘source’
ngrep.c:545: error: ‘struct udphdr’ has no member named ‘dest’
make: *** [ngrep.o] Error 1 ... | Found the problem:
```
#ifdef HAVE_DUMB_UDPHDR
printf("%s:%d -", inet_ntoa(ip_packet->ip_src), ntohs(udp->source));
printf("> %s:%d", inet_ntoa(ip_packet->ip_dst), ntohs(udp->dest));
#else
printf("%s:%d -", inet_ntoa(ip_packet->ip_src), ntohs(udp->uh_sport));
... |
213,953 | <p>I recently ran into a problem that I thought boost::lambda or boost::phoenix could help be solve, but I was not able to get the syntax right and so I did it another way. What I wanted to do was remove all the elements in "strings" that were less than a certain length and not in another container.</p>
<p>This is my ... | [
{
"answer_id": 214222,
"author": "Adam Mitz",
"author_id": 2574,
"author_profile": "https://Stackoverflow.com/users/2574",
"pm_score": 3,
"selected": true,
"text": "<p>You need boost::labmda::bind to lambda-ify function calls, for example the length < 24 part becomes:</p>\n\n<pre><cod... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29049/"
] | I recently ran into a problem that I thought boost::lambda or boost::phoenix could help be solve, but I was not able to get the syntax right and so I did it another way. What I wanted to do was remove all the elements in "strings" that were less than a certain length and not in another container.
This is my first try:... | You need boost::labmda::bind to lambda-ify function calls, for example the length < 24 part becomes:
```
bind(&string::length, _1) < 24
```
EDIT
See "Head Geek"'s post for why set::find is tricky. He got it to resolve the correct set::find overload (so I copied that part), but he missed an essential boost::ref() --... |
213,958 | <p>What new features in java 7 is going to be implemented?
And what are they doing now?</p>
| [
{
"answer_id": 213984,
"author": "David G",
"author_id": 3150,
"author_profile": "https://Stackoverflow.com/users/3150",
"pm_score": 2,
"selected": false,
"text": "<p>In addition to what John Skeet said, here's an <a href=\"http://openjdk.java.net/projects/jdk7/features/\" rel=\"nofollow... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What new features in java 7 is going to be implemented?
And what are they doing now? | Java SE 7 [Features and Enhancements](http://www.oracle.com/technetwork/java/javase/jdk7-relnotes-418459.html) from JDK 7 Release Notes
---------------------------------------------------------------------------------------------------------------------------------------
This is the Java 7 new features summary from th... |
213,978 | <p>I was running my first Visual Studio 2008 Unit Test with a WCF Service and I received the following error:</p>
<blockquote>
<p>Test method
UnitTest.ServiceUnitTest.TestMyService
threw exception:
System.ServiceModel.Security.MessageSecurityException:
The HTTP request is unauthorized with
client authenti... | [
{
"answer_id": 213989,
"author": "Karg",
"author_id": 12685,
"author_profile": "https://Stackoverflow.com/users/12685",
"pm_score": 1,
"selected": false,
"text": "<p>The default authentication is windows (or NTLM) so you'll need to specify that you don't want authentication in your confi... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26327/"
] | I was running my first Visual Studio 2008 Unit Test with a WCF Service and I received the following error:
>
> Test method
> UnitTest.ServiceUnitTest.TestMyService
> threw exception:
> System.ServiceModel.Security.MessageSecurityException:
> The HTTP request is unauthorized with
> client authentication scheme
>... | I had to change the following IIS and WCF service configurations to get past the "Negotiate,NTLM" exception.
IIS Configurations:
>
> -- Unchecked "Anonymous Access" checkbox and check the "Integrated
> Windows authentication" checkbox in
> the directory security setting for the
> WCF Service virtual directory.
> ... |
213,985 | <p>I have a co-worker that swears by</p>
<pre><code>//in a singleton "Constants" class
public static final String EMPTY_STRING = "";
</code></pre>
<p>in a constants class available throughout the project. That way, we can write something like</p>
<pre><code>if (Constants.EMPTY_STRING.equals(otherString)) {
...
}... | [
{
"answer_id": 213991,
"author": "shelfoo",
"author_id": 3444,
"author_profile": "https://Stackoverflow.com/users/3444",
"pm_score": 3,
"selected": false,
"text": "<p>I much prefer seeing EMPTY_STRING.</p>\n\n<p>It makes it english. \"\".equals 'reads' differently than EMPTY_STRING.equal... | 2008/10/17 | [
"https://Stackoverflow.com/questions/213985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1318/"
] | I have a co-worker that swears by
```
//in a singleton "Constants" class
public static final String EMPTY_STRING = "";
```
in a constants class available throughout the project. That way, we can write something like
```
if (Constants.EMPTY_STRING.equals(otherString)) {
...
}
```
instead of
```
if ("".equals... | String literals are interned by default, so no matter how many times you refer to **""** in code, there will only be one empty String object. I don't see any benefit in declaring EMPTY\_STRING. Otherwise, you might as well declare ONE, TWO, THREE, FOUR, etc. for integer literals.
Of course, if you want to change the v... |
214,009 | <p>As kind of a followup to <a href="https://stackoverflow.com/questions/210446/what-is-the-best-way-for-a-client-app-to-find-a-server-on-a-local-network-in-c">this question</a> I've gotten a solution working on my local machine, but not on a machine on the network.</p>
<p>I don't know too much about sockets other tha... | [
{
"answer_id": 214629,
"author": "Andrew Edgecombe",
"author_id": 11694,
"author_profile": "https://Stackoverflow.com/users/11694",
"pm_score": 3,
"selected": true,
"text": "<p>I have to start by saying that I know nothing about C#, but...</p>\n\n<p>Looking at the definition of the <code... | 2008/10/17 | [
"https://Stackoverflow.com/questions/214009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23822/"
] | As kind of a followup to [this question](https://stackoverflow.com/questions/210446/what-is-the-best-way-for-a-client-app-to-find-a-server-on-a-local-network-in-c) I've gotten a solution working on my local machine, but not on a machine on the network.
I don't know too much about sockets other than that basics, so bea... | I have to start by saying that I know nothing about C#, but...
Looking at the definition of the `ipep` in the client code, it looks like you're trying to send your data to yourself, rather than broadcast it (as has been suggested in your other question). The thing that caught my attention was that "127.0.0.1" is the a... |
214,017 | <p>Consider I'm interfacing with an external system that will send a message (DB table, message queue, web service) in some format. In the "message header" there is the "MessageType" that is a number from 1 to 20. The MessageType defines what to do with the rest of the message. There are things like new, modified, d... | [
{
"answer_id": 214032,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>In Java, you can make it an enum and give behaviour to the different values (although with 100 values, I'd hope that ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/214017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2862/"
] | Consider I'm interfacing with an external system that will send a message (DB table, message queue, web service) in some format. In the "message header" there is the "MessageType" that is a number from 1 to 20. The MessageType defines what to do with the rest of the message. There are things like new, modified, deleted... | In Java, you can make it an enum and give behaviour to the different values (although with 100 values, I'd hope that each type of behaviour is briefly, calling out to "proper" classes).
In C#, you can have a map from value to some appropriate delegate type - then when you statically construct the map, you can either u... |
214,037 | <p>I really like Entity Framework, but there are some key pieces that are a challenge to me. Can anyone tell me how to filter an EntityDataSource on an Association column? EF hides the FK values and instead has an Association property. Given an Entity, Person, with a PersonType association, I would have expected someth... | [
{
"answer_id": 639287,
"author": "Davy Landman",
"author_id": 11098,
"author_profile": "https://Stackoverflow.com/users/11098",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried applying the filter in memory using LINQ? (or Perhaps against the database?)</p>\n\n<pre><code>var ... | 2008/10/17 | [
"https://Stackoverflow.com/questions/214037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16426/"
] | I really like Entity Framework, but there are some key pieces that are a challenge to me. Can anyone tell me how to filter an EntityDataSource on an Association column? EF hides the FK values and instead has an Association property. Given an Entity, Person, with a PersonType association, I would have expected something... | I think the answer you're looking for involves using the Include method, such as:
```
entities.it.Include("PersonType").Where(a => a.PersonType.PersonTypeID = '1');
``` |