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 |
|---|---|---|---|---|---|---|
532,553 | <p>I have searched the web but all the ones readily available are where you specificy a date and it counts down to that date. What I need is something which will simply count down from "27 minutes and 43 seconds" (in that format) all the way down to 0 from whenever they land on the page, anyone got any snippets availab... | [
{
"answer_id": 532594,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 2,
"selected": false,
"text": "<p>I think you're looking for something like <a href=\"http://javascript.internet.com/time-date/countdown-timer... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26823/"
] | I have searched the web but all the ones readily available are where you specificy a date and it counts down to that date. What I need is something which will simply count down from "27 minutes and 43 seconds" (in that format) all the way down to 0 from whenever they land on the page, anyone got any snippets available? | Something like this should do the trick. I'm bored and decided to do it myself instead of Googling. Just set the minutes and seconds at the top and change the call to countdown inside the onload to the id of the element you want it to update.
```
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
... |
532,566 | <p>I have a table Users, so some rows specially in field Full Name are in different upper/lower case, so i found this function: </p>
<pre><code>CREATE function properCase(@texto varchar(8000)) returns varchar(8000) as
begin
--declare @texto = 'hola'
set @texto = lower(@texto)
declare @i int
... | [
{
"answer_id": 532582,
"author": "Joe",
"author_id": 57135,
"author_profile": "https://Stackoverflow.com/users/57135",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure how it's any easier storing it in a text file. The relationships of the data are the same. Granted, SQL is n... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388553/"
] | I have a table Users, so some rows specially in field Full Name are in different upper/lower case, so i found this function:
```
CREATE function properCase(@texto varchar(8000)) returns varchar(8000) as
begin
--declare @texto = 'hola'
set @texto = lower(@texto)
declare @i int
set @i = a... | Given the option I would store ACL in a database:
* The language to access and query the data is easier and standard (SQL)
* The DB will give you transactions, indexes for fast query, integrity constraints and security.
* Depending on how you store the data in a local file you may need to move your data files along w... |
532,586 | <p>I am working with 24x24 pixel icons. And I would like to be able to change a specific color within this icon to a different color. For example turn the white areas to red.</p>
| [
{
"answer_id": 532666,
"author": "McDowell",
"author_id": 304,
"author_profile": "https://Stackoverflow.com/users/304",
"pm_score": 1,
"selected": false,
"text": "<p>You can do this with a <a href=\"http://java.sun.com/javase/6/docs/api/java/awt/image/BufferedImage.html\" rel=\"nofollow ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6186/"
] | I am working with 24x24 pixel icons. And I would like to be able to change a specific color within this icon to a different color. For example turn the white areas to red. | I don't know of an API method that does that. And by default, `Images` are not writable. However, if you have a [`BufferedImage`](http://java.sun.com/javase/6/docs/api/java/awt/image/BufferedImage.html), you could do it like this:
```
public void changeColor(BufferedImage img, Color old, Color new) {
final int old... |
532,588 | <p>I am doing a code review on some large class libraries and I was wondering if anyone knows of an easy easy way to generate a list of all the methods (and possibly properties/variables too) and their access modifiers. For example, I would like something like this:</p>
<pre><code>private MyClass.Method1()
internal My... | [
{
"answer_id": 532595,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 1,
"selected": false,
"text": "<p>Well, you can certainly use reflection for this, to enumerate the methods.</p>\n"
},
{
"answer_id": 532596... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343/"
] | I am doing a code review on some large class libraries and I was wondering if anyone knows of an easy easy way to generate a list of all the methods (and possibly properties/variables too) and their access modifiers. For example, I would like something like this:
```
private MyClass.Method1()
internal MyClass.Method2(... | Yup, use reflection:
```
foreach (Type type in assembly.GetTypes())
{
foreach (MethodInfo method in type.GetMethods(BindingFlags.Public |
BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance))
{
Console.WriteLine("{0} {1}{2}.{3}", GetFriendlyAccess(method),
method.Is... |
532,613 | <p>I'm interested in executing powershell scripts on a computer behind a firewall. What ports will I need to have open? Will any special configuration be needed or I'll be just be able to connect to a fresh install of Windows Server 2008 r2 and start executing my scripts?</p>
| [
{
"answer_id": 532619,
"author": "GEOCHET",
"author_id": 5640,
"author_profile": "https://Stackoverflow.com/users/5640",
"pm_score": -1,
"selected": false,
"text": "<p>What ports you need open is entirely dependent on what you plan to be doing in your scripts.</p>\n"
},
{
"answer... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11439/"
] | I'm interested in executing powershell scripts on a computer behind a firewall. What ports will I need to have open? Will any special configuration be needed or I'll be just be able to connect to a fresh install of Windows Server 2008 r2 and start executing my scripts? | MichaelGG got it right - all you need to do is use the native remoting available in PowerShell V2. It gives you a crazy degree of control over networking all using the WS-MAN protocol (that is a standard management protocol which is implemented by our WINRM service).
The way the V2 remoting works is that you can invo... |
532,623 | <p>I have Visual Studio 2008 SP1, two C++/CLI projects, lets say proj1 and proj2.
proj2 is dependent on proj1, but in a weird way (see below).
In Project Dependencies I specify that proj2 depends on proj1.
Also proj2 references include proj1.
Then I want proj1 to be a friend to proj2,
so, as MSDN page on <a href="http:... | [
{
"answer_id": 771654,
"author": "Colin Desmond",
"author_id": 93399,
"author_profile": "https://Stackoverflow.com/users/93399",
"pm_score": 0,
"selected": false,
"text": "<p>If ProjA depends on ProjB and ProjB depends on ProjA then I am surprised you can build it at all! This sort of ci... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6671/"
] | I have Visual Studio 2008 SP1, two C++/CLI projects, lets say proj1 and proj2.
proj2 is dependent on proj1, but in a weird way (see below).
In Project Dependencies I specify that proj2 depends on proj1.
Also proj2 references include proj1.
Then I want proj1 to be a friend to proj2,
so, as MSDN page on ["Friend Assembli... | As the OP has already found out, this is actually a bug. A [bug](http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=413878) was filed by the OP and acknowledged by Microsoft. It appears to affect VS2005, VS2008 and VS2010 (targeting VS2008).
The workaround that I used was a dummy intermedi... |
532,626 | <p>I have a navigation layer, and I cannot seem to get the links to center within.</p>
<p>This is the stylesheet I am using</p>
<pre><code>.Layer1 {
position:absolute;
width: 10%;
height: 95%;
list-style-position: outside;
list-style-type: disc;
background-color: #D2FFFF;
}
.Layer1 a {
fon... | [
{
"answer_id": 532634,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>Have you tried adding:</p>\n\n<pre><code>text-align: center;\n</code></pre>\n\n<p>to .Layer1 {}?</p>\n"
},
{
"answe... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have a navigation layer, and I cannot seem to get the links to center within.
This is the stylesheet I am using
```
.Layer1 {
position:absolute;
width: 10%;
height: 95%;
list-style-position: outside;
list-style-type: disc;
background-color: #D2FFFF;
}
.Layer1 a {
font-family: Verdana, Ar... | Links are inline elements, so setting text-align center on them won't achieve anything. Try making the link a block with an assigned width and then applying text-align center. |
532,628 | <p>I have a VB.NET 3.5 sp1 console application running on Windows XP sp3 from a batch file:</p>
<pre><code>"D:\Program Files\PartsDepotJob\PartsDepotJob.exe" >> "D:\Program Files\PartsDepotJob\partdepot.log.txt"
</code></pre>
<p>The output looks like the following:</p>
<blockquote>
<p>2/10/2009 9:03:19 AM<br... | [
{
"answer_id": 532634,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>Have you tried adding:</p>\n\n<pre><code>text-align: center;\n</code></pre>\n\n<p>to .Layer1 {}?</p>\n"
},
{
"answe... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1433/"
] | I have a VB.NET 3.5 sp1 console application running on Windows XP sp3 from a batch file:
```
"D:\Program Files\PartsDepotJob\PartsDepotJob.exe" >> "D:\Program Files\PartsDepotJob\partdepot.log.txt"
```
The output looks like the following:
>
> 2/10/2009 9:03:19 AM
>
> Processing PO#: 2100 in 002
>
> Created... | Links are inline elements, so setting text-align center on them won't achieve anything. Try making the link a block with an assigned width and then applying text-align center. |
532,635 | <p>I would like to set up a cookie that never expires. Would that even be possible?</p>
<pre><code> document.cookie = "name=value; expires=date; path=path;domain=domain; secure";
</code></pre>
<p>I don't want to make the date really large, I am just wondering if there was a value for the expires parameter on the cook... | [
{
"answer_id": 532638,
"author": "Paolo Bergantino",
"author_id": 16417,
"author_profile": "https://Stackoverflow.com/users/16417",
"pm_score": 9,
"selected": true,
"text": "<p>Nope. That can't be done. The best 'way' of doing that is just making the expiration date be like 2100.</p>\n"
... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17162/"
] | I would like to set up a cookie that never expires. Would that even be possible?
```
document.cookie = "name=value; expires=date; path=path;domain=domain; secure";
```
I don't want to make the date really large, I am just wondering if there was a value for the expires parameter on the cookie that told it never to e... | Nope. That can't be done. The best 'way' of doing that is just making the expiration date be like 2100. |
532,643 | <p>In IE7 my web site always causes the browser to prompt a "Security Information" dialogue box:</p>
<blockquote>
<p>This page contains both secure and
non-secure items. </p>
<p>Do you want to display the non-secure items?</p>
</blockquote>
<p>How can I avoid getting this message when traveling between non-... | [
{
"answer_id": 532659,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 5,
"selected": true,
"text": "<p>You need to make sure all your images, script files, CSS files and so on have HTTPS urls if you're on a secure page.</p>\n\... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532643",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6050/"
] | In IE7 my web site always causes the browser to prompt a "Security Information" dialogue box:
>
> This page contains both secure and
> non-secure items.
>
>
> Do you want to display the non-secure items?
>
>
>
How can I avoid getting this message when traveling between non-secure and secure pages (HTTP to HTT... | You need to make sure all your images, script files, CSS files and so on have HTTPS urls if you're on a secure page.
If you view-source and search for "http:" this will soon tell which one (or more) is wrong.
Example:
```
<script src="script.js" type="text/javascript"></script> - Correct
<script src="https://ssl.goo... |
532,662 | <p>I would appreciate any advice regarding tools and practices I could use to confirm my recently completed website is performing correctly.</p>
<p>Although I am confident the code is not producing errors and is functionally operating as it should, I have little understanding of how to identify IIS, SQL Server and Win... | [
{
"answer_id": 532659,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 5,
"selected": true,
"text": "<p>You need to make sure all your images, script files, CSS files and so on have HTTPS urls if you're on a secure page.</p>\n\... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532662",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5217/"
] | I would appreciate any advice regarding tools and practices I could use to confirm my recently completed website is performing correctly.
Although I am confident the code is not producing errors and is functionally operating as it should, I have little understanding of how to identify IIS, SQL Server and Windows perfo... | You need to make sure all your images, script files, CSS files and so on have HTTPS urls if you're on a secure page.
If you view-source and search for "http:" this will soon tell which one (or more) is wrong.
Example:
```
<script src="script.js" type="text/javascript"></script> - Correct
<script src="https://ssl.goo... |
532,670 | <p>How can I make a link in HTML turn a color when hovering and remove the underline using CSS?</p>
| [
{
"answer_id": 532679,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 5,
"selected": true,
"text": "<p>You want to look at the <a href=\"http://www.w3.org/TR/CSS2/selector.html#dynamic-pseudo-classes\" rel=\"nofollow norefe... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I make a link in HTML turn a color when hovering and remove the underline using CSS? | You want to look at the [:hover pseudoselector](http://www.w3.org/TR/CSS2/selector.html#dynamic-pseudo-classes), the [color property](http://www.w3.org/TR/CSS2/colors.html#colors), and the [text-decoration](http://www.w3.org/TR/CSS2/text.html#lining-striking-props) property.
```
a:hover { color: red; text-decoration: ... |
532,694 | <p>Having this table</p>
<pre><code>Table "Items"
itemID
itemTitle
itemContent
</code></pre>
<p>and this</p>
<pre><code>Table "MyList"
userID
itemID
deleted
</code></pre>
<p>how can I select all rows from table "Items" and showing the field "deleted", even if the itemID do not exist in "MyList", given an userID?<... | [
{
"answer_id": 532706,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 4,
"selected": false,
"text": "<pre><code>SELECT I.itemID, I.itemTitle, M.deleted\nFROM\n Items I\n LEFT OUTER JOIN MyList M ON M.itemID = I.it... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2019426/"
] | Having this table
```
Table "Items"
itemID
itemTitle
itemContent
```
and this
```
Table "MyList"
userID
itemID
deleted
```
how can I select all rows from table "Items" and showing the field "deleted", even if the itemID do not exist in "MyList", given an userID?
Example of the query result:
```
itemID | itemT... | I'm not sure if this is the best way of doing this, but it returns what I was looking for:
```
select itemID, itemTitle, deleted, userID
FROM(
SELECT i.id_itemID, i.itemTitle, M.deleted, M.userID
FROM
MyList M
right OUTER JOIN Items I ON I.itemID= M.itemID
) as MyTableItems
where itemID = 3 or itemID is null
... |
532,702 | <p>I realize this is kind of a goofy question, for lack of a better term. I'm just kind of looking for any outside idea on increasing the efficiency of this code, as it's bogging down the system very badly (it has to perform this function a lot) and I'm running low on ideas. </p>
<p>What it's doing it loading two imag... | [
{
"answer_id": 532727,
"author": "Assaf Lavie",
"author_id": 11208,
"author_profile": "https://Stackoverflow.com/users/11208",
"pm_score": 2,
"selected": false,
"text": "<p>You could optimize away some of the pointer arithmetic you're doing over and over with the subscript operators [][]... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532702",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48957/"
] | I realize this is kind of a goofy question, for lack of a better term. I'm just kind of looking for any outside idea on increasing the efficiency of this code, as it's bogging down the system very badly (it has to perform this function a lot) and I'm running low on ideas.
What it's doing it loading two image containe... | I think the array accesses (are they real array accesses or operator []?) are going to kill you. Each one represents a multiply.
Basically, you want something like this:
```
for (int y=0; y < height; y++) {
unsigned char *destBgr = imgRgb.GetScanline(y); // inline methods are better
unsigned char *destBW = im... |
532,734 | <p>I'm encountering a very strange problem concerning what appears to be a corrupt index of some kind. Not corrupt in the sense that dbcc checkdb will pick it up, but corrupt in the sense that it has rows that it shouldn't have.</p>
<p>I have two tables, TableA and TableB. For the purposes of my application, some rows... | [
{
"answer_id": 532750,
"author": "SQLMenace",
"author_id": 740,
"author_profile": "https://Stackoverflow.com/users/740",
"pm_score": 0,
"selected": false,
"text": "<p>script out the indexes and look at the script, was it created with ALLOW_DUP_ROW? if so then that could be your problem</... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm encountering a very strange problem concerning what appears to be a corrupt index of some kind. Not corrupt in the sense that dbcc checkdb will pick it up, but corrupt in the sense that it has rows that it shouldn't have.
I have two tables, TableA and TableB. For the purposes of my application, some rows are consi... | ```
ROW_NUMBER() OVER (PARTITION By Col1 ORDER BY Col1)
```
is not a stable sort order, it can change from query to query depending on access path.
Your view may return different results being run several times.
Rebuilding indexes seems to affect the sort order.
Use this:
```
ROW_NUMBER() OVER (PARTITION By Col1 ... |
532,754 | <p>In PHP, if a static attribute is defined in the parent class, it cannot be overridden in a child class. But I'm wondering if there's any way around this. </p>
<p>I'm trying to write a wrapper for someone else's (somewhat clunky) function. The function in question can be applied to lots of different data types but r... | [
{
"answer_id": 532800,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 5,
"selected": false,
"text": "<p>The forthcoming PHP 5.3.0 release includes <a href=\"http://uk.php.net/oop5.late-static-bindings\" rel=\"noreferrer\">... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532754",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49529/"
] | In PHP, if a static attribute is defined in the parent class, it cannot be overridden in a child class. But I'm wondering if there's any way around this.
I'm trying to write a wrapper for someone else's (somewhat clunky) function. The function in question can be applied to lots of different data types but requires di... | Classic example of why using statics as globals (functions in this case) is a bad idea no matter the language.
The most robust method is to create multiple implementation sub classes of an abstract base "Action" class.
Then to try and remove some of the annoyance of instantiating an instance of the class just to call... |
532,755 | <p>What is the set of valid outputs for the following, according to the standard?</p>
<pre><code>bool x;
cout << (x ? 1 : 2);
</code></pre>
<p>edit: <strong>unknown(google)</strong> has got it. In gcc my code was crashing because of <code>sprite.setFrame(isPressed ? 0 : 1)</code> with the conditional returning ... | [
{
"answer_id": 532767,
"author": "Toon Krijthe",
"author_id": 18061,
"author_profile": "https://Stackoverflow.com/users/18061",
"pm_score": 2,
"selected": false,
"text": "<p>If x is uninitialized, it can be both true or false. So the valid outputs are 1 or 2.</p>\n"
},
{
"answer_... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What is the set of valid outputs for the following, according to the standard?
```
bool x;
cout << (x ? 1 : 2);
```
edit: **unknown(google)** has got it. In gcc my code was crashing because of `sprite.setFrame(isPressed ? 0 : 1)` with the conditional returning 28! | >
> Using a bool value in ways described
> by This Standard as "undefined" such
> as by examining the value of an
> unitialized automatic variable, might
> cause it to behave as it is neither
> true or false.
>
>
>
Welcome to the world of undefined behaviour. But first, why would you want to do that? |
532,773 | <p>My current project is an internal web application built using ASP.Net MVC which I am adding authentication to. I have a pre-built HTTPModule which creates a IPrincipal with the appropriate roles. If the user isn't authenticated I get a user object with the role "Public"</p>
<p>As this is an internal application mos... | [
{
"answer_id": 532876,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": false,
"text": "<p>You can derive a new attribute from AuthorizeAttribute and override the OnAuthorization method, then apply your cust... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29540/"
] | My current project is an internal web application built using ASP.Net MVC which I am adding authentication to. I have a pre-built HTTPModule which creates a IPrincipal with the appropriate roles. If the user isn't authenticated I get a user object with the role "Public"
As this is an internal application most of the p... | Well in the end I think my answer was in the question. Instead of putting the Authorize attribute on my base controller I have derived a new AdminBaseController.
```
[HandleError]
public abstract class MyControllerBase : Controller
{
...
}
[Authorize(Roles="Admin")]
public abstract class AdminControllerBase : MyC... |
532,777 | <p>D2009 introduces PNG support for Images and Imagelists.</p>
<p>However...</p>
<p>I have an imagelist containing png images with alpha. I want to place one of these on a form using a TImage. How do I do this and get the image nicely composited?</p>
<p>As an example of the problem I'm facing the code below fails to... | [
{
"answer_id": 543388,
"author": "TheArtTrooper",
"author_id": 51571,
"author_profile": "https://Stackoverflow.com/users/51571",
"pm_score": 1,
"selected": false,
"text": "<p>I just tried a simple test. TImageList contains a PNG image with transparency. I render the image on the second... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] | D2009 introduces PNG support for Images and Imagelists.
However...
I have an imagelist containing png images with alpha. I want to place one of these on a form using a TImage. How do I do this and get the image nicely composited?
As an example of the problem I'm facing the code below fails to work correctly, and pro... | From my research I found that TImageList stores the images as TBitmaps, so the alpha information is lost on storage, and you can't achieve what you're looking for with the current implementation of TImageList.
**Update:**
A little more experiments and with the code below i could make transparency work with the code b... |
532,779 | <p>When I'm developing in C#, I heavily use GhostDoc to speed up the process of commenting my code. I'm currently working on a C++ project and I haven't found an equivalent tool. I know about Doxygen, but from what I know it is used to create documentation outside the code, not comments in the code. Are there any good ... | [
{
"answer_id": 532789,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.wholetomato.com/\" rel=\"nofollow noreferrer\">Visual Assist</a> might do the job, though I'... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26339/"
] | When I'm developing in C#, I heavily use GhostDoc to speed up the process of commenting my code. I'm currently working on a C++ project and I haven't found an equivalent tool. I know about Doxygen, but from what I know it is used to create documentation outside the code, not comments in the code. Are there any good equ... | [Visual Assist](http://www.wholetomato.com/) helps by providing custom scripts executed while typing (or on other).
For example, you can have a script for comments like this :
```
/************************************************************************/
/* My comment : $end$ ... |
532,804 | <p>I have a uitextview that is editable but there are certain characters I would like to be disallowed from being typed.</p>
<p>How can I do that?</p>
| [
{
"answer_id": 532844,
"author": "Louis Gerbarg",
"author_id": 30506,
"author_profile": "https://Stackoverflow.com/users/30506",
"pm_score": 3,
"selected": true,
"text": "<p>You can do this by assigning a delegate to the UITextView, and implementing the following method in the delegate:<... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62009/"
] | I have a uitextview that is editable but there are certain characters I would like to be disallowed from being typed.
How can I do that? | You can do this by assigning a delegate to the UITextView, and implementing the following method in the delegate:
```
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text;
```
In the body just write some code that scans through the input text to see if you fi... |
532,850 | <p>Would it be possible to make a regex that reads {variable} like <code><?php echo $variable ?></code> in PHP files?</p>
<p>Thanks</p>
<p>Remy</p>
| [
{
"answer_id": 532865,
"author": "Suroot",
"author_id": 64626,
"author_profile": "https://Stackoverflow.com/users/64626",
"pm_score": 0,
"selected": false,
"text": "<p>{Not actually an answer, but need clarification}</p>\n\n<p>Could you expand your question? Are you wanting to apply a r... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Would it be possible to make a regex that reads {variable} like `<?php echo $variable ?>` in PHP files?
Thanks
Remy | The PHP manual already provides a [regular expression for variable names](http://docs.php.net/manual/en/language.variables.basics.php):
```
[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*
```
You just have to alter it to this:
```
\{[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*\}
```
And you’re done.
---
**Edit** You sho... |
532,856 | <p>What is the ASP.NET MVC equivalent to "override void Render" from ASP.NET WebForms?
Where are you opportunities to do some last-minute processing before the output is sent to the client? </p>
<p>For example, I wouldn't use this in production code, but illustrates cleaning up the <code><title></code> and <cod... | [
{
"answer_id": 532868,
"author": "Ash",
"author_id": 31128,
"author_profile": "https://Stackoverflow.com/users/31128",
"pm_score": 2,
"selected": false,
"text": "<p>This isn't the way in which MVC works. </p>\n\n<p>All your 'onprerender' code is done in the view. By the time you pass you... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | What is the ASP.NET MVC equivalent to "override void Render" from ASP.NET WebForms?
Where are you opportunities to do some last-minute processing before the output is sent to the client?
For example, I wouldn't use this in production code, but illustrates cleaning up the `<title>` and `<head>` markup for an entire si... | This isn't the way in which MVC works.
All your 'onprerender' code is done in the view. By the time you pass your data to the view from the controller you should have done all processing necessary to display the whole page.
The only slight exception to this is the model may still do a little processing while it is b... |
532,859 | <p>I am trying to emulate StringBuilder behavior in an XSL. Is there a way to do this. It seems pretty hard given the fact that XSLT is a functional programming language</p>
| [
{
"answer_id": 532887,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "<p>Have a look at the <a href=\"http://www.w3.org/TR/2002/WD-xquery-operators-20021115/#func-concat\" rel=\"nofollow noref... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6613/"
] | I am trying to emulate StringBuilder behavior in an XSL. Is there a way to do this. It seems pretty hard given the fact that XSLT is a functional programming language | You can get the accumulting concats quite simply with just a little bit of recursion if you're looking at a node-set (so long as you can construct the xpath to find the node-set), doing this so you can add arbitrary bits and pieces in and out of the flow it starts getting messy.
Try this for starters (does join as wel... |
532,878 | <p>So I have a table as follows:</p>
<pre><code>ID_STUDENT | ID_CLASS | GRADE
-----------------------------
1 | 1 | 90
1 | 2 | 80
2 | 1 | 99
3 | 1 | 80
4 | 1 | 70
5 | 2 | 78
6 | 2 | 90
6 | ... | [
{
"answer_id": 532941,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 6,
"selected": true,
"text": "<pre><code>SELECT id_student, id_class, grade,\n @student:=CASE WHEN @class <> id_class THEN 0 ELSE @student+1 END... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532878",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60824/"
] | So I have a table as follows:
```
ID_STUDENT | ID_CLASS | GRADE
-----------------------------
1 | 1 | 90
1 | 2 | 80
2 | 1 | 99
3 | 1 | 80
4 | 1 | 70
5 | 2 | 78
6 | 2 | 90
6 | 3 | 50
... | ```
SELECT id_student, id_class, grade,
@student:=CASE WHEN @class <> id_class THEN 0 ELSE @student+1 END AS rn,
@class:=id_class AS clset
FROM
(SELECT @student:= -1) s,
(SELECT @class:= -1) c,
(SELECT *
FROM mytable
ORDER BY id_class, id_student
) t
```
This works in a very plain way:
1. Initial... |
532,886 | <p>I have cross posted on <a href="http://access-programmers.co.uk/forums/showthread.php?t=144006" rel="nofollow noreferrer">access-programmers.co.uk</a></p>
<p>Please post responses on that forum is possible..</p>
<p>I have compiled a dll in c# 3.5.. where I set the solution properties to register the build for COM ... | [
{
"answer_id": 532955,
"author": "Rob",
"author_id": 7872,
"author_profile": "https://Stackoverflow.com/users/7872",
"pm_score": 1,
"selected": false,
"text": "<p>It looks like the assembly you're registering is on a network share. .net assemblies have a different security model applied ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61685/"
] | I have cross posted on [access-programmers.co.uk](http://access-programmers.co.uk/forums/showthread.php?t=144006)
Please post responses on that forum is possible..
I have compiled a dll in c# 3.5.. where I set the solution properties to register the build for COM interop.
```
using System;
using System.Collections.G... | It looks like the assembly you're registering is on a network share. .net assemblies have a different security model applied to them when that's the case.
Have you tried having the assembly and TLB in a local directory and then adding the TLB in the Tools > References menu?
Also - and this may well be off the mark ut... |
532,892 | <p>Suppose I have a string, for example,</p>
<pre><code>string snip = "</li></ul>";
</code></pre>
<p>I want to basically write it multiple times, depending on some integer value. </p>
<pre><code>string snip = "</li></ul>";
int multiplier = 2;
// TODO: magic code to do this
// snip * multi... | [
{
"answer_id": 532912,
"author": "Tamas Czinege",
"author_id": 8954,
"author_profile": "https://Stackoverflow.com/users/8954",
"pm_score": 6,
"selected": false,
"text": "<p>Unfortunately / fortunately, the string class is sealed so you can't inherit from it and overload the * operator. Y... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31765/"
] | Suppose I have a string, for example,
```
string snip = "</li></ul>";
```
I want to basically write it multiple times, depending on some integer value.
```
string snip = "</li></ul>";
int multiplier = 2;
// TODO: magic code to do this
// snip * multiplier = "</li></ul></li></ul>";
```
EDIT:
I know I can easi... | In .NET 4 you can do this:
```
String.Concat(Enumerable.Repeat("Hello", 4))
``` |
532,902 | <p>I have some sprites that the users can manipulate, drag around and resize. Now I'd like to be able to display text in those sprites. I've tried lots of, probably stupid, ways. Like inheriting from Label and adding a Label child to the sprite, but no text shows up. </p>
<p>One disturbing thing: Inheriting from Label... | [
{
"answer_id": 532969,
"author": "VBNight",
"author_id": 63367,
"author_profile": "https://Stackoverflow.com/users/63367",
"pm_score": -1,
"selected": false,
"text": "<p>Add a new label as a child of your sprite object.</p>\n"
},
{
"answer_id": 532993,
"author": "Christophe H... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44639/"
] | I have some sprites that the users can manipulate, drag around and resize. Now I'd like to be able to display text in those sprites. I've tried lots of, probably stupid, ways. Like inheriting from Label and adding a Label child to the sprite, but no text shows up.
One disturbing thing: Inheriting from Label I get the... | I would go with something more low-level than Label. Use a TextField and add it as a child to the Sprite:
```
var text:TextField = new TextField();
text.text = "hello world";
addChild(text);
```
Note: your text will not show up if the Sprite is rotated and the fonts are not embedded. |
532,906 | <p>As you most likely already know, it's simple in JQuery to select all elements in the document that have a specific CSS class, and then, using chaining, assign common event handlers to the selected elements:</p>
<pre><code>$(".toolWindow").click(toolWindow_click);
$(".toolWindow").keypress(toolWindow_keypress);
</co... | [
{
"answer_id": 532932,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>It depends on what you mean by 'behavior'. For example, if your behavior is really just a fancy styling effect, I ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5023/"
] | As you most likely already know, it's simple in JQuery to select all elements in the document that have a specific CSS class, and then, using chaining, assign common event handlers to the selected elements:
```
$(".toolWindow").click(toolWindow_click);
$(".toolWindow").keypress(toolWindow_keypress);
```
As usual the... | The "class" is actually part of the document data (and hopefully semantically relevant) not the style or design of it.
This is why it's okay to use for both. |
532,907 | <p>im creating an application that have to read and update Contacts Information (like phone number, email, etc..) from Microsoft Exchange...</p>
<p>Does any one know how can i connect to a MS Exchange DB ??</p>
| [
{
"answer_id": 532960,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 1,
"selected": false,
"text": "<p>You will have to use Extended MAPI, it is not a standard SQL database.</p>\n"
},
{
"answer_id": 532970,
... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | im creating an application that have to read and update Contacts Information (like phone number, email, etc..) from Microsoft Exchange...
Does any one know how can i connect to a MS Exchange DB ?? | WebDAV is what i use...
Here's a function i wrote to access our exchange server (be kind i wrote it years ago).. (:
```
/// <summary>
/// Returns XML string for a specific query
/// </summary>
/// <param name="Query"></param>
/// <param name="Account"></param>
/// <param name="Folder"></param>
... |
532,909 | <p>The fullscreen functionality for my Flash video player does not work in Flash player versions 9.0.47.0 and 9.0.28.0. It works on all other versions 9.0.115.0 and above. On clicking the fullscreen button, the function gets triggered but the video does not go fullscreen, it stretches inside the video player. Is there... | [
{
"answer_id": 532960,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 1,
"selected": false,
"text": "<p>You will have to use Extended MAPI, it is not a standard SQL database.</p>\n"
},
{
"answer_id": 532970,
... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The fullscreen functionality for my Flash video player does not work in Flash player versions 9.0.47.0 and 9.0.28.0. It works on all other versions 9.0.115.0 and above. On clicking the fullscreen button, the function gets triggered but the video does not go fullscreen, it stretches inside the video player. Is there any... | WebDAV is what i use...
Here's a function i wrote to access our exchange server (be kind i wrote it years ago).. (:
```
/// <summary>
/// Returns XML string for a specific query
/// </summary>
/// <param name="Query"></param>
/// <param name="Account"></param>
/// <param name="Folder"></param>
... |
532,917 | <p>I'm writing some Windows software and when it terminates, I'm getting a lot of incorrect memory leak messages:</p>
<pre><code>Detected memory leaks!
Dumping objects ->
{29745} normal block at 0x02938E38, 36 bytes long.
Data: <, E > 2C 0B 45 10 00 00 00 00 01 00 00 00 01 CD CD CD
{29732} norma... | [
{
"answer_id": 532964,
"author": "Craig H",
"author_id": 2328,
"author_profile": "https://Stackoverflow.com/users/2328",
"pm_score": 2,
"selected": false,
"text": "<p>I find it highly unlikely that those are false positives. A they say in the <a href=\"http://www.pragprog.com/the-pragma... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47154/"
] | I'm writing some Windows software and when it terminates, I'm getting a lot of incorrect memory leak messages:
```
Detected memory leaks!
Dumping objects ->
{29745} normal block at 0x02938E38, 36 bytes long.
Data: <, E > 2C 0B 45 10 00 00 00 00 01 00 00 00 01 CD CD CD
{29732} normal block at 0x02938C08, ... | which compiler?
Get another profiling/leak detection tool as well. (Boundschecker, etc)
The false positives I've gotten in the past never obstructed me from finding "real" leaks.
I don't agree with the others who say that you are wrong about false positives - But do double check - check all your "new"s and trace th... |
532,918 | <p>I am trying to create a <a href="http://www.useit.com/alertbox/modal-dialog-box-lightbox-xero.jpg" rel="nofollow noreferrer">lightbox effect</a> within my application. To achieve this, I have a UserControl with a panel representing the semi-transparent overlay and a seperate panel hosting all the necessary content.<... | [
{
"answer_id": 532964,
"author": "Craig H",
"author_id": 2328,
"author_profile": "https://Stackoverflow.com/users/2328",
"pm_score": 2,
"selected": false,
"text": "<p>I find it highly unlikely that those are false positives. A they say in the <a href=\"http://www.pragprog.com/the-pragma... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532918",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | I am trying to create a [lightbox effect](http://www.useit.com/alertbox/modal-dialog-box-lightbox-xero.jpg) within my application. To achieve this, I have a UserControl with a panel representing the semi-transparent overlay and a seperate panel hosting all the necessary content.
When I show this UserControl It often a... | which compiler?
Get another profiling/leak detection tool as well. (Boundschecker, etc)
The false positives I've gotten in the past never obstructed me from finding "real" leaks.
I don't agree with the others who say that you are wrong about false positives - But do double check - check all your "new"s and trace th... |
532,927 | <p>I have to maintain an application that has a lot of columns that are of the text data type, with multiple values inserted into them delimited with commas, slashes or sometimes even the pipe (|) character. I'm trying to figure out why on Earth you would ever want to do this.</p>
<p>For an example, an orders table h... | [
{
"answer_id": 532933,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 3,
"selected": false,
"text": "<p>The two likeliest scenarios are:</p>\n\n<ul>\n<li>Your predecessor was incompetent / didn't understand normalization</li>\n<li>... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40667/"
] | I have to maintain an application that has a lot of columns that are of the text data type, with multiple values inserted into them delimited with commas, slashes or sometimes even the pipe (|) character. I'm trying to figure out why on Earth you would ever want to do this.
For an example, an orders table has a column... | >
> Did my predecessor know something I didn't, or am I right to be saying "WTF?!!" when I look at this schema?
>
>
>
No, your predecessor didn't. Yes, you are right. See note at the end, however.
>
> It seems like it's insanely inefficient and difficult to maintain like this, and it makes running reports extra... |
532,981 | <p>I'm trying to configure emacs to indent my C block comments nicely.</p>
<p>Emacs (22.3) does by default (regardless of the indentation style):</p>
<pre>
/* My very long comment which spreads over multiple lines
* and thus needs to be filled.
*/
</pre>
<p>But what I would highly prefer is:</p>
<pre>
/* My very lo... | [
{
"answer_id": 533492,
"author": "Dortz",
"author_id": 62305,
"author_profile": "https://Stackoverflow.com/users/62305",
"pm_score": 0,
"selected": false,
"text": "<p>You can try just changing the c-block-comment-prefix to \" * \",</p>\n\n<p>or make sure c-comment-prefix-regexp is '//+\\... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60183/"
] | I'm trying to configure emacs to indent my C block comments nicely.
Emacs (22.3) does by default (regardless of the indentation style):
```
/* My very long comment which spreads over multiple lines
* and thus needs to be filled.
*/
```
But what I would highly prefer is:
```
/* My very long comment which spreads ... | Hm, it works here with 22.3.1 and starting with the '-Q' option which doesn't load any personal or site lisp files. Sorry to not be much help, but I think it's your setup. Try doing 'emacs -Q' and see if you still see the same problem. |
532,985 | <p>Basically I want to have one xslt to become my 'base' xslt and want to link this into child xslt files.</p>
<p>Is this possible? </p>
<p>The aim is to reduce code duplication. </p>
<p>We will have many child xslt files for the various customers all with their own formatting and additional text etc and don't want... | [
{
"answer_id": 532999,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>Yes you can - you can <code>include</code> and <code>import</code> other XSLTs.</p>\n\n<p><a href=\"http://www.w3sc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/532985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31766/"
] | Basically I want to have one xslt to become my 'base' xslt and want to link this into child xslt files.
Is this possible?
The aim is to reduce code duplication.
We will have many child xslt files for the various customers all with their own formatting and additional text etc and don't want to repeat the base code ... | ```
<xsl:import href="library/utility-include.xsl" />
```
The href path is relative to the current xsl file. [`<xsl:import/>` documentation](http://www.w3schools.com/Xsl/el_import.asp).
Remember that you must write your import lines as the first child element of `<xsl:stylesheet>` or `<xsl:transform>`. They cannot a... |
533,005 | <p>We're using silverlight in a kiosk type scenario. Is there a way to disable the right click ability to enter the silverlight configuration dialog?</p>
| [
{
"answer_id": 533084,
"author": "Eric Ness",
"author_id": 60874,
"author_profile": "https://Stackoverflow.com/users/60874",
"pm_score": 4,
"selected": true,
"text": "<p>//in the SharePoint I have added a Small code to tell SP to run the script after every part is loaded. Works like a ch... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9266/"
] | We're using silverlight in a kiosk type scenario. Is there a way to disable the right click ability to enter the silverlight configuration dialog? | //in the SharePoint I have added a Small code to tell SP to run the script after every part is loaded. Works like a charm :)
// EDIT
or better yet the silverlight forum recommends you do this:
[Silverlight Forum](http://silverlight.net/forums/p/37820/109804.aspx)
```
<div id="silverlightObjDiv">
<!-- silverlight... |
533,007 | <p>Is it possible to open Microsoft Script Editor, then from within the editor open a .vbs (VBScript) file, then run/debug it?</p>
<p>I know I can use the command-line cscript (filename) //X to launch the file, allowing me to select Microsoft Script Editor as the debugger, but I want to do everything from within Micro... | [
{
"answer_id": 533235,
"author": "DMKing",
"author_id": 10887,
"author_profile": "https://Stackoverflow.com/users/10887",
"pm_score": 2,
"selected": true,
"text": "<p>Your script has to be part of a web page. It would be nice if the MS Script Editor lived up to its name but it doesn't. ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59333/"
] | Is it possible to open Microsoft Script Editor, then from within the editor open a .vbs (VBScript) file, then run/debug it?
I know I can use the command-line cscript (filename) //X to launch the file, allowing me to select Microsoft Script Editor as the debugger, but I want to do everything from within Microsoft Scrip... | Your script has to be part of a web page. It would be nice if the MS Script Editor lived up to its name but it doesn't. You can make a simple HTML page to include your vbs file and use that in the Script Editor to launch your script. The page can be as simple as this:
```
<script language="vbscript" src="file:///C:\my... |
533,008 | <p>Which style is preferred?
Is there a good reason for one vs. the other?</p>
<p>Thanks in advance!</p>
<pre><code>1) cmds.each do |cmd|
end
2) cmds.each { |cmd|
}
</code></pre>
<p>Example code:</p>
<pre><code>cmds = [ "create", "update", "list", "help" ]
# Block style one
#
cmds.each do |cmd|
puts "loop... | [
{
"answer_id": 533029,
"author": "Gordon Wilson",
"author_id": 23071,
"author_profile": "https://Stackoverflow.com/users/23071",
"pm_score": 6,
"selected": true,
"text": "<p>The rails team and many other rubyists <a href=\"http://wiki.rubyonrails.org/rails/pages/CodingStandards\" rel=\"n... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64383/"
] | Which style is preferred?
Is there a good reason for one vs. the other?
Thanks in advance!
```
1) cmds.each do |cmd|
end
2) cmds.each { |cmd|
}
```
Example code:
```
cmds = [ "create", "update", "list", "help" ]
# Block style one
#
cmds.each do |cmd|
puts "loop1, cmd: #{cmd}"
end
# Block style two
#
cmd... | The rails team and many other rubyists [prefer](http://wiki.rubyonrails.org/rails/pages/CodingStandards) to use curly braces for one line blocks and `do...end` for multi-line ones.
The only functional difference between the two is that the precedence of a `do...end` block is lower than that of a `{...}` block. |
533,014 | <p>Given the following two (simplified) models:</p>
<pre><code>class Customer < ActiveRecord::Base
# finder sql to include global users in the association
has_many :users, :dependent => :destroy,
:finder_sql => 'SELECT `u`.* FROM `users` `u`
WHERE (`u`.`customer_id` = "#{id}" OR `u`.`customer_id` IS N... | [
{
"answer_id": 533073,
"author": "DanSingerman",
"author_id": 43965,
"author_profile": "https://Stackoverflow.com/users/43965",
"pm_score": 2,
"selected": true,
"text": "<p>Either of these should work</p>\n\n<pre><code>User.find(:all, :conditions => ['customer_id = ? OR customer_id IS... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20467/"
] | Given the following two (simplified) models:
```
class Customer < ActiveRecord::Base
# finder sql to include global users in the association
has_many :users, :dependent => :destroy,
:finder_sql => 'SELECT `u`.* FROM `users` `u`
WHERE (`u`.`customer_id` = "#{id}" OR `u`.`customer_id` IS NULL)'
validates_pres... | Either of these should work
```
User.find(:all, :conditions => ['customer_id = ? OR customer_id IS NULL', Customer.first[:id]])
```
or
```
Customer.first.users.select{|user| user.email == "test@example.com"}
``` |
533,021 | <p>The following SQL statement is occasionally generating deadlocks in my mssqlserver 2000 server</p>
<pre><code>delete from tb_intervaloServico
where idFeriado in (
select ints.idIntervalo
from tb_periodicidadeServico ps, tb_intervaloServico ints
where ints.idPeriodicidadeServico=ps.idPeriodicidadeServ... | [
{
"answer_id": 533312,
"author": "John Sansom",
"author_id": 60308,
"author_profile": "https://Stackoverflow.com/users/60308",
"pm_score": 0,
"selected": false,
"text": "<p>The following article will guide you through how to troubleshoot deadlocks in SQL Server 2000.</p>\n\n<p><a href=\"... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12772/"
] | The following SQL statement is occasionally generating deadlocks in my mssqlserver 2000 server
```
delete from tb_intervaloServico
where idFeriado in (
select ints.idIntervalo
from tb_periodicidadeServico ps, tb_intervaloServico ints
where ints.idPeriodicidadeServico=ps.idPeriodicidadeServico
and id... | You need to enable some trace flags on your db so you get a printout in your log that explains the deadlock chain.
Try starting SQL server with trace flags 1204,1205 and 1206. Then post the deadlock chain.
You could try escalating the locks on in your sql, its possible this will fix it but without the chain printou... |
533,034 | <p>I have a large database of zip / postal codes used in proximity searches. There are about 1 million records. Somehow I didn't add the primary key to the table, and now I have to add it because searches take about 3 seconds because of the full table scan. When I go to generate a script to add it in SSMS, the operatio... | [
{
"answer_id": 533043,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 1,
"selected": false,
"text": "<p>Generate the script and paste it into a query and run it there. Make sure your SSMS is not set to have an execution ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26/"
] | I have a large database of zip / postal codes used in proximity searches. There are about 1 million records. Somehow I didn't add the primary key to the table, and now I have to add it because searches take about 3 seconds because of the full table scan. When I go to generate a script to add it in SSMS, the operation t... | Make sure that the execution timeout in your SSMS Options/Query Execution is set to 0 (no timeout). Then use a query similar to the following with table/column/key names replaced with yours. Adjust the parameters as desired.
```
ALTER TABLE tableName WITH NOCHECK
ADD CONSTRAINT PK_tableName PRIMARY KEY CLUSTERED (col... |
533,038 | <p>I want to use this snippet from <a href="http://www.mr-edd.co.uk/?p=16" rel="nofollow noreferrer">Mr-Edd's iostreams article</a> to print std::clog somewhere.</p>
<pre><code>#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
int main()
{
std::ostringstream oss;
... | [
{
"answer_id": 533127,
"author": "Evan Teran",
"author_id": 13430,
"author_profile": "https://Stackoverflow.com/users/13430",
"pm_score": 3,
"selected": false,
"text": "<p>I <strong>think</strong> you want to pull the text from the ostream while it's not empty. You could do something lik... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20003/"
] | I want to use this snippet from [Mr-Edd's iostreams article](http://www.mr-edd.co.uk/?p=16) to print std::clog somewhere.
```
#include <iostream>
#include <iomanip>
#include <string>
#include <sstream>
int main()
{
std::ostringstream oss;
// Make clog use the buffer from oss
std::streambuf *former_buff =... | I encourage you to look at [`Boost.IOStreams`](http://www.boost.org/doc/libs/release/libs/iostreams/doc/index.html). It seems to fit your use-case nicely, and using it is surprisingly simple:
```
#include <boost/iostreams/concepts.hpp>
#include <boost/iostreams/stream_buffer.hpp>
#include <iostream>
namespace bio = ... |
533,048 | <p>Is it possible to decorate/extend the python standard logging system, so that when a logging method is invoked it also logs the file and the line number where it was invoked or maybe the method that invoked it?</p>
| [
{
"answer_id": 533077,
"author": "Seb",
"author_id": 189,
"author_profile": "https://Stackoverflow.com/users/189",
"pm_score": 9,
"selected": true,
"text": "<p>Sure, check <a href=\"http://docs.python.org/library/logging.html#formatter-objects\" rel=\"noreferrer\">formatters</a> in loggi... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/333261/"
] | Is it possible to decorate/extend the python standard logging system, so that when a logging method is invoked it also logs the file and the line number where it was invoked or maybe the method that invoked it? | Sure, check [formatters](http://docs.python.org/library/logging.html#formatter-objects) in logging docs. Specifically the lineno and pathname variables.
>
> **%(pathname)s** Full pathname of the source file where the logging call was issued(if available).
>
>
> **%(filename)s** Filename portion of pathname.
>
>
>... |
533,049 | <p>I've been researching timestamps in PHP & MySQL. My undertanding is that UNIX timestamps only exist in GMT ... the whole point being that you convert it into the users timezone (GMT +/- timezone = users localtime). I'm doing this successfuly by saving the timestamp in it's "raw" form (as a 10 digit long int) and... | [
{
"answer_id": 533349,
"author": "Syntax",
"author_id": 62551,
"author_profile": "https://Stackoverflow.com/users/62551",
"pm_score": 0,
"selected": false,
"text": "<p>I set the timezone in php with <a href=\"http://us3.php.net/putenv\" rel=\"nofollow noreferrer\">putenv</a>. This shou... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been researching timestamps in PHP & MySQL. My undertanding is that UNIX timestamps only exist in GMT ... the whole point being that you convert it into the users timezone (GMT +/- timezone = users localtime). I'm doing this successfuly by saving the timestamp in it's "raw" form (as a 10 digit long int) and conver... | Your method is just fine :)
You'd probably want to set timezone in a more global scope, e.g. on whatever PHP script you are using for logins, rather than having to recall it every time you use a date function. This also makes it easier to change if, for whatever reason, you change your mind and want to standardize tim... |
533,050 | <p>I have been using the STOMP protocol in various guises. I have experienced this phenomenon in the PHP, Python and Objective-C libraries for STOMP. The STOMP specification on <a href="http://stomp.codehaus.org/" rel="nofollow noreferrer">the STOMP website</a> is not specific on this point.</p>
<p>Basically, the CONN... | [
{
"answer_id": 540683,
"author": "Dejan Bosanac",
"author_id": 55773,
"author_profile": "https://Stackoverflow.com/users/55773",
"pm_score": 3,
"selected": true,
"text": "<p>ActiveMQ does not require these headers to be sent. Take a look at this telnet session for example</p>\n\n<pre><co... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] | I have been using the STOMP protocol in various guises. I have experienced this phenomenon in the PHP, Python and Objective-C libraries for STOMP. The STOMP specification on [the STOMP website](http://stomp.codehaus.org/) is not specific on this point.
Basically, the CONNECT function in all three libraries (although t... | ActiveMQ does not require these headers to be sent. Take a look at this telnet session for example
```
$ telnet localhost 61613
Trying ::1...
Connected to localhost.
Escape character is '^]'.
CONNECT
^@
CONNECTED
session:ID:nc-example.com-51165-1234432649359-2:0
```
It connects successfully to the broker without an... |
533,065 | <p>I'm trying to encapsulate some functions from the C socket library into my own C++ class. I'd like to define a member function that uses the same name as its corresponding C function, but with a different signature. For example, I'd like to write the function</p>
<pre><code>ssize_t MyClass::write(const void *buf)... | [
{
"answer_id": 533085,
"author": "UncleZeiv",
"author_id": 60531,
"author_profile": "https://Stackoverflow.com/users/60531",
"pm_score": 4,
"selected": true,
"text": "<p>Have you tried calling the C function expliciting that it lives in the global namespace, like ::write?</p>\n"
},
{... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1288/"
] | I'm trying to encapsulate some functions from the C socket library into my own C++ class. I'd like to define a member function that uses the same name as its corresponding C function, but with a different signature. For example, I'd like to write the function
```
ssize_t MyClass::write(const void *buf);
```
which ma... | Have you tried calling the C function expliciting that it lives in the global namespace, like ::write? |
533,070 | <p>I have a small C++ program for Win32, which has the following WinMain:</p>
<pre><code>int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
</code></pre>
<p>when trying to compile for x64, I get the... | [
{
"answer_id": 533135,
"author": "Jon Bright",
"author_id": 1813,
"author_profile": "https://Stackoverflow.com/users/1813",
"pm_score": 0,
"selected": false,
"text": "<p>No promises, but I suspect your problem might be fixed by changing \"APIENTRY\" to \"WINAPI\". If this does fix it, t... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19808/"
] | I have a small C++ program for Win32, which has the following WinMain:
```
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
```
when trying to compile for x64, I get the following error:
```
err... | Your linker is set to link the executable under the `CONSOLE` subsystem, thus it's looking for `main`, you'll need to set the subsystem to `WINDOWS`. |
533,086 | <p>I am working through the examples in a Django book that I have, but the book was written for 0.96 and I am using 1.0.2, yeah, I know, not the best idea. But reading Django's "porting your apps from 0.96 to 1.0" doc has cleared up most of the differences for me. Until I get to the point where I need to implement inli... | [
{
"answer_id": 533149,
"author": "Baishampayan Ghose",
"author_id": 8024,
"author_profile": "https://Stackoverflow.com/users/8024",
"pm_score": 3,
"selected": true,
"text": "<p>You can do something like this:</p>\n\n<pre><code>class SearchKeywordInline(admin.StackedInline):\n model = ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64651/"
] | I am working through the examples in a Django book that I have, but the book was written for 0.96 and I am using 1.0.2, yeah, I know, not the best idea. But reading Django's "porting your apps from 0.96 to 1.0" doc has cleared up most of the differences for me. Until I get to the point where I need to implement inline ... | You can do something like this:
```
class SearchKeywordInline(admin.StackedInline):
model = SearchKeyword
extra = 3
class FlatPageAdmin(admin.ModelAdmin):
inlines = [SearchKeywordInline]
# unregister the FlatPage model from the admin site so I can
# register it again with the inline stuff (Thanks Carl & ... |
533,102 | <p>I thought about this awhile ago and it recently resurfaced as my shop is doing its first real Java web app.</p>
<p>As an intro, I see two main package naming strategies. (To be clear, I'm not referring to the whole 'domain.company.project' part of this, I'm talking about the package convention beneath that.) Anyw... | [
{
"answer_id": 533175,
"author": "JeeBee",
"author_id": 17832,
"author_profile": "https://Stackoverflow.com/users/17832",
"pm_score": 2,
"selected": false,
"text": "<p>It depends on the granularity of your logical processes?</p>\n\n<p>If they're standalone, you often have a new project f... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16562/"
] | I thought about this awhile ago and it recently resurfaced as my shop is doing its first real Java web app.
As an intro, I see two main package naming strategies. (To be clear, I'm not referring to the whole 'domain.company.project' part of this, I'm talking about the package convention beneath that.) Anyway, the pack... | For package design, I first divide by layer, then by some other functionality.
There are some additional rules:
1. layers are stacked from most general (bottom) to most specific (top)
2. each layer has a public interface (abstraction)
3. a layer can only depend on the public interface of another layer (encapsulation)... |
533,111 | <p>I am using a Drop Down List for selecting some options. Everything works fine, all I need is to change the name in the URL. Is there a way to change the URL ONLY based on the option?</p>
<p>Default Puma - </p>
<pre><code>Default.aspx?Dept=Shoes&Type=Puma
</code></pre>
<p>if Nike is selected -</p>
<pre><cod... | [
{
"answer_id": 533124,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 0,
"selected": false,
"text": "<p>You are going to want to do this with Javascript. You can change <code>window.location</code> from Javascript and ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533111",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54197/"
] | I am using a Drop Down List for selecting some options. Everything works fine, all I need is to change the name in the URL. Is there a way to change the URL ONLY based on the option?
Default Puma -
```
Default.aspx?Dept=Shoes&Type=Puma
```
if Nike is selected -
```
Default.aspx?Dept=Shoes&Type=Nike
``` | To handle this on the server you could enable the autopostback property of the control and create a SelectedIndexChanged event to call a method to identify the selected option and redirect based on this selection.
```
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e)
{
Response.Redirect... |
533,125 | <p>I have a Windows box with cygwin, python and django installed.</p>
<p>Now I want to run django-admin, but when I do I get the error:</p>
<pre><code>$ django-admin.py
c:\Python26\python.exe: can't open file '/usr/bin/django-admin.py': [Errno 2] No such file or directory
</code></pre>
| [
{
"answer_id": 533184,
"author": "David Santamaria",
"author_id": 24097,
"author_profile": "https://Stackoverflow.com/users/24097",
"pm_score": 3,
"selected": false,
"text": "<p>From <a href=\"http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs\" rel=\"noreferrer\">here</... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64653/"
] | I have a Windows box with cygwin, python and django installed.
Now I want to run django-admin, but when I do I get the error:
```
$ django-admin.py
c:\Python26\python.exe: can't open file '/usr/bin/django-admin.py': [Errno 2] No such file or directory
``` | From [here](http://docs.djangoproject.com/en/dev/ref/django-admin/?from=olddocs)
>
> For Windows users, who do not have symlinking functionality available, you can copy django-admin.py to a location on your existing path or edit the PATH settings (under Settings - Control Panel - System - Advanced - Environment...) t... |
533,134 | <p>I have a number of divs next to each other (horizontally) and want the width of each of them, sequentially. Ideally they should look like one long div that grows to the right from the left. My issue is that they all start growing simultaneously. Each div has the name 'div' with a number at the end, and I'm using ... | [
{
"answer_id": 533170,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 2,
"selected": false,
"text": "<p>Use the callback from the animate function to initiate the next operation</p>\n\n<pre><code><script type=\"text/jav... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16508/"
] | I have a number of divs next to each other (horizontally) and want the width of each of them, sequentially. Ideally they should look like one long div that grows to the right from the left. My issue is that they all start growing simultaneously. Each div has the name 'div' with a number at the end, and I'm using 'i' as... | I ended up making a separate function that would call an animation on the div then call itself. As it called itself it would increment a counter and I compare the counter to my total value and stop the loop when needed. |
533,166 | <p>This may sound trivial, but what is the difference between</p>
<pre><code>Dim v As String()
</code></pre>
<p>and</p>
<pre><code>Dim v() As String
</code></pre>
<p>in VB.NET?</p>
| [
{
"answer_id": 533185,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": 1,
"selected": false,
"text": "<p>There is no difference.</p>\n"
},
{
"answer_id": 533211,
"author": "Joel Coehoorn",
"author_id": 3043,
... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1508/"
] | This may sound trivial, but what is the difference between
```
Dim v As String()
```
and
```
Dim v() As String
```
in VB.NET? | No difference. From the [VB.NET Language Specification on Arrays](http://msdn.microsoft.com/en-us/library/aa711948.aspx):
Array types are specified by adding a modifier to an existing **type name**. The modifier consists of a left parenthesis, a set of zero or more commas, and a right parenthesis.
...
A variable ma... |
533,171 | <p>I'm attempting to use an unknown type in a for each loop as per the following code:</p>
<pre><code>private sub ReflectThis(ByVal rawData As Object())
Dim dataType As Type = rawData(0).GetType()
Dim properties As PropertyInfo() = dataType.getProperties()
For Each item As dataType In rawData ''//AAAA
For Ea... | [
{
"answer_id": 533195,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>Just don't specify the type:</p>\n\n<pre><code>For Each item in rawData\n</code></pre>\n"
},
{
"answer_id":... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm attempting to use an unknown type in a for each loop as per the following code:
```
private sub ReflectThis(ByVal rawData As Object())
Dim dataType As Type = rawData(0).GetType()
Dim properties As PropertyInfo() = dataType.getProperties()
For Each item As dataType In rawData ''//AAAA
For Each property As... | When you declare a variable "As" a type, that means you know the type at *compile* time. That lets the compiler check what you're doing with it. In this case, you *don't* know the type at compile time - you're getting it at execution time. All you know is that each item is an object - so either don't specify the type (... |
533,180 | <p>I am building and Anaysis Services project using VS 2005. The goal is to analyse advertising campaigns.</p>
<p>I have a single cube with 2 fact tables</p>
<p>factCampaign: which contains details of what people interviewed thought of an advertising campaign
factDemographics: which contains demographic information ... | [
{
"answer_id": 533195,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>Just don't specify the type:</p>\n\n<pre><code>For Each item in rawData\n</code></pre>\n"
},
{
"answer_id":... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am building and Anaysis Services project using VS 2005. The goal is to analyse advertising campaigns.
I have a single cube with 2 fact tables
factCampaign: which contains details of what people interviewed thought of an advertising campaign
factDemographics: which contains demographic information of the people inte... | When you declare a variable "As" a type, that means you know the type at *compile* time. That lets the compiler check what you're doing with it. In this case, you *don't* know the type at compile time - you're getting it at execution time. All you know is that each item is an object - so either don't specify the type (... |
533,199 | <p>If you scan a folder containing other folders AND files, how do you get rid of . and .. and files? How do you put in array only folders WITHOUT . and ..?
I would like to use regular expression, but I'm newbie and I can't get it right.
My code is now this but doesn't work:</p>
<blockquote>
<p>if(fnmatch("\.{1,2}",... | [
{
"answer_id": 533216,
"author": "phihag",
"author_id": 35070,
"author_profile": "https://Stackoverflow.com/users/35070",
"pm_score": 4,
"selected": true,
"text": "<p>You are confusing fnmatch and regular expressions in your code. To get all files and directories except the special ones,... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46866/"
] | If you scan a folder containing other folders AND files, how do you get rid of . and .. and files? How do you put in array only folders WITHOUT . and ..?
I would like to use regular expression, but I'm newbie and I can't get it right.
My code is now this but doesn't work:
>
> if(fnmatch("\.{1,2}",$dir\_array[$i]) || ... | You are confusing fnmatch and regular expressions in your code. To get all files and directories except the special ones, use this:
```
$dir_array = array_diff($dir_array, array(".", ".."));
```
Alternatively, if you iterate the array anyway, you can test each element like this:
```
foreach ($dir_array as $name) {
... |
533,219 | <p>Consider a view consisting of several tables... for example a <code>v_active_car</code>, which is made up of the tables <code>car</code> joined on to <code>body</code>, <code>engine</code>, <code>wheels</code> and <code>stereo</code>. It might look something like this:</p>
<p><strong><code>v_active_cars</code> vie... | [
{
"answer_id": 533228,
"author": "Learning",
"author_id": 18275,
"author_profile": "https://Stackoverflow.com/users/18275",
"pm_score": 1,
"selected": false,
"text": "<p>You seem to be doing everything right. The next step would be checking index coverage. </p>\n"
},
{
"answer_i... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24181/"
] | Consider a view consisting of several tables... for example a `v_active_car`, which is made up of the tables `car` joined on to `body`, `engine`, `wheels` and `stereo`. It might look something like this:
**`v_active_cars` view**
```
SELECT * FROM car
INNER JOIN body ON car.body = body.body_id
INNER JOIN engin... | 1. make sure that there are indexes for all the JOINs
* in your case, each level is selected both by a key, and a flag. adding the flag as part of the index might allow the DB to use only the index, instead of reading the whole record
* make sure you have enough RAM to hold the resultset. InnoDB tables in particular ... |
533,256 | <p>I have a table constructed like this :</p>
<pre><code>oid | identifier | value
1 | 10 | 101
2 | 10 | 102
3 | 20 | 201
4 | 20 | 202
5 | 20 | 203
</code></pre>
<p>I'd like to query this table to get a result like this :</p>
<pre><code>identifier | values[]
10 |... | [
{
"answer_id": 533326,
"author": "Johannes Weiss",
"author_id": 55925,
"author_profile": "https://Stackoverflow.com/users/55925",
"pm_score": 4,
"selected": false,
"text": "<p>You have to create an aggregate function, e.g.</p>\n\n<pre><code>CREATE AGGREGATE array_accum (anyelement)\n(\ns... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64667/"
] | I have a table constructed like this :
```
oid | identifier | value
1 | 10 | 101
2 | 10 | 102
3 | 20 | 201
4 | 20 | 202
5 | 20 | 203
```
I'd like to query this table to get a result like this :
```
identifier | values[]
10 | {101, 102}
20 | {201, 202... | This is a Postgres built-in since a few versions so you no longer need to define your own, the name is `array_agg()`.
```
test=> select array_agg(n) from generate_series(1,10) n group by n%2;
array_agg
--------------
{1,3,5,7,9}
{2,4,6,8,10}
```
(this is Postgres 8.4.8).
Note that no `ORDER BY` is specified,... |
533,260 | <p>I am looking for a way to do something like this with Ninject :</p>
<pre><code>// Sample from the Unity application block
IMyService result = myContainer.Resolve<IMyService>("Data");
</code></pre>
<p>( from <a href="http://msdn.microsoft.com/en-us/library/cc440957.aspx" rel="noreferrer">http://msdn.microsof... | [
{
"answer_id": 533431,
"author": "Mauricio Scheffer",
"author_id": 21239,
"author_profile": "https://Stackoverflow.com/users/21239",
"pm_score": 0,
"selected": false,
"text": "<p>AFAIK there is no way to do that directly in Ninject, but you can use <a href=\"http://www.google.com/search?... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9178/"
] | I am looking for a way to do something like this with Ninject :
```
// Sample from the Unity application block
IMyService result = myContainer.Resolve<IMyService>("Data");
```
( from <http://msdn.microsoft.com/en-us/library/cc440957.aspx> )
Is it possible? | Ninject 2.0 has this capability:
```
Bind<IMyService>().To<MyServiceA>().Named("Data");
Bind<IMyService>().To<MyServiceB>().Named("SomethingElse");
kernel.Get<IMyService>("Data"); // will return MyServiceA
``` |
533,300 | <p>I thought I was starting to get a grip on "the Python way" of programming. Methods of a class accept self as the first parameter to refer to the instance of the class whose context the method is being called in. The @classmethod decorator refers to a method whose functionality is associated with the class, but which... | [
{
"answer_id": 533315,
"author": "SilentGhost",
"author_id": 12855,
"author_profile": "https://Stackoverflow.com/users/12855",
"pm_score": 6,
"selected": true,
"text": "<p><a href=\"http://docs.python.org/library/functions.html#classmethod\" rel=\"noreferrer\">class itself</a>:</p>\n\n<b... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5287/"
] | I thought I was starting to get a grip on "the Python way" of programming. Methods of a class accept self as the first parameter to refer to the instance of the class whose context the method is being called in. The @classmethod decorator refers to a method whose functionality is associated with the class, but which do... | [class itself](http://docs.python.org/library/functions.html#classmethod):
>
> A class method receives the class as implicit first argument, just like an instance method receives the instance.
>
>
>
```
class C:
@classmethod
def f(cls):
print(cls.__name__, type(cls))
>>> C.f()
C <class 'type'>
`... |
533,305 | <p>I have 2 forms in my project, form1 and form2. When I click in a button in form1 I run this code:</p>
<pre><code>Form tempform = new Form2();
tempform.Show();
</code></pre>
<p>In my code for Form2 I have a label which I now need to change the text.
How can I access the label? </p>
<p>I tried:</p>
<pre><code>temp... | [
{
"answer_id": 533318,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>Controls have <code>protected</code> access by default. You can change that to <code>public</code>, or you can add... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8715/"
] | I have 2 forms in my project, form1 and form2. When I click in a button in form1 I run this code:
```
Form tempform = new Form2();
tempform.Show();
```
In my code for Form2 I have a label which I now need to change the text.
How can I access the label?
I tried:
```
tempform.label1.value = "new text"
```
And tha... | If the label value should only be set once, when the form is created, then use a constructor for Form2 like this:
```
public Form2(string labelValue)
{
_labelValue = labelValue;
}
```
and then call that constructor when you create the form.
Alternatively, if the label changes over the lifetime of the form, make a... |
533,310 | <p>This is using Rails 2.2.2</p>
<p>I have a model that uses the acts_as_flaggable plugin, and on the page I use to display an instance of the model, I list any flags that the model has.</p>
<p>When I start my Rails dev server(mongrel) using the standard script/server command, load the page holding the following code... | [
{
"answer_id": 533355,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 0,
"selected": false,
"text": "<p>That means that you have a nil object where you expected a real object. It sounds like its crashing somewhere in th... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27521/"
] | This is using Rails 2.2.2
I have a model that uses the acts\_as\_flaggable plugin, and on the page I use to display an instance of the model, I list any flags that the model has.
When I start my Rails dev server(mongrel) using the standard script/server command, load the page holding the following code, it loads fine... | Having experience a similar problem, I'd check your `/config/initializers` directory. Does it declare some methods or include some modules into the models? If so, it will happen on first load, but the models will get reloaded on subsequent requests without the initializers running again. |
533,330 | <p>Are dynamic dispatch and dynamic binding the same thing?</p>
<p>Thanks</p>
<p>Maciej</p>
| [
{
"answer_id": 533362,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 4,
"selected": false,
"text": "<p>No. </p>\n\n<p>Dynamic Dispatch - The actual method group/signature/override chain is bound at compile time. The meth... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Are dynamic dispatch and dynamic binding the same thing?
Thanks
Maciej | No.
Dynamic Dispatch - The actual method group/signature/override chain is bound at compile time. The method called is dependent upon the actual runtime type of the object but no actual interpretation occurs. It will still be a version of the statically bound method.
Here is an example in C#.
```
class Foo {
p... |
533,343 | <p>I´m using the LinqDataSource to populate a grid. But now I need the SQL query that the LinqDataSource generates, to pass around throught methods (no, I can't modify the methods to not need a SQL query). </p>
<p>Is there a way to obtain the generated SQL query from a instantiated and configured LinqDataSource?</p>
| [
{
"answer_id": 533380,
"author": "thinkbeforecoding",
"author_id": 47001,
"author_profile": "https://Stackoverflow.com/users/47001",
"pm_score": 0,
"selected": false,
"text": "<p>The Sql will only be generated by the Linq to Sql infrastructure at runtime.</p>\n\n<p>I think there are some... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533343",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27959/"
] | I´m using the LinqDataSource to populate a grid. But now I need the SQL query that the LinqDataSource generates, to pass around throught methods (no, I can't modify the methods to not need a SQL query).
Is there a way to obtain the generated SQL query from a instantiated and configured LinqDataSource? | Hope this helps.
using the function below will return a SqlQueryText
you can rebuild the query from that object.
* to get the sql text you can use use the .Text Property
* to get the passed
parameters you can use the .Params property
```
public static SqlQueryText GetFullQueryInfo(DataContext dataContext, IQue... |
533,376 | <p>I have a complicated HQL query.</p>
<p>I would like to access the Oracle specific <strong>rownum</strong> column value as part of my returned results. How do I write my query (and/or change my hbm.xml) to support this?</p>
<p>What I have tried so far does not work:</p>
<p>modifying my hbm.xml</p>
<pre><code><... | [
{
"answer_id": 533417,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 3,
"selected": true,
"text": "<p>ROWNUM doesn't belong to any table, so your query should be:</p>\n\n<pre><code>\"select rownum from Dog as dog wher... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62255/"
] | I have a complicated HQL query.
I would like to access the Oracle specific **rownum** column value as part of my returned results. How do I write my query (and/or change my hbm.xml) to support this?
What I have tried so far does not work:
modifying my hbm.xml
```
<property name="rownum" type="int" update="false" in... | ROWNUM doesn't belong to any table, so your query should be:
```
"select rownum from Dog as dog where ..."
```
For example:
```
SQL> select emp.ename, rownum from emp;
ENAME ROWNUM
---------- ----------
SMITH 1
ALLEN 2
WARD 3
JONES 4
MARTIN ... |
533,379 | <p>In short, I think boxing is an annoyance. Let's look at some alternatives...</p>
<pre><code>public class Box<T>
where T : struct
{
public T Value { get; set; }
public static implicit operator T(Box<T> box)
{
return box.Value;
}
}
</code></pre>
<p>System.Int32 derives from ab... | [
{
"answer_id": 533420,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": true,
"text": "<p>I'm not entirely sure of your question here. Are you just asking whether your solution is perhaps better than normal b... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58961/"
] | In short, I think boxing is an annoyance. Let's look at some alternatives...
```
public class Box<T>
where T : struct
{
public T Value { get; set; }
public static implicit operator T(Box<T> box)
{
return box.Value;
}
}
```
System.Int32 derives from abstract class System.ValueType which ... | I'm not entirely sure of your question here. Are you just asking whether your solution is perhaps better than normal boxing? It certainly has some appeal. If you're asking why boxing wasn't implemented this way in the first place, just remember that .NET didn't have generics to start with.
EDIT: Boxing is relatively r... |
533,382 | <p>I need to generate code for a method at runtime. It's important to be able to run arbitrary code and have a docstring.</p>
<p>I came up with a solution combining <code>exec</code> and <code>setattr</code>, here's a dummy example:</p>
<pre><code>class Viking(object):
def __init__(self):
code = '''
... | [
{
"answer_id": 533581,
"author": "Justin Voss",
"author_id": 5616,
"author_profile": "https://Stackoverflow.com/users/5616",
"pm_score": 4,
"selected": false,
"text": "<p>Python will let you declare a function in a function, so you don't have to do the <code>exec</code> trickery.</p>\n\n... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8206/"
] | I need to generate code for a method at runtime. It's important to be able to run arbitrary code and have a docstring.
I came up with a solution combining `exec` and `setattr`, here's a dummy example:
```
class Viking(object):
def __init__(self):
code = '''
def dynamo(self, arg):
... | Based on Theran's code, but extending it to methods on classes:
```
class Dynamo(object):
pass
def add_dynamo(cls,i):
def innerdynamo(self):
print "in dynamo %d" % i
innerdynamo.__doc__ = "docstring for dynamo%d" % i
innerdynamo.__name__ = "dynamo%d" % i
setattr(cls,innerdynamo.__name__,i... |
533,395 | <p>I am fairly inexperienced with asp.net ajax and am having a problem where a javascript error is thrown (object not found).</p>
<p>The debugger then stops and points to a substring of my viewstate it looks something like the following (not exactly this since my viewstate is huge) with the section between the ellipse... | [
{
"answer_id": 533416,
"author": "levand",
"author_id": 3044,
"author_profile": "https://Stackoverflow.com/users/3044",
"pm_score": 0,
"selected": false,
"text": "<p>Debugging by browser error messages, especially IE, is notoriously difficult. Even simple error conditions, like an invali... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5056/"
] | I am fairly inexperienced with asp.net ajax and am having a problem where a javascript error is thrown (object not found).
The debugger then stops and points to a substring of my viewstate it looks something like the following (not exactly this since my viewstate is huge) with the section between the ellipses highligh... | The line number that is reported in your error is likely misleading. I would recommend stepping through the javascript with a debugger. I usually do this with IE and Visual Studio or the microsoft script debugger (check out [this link](http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx) for directions). There's al... |
533,398 | <p>Without using the new 2.6 subprocess module, how can I get either os.popen or os.system to execute my commands using the tcsh instead of bash? I need to source some scripts which are written in tcsh before executing some other commands and I need to do this within python2.4.</p>
<p>EDIT
Thanks for answers using 't... | [
{
"answer_id": 533422,
"author": "Torsten Marek",
"author_id": 9567,
"author_profile": "https://Stackoverflow.com/users/9567",
"pm_score": 3,
"selected": false,
"text": "<p>How about:</p>\n\n<pre><code>>>> os.system(\"tcsh your_own_script\")\n</code></pre>\n\n<p>Or just write th... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20712/"
] | Without using the new 2.6 subprocess module, how can I get either os.popen or os.system to execute my commands using the tcsh instead of bash? I need to source some scripts which are written in tcsh before executing some other commands and I need to do this within python2.4.
EDIT
Thanks for answers using 'tcsh -c', bu... | Just prefix the shell as part of your command. I don't have tcsh installed but with zsh:
```
>>> os.system ("zsh -c 'echo $0'")
zsh
0
``` |
533,405 | <p>I want to use custom jsp tags to help build a menu in my application. However, I want all the actual HTML to live in JSP files, rather than in the Java class.</p>
<p>So, suppose I have a tag like this:</p>
<pre><code><mytags:Menu>
<mytags:MenuItem name="foo"/>
<mytags:MenuItem name="bar"/>
... | [
{
"answer_id": 533424,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 3,
"selected": true,
"text": "<p>I really suggest you use <a href=\"http://www.onjava.com/pub/a/onjava/2004/05/12/jsp2part4.html\" rel=\"nofollow nore... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4257/"
] | I want to use custom jsp tags to help build a menu in my application. However, I want all the actual HTML to live in JSP files, rather than in the Java class.
So, suppose I have a tag like this:
```
<mytags:Menu>
<mytags:MenuItem name="foo"/>
<mytags:MenuItem name="bar"/>
<mytags:MenuItem name="baz"/>
</mytags:... | I really suggest you use [jsp 2.0 tag files](http://www.onjava.com/pub/a/onjava/2004/05/12/jsp2part4.html) instead of the approach you suggest. Jsp 2.0 tag files were created to address problems like the one you describe. Combined with jstl (and possibly java classes if it's really complex), you should be able to achie... |
533,426 | <p>The following code compiles:</p>
<pre><code>class Testing<TKey, TValue>
{
public bool Test(TKey key)
{
return key == null;
}
}
</code></pre>
<p>However, TKey can be a value type, and possibly not allow the value "null". </p>
<p>I know the results of this program, and how to add constrai... | [
{
"answer_id": 533436,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>As for the \"why\", I'm not sure. But to fix it, you can use <code>default(T)</code> instead of <code>null</code>.... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18941/"
] | The following code compiles:
```
class Testing<TKey, TValue>
{
public bool Test(TKey key)
{
return key == null;
}
}
```
However, TKey can be a value type, and possibly not allow the value "null".
I know the results of this program, and how to add constraints. What I'm wondering is **why doesn't... | It's convenient to be able to do this in various cases. If `TKey` is a non-nullable value type, the result of the comparison will always be false. (It's possible that the JITter will remove that branch entirely - don't forget that although one version of the JITted code is shared for all reference types, it reJITs for ... |
533,459 | <p>How can I do this in PHP</p>
<pre><code>$myDBClass->users()->limit(5);//output you limited users to 5
$myDBClass->comments()->limit(3);//output you limited comments to 3
</code></pre>
<p>what I meant is nested methods or nested class (I don't know!)
so when I call the limit method as a child of users i... | [
{
"answer_id": 533474,
"author": "Antonio Haley",
"author_id": 390,
"author_profile": "https://Stackoverflow.com/users/390",
"pm_score": 3,
"selected": false,
"text": "<p>The standard convention for this is to return the instance of $this at the end of each of the method call. So when re... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459737/"
] | How can I do this in PHP
```
$myDBClass->users()->limit(5);//output you limited users to 5
$myDBClass->comments()->limit(3);//output you limited comments to 3
```
what I meant is nested methods or nested class (I don't know!)
so when I call the limit method as a child of users it will know that I am calling it from ... | Have the methods return objects with the methods described, and you get what you are after.
So, as long as `$DB` is an object that has a `comments()`-method, that part is valid. If that `comments()` returns an object that has an `id()`-method, that part is valid, too. Then, `id()` needs to return an object that has th... |
533,462 | <p><img src="https://farm4.static.flickr.com/3352/3270044482_610eee066a.jpg?v=0" alt="alt text"></p>
<p>I am using the autocomplete YUI feature. However, as you can see I am having trouble aligning the suggestion drop down with the text input when I put a label in front of the text input. I am following <a href="http... | [
{
"answer_id": 533691,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 0,
"selected": false,
"text": "<p>Seems like this auto-complete plugin isn't using the infamous <a href=\"http://www.quirksmode.org/js/findpos.html\... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32174/"
] | 
I am using the autocomplete YUI feature. However, as you can see I am having trouble aligning the suggestion drop down with the text input when I put a label in front of the text input. I am following [the example here](http://developer.ya... | AutoComplete doesn't automatically brute-force the position of your AC container every time it shows, because unless you're doing inline work this is unnecessary. However, now that you've moved your input field inline, you do need to take another step to align the container, either with custom CSS or brute force JS pos... |
533,465 | <p>I have some URL that contains special characters. For example:</p>
<pre><code>http://www.example.com/bléèàû.html
</code></pre>
<p>If you type this URL in a browser, my web server would show the correct page (it can handle special character).</p>
<p>I have looked at the <a href="https://www.sitemaps.org/protocol.h... | [
{
"answer_id": 533506,
"author": "Cal Jacobson",
"author_id": 62649,
"author_profile": "https://Stackoverflow.com/users/62649",
"pm_score": 1,
"selected": false,
"text": "<p>The spec says that sitemaps <strong>must</strong> be UTF-8 encoded. If the URL is correct and is used on your sit... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1406/"
] | I have some URL that contains special characters. For example:
```
http://www.example.com/bléèàû.html
```
If you type this URL in a browser, my web server would show the correct page (it can handle special character).
I have looked at the [sitemaps specs](https://www.sitemaps.org/protocol.html) and it's not clear w... | The sitemaps specification doesn't say. It shows examples of URLs in various escaped forms but does not definitively say whether the first example (raw characters) is allowable. It only calls them ‘URL’s, with no reference to a particular definition of ‘URL’ or RFC which would clarify whether they mean old-school ASCII... |
533,485 | <p>I have a Table that looks like this:</p>
<pre><code>IP Hostname TransactionDate
------------- ---------- -------------------
1.1.1.1 A 2009-01-01 01:00:00
1.1.1.1 A 2009-01-02 01:00:00
1.1.1.1 A 2009-01-03 01:45:00
1.1.1.1 B 2009-01-04 01:00:0... | [
{
"answer_id": 533582,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 1,
"selected": false,
"text": "<p>There are a few solutions to this problem in Joe Celko's <a href=\"https://rads.stackoverflow.com/amzn/click/com/0123... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533485",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63623/"
] | I have a Table that looks like this:
```
IP Hostname TransactionDate
------------- ---------- -------------------
1.1.1.1 A 2009-01-01 01:00:00
1.1.1.1 A 2009-01-02 01:00:00
1.1.1.1 A 2009-01-03 01:45:00
1.1.1.1 B 2009-01-04 01:00:00
1.1.1.1 ... | There are a few solutions to this problem in Joe Celko's [SQL Puzzles and Answers](https://rads.stackoverflow.com/amzn/click/com/0123735963). Google has [an excerpt](http://books.google.com/books?id=krv8CUJU44sC&pg=PA234&lpg=PA234&dq=celko+contiguous+time&source=bl&ots=jkBHcDSyvj&sig=G9Lx595vqFVXSNesYti40nOiuE8&hl=en&e... |
533,491 | <p>I know that I have to use <code>SetConsoleCtrlHandler()</code> if I want to manage console closing events.</p>
<p>I do not know how to block the <code>CTRL_CLOSE_EVENT</code>. I've tried returning false/true if it catches that event, but no success</p>
<p>Here is what I have so far (thank you Anton Gogolev!):</p>
<p... | [
{
"answer_id": 533504,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 4,
"selected": true,
"text": "<p>The documentation for <a href=\"http://msdn.microsoft.com/en-us/library/ms686016(VS.85).aspx\" rel=\"noreferrer\"><code... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22582/"
] | I know that I have to use `SetConsoleCtrlHandler()` if I want to manage console closing events.
I do not know how to block the `CTRL_CLOSE_EVENT`. I've tried returning false/true if it catches that event, but no success
Here is what I have so far (thank you Anton Gogolev!):
```
[DllImport("Kernel32")]
public static ... | The documentation for [`SetConsoleCtrlHandler()`](http://msdn.microsoft.com/en-us/library/ms686016(VS.85).aspx) says:
>
> The system generates CTRL\_CLOSE\_EVENT, CTRL\_LOGOFF\_EVENT, and CTRL\_SHUTDOWN\_EVENT signals when the user closes the console, logs off, or shuts down the system so that the process has an oppo... |
533,516 | <p>[DUPLICATE of <a href="https://stackoverflow.com/questions/337704/parameterizing-a-sql-in-clause]">Parameterize an SQL IN clause</a></p>
<hr>
<p><strong>Issue:</strong> I need to send in a list of values into a stored procedure for use with an IN statement in the WHERE clause.</p>
<p><strong>Example:</strong></p>... | [
{
"answer_id": 533530,
"author": "hunterjrj",
"author_id": 22670,
"author_profile": "https://Stackoverflow.com/users/22670",
"pm_score": 3,
"selected": true,
"text": "<p>I don't believe that the 'IN' clause can handle an expression, I believe you need a literal. </p>\n\n<p>Try:</p>\n\n<p... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59376/"
] | [DUPLICATE of [Parameterize an SQL IN clause](https://stackoverflow.com/questions/337704/parameterizing-a-sql-in-clause])
---
**Issue:** I need to send in a list of values into a stored procedure for use with an IN statement in the WHERE clause.
**Example:**
```
declare @SPType NVARCHAR ( 30 )
declare @SPCodeA int
... | I don't believe that the 'IN' clause can handle an expression, I believe you need a literal.
Try:
```
declare @sql NVARCHAR(MAX)
declare @SPType NVARCHAR ( 30 )
declare @SPCodeA int
set @SPCodeA = 75
set @SPType = '''I'',''M'''
SET @sql = 'select * from table where CodeA=' + CONVERT(NVARCHAR(MAX), @spcodea) +' a... |
533,525 | <p>I am trying to write a translation layer for a test system for which I am writing software. I am using LabVIEW for the test system and that uses a RESTful webservice. I have implemented the REST Methods and they are working OK. The remote Test controller and data service layer etc are written in C# and SQL and these... | [
{
"answer_id": 533563,
"author": "BC.",
"author_id": 54838,
"author_profile": "https://Stackoverflow.com/users/54838",
"pm_score": 2,
"selected": false,
"text": "<p>Have you considered using WCF instead? <a href=\"http://msdn.microsoft.com/en-us/netframework/cc950529.aspx\" rel=\"nofollo... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to write a translation layer for a test system for which I am writing software. I am using LabVIEW for the test system and that uses a RESTful webservice. I have implemented the REST Methods and they are working OK. The remote Test controller and data service layer etc are written in C# and SQL and these ar... | Have you considered using WCF instead? [There is an easier way](http://msdn.microsoft.com/en-us/netframework/cc950529.aspx) to publish those services for REST interaction. |
533,527 | <p>This is probably very simple, but I simply cannot find the answer myself :( </p>
<p>Basicaly, what I want is, given this string:</p>
<p>"<a href="http://www.google.com/search?hl=en&q=c#" rel="noreferrer">http://www.google.com/search?hl=en&q=c#</a> objects"</p>
<p>I want this output:</p>
<p><a href="http:... | [
{
"answer_id": 533531,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": false,
"text": "<p>Look at Server.UrlEncode</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/ms525738.aspx\" rel=\"nofollow norefer... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15861/"
] | This is probably very simple, but I simply cannot find the answer myself :(
Basicaly, what I want is, given this string:
"<http://www.google.com/search?hl=en&q=c#> objects"
I want this output:
<http://www.google.com/search?hl=en&q=c%23+objects>
I'm sure there's some helper class somewhere buried in the Framework ... | HttpServerUtility.UrlEncode(string)
Should sort out any troublesome characters
To use it you'll need to add a reference to System.Web (Project Explorer > References > Add reference > System.Web)
Once you've done that you can use it to encode any items you wish to add to the querystring:
```
System.Web.HttpUtility.U... |
533,553 | <p>Most Stackoverflow answers that I have found in regards to the Perl build process and unit testing and code coverage simply point me to CPAN for the documentation there. There's absolutely nothing wrong with pointing to CPAN modules because that's where the full documentation is supposed to reside. I've had troubl... | [
{
"answer_id": 533577,
"author": "Kurt W. Leucht",
"author_id": 27687,
"author_profile": "https://Stackoverflow.com/users/27687",
"pm_score": 8,
"selected": true,
"text": "<p>It took me a while and it also took me taking small snippets from a number of different sources and melting them ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533553",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27687/"
] | Most Stackoverflow answers that I have found in regards to the Perl build process and unit testing and code coverage simply point me to CPAN for the documentation there. There's absolutely nothing wrong with pointing to CPAN modules because that's where the full documentation is supposed to reside. I've had trouble fin... | It took me a while and it also took me taking small snippets from a number of different sources and melting them together, but I think I have a small working example that sufficiently demonstrates to a Perl newbie the Perl build process including unit testing and code coverage analysis & reporting. (I'm using [ActiveSt... |
533,554 | <p>I have a c# .net winforms solution and I want to create two different builds: one that supports IE6 and one that supports IE7. A few of the files in one of my projects are different for the IE6 build versus the IE7 build, so I want to include the IE6 files when I build for IE6 and the IE7 files when I build for IE7.... | [
{
"answer_id": 533656,
"author": "Kevin Tighe",
"author_id": 39461,
"author_profile": "https://Stackoverflow.com/users/39461",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure how to do what you're asking, but couldn't you just include both versions of your API wrapper in the d... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533554",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8479/"
] | I have a c# .net winforms solution and I want to create two different builds: one that supports IE6 and one that supports IE7. A few of the files in one of my projects are different for the IE6 build versus the IE7 build, so I want to include the IE6 files when I build for IE6 and the IE7 files when I build for IE7. Wh... | In MSBuild, you can specify conditions to item groups. You can then bind those conditions to the target device.
Example:
```
<!-- Declare the condition property at the beggining of the build file -->
<PropertyGroup Condition="$(Platform) == 'IE7'">
<UseNewLibrary>true</UseNewLibrary>
</PropertyGroup>
<PropertyGrou... |
533,560 | <p>Please keep in mind that I'm new to C# and OOP so I apologize in advance if this seems like an easy question to some. I'm going back through my code and looking for ways to objectify repetitive code and create a class for it so that I can simply reuse the class. That being said, I'm not looking to learn NHibernate... | [
{
"answer_id": 533624,
"author": "netterdotter",
"author_id": 59284,
"author_profile": "https://Stackoverflow.com/users/59284",
"pm_score": 0,
"selected": false,
"text": "<p>You should take a look at ADO.NET and use things like DataSets. Linq-to-SQL would probably also be useful for you.... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38317/"
] | Please keep in mind that I'm new to C# and OOP so I apologize in advance if this seems like an easy question to some. I'm going back through my code and looking for ways to objectify repetitive code and create a class for it so that I can simply reuse the class. That being said, I'm not looking to learn NHibernate or a... | You can create a class that lets you call stored procedures (this is known as a Data Access Component (DAC) class, which is usually referenced by a Business Component (BC) class, but it is outside the scope of your question).
There are a few objects you will want to use in this new class:
Microsoft.Practices.Enterpris... |
533,574 | <p>I have a <code>UIImage</code> view that responds to touch events. I want to cancel the touch sequence, i.e., further calls to <code>touchesMoved:</code>, if the touch goes outside of certain bounds. How can I do that?</p>
<p>I know that in <code>touchesMoved:</code> I can inspect the coordinates of the touch object... | [
{
"answer_id": 533889,
"author": "Michael Fey",
"author_id": 36974,
"author_profile": "https://Stackoverflow.com/users/36974",
"pm_score": 3,
"selected": false,
"text": "<p>This solution may be a bit kludgy, but you could implement and manually call</p>\n\n<pre><code>- (void) touchesCanc... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44091/"
] | I have a `UIImage` view that responds to touch events. I want to cancel the touch sequence, i.e., further calls to `touchesMoved:`, if the touch goes outside of certain bounds. How can I do that?
I know that in `touchesMoved:` I can inspect the coordinates of the touch object and ignore it, but what I don't know is ho... | This solution may be a bit kludgy, but you could implement and manually call
```
- (void) touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event;
```
I am basing this solution loosely on some tweaking I did to the MoveMe sample app on Apple's [iPhone sample code](http://developer.apple.com/iphone/samples/index... |
533,604 | <p>When I serialize an object of a class with a enum property to JSON, if the value is null, the resulting json string has a name value pair like this:</p>
<pre><code>"controlType":"-2147483648"
</code></pre>
<p>This causes issues when I deserialize the string to a strongly typed object.</p>
<p>What's the best way o... | [
{
"answer_id": 533699,
"author": "thesmart",
"author_id": 20176,
"author_profile": "https://Stackoverflow.com/users/20176",
"pm_score": 0,
"selected": false,
"text": "<p>Consider:</p>\n\n<pre><code>echo json_encode(array(\"test\"=>null));\n</code></pre>\n\n<p>This produces:</p>\n\n<pr... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When I serialize an object of a class with a enum property to JSON, if the value is null, the resulting json string has a name value pair like this:
```
"controlType":"-2147483648"
```
This causes issues when I deserialize the string to a strongly typed object.
What's the best way of handling enums and nulls? | the below code gives you json = '**{"Name":"Test","Id":1,"MyEnum":3}**', when you have a non-null value.
```
public enum SerializeObjTestClassEnum {
one = 1, two, three, four
}
[Serializable]
public class SerializeObjTestClass {
public string Name { get; set; }
public int Id { get; set; }
public SerializeObjT... |
533,607 | <p>How can I modify this:</p>
<pre class="lang-html prettyprint-override"><code><div style="border: solid 1px red; text-align: center">
<div style="background-color: yellow; float: left">left</div>
middle
<div style="float:right; background-color: yellow">right</div>
</div&... | [
{
"answer_id": 533615,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 0,
"selected": false,
"text": "<p>\"middle\" needs to be in a div of its own or can throw off your display</p>\n"
},
{
"answer_id": 533625,
... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44683/"
] | How can I modify this:
```html
<div style="border: solid 1px red; text-align: center">
<div style="background-color: yellow; float: left">left</div>
middle
<div style="float:right; background-color: yellow">right</div>
</div>
```
So that "right" is in line vertically with "left"?
Here's what my bad css ... | If you use a ‘float: right’, make it the first thing on the line:
```html
<div style="border: solid 1px red; text-align: center">
<div style="float:right; background-color: yellow">right</div>
<div style="background-color: yellow; float: left">left</div>
middle
</div>
```
Otherwise it always falls into t... |
533,614 | <p>I once accidentally uploaded only part of my flash program to my website (i.e., it was truncated), and to my biggest surprise, the flash object was loaded successfully into the webpage, no errors were raised, no warnings were given at all. (This was a release version of the player, the debug version might have behav... | [
{
"answer_id": 533615,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 0,
"selected": false,
"text": "<p>\"middle\" needs to be in a div of its own or can throw off your display</p>\n"
},
{
"answer_id": 533625,
... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42136/"
] | I once accidentally uploaded only part of my flash program to my website (i.e., it was truncated), and to my biggest surprise, the flash object was loaded successfully into the webpage, no errors were raised, no warnings were given at all. (This was a release version of the player, the debug version might have behaved ... | If you use a ‘float: right’, make it the first thing on the line:
```html
<div style="border: solid 1px red; text-align: center">
<div style="float:right; background-color: yellow">right</div>
<div style="background-color: yellow; float: left">left</div>
middle
</div>
```
Otherwise it always falls into t... |
533,617 | <p>In some cases I've been using a DataTable, filtering it witha DataView and displaying the DataView in a DataGrid. I've recently started switching to using my own classes. For example:</p>
<pre><code>[Serializable]
[System.Xml.Serialization.XmlRoot("Items", Namespace = "http://mycomp.com/test")]
public class Items:... | [
{
"answer_id": 533622,
"author": "Alejandro Mezcua",
"author_id": 12753,
"author_profile": "https://Stackoverflow.com/users/12753",
"pm_score": 1,
"selected": false,
"text": "<p>If I understand your question correctly, you could use LINQ to Objects and bind the resulting list to the grid... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533617",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9266/"
] | In some cases I've been using a DataTable, filtering it witha DataView and displaying the DataView in a DataGrid. I've recently started switching to using my own classes. For example:
```
[Serializable]
[System.Xml.Serialization.XmlRoot("Items", Namespace = "http://mycomp.com/test")]
public class Items: List<Item>
{
... | You can use FindAll() method:
```
List<Items> allItems = /* initialize list */;
List<Items> filteredList =
allItems.FindAll(item => item.Name.StartsWith("A"));
``` |
533,631 | <p>In <a href="https://rads.stackoverflow.com/amzn/click/com/0596009259" rel="noreferrer" rel="nofollow noreferrer"><em>Programming Python</em></a>, Mark Lutz mentions the term <em>mixin</em>. I am from a C/C++/C# background and I have not heard the term before. What is a mixin?</p>
<p>Reading between the lines of <a h... | [
{
"answer_id": 533675,
"author": "Randolpho",
"author_id": 12716,
"author_profile": "https://Stackoverflow.com/users/12716",
"pm_score": 8,
"selected": false,
"text": "<p>First, you should note that mixins only exist in multiple-inheritance languages. You can't do a mixin in Java or C#. ... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55155/"
] | In [*Programming Python*](https://rads.stackoverflow.com/amzn/click/com/0596009259), Mark Lutz mentions the term *mixin*. I am from a C/C++/C# background and I have not heard the term before. What is a mixin?
Reading between the lines of [this example](http://books.google.com/books?id=5zYVUIl7F0QC&pg=RA1-PA584&lpg=RA1... | A mixin is a special kind of multiple inheritance. There are two main situations where mixins are used:
1. You want to provide a lot of optional features for a class.
2. You want to use one particular feature in a lot of different classes.
For an example of number one, consider [werkzeug's request and response system... |
533,633 | <p>I am trying to create a sequence lazily by using F#.</p>
<p>The sequence is defined as follows:</p>
<blockquote>
<p>The nth term of the sequence of
triangle numbers is given by, tn =
½n(n+1); so the first ten triangle
numbers are:</p>
<p>1, 3, 6, 10, 15, 21, 28, 36, 45, 55,
...</p>
</blockquote>
<p... | [
{
"answer_id": 533660,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 4,
"selected": true,
"text": "<p>First off, why do you use <code>match</code> if you've got only one case?</p>\n\n<pre><code>let tri_seq = 1.0 |>... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50312/"
] | I am trying to create a sequence lazily by using F#.
The sequence is defined as follows:
>
> The nth term of the sequence of
> triangle numbers is given by, tn =
> ½n(n+1); so the first ten triangle
> numbers are:
>
>
> 1, 3, 6, 10, 15, 21, 28, 36, 45, 55,
> ...
>
>
>
Here is what I have so far but it dosn... | First off, why do you use `match` if you've got only one case?
```
let tri_seq = 1.0 |> Seq.unfold (fun x -> Some (x, 0.5 * x * (x + 1.0)))
```
Second, what “doesn't seem to work”? Are you aware that you produce an infinite list?
/Edit: For completeness’ sake, here’s the correct solution, which the OP found himself... |
533,636 | <p>Does anyone have a way to generate files of random data in Windows? I would like to generate 50,000 small (2K) files as an example.</p>
| [
{
"answer_id": 533649,
"author": "jgallant",
"author_id": 62923,
"author_profile": "https://Stackoverflow.com/users/62923",
"pm_score": 0,
"selected": false,
"text": "<p>Well, technically you could write something to do this for you.<br>\nI don't know of anything specific.. but the easie... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533636",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Does anyone have a way to generate files of random data in Windows? I would like to generate 50,000 small (2K) files as an example. | You can run fsutil in a batch loop to create files of any size.
```
fsutil file createnew filename.extension 2000
``` |
533,673 | <p>I have a query like:</p>
<pre><code>var function = GetSomeExpression();
using (FooModel context = new FooModel())
{
var bar = context.Bar.Where(function);
}
</code></pre>
<p>I'd like to make a generic method that can execute Where against different Entities in the context. The goal is not having to do co... | [
{
"answer_id": 533998,
"author": "Michael G",
"author_id": 33082,
"author_profile": "https://Stackoverflow.com/users/33082",
"pm_score": 1,
"selected": false,
"text": "<p>see this post</p>\n\n<p><a href=\"https://stackoverflow.com/questions/110314/linq-to-entities-building-where-clauses-... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533673",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54612/"
] | I have a query like:
```
var function = GetSomeExpression();
using (FooModel context = new FooModel())
{
var bar = context.Bar.Where(function);
}
```
I'd like to make a generic method that can execute Where against different Entities in the context. The goal is not having to do context.Bar.Where, context.Ca... | This is way easier then what I was trying before:
```
private List<T> GetResults<T>(IQueryable<T> source,
Expression<Func<T, bool>> queryFunction)
{
return source.Where(queryFunction).ToList<T>();
}
``` |
533,718 | <p>We have a WinForms app, written in VB.NET (CLR 2.0), that does a lot of Outlook-related stuff. One of the things we do is programmatically open up a new Outlook 2003 'compose new Email' form, pre-populated with the 'to' address.</p>
<pre><code>Me.WordApp = New Word.Application
Dim template As Object = System.Refle... | [
{
"answer_id": 533807,
"author": "olli-MSFT",
"author_id": 59021,
"author_profile": "https://Stackoverflow.com/users/59021",
"pm_score": 2,
"selected": true,
"text": "<p>I had a similar experience with an Excel 2003 Add-In. Do you have both Office 2003 and Office 2007 installed on the de... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24867/"
] | We have a WinForms app, written in VB.NET (CLR 2.0), that does a lot of Outlook-related stuff. One of the things we do is programmatically open up a new Outlook 2003 'compose new Email' form, pre-populated with the 'to' address.
```
Me.WordApp = New Word.Application
Dim template As Object = System.Reflection.Missing.V... | I had a similar experience with an Excel 2003 Add-In. Do you have both Office 2003 and Office 2007 installed on the development machine? If so, check the *References* section in your project thouroughly. I had a dependency to Office 11, but underneath the Office 12 interop assembly was used.
I think that [Assembly Bi... |
533,724 | <p>Just a simple program to get used to pointers. The program is supposed to put the contents of a portion of my memory into a character array in reverse order of how the memory is read. I.E. looking at descending memory address, and I want to store it in descending order in a character array.</p>
<p>My compiler kee... | [
{
"answer_id": 533739,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 2,
"selected": true,
"text": "<p>You can't realloc memory that wasn't malloced in the first place. You should declare reverse as \"char *\" and mallo... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533724",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64709/"
] | Just a simple program to get used to pointers. The program is supposed to put the contents of a portion of my memory into a character array in reverse order of how the memory is read. I.E. looking at descending memory address, and I want to store it in descending order in a character array.
My compiler keeps telling m... | You can't realloc memory that wasn't malloced in the first place. You should declare reverse as "char \*" and malloc it to start with.
This will get you going, but you really should think about reallocing in chunks, rather than one byte at a time. Oh, I didn't bother to fix the fact that "reverse" is probably not null... |
533,726 | <p>I have the following models:</p>
<pre><code>class Author(models.Model):
author_name = models.CharField()
class Book(models.Model):
book_name = models.CharField()
class AuthorBook(models.Model):
author_id = models.ForeignKeyField(Author)
book_id = models.ForeignKeyField(Book)
</code></pre>
<p>With that be... | [
{
"answer_id": 533739,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 2,
"selected": true,
"text": "<p>You can't realloc memory that wasn't malloced in the first place. You should declare reverse as \"char *\" and mallo... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10040/"
] | I have the following models:
```
class Author(models.Model):
author_name = models.CharField()
class Book(models.Model):
book_name = models.CharField()
class AuthorBook(models.Model):
author_id = models.ForeignKeyField(Author)
book_id = models.ForeignKeyField(Book)
```
With that being said, I'm trying to em... | You can't realloc memory that wasn't malloced in the first place. You should declare reverse as "char \*" and malloc it to start with.
This will get you going, but you really should think about reallocing in chunks, rather than one byte at a time. Oh, I didn't bother to fix the fact that "reverse" is probably not null... |
533,732 | <p>I marshalled correctly to:</p>
<pre><code>IntPtr buffer
</code></pre>
<p>Buffer is pointer to array of 2 pointers to arrays with respective data.
The problem is that I get not accurate data, like if there's something missing in the data retrieved (e.g. missimg samples from stream of audio data).</p>
<pre><code>//... | [
{
"answer_id": 533748,
"author": "leppie",
"author_id": 15541,
"author_profile": "https://Stackoverflow.com/users/15541",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, you would need to copy the byte buffers too :)</p>\n\n<p>Update: That looks better!</p>\n"
},
{
"answer_id... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I marshalled correctly to:
```
IntPtr buffer
```
Buffer is pointer to array of 2 pointers to arrays with respective data.
The problem is that I get not accurate data, like if there's something missing in the data retrieved (e.g. missimg samples from stream of audio data).
```
// length is parameter
IntPtr[] temp = ... | I finally solved it. I wasn't reading full input buffer by mistake. Thanks for all your help! |
533,753 | <p>I have a multiline radio button and I want the bullet to be to the left of the content (as default) aligned to the top of the radio button control. What's the easiest way to do this in XAML?</p>
| [
{
"answer_id": 533763,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 2,
"selected": false,
"text": "<p>Override the Control.Template for the RadioButton. Here is the example from MSDN <a href=\"http://msdn.microsoft.com/... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21186/"
] | I have a multiline radio button and I want the bullet to be to the left of the content (as default) aligned to the top of the radio button control. What's the easiest way to do this in XAML? | **Note**: Be sure to check out [Rachel's answer](https://stackoverflow.com/a/16342879/16940) - she takes this one stage further into a generic template
---
First of all don't waste your time with `VerticalAlignment` or `VerticalContentAlignment` (or even `ControlTemplate`). They're not going to do what you want or mi... |
533,767 | <p>Given a start date of 1/1/2009 and an end date of 12/31/2009, how can I iterate through each date and retrieve a DateTime value using c#?</p>
<p>Thanks!</p>
| [
{
"answer_id": 533774,
"author": "kemiller2002",
"author_id": 1942,
"author_profile": "https://Stackoverflow.com/users/1942",
"pm_score": 3,
"selected": false,
"text": "<pre><code>DateTime dateTime = new DateTime(2009, 1, 1); \n\nwhile(dateTime.Year < 2010)\n {\n\n dateTime... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2849/"
] | Given a start date of 1/1/2009 and an end date of 12/31/2009, how can I iterate through each date and retrieve a DateTime value using c#?
Thanks! | I would use a loop that looks like this
```
for(DateTime date = begin; date <= end; date = date.AddDays(1))
{
}
```
Set begin and end accordingly |
533,769 | <p>I am using C# 2.0, and I can't help but think this isn't the most efficient way to search a collection (in this case a DataTable) for a value:</p>
<pre><code>bool found = false;
foreach (DataRow row in data.Rows)
{
if (id == row["rowID"])
{
found = true;
break;
}
}
if (!found)
{
//Do... | [
{
"answer_id": 533775,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 4,
"selected": true,
"text": "<p>Look at the datatable's <code>Select()</code> method:</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/b5... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/343/"
] | I am using C# 2.0, and I can't help but think this isn't the most efficient way to search a collection (in this case a DataTable) for a value:
```
bool found = false;
foreach (DataRow row in data.Rows)
{
if (id == row["rowID"])
{
found = true;
break;
}
}
if (!found)
{
//Do stuff here
}
... | Look at the datatable's `Select()` method:
<http://msdn.microsoft.com/en-us/library/b5c0xc84(VS.80).aspx>
```
DataRow[] rows = data.Select("rowID=" + id.ToString());
if (rows.Length > 0)
{
//Do stuff here
}
``` |
533,804 | <p>All I want to do is append the current date and time to my log file, say:</p>
<pre><code>"export_(Wed_Feb_21_2009_at_1_36_41PM)"
</code></pre>
<p>Here is my current config from my app.config</p>
<pre class="lang-xml prettyprint-override"><code><appender name="RollingFileAppender" type="log4net.Appender.Rolling... | [
{
"answer_id": 533840,
"author": "Bob Nadler",
"author_id": 2514,
"author_profile": "https://Stackoverflow.com/users/2514",
"pm_score": 1,
"selected": false,
"text": "<p>Use <a href=\"http://logging.apache.org/log4net/release/sdk/log4net.Appender.RollingFileAppender.StaticLogFileName.htm... | 2009/02/10 | [
"https://Stackoverflow.com/questions/533804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36269/"
] | All I want to do is append the current date and time to my log file, say:
```
"export_(Wed_Feb_21_2009_at_1_36_41PM)"
```
Here is my current config from my app.config
```xml
<appender name="RollingFileAppender" type="log4net.Appender.RollingFileAppender">
<file value="c:\export.txt" />
<appendToFile value="... | Add the following to your config file
```xml
<appender name="rollingFile" type="log4net.Appender.RollingFileAppender,log4net">
<param name="File" value="c:\\ProjectX\\Log\\log.txt"/>
<param name="AppendToFile" value="true"/>
<lockingModel type="log4net.Appender.FileAppender+MinimalLock"/>
<param name="RollingS... |