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 |
|---|---|---|---|---|---|---|
535,063 | <p>Does anyone know what is the replacement for SqlMethods.DateDiffMonth in the Entity Framework.</p>
<p>This is the error I am getting when I tried to use it.</p>
<p>LINQ to Entities does not recognize the method 'Int32 DateDiffMonth(System.DateTime, System.DateTime)' method, and this method cannot be translated int... | [
{
"answer_id": 1748323,
"author": "CraigTP",
"author_id": 57477,
"author_profile": "https://Stackoverflow.com/users/57477",
"pm_score": 2,
"selected": false,
"text": "<p>It would appear that, currently, you need to express this using an eSQL statement that effectively calls down to the S... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Does anyone know what is the replacement for SqlMethods.DateDiffMonth in the Entity Framework.
This is the error I am getting when I tried to use it.
LINQ to Entities does not recognize the method 'Int32 DateDiffMonth(System.DateTime, System.DateTime)' method, and this method cannot be translated into a store express... | It would appear that, currently, you need to express this using an eSQL statement that effectively calls down to the SQLServer DATEDIFF method
For example:
```
db.entity.Where("SqlServer.DATEDIFF('MONTH', [start date], [end date]) = 1");
```
(See [here](http://social.msdn.microsoft.com/forums/en-US/adodotnetentityf... |
535,083 | <p>I have a page design with a menu as follows:</p>
<pre><code>Cat1 | Cat2 | Cat 3 | Cat 4
</code></pre>
<p>When I hover the word Cat2, The bgcolor of the whole box of Cat2 changes to blue color. Also, whole cell needs to be clickable and linked to other page. </p>
<p>I can do that without ha... | [
{
"answer_id": 535095,
"author": "Chuck",
"author_id": 50742,
"author_profile": "https://Stackoverflow.com/users/50742",
"pm_score": 2,
"selected": false,
"text": "<p>Put a border-left in CSS? Or does it need to be a literal bar character?</p>\n"
},
{
"answer_id": 535119,
"au... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a page design with a menu as follows:
```
Cat1 | Cat2 | Cat 3 | Cat 4
```
When I hover the word Cat2, The bgcolor of the whole box of Cat2 changes to blue color. Also, whole cell needs to be clickable and linked to other page.
I can do that without having the symbol "|" by changing t... | Put a border-left in CSS? Or does it need to be a literal bar character? |
535,087 | <p>I need to change the location property of label1 from (50, 50) to (50, 70) when Button1 is clicked. This should be easy, but I can't get it to work.</p>
| [
{
"answer_id": 535108,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 5,
"selected": true,
"text": "<p>What are you trying? I find the easiest thing to do is set the Top and Left properties individually:</p>\n\n<pre><code... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535087",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39035/"
] | I need to change the location property of label1 from (50, 50) to (50, 70) when Button1 is clicked. This should be easy, but I can't get it to work. | What are you trying? I find the easiest thing to do is set the Top and Left properties individually:
```
label1.Left = 50;
label1.Top = 70;
```
Setting Location.X and Location.Y will probably result in a compile-time error, because Location is of type "Point", a value type. |
535,120 | <p>I am getting a EXC_BAD_ACCESS (SIGBUS) on this line in my iPhone project:</p>
<pre><code>if (timeoutTimer) [timeoutTimer invalidate];
</code></pre>
<p>The thing that has me stumped is that I don't understand how that line could crash, since the if statement is meant to be checking for nil. Am I misunderstanding th... | [
{
"answer_id": 535128,
"author": "Sophie Alpert",
"author_id": 49485,
"author_profile": "https://Stackoverflow.com/users/49485",
"pm_score": -1,
"selected": false,
"text": "<p>They should be the same. Perhaps the line number is in fact incorrect.</p>\n\n<p>Look for other possible errors ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6044/"
] | I am getting a EXC\_BAD\_ACCESS (SIGBUS) on this line in my iPhone project:
```
if (timeoutTimer) [timeoutTimer invalidate];
```
The thing that has me stumped is that I don't understand how that line could crash, since the if statement is meant to be checking for nil. Am I misunderstanding the way Objective-C works,... | Just because a variable is set to a value other than `nil` doesn't mean it's pointing to a valid object. For example:
```
id object = [[NSObject alloc] init];
[object release];
NSLog(@"%@", object); // Not nil, but a deallocated object,
// meaning a likely crash
```
Your timer has probably alre... |
535,125 | <p><strong>This is NOT a question about how to create columns in css - so please dont give me any css for doing that. I've just excluded it here for readability.</strong></p>
<p>I have created two columns in css and I want to place items in them based upon some css class. I think this is possible but I'm not sure how.... | [
{
"answer_id": 535144,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 2,
"selected": false,
"text": "<p>You can't do <i>precisely</i> what you're asking for with CSS. But you can do .women { float: left } .men { float: right... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | **This is NOT a question about how to create columns in css - so please dont give me any css for doing that. I've just excluded it here for readability.**
I have created two columns in css and I want to place items in them based upon some css class. I think this is possible but I'm not sure how.
```
<DIV id="col1">
... | You can't do *precisely* what you're asking for with CSS. But you can do .women { float: left } .men { float: right}, which may be just about as good.
This is kind of a band-aid on your fundamental problem, though, which is failure to separate your presentation logic from your control logic. Instead of having two iden... |
535,135 | <p>I have to write code to clone a database entry with associated data in other tables and assign it a new ID. Simplified I have a MAIN Table with a key of ID and sub table say SUB1 with FK of ID and multiple records for each entry in MAIN.<br>
I want to copy the data for a specific ID in MAIN to new records updating t... | [
{
"answer_id": 535310,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 2,
"selected": true,
"text": "<p>I'm not too familiar with DB2, but I would think that direct inserts would work a lot better than trying to work with ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46527/"
] | I have to write code to clone a database entry with associated data in other tables and assign it a new ID. Simplified I have a MAIN Table with a key of ID and sub table say SUB1 with FK of ID and multiple records for each entry in MAIN.
I want to copy the data for a specific ID in MAIN to new records updating the I... | I'm not too familiar with DB2, but I would think that direct inserts would work a lot better than trying to work with a cursor across scopes.
Having the output parameter for the copy main stored procedure as an input into the other stored procedure(s) makes perfect sense to me.
As an example of how I would create Cop... |
535,143 | <p>Is there an inbuilt PHP function to replace multiple values inside a string with an array that dictates exactly what is replaced with what?</p>
<p>For example:</p>
<pre><code>$searchreplace_array = Array('blah' => 'bleh', 'blarh' => 'blerh');
$string = 'blah blarh bleh bleh blarh';
</code></pre>
<p>And the ... | [
{
"answer_id": 535145,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 1,
"selected": false,
"text": "<p><code>str_replace()</code> does that.</p>\n\n<p>You can check the <a href=\"http://php.net/manual/en/function.str-replace... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24416/"
] | Is there an inbuilt PHP function to replace multiple values inside a string with an array that dictates exactly what is replaced with what?
For example:
```
$searchreplace_array = Array('blah' => 'bleh', 'blarh' => 'blerh');
$string = 'blah blarh bleh bleh blarh';
```
And the resulting would be: 'bleh blerh bleh bl... | You are looking for [`str_replace()`](http://www.php.net/str_replace).
```
$string = 'blah blarh bleh bleh blarh';
$result = str_replace(
array('blah', 'blarh'),
array('bleh', 'blerh'),
$string
);
```
**// Additional tip:**
And if you are stuck with an associative array like in your example, you can split i... |
535,148 | <p>Selection count, <code>.SelectedItems.Count</code>, does not change when
the <code>Selected</code> property is set to true on an item in the <code>Items</code>
collection of a <code>ListView</code>.</p>
<p>Example:</p>
<pre><code> lvPept.SelectedItems.Clear()
lvPept.Items(6).Selected = True
Dim newLen As In... | [
{
"answer_id": 535177,
"author": "Brandon",
"author_id": 63775,
"author_profile": "https://Stackoverflow.com/users/63775",
"pm_score": 1,
"selected": false,
"text": "<p>That's an interesting one.</p>\n\n<p>The only thing that I think could make this happen is if the ListView didn't reali... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63550/"
] | Selection count, `.SelectedItems.Count`, does not change when
the `Selected` property is set to true on an item in the `Items`
collection of a `ListView`.
Example:
```
lvPept.SelectedItems.Clear()
lvPept.Items(6).Selected = True
Dim newLen As Integer = lvPept.SelectedItems.Count
```
`lvPept` is a `ListView`... | That's an interesting one.
The only thing that I think could make this happen is if the ListView didn't realize that the ListItem had changed it's "Selected" value and therefore doesn't update its selected item collections.
The .SelectedItems property is not necessarily generated each time you get the property - if y... |
535,164 | <p>I am trying to develop an app with a UIPicker in landscape mode, taking up (almost) the entire width of the screen (with 5 or 6 components). Can you please tell me how to set the size of UIPicker. Thank you very much for your help. </p>
| [
{
"answer_id": 535176,
"author": "Can Berk Güder",
"author_id": 2119,
"author_profile": "https://Stackoverflow.com/users/2119",
"pm_score": 2,
"selected": false,
"text": "<p>You can't. UIPickerView's size is constant.</p>\n\n<p><strong>UPDATE:</strong> It turns out you <strong>can</stron... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to develop an app with a UIPicker in landscape mode, taking up (almost) the entire width of the screen (with 5 or 6 components). Can you please tell me how to set the size of UIPicker. Thank you very much for your help. | Actually, I resize my pickers for almost every app. I do not like that they take up the entire screen. Here is the method that I am using: (note that I am also rotating the picker to be horizontal)
in viewDidLoad .....
```
picker = [[UIPickerView alloc] initWithFrame:CGRectZero];
picker.delegate = self;
picker.dataSo... |
535,165 | <p>I'm writing an application that communicates with the serial port to control a device. The development environment is on a virtualized Windows 2003 R2 machine hosted on a Windows Vista machine. When I try to map the COM ports through virtual PC so they can be use in the virtual machine, I get the following error r... | [
{
"answer_id": 535176,
"author": "Can Berk Güder",
"author_id": 2119,
"author_profile": "https://Stackoverflow.com/users/2119",
"pm_score": 2,
"selected": false,
"text": "<p>You can't. UIPickerView's size is constant.</p>\n\n<p><strong>UPDATE:</strong> It turns out you <strong>can</stron... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64734/"
] | I'm writing an application that communicates with the serial port to control a device. The development environment is on a virtualized Windows 2003 R2 machine hosted on a Windows Vista machine. When I try to map the COM ports through virtual PC so they can be use in the virtual machine, I get the following error right ... | Actually, I resize my pickers for almost every app. I do not like that they take up the entire screen. Here is the method that I am using: (note that I am also rotating the picker to be horizontal)
in viewDidLoad .....
```
picker = [[UIPickerView alloc] initWithFrame:CGRectZero];
picker.delegate = self;
picker.dataSo... |
535,185 | <p>The button_to causes a line break before it in HTML. I have <a href="http://ror.leewbutler.com/2008/04/xdressed-clickables.html" rel="nofollow noreferrer">found a workaround which will work</a>, but it's hardly ideal, because then the buttons are NOT real buttons. Is there any other way to avoid the line break befor... | [
{
"answer_id": 535201,
"author": "Dan Rosenstark",
"author_id": 8047,
"author_profile": "https://Stackoverflow.com/users/8047",
"pm_score": 2,
"selected": false,
"text": "<p>Got it from somewhere out there. Happily:</p>\n\n<pre><code>.button-to { display:inline-block;}\n</code></pre>\n"
... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535185",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] | The button\_to causes a line break before it in HTML. I have [found a workaround which will work](http://ror.leewbutler.com/2008/04/xdressed-clickables.html), but it's hardly ideal, because then the buttons are NOT real buttons. Is there any other way to avoid the line break before the form?
Here's the resulting HTML
... | Ensure the CSS for that div is set to
```
display: inline;
``` |
535,190 | <p>I am new to LINQ. I just dragged all my database tables onto the designer in a LINQ to SQL dbml. All my relationships are correct and look nice in the designer. I am able to pull data using simple LINQ code. I want to add my own methods now but don't want to blow away my changes if (when) I need to regenerate my... | [
{
"answer_id": 535200,
"author": "Brandon",
"author_id": 63775,
"author_profile": "https://Stackoverflow.com/users/63775",
"pm_score": 2,
"selected": false,
"text": "<p>Take a look at using a Partial class... it might fit your situation very nicely.</p>\n"
},
{
"answer_id": 53520... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64874/"
] | I am new to LINQ. I just dragged all my database tables onto the designer in a LINQ to SQL dbml. All my relationships are correct and look nice in the designer. I am able to pull data using simple LINQ code. I want to add my own methods now but don't want to blow away my changes if (when) I need to regenerate my dbml. ... | The LINQ-generated classes are partial classes, meaning you can extend them by creating your own [partial classes](http://msdn.microsoft.com/en-us/library/bb882671.aspx) or [partial methods](http://msdn.microsoft.com/en-us/library/bb546176.aspx).
In your case, you can create a partial class for your SystemUser, and th... |
535,218 | <p>I want to fire a function when an image is clicked, and that function will hit a URL passing it a parameter and then update the containing div's class with the value I get back from the URL.</p>
<p>Can someone help me with code for this?</p>
<p>My DOM looks like:</p>
<pre><code><div class="c1"><img src="... | [
{
"answer_id": 535265,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 1,
"selected": false,
"text": "<p>This is assuming that your only returning plain text from your service. It might be useful to include a sample of the... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to fire a function when an image is clicked, and that function will hit a URL passing it a parameter and then update the containing div's class with the value I get back from the URL.
Can someone help me with code for this?
My DOM looks like:
```
<div class="c1"><img src="/images/hello.jpg"/></div>
```
My U... | This is assuming that your only returning plain text from your service. It might be useful to include a sample of the format of the return content in your question. I'm also not sure if you need the removeClass function, but I added it anyways.
```
$('c1 > img').click(function() {
var img = $(this);
$.get('http://... |
535,223 | <p><strike>Just started programming in C++.</p>
<p>I've created a Point class, a std::list and an iterator like so:</p>
<pre><code>class Point {
public:
int x, y;
Point(int x1, int y1)
{
x = x1;
y = y1;
}
};
std::list <Point> pointList;
std::list <Point>::iterator iter;
<... | [
{
"answer_id": 535233,
"author": "Gregor Brandt",
"author_id": 62488,
"author_profile": "https://Stackoverflow.com/users/62488",
"pm_score": 2,
"selected": false,
"text": "<p>a few things..</p>\n\n<ul>\n<li>Did you try <code>iter->x</code> and <code>iter->y</code> instead of copyin... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64878/"
] | Just started programming in C++.
I've created a Point class, a std::list and an iterator like so:
```
class Point {
public:
int x, y;
Point(int x1, int y1)
{
x = x1;
y = y1;
}
};
std::list <Point> pointList;
std::list <Point>::iterator iter;
```
I then push new points onto pointLis... | That should be a valid bit of code.
```
#include <iostream>
#include <list>
class Point {
public:
int x, y;
Point(int x1, int y1)
{
x = x1;
y = y1;
}
};
int main()
{
std::list<Point> points;
points.push_back(Point(0, 0));
points.push_back(Point(1, 1));
points.push_ba... |
535,266 | <p>i am trying to make a basic IRC client...but my problem is getting the text to display in a RTF box without it lagging
<br />
<br />
i settled on using threading, and i want to update the RTF box in a thread, but i cant because it gives me errors about the RTF box element not being static?
<br />
<br />
any insight?... | [
{
"answer_id": 535275,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 0,
"selected": false,
"text": "<p>The RichTextBox is on the UI thread so you're not going to be able to access the RichTextBox unless your on the UI thr... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64884/"
] | i am trying to make a basic IRC client...but my problem is getting the text to display in a RTF box without it lagging
i settled on using threading, and i want to update the RTF box in a thread, but i cant because it gives me errors about the RTF box element not being static?
any insight? i will paste code if you guy... | In general, trying to update a Control from a thread other than the main thread will not work, due to limitations of Windows. If you need to call a method or set a property on the RTF box from your worker thread, you'll probably need to use [Invoke](http://msdn.microsoft.com/en-us/library/system.windows.forms.control.i... |
535,270 | <p>ActiveRecord query caching is enabled when a controller's action is invoked. I also know that you can do something like this to temporarily enable caching for a given Model for a given code block:</p>
<pre><code>User.cache do
....
end
</code></pre>
<p>But is there a way to enable query caching for other con... | [
{
"answer_id": 535332,
"author": "Jeremy",
"author_id": 62657,
"author_profile": "https://Stackoverflow.com/users/62657",
"pm_score": 3,
"selected": true,
"text": "<p>An ActiveRecord query cache lives only for the duration of a particular action (i.e. request). If you want a cached objec... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4883/"
] | ActiveRecord query caching is enabled when a controller's action is invoked. I also know that you can do something like this to temporarily enable caching for a given Model for a given code block:
```
User.cache do
....
end
```
But is there a way to enable query caching for other contexts (e.g. when a script i... | An ActiveRecord query cache lives only for the duration of a particular action (i.e. request). If you want a cached object to survive longer or be used between processes you need to look at something like memcached. |
535,277 | <p>In C++ I'd write something like this:</p>
<pre><code>if (a == something && b == anotherthing)
{
foo();
}
</code></pre>
<p>Am I correct in thinking the Clojure equivalent is something like this:</p>
<pre><code>(if (= a something)
(if (= b anotherthing)
(foo)))
</code></pre>
<p>Or is there a... | [
{
"answer_id": 535284,
"author": "Doug Currie",
"author_id": 33252,
"author_profile": "https://Stackoverflow.com/users/33252",
"pm_score": 6,
"selected": true,
"text": "<p>In Common Lisp and Scheme</p>\n\n<pre><code>(and (= a something) (= b another) (foo))\n</code></pre>\n"
},
{
... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535277",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2820/"
] | In C++ I'd write something like this:
```
if (a == something && b == anotherthing)
{
foo();
}
```
Am I correct in thinking the Clojure equivalent is something like this:
```
(if (= a something)
(if (= b anotherthing)
(foo)))
```
Or is there another way to perform a logical "and" that I've missed? A... | In Common Lisp and Scheme
```
(and (= a something) (= b another) (foo))
``` |
535,317 | <p>I know <em>find</em> method finds the supplied key in <em>std::map</em> and return an iterator to the element. Is there anyway to find the value and get an iterator to the element? What I need to do is to check specified value exist in std::map. I have done this by looping all items in the map and comparing. But I w... | [
{
"answer_id": 535326,
"author": "James Thompson",
"author_id": 57458,
"author_profile": "https://Stackoverflow.com/users/57458",
"pm_score": 2,
"selected": false,
"text": "<p>No, you have to loop over the std::map and check all values manually. Depending on what you want to do, you coul... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535317",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50419/"
] | I know *find* method finds the supplied key in *std::map* and return an iterator to the element. Is there anyway to find the value and get an iterator to the element? What I need to do is to check specified value exist in std::map. I have done this by looping all items in the map and comparing. But I wanted to know is ... | You can use [boost::multi\_index](http://www.boost.org/doc/libs/1_37_0/libs/multi_index/doc/index.html) to create a [bidirectional map](http://www.boost.org/doc/libs/1_37_0/libs/multi_index/doc/examples.html) - you can use either value of the pair as a key to do a quick lookup. |
535,328 | <p>Is it possible to hide the parameterless constructor from a user in C#?</p>
<p>I want to force them to always use the constructor with parameters</p>
<p>e.g. this Position struct</p>
<pre><code>public struct Position
{
private readonly int _xposn;
private readonly int _yposn;
public int Xposn
{
... | [
{
"answer_id": 535342,
"author": "Spence",
"author_id": 53771,
"author_profile": "https://Stackoverflow.com/users/53771",
"pm_score": 2,
"selected": false,
"text": "<p>Well a struct is literally a declaration of how the memory will sit.</p>\n\n<p>Even when you use an object, the objects ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17194/"
] | Is it possible to hide the parameterless constructor from a user in C#?
I want to force them to always use the constructor with parameters
e.g. this Position struct
```
public struct Position
{
private readonly int _xposn;
private readonly int _yposn;
public int Xposn
{
get { return _xposn; ... | No, you can't do this. As you said, [similar question](https://stackoverflow.com/questions/333829) has been asked before - and I thought the answer was fairly clear that you couldn't do it.
You *can* [create a private parameterless constructor for a struct](http://codeblog.jonskeet.uk/2008/12/10/value-types-and-parame... |
535,331 | <p>I know that Python has a <a href="http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock" rel="nofollow noreferrer">global lock</a> and i've read Glyph's explaination of <a href="https://stackoverflow.com/questions/203912/does-python-support-multiprocessor-multicore-programming/204150#20... | [
{
"answer_id": 535347,
"author": "John Fouhy",
"author_id": 15154,
"author_profile": "https://Stackoverflow.com/users/15154",
"pm_score": 2,
"selected": false,
"text": "<p>If the sobel operator is CPU-bound, then you won't get any benefit from multiple threads because python does not tak... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535331",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50/"
] | I know that Python has a [global lock](http://docs.python.org/c-api/init.html#thread-state-and-the-global-interpreter-lock) and i've read Glyph's explaination of [python multithreading](https://stackoverflow.com/questions/203912/does-python-support-multiprocessor-multicore-programming/204150#204150). But I still want t... | Python 2.6 now includes the [**mulitprocessing**](http://docs.python.org/library/multiprocessing.html) module (formerly [**processing**](http://pyprocessing.berlios.de/doc/index.html) module on older versions of Python).
It has essentially the same interface as the **threading** module, but launches the execution int... |
535,334 | <p>Is there a way (ideally easy) to make headings and sections autonumber in HTML/CSS? Perhaps a JS library?</p>
<p>Or is this something that is hard to do in HTML?</p>
<p>I'm looking at an application for a corporate wiki but we want to be able to use heading numbers like we always have in word processors.</p>
| [
{
"answer_id": 535345,
"author": "Arve Systad",
"author_id": 39785,
"author_profile": "https://Stackoverflow.com/users/39785",
"pm_score": 0,
"selected": false,
"text": "<p>Could possibly be done either serverside or with JavaScript. Don't know about any premade scripts that does it thou... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40529/"
] | Is there a way (ideally easy) to make headings and sections autonumber in HTML/CSS? Perhaps a JS library?
Or is this something that is hard to do in HTML?
I'm looking at an application for a corporate wiki but we want to be able to use heading numbers like we always have in word processors. | 2016 update. Please see [Stephen's answer](https://stackoverflow.com/a/535390/35935) below for a proper method in CSS. My answer made sense in 2009 when the browsers and libraries were different. We are now living in a whole new world and the method presented here is outdated. I'm leaving it for the poor souls that are... |
535,336 | <p>Sorry if this is too little of a challenge to be suited as a stack overflow question, but I'm kind of new to Regular Expressions.</p>
<p>My question is, what is the regular expression that returns the string "token" for all the examples bellow?</p>
<ul>
<li>token.domain.com</li>
<li>token.domain.com/ </li>
<li>tok... | [
{
"answer_id": 535348,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 0,
"selected": false,
"text": "<p>If you want to use preg_replace(), then:</p>\n\n<pre><code>preg_replace('/\\..*/', '', $_SERVER['SERVER_NAME'])\n</code><... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43923/"
] | Sorry if this is too little of a challenge to be suited as a stack overflow question, but I'm kind of new to Regular Expressions.
My question is, what is the regular expression that returns the string "token" for all the examples bellow?
* token.domain.com
* token.domain.com/
* token.domain.com/index.php
* token.doma... | ```
preg_replace('/^(?:([^\.]+)\.)?domain\.com$/', '\1', $_SERVER['SERVER_NAME'])
```
**Edit:** What does the following output for you:
```
<?php
echo preg_replace('/^(?:([^\.]+)\.)?domain\.com$/', '\1', "sean.domain.com") . "<br />";
echo preg_replace('/^(?:([^\.]+)\.)?domain\.com$/', '\1', "titel.domain.co... |
535,353 | <p>I'm trying to port a Perl script over from Unix to Windows but am having a near impossible time getting it to work due to the unsupported forking pipes in the open function. Here's the code:</p>
<pre><code>sub p4_get_file_content {
my $filespec = shift;
return 'Content placeholder!' if ($options{'dry-run'}... | [
{
"answer_id": 535379,
"author": "Jay",
"author_id": 20840,
"author_profile": "https://Stackoverflow.com/users/20840",
"pm_score": 4,
"selected": true,
"text": "<p>I know it's not a direct answer to your question, but it looks like you're scripting something on top of Perforce in Perl? I... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to port a Perl script over from Unix to Windows but am having a near impossible time getting it to work due to the unsupported forking pipes in the open function. Here's the code:
```
sub p4_get_file_content {
my $filespec = shift;
return 'Content placeholder!' if ($options{'dry-run'});
debug("p... | I know it's not a direct answer to your question, but it looks like you're scripting something on top of Perforce in Perl? If so you might find an existing library does what you want already and save yourself a lot of headaches, or at least give you some sample code to work from.
For example:
* [**P4Perl**](http://... |
535,360 | <p>I am writing a month calendar-style control, and need to display a string that indicates today's date. So on an English-culture machine it would show <code>'Today : 11/02/2009'</code>. </p>
<p>If a different culture happens to be used, such as French, then I would like to use the French word for 'Today'. </p>
<p>D... | [
{
"answer_id": 535376,
"author": "cdonner",
"author_id": 58880,
"author_profile": "https://Stackoverflow.com/users/58880",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/goglobal/bb688124.aspx#e5e\" rel=\"nofollow noreferrer\">This</a> is a pretty... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6276/"
] | I am writing a month calendar-style control, and need to display a string that indicates today's date. So on an English-culture machine it would show `'Today : 11/02/2009'`.
If a different culture happens to be used, such as French, then I would like to use the French word for 'Today'.
Does the .NET platform expose... | Old.. but still useful (how old? VB6 old).
Basically Windows keeps a localized version of "Today" in Comctl32.dll. You can fish it out with a a loadstringex call:
```
Private Const IDM_TODAY As Long = 4163
Private Const IDM_GOTODAY As Long = 4164
Public Function GetTodayLocalized(ByVal LocaleId As Long) As String
... |
535,366 | <p>I have a page which contains some search fields to query a database, and display results. The viewstate is required to retain the lists of items in dropdowns.</p>
<p>Everything works fine in Firefox (3) & Chrome, but fails in Internet Explorer, but only sometimes (certain actions, such as resetting the form, wh... | [
{
"answer_id": 535417,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 2,
"selected": true,
"text": "<p>It seems a bit wierd that your viewstate is posting to the the Url. The would happen if you had some custom form tag t... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21969/"
] | I have a page which contains some search fields to query a database, and display results. The viewstate is required to retain the lists of items in dropdowns.
Everything works fine in Firefox (3) & Chrome, but fails in Internet Explorer, but only sometimes (certain actions, such as resetting the form, which really jus... | It seems a bit wierd that your viewstate is posting to the the Url. The would happen if you had some custom form tag that was using a GET method instead of the default asp.net page level form tag.
If you need a form tag with the GET method I would set EnableViewState="false" on the Page declaration and setup some sort... |
535,385 | <p>I want to create a 100% object oriented framework in PHP with no procedural programming at all, and where everything is an object. Much like Java except it will be done in PHP.</p>
<p>Any pointers at what features this thing should have, should it use any of the existing design patterns such as MVC? How creating ob... | [
{
"answer_id": 535401,
"author": "teh_noob",
"author_id": 63203,
"author_profile": "https://Stackoverflow.com/users/63203",
"pm_score": 2,
"selected": false,
"text": "<p>I've got the perfect link for you my friend: <a href=\"http://nettuts.com/tutorials/php/creating-a-php5-framework-part... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49153/"
] | I want to create a 100% object oriented framework in PHP with no procedural programming at all, and where everything is an object. Much like Java except it will be done in PHP.
Any pointers at what features this thing should have, should it use any of the existing design patterns such as MVC? How creating objects for ... | I've gone through many of problems on your list, so let me spec out how I handle it. I am also OOP addict and find object techniques extremely flexible and powerful yet elegant (if done correctly).
**MVC** - yes, hands down, MVC is a standard for web applications. It is well documented and understandable model. Furthe... |
535,438 | <p>For a project in C, we need to build a shell over a Unix server.</p>
<p>It needs to be able to execute functionality native to Unix, and not bash (or any other Unix shell).</p>
<p>I am writing a method in the hopes to generalize a call to a command. into a general function:</p>
<pre><code>#include <stdio.h>... | [
{
"answer_id": 535453,
"author": "Paul",
"author_id": 51102,
"author_profile": "https://Stackoverflow.com/users/51102",
"pm_score": 3,
"selected": true,
"text": "<p>What you're asking for is the command 'which', ie</p>\n\n<pre><code>me@stackoverflow:~$ which which\n/usr/bin/which\n</code... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27678/"
] | For a project in C, we need to build a shell over a Unix server.
It needs to be able to execute functionality native to Unix, and not bash (or any other Unix shell).
I am writing a method in the hopes to generalize a call to a command. into a general function:
```
#include <stdio.h>
#include <stdlib.h>
#include <uni... | What you're asking for is the command 'which', ie
```
me@stackoverflow:~$ which which
/usr/bin/which
```
On linux it's a shell script, so take a look a gander.
However, I don't think this is required to make a UNIX shell. If you type
```
man 3 exec
```
you'll find that execlp() and execvp() take care of the deta... |
535,444 | <p>I'd like to implement a custom manipulator for ostream to do some manipulation on the next item being inserted into the stream. For example, let's say I have a custom manipulator <em>quote</em>:</p>
<pre><code>std::ostringstream os;
std::string name("Joe");
os << "SELECT * FROM customers WHERE name = " <&l... | [
{
"answer_id": 535496,
"author": "j_random_hacker",
"author_id": 47984,
"author_profile": "https://Stackoverflow.com/users/47984",
"pm_score": 3,
"selected": false,
"text": "<p><strong>[EDIT: \"True manipulator semantics\" (i.e. a persistent quoting state) could also be achieved by <em>w... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535444",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44497/"
] | I'd like to implement a custom manipulator for ostream to do some manipulation on the next item being inserted into the stream. For example, let's say I have a custom manipulator *quote*:
```
std::ostringstream os;
std::string name("Joe");
os << "SELECT * FROM customers WHERE name = " << quote << name;
```
The man... | It's particularly difficult to add a manipulator to a C++ stream, as one has no control of how the manipulator is used. One can imbue a new locale into a stream, which has a facet installed that controls how numbers are printed - but not how strings are output. And then the problem would still be how to store the quoti... |
535,463 | <p>I'm a beginner in Java. While running the java application I got below mentioned bug. Why has this bug occured?</p>
<pre><code>#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (exceptions.cpp:367), pid=2552, tid=2532
# Error: ExceptionMark destructor expects no pending ex... | [
{
"answer_id": 535486,
"author": "Adeel Ansari",
"author_id": 42769,
"author_profile": "https://Stackoverflow.com/users/42769",
"pm_score": 1,
"selected": false,
"text": "<p>Are you running some web application into IE 7? I have seen few similar crashes posted over the internet. If thats... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm a beginner in Java. While running the java application I got below mentioned bug. Why has this bug occured?
```
#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (exceptions.cpp:367), pid=2552, tid=2532
# Error: ExceptionMark destructor expects no pending exceptions
#
# Ja... | You are also running jre1.6.0\_07 - but your classpath and java\_home are pointing to
JAVA\_HOME=C:\Program Files\Java\jdk1.6.0\_06\bin;.;
CLASSPATH=C:\Program Files\Java\jdk1.6.0\_06\bin;.;
This mix of paths might be causing some problems for the runtime.
I'd suggest uninstalling all versions of java (it appears yo... |
535,481 | <p>I am attempting to conceptualize the Singleton design pattern (qua Java) in OCaml and have seen ever instance allude to functors or modules, neither of which I am using in a proof of concept of GoF's work. Basically, I would like to recreate the following functionality using OCaml:</p>
<pre><code>public class Singl... | [
{
"answer_id": 538538,
"author": "nlucaroni",
"author_id": 157,
"author_profile": "https://Stackoverflow.com/users/157",
"pm_score": 2,
"selected": false,
"text": "<p>Objects in Ocaml can not have static / global methods. You can try, <a href=\"http://caml.inria.fr/pub/docs/manual-ocaml/... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25985/"
] | I am attempting to conceptualize the Singleton design pattern (qua Java) in OCaml and have seen ever instance allude to functors or modules, neither of which I am using in a proof of concept of GoF's work. Basically, I would like to recreate the following functionality using OCaml:
```
public class Singleton
{
privat... | Objects in Ocaml can not have static / global methods. You can try, [Immediate objects](http://caml.inria.fr/pub/docs/manual-ocaml/manual005.html#ss:immediate-objects). Caveat, I think you can still do obj.copy to get a copy of the object, and every time they are evaluated they return a new object (so you cannot pass p... |
535,509 | <p>I need to shut down my application and then delete the executable. I am doing it by kicking off a low priority batch job and then immediately shutting down the exe. Is there a better way?</p>
| [
{
"answer_id": 535532,
"author": "Ryan",
"author_id": 29762,
"author_profile": "https://Stackoverflow.com/users/29762",
"pm_score": 2,
"selected": false,
"text": "<p>There are the PendMoves and <a href=\"http://technet.microsoft.com/en-us/sysinternals/bb897556.aspx\" rel=\"nofollow noref... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46255/"
] | I need to shut down my application and then delete the executable. I am doing it by kicking off a low priority batch job and then immediately shutting down the exe. Is there a better way? | As long as any code from an executable is in memory, it cannot be deleted, but there are some other things you can try:
* Telling [`MoveFileEx`](http://msdn.microsoft.com/en-us/library/aa365240(VS.85).aspx) to defer the delete until next reboot is one approach typically used by install/uninstall code.
* Use the [Task ... |
535,531 | <p>I have a <code>IEnumerable<T></code> collection with Name and FullName as items in it. There are around 5000 items in it.</p>
<p>I want to display the FullNames sorted by its lenght, so first the longest name to the shortest name displays. How can I do it in most optimized manner?</p>
| [
{
"answer_id": 535538,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 1,
"selected": false,
"text": "<p>It would help to have some more information about exactly what your data structures look like. But I think that ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535531",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55428/"
] | I have a `IEnumerable<T>` collection with Name and FullName as items in it. There are around 5000 items in it.
I want to display the FullNames sorted by its lenght, so first the longest name to the shortest name displays. How can I do it in most optimized manner? | This answer is effectively the same as spoon16's but without using a query expression. I generally don't use a query expression for single operations (e.g. *just* an ordering, or *just* a filter, or *just* a projection). I figured it would be good to see the alternatives :)
```
var orderedList = nameList.OrderByDescen... |
535,534 | <p>I've got a Wordpress site on our home intranet that has run into trouble now that the IP address has changed - The index page loads, but not the CSS and I can't log in to the site administration panel.</p>
<p>Unfortunately I am a bit behind on backups. Is there a way to get Wordpress to refer to the new IP address?... | [
{
"answer_id": 535557,
"author": "Shoban",
"author_id": 12178,
"author_profile": "https://Stackoverflow.com/users/12178",
"pm_score": 1,
"selected": false,
"text": "<p>I ran into this problem once. Loginto your DB and check your wp_options (if wp_ is your table prefix) and then search fo... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37176/"
] | I've got a Wordpress site on our home intranet that has run into trouble now that the IP address has changed - The index page loads, but not the CSS and I can't log in to the site administration panel.
Unfortunately I am a bit behind on backups. Is there a way to get Wordpress to refer to the new IP address? | You have two places to update this (well three, but we'll stick with the two).
***If*** you can still log into your admin section, type the following for your URI /wp-admin/options.php - so for example, if your site is <http://localhost> then your full URL will be <http://localhost/wp-admin/options.php>. Once you've l... |
535,568 | <p>In my script i'm trying to test for true and false. Is this syntax incorrect?</p>
<pre><code>$pdaout = ""
if ($pda.ActiveSyncEnabled.tostring() -like "True") {$pdaout = "TRUE"}
if ($pda.ActiveSyncEnabled.tostring() -like "False") {$pdaout = "-"}
write-host $pdaout
</code></pre>
| [
{
"answer_id": 535860,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 0,
"selected": false,
"text": "<p>It should be, except may be for the <code>tostring()</code> function (use <code>toString()</code> to make sure there is no i... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18853/"
] | In my script i'm trying to test for true and false. Is this syntax incorrect?
```
$pdaout = ""
if ($pda.ActiveSyncEnabled.tostring() -like "True") {$pdaout = "TRUE"}
if ($pda.ActiveSyncEnabled.tostring() -like "False") {$pdaout = "-"}
write-host $pdaout
``` | Seems like it would be better to just check the boolean value directly instead of using ToString():
```
$pdaout = ""
if ($pda.ActiveSyncEnabled -eq $True) { $pdaout = "TRUE" }
else { $pdaout = "-" }
write-host $pdaout
```
Here is a blog post from the [Windows Powershell team re: Boolean Values and Operators](http:... |
535,572 | <p>What is the best way to make a generic equivalence function for two Dictionaries, whose keys and values are value types?</p>
<p>Right now I have a Dictionary<code><</code>string, bool>, and have created an extension method that (I think) works to test for equivalence between two Dictionary<code><</code>string... | [
{
"answer_id": 535608,
"author": "scwagner",
"author_id": 3981,
"author_profile": "https://Stackoverflow.com/users/3981",
"pm_score": 0,
"selected": false,
"text": "<p>I can't think of a way to do exactly what you're looking for in a single construct. You could have overloads that expli... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47630/"
] | What is the best way to make a generic equivalence function for two Dictionaries, whose keys and values are value types?
Right now I have a Dictionary`<`string, bool>, and have created an extension method that (I think) works to test for equivalence between two Dictionary`<`string, bool>.
I wanted to make it more gen... | Why do you want to restrict `K` and `V` to being value types in the first place? I suggest you just remove the constraints. There are "interesting" things about dictionaries though - are two dictionaries which happen to have the same entries, but use different equality comparers equivalent? `IDictionary<,>` doesn't hav... |
535,600 | <p>Does anyone know what the regular expression in Ruby is to verify an email address is in proper RFC 2822 email format?</p>
<p>What I want to do is:</p>
<pre><code>string.match(RFC_2822_REGEX)
</code></pre>
<p>where "RFC_2822_REGEX" is the regular expression to verify if my string is in valid RFC 2882 form.</p>
| [
{
"answer_id": 535610,
"author": "Lonzo",
"author_id": 47342,
"author_profile": "https://Stackoverflow.com/users/47342",
"pm_score": 1,
"selected": false,
"text": "<p>Try <a href=\"http://tfletcher.com/lib/\" rel=\"nofollow noreferrer\">this:</a></p>\n"
},
{
"answer_id": 535679,... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535600",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Does anyone know what the regular expression in Ruby is to verify an email address is in proper RFC 2822 email format?
What I want to do is:
```
string.match(RFC_2822_REGEX)
```
where "RFC\_2822\_REGEX" is the regular expression to verify if my string is in valid RFC 2882 form. | You can use the [mail](http://rubygems.org/gems/mail "Mail") gem to parse any string according to RFC2822 like so:
```
def valid_email( value )
begin
return false if value == ''
parsed = Mail::Address.new( value )
return parsed.address == value && parsed.local != parsed.address
rescue Mail::Field::ParseEr... |
535,606 | <p>We're creating a demonstration mode for our web application. We're going about this by creating new user that is tied to a real client, showing all of their data, but filtering certain fields to be non-identifiable (names, important numbers, etc...)</p>
<p><strong>The weird part here is that the data is correctly ... | [
{
"answer_id": 535610,
"author": "Lonzo",
"author_id": 47342,
"author_profile": "https://Stackoverflow.com/users/47342",
"pm_score": 1,
"selected": false,
"text": "<p>Try <a href=\"http://tfletcher.com/lib/\" rel=\"nofollow noreferrer\">this:</a></p>\n"
},
{
"answer_id": 535679,... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535606",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62590/"
] | We're creating a demonstration mode for our web application. We're going about this by creating new user that is tied to a real client, showing all of their data, but filtering certain fields to be non-identifiable (names, important numbers, etc...)
**The weird part here is that the data is correctly filtered for stan... | You can use the [mail](http://rubygems.org/gems/mail "Mail") gem to parse any string according to RFC2822 like so:
```
def valid_email( value )
begin
return false if value == ''
parsed = Mail::Address.new( value )
return parsed.address == value && parsed.local != parsed.address
rescue Mail::Field::ParseEr... |
535,616 | <p>I have the following CSS fragment:</p>
<pre><code>INPUT{ font-family: Raavi; font-size: 14px;}
</code></pre>
<p>Which works fine when the textbox contains some Punjabi script like this: ਪੰਜਾਬੀ</p>
<p>But the user might enter English instead, and I would rather use the Verdana font with a different size, since the... | [
{
"answer_id": 535629,
"author": "Zack The Human",
"author_id": 18265,
"author_profile": "https://Stackoverflow.com/users/18265",
"pm_score": 4,
"selected": false,
"text": "<p>A pure CSS solution might be as easy as:</p>\n\n<pre><code>input[lang=en] {\n font-family:Verdana;\n font-size... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12113/"
] | I have the following CSS fragment:
```
INPUT{ font-family: Raavi; font-size: 14px;}
```
Which works fine when the textbox contains some Punjabi script like this: ਪੰਜਾਬੀ
But the user might enter English instead, and I would rather use the Verdana font with a different size, since the English letters in the Raavi fon... | This is addressed in CSS3, and that's not going to help for compatibility with old browsers, but it works for me when mixing Greek and Latin text with different fonts for each. Here's an example taken from the CSS Fonts Module Working Draft:
```
@font-face {
font-family: BBCBengali;
src: url(fonts/BBCBengali.t... |
535,626 | <p>I'm trying to implement caching for a PHP script I'm writing, but I keep running into the following problem. I want the script to be included in other PHP pages, but when I try to pass the cached file and exit the embedded script it exits both the script and the parent page, but doesn't parse the rest of the code o... | [
{
"answer_id": 535652,
"author": "Peter Bailey",
"author_id": 8815,
"author_profile": "https://Stackoverflow.com/users/8815",
"pm_score": 3,
"selected": true,
"text": "<p>Just wrap the \"additional code here\" in an else statement?</p>\n\n<pre><code><?php\n $whatever = true;\n\n if ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27025/"
] | I'm trying to implement caching for a PHP script I'm writing, but I keep running into the following problem. I want the script to be included in other PHP pages, but when I try to pass the cached file and exit the embedded script it exits both the script and the parent page, but doesn't parse the rest of the code on th... | Just wrap the "additional code here" in an else statement?
```
<?php
$whatever = true;
if ($whatever == true) {
echo "file2.php has been included<br />";
} else {
// Additional code here
}
?>
```
Otherwise I'm not sure what you're getting at. The **exit** command always terminates the current execut... |
535,632 | <p>what is the best way to find which are the default crawling accounts used for crawling for all the shared service providers in a Farm in MOSS
i would prefer if any one can tell me using Shared Service Provider Database</p>
| [
{
"answer_id": 541790,
"author": "Mark Mascolino",
"author_id": 65164,
"author_profile": "https://Stackoverflow.com/users/65164",
"pm_score": -1,
"selected": false,
"text": "<p>Since you should only have a few SSPs in a Farm, the easiest way is to just check the SSP web admin screen for ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54271/"
] | what is the best way to find which are the default crawling accounts used for crawling for all the shared service providers in a Farm in MOSS
i would prefer if any one can tell me using Shared Service Provider Database | Well getting the value for one SSP is easy:
```
ServerContext serverCtx = ServerContext.Default;
SearchContext searchCtx = SearchContext.GetContext(serverCtx);
Content content = new Content(searchCtx);
Console.WriteLine(content.DefaultGatheringAccount);
```
The trick is getting it for all SSPs. As far as I can tell ... |
535,644 | <p><strong>STILL NOT RESOLVED :(</strong> [Feb 11th]</p>
<p>I have a large text file full of random data and want to pull out all the email addresses from it.</p>
<p>I would like to do this in Ruby, with pseudo code like this:</p>
<pre><code>monster_data_string = "asfsfsdfsdfsf sfda **joe@example.com** sdfd... | [
{
"answer_id": 536864,
"author": "Noel Walters",
"author_id": 53030,
"author_profile": "https://Stackoverflow.com/users/53030",
"pm_score": 1,
"selected": false,
"text": "<p>Given that it is not possible to parse every valid email address using a regexp you are left with two choices:</p>... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | **STILL NOT RESOLVED :(** [Feb 11th]
I have a large text file full of random data and want to pull out all the email addresses from it.
I would like to do this in Ruby, with pseudo code like this:
```
monster_data_string = "asfsfsdfsdfsf sfda **joe@example.com** sdfdsf"
monster_data_string.match(EMAIL_REGEX)
```... | Watch this...
```
f = File.open("content.txt")
content = f.read
r = Regexp.new(/\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b/)
emails = content.scan(r).uniq
puts YAML.dump(emails)
``` |
535,655 | <p>I'm working on a web application that parses and displays email messages in a threaded format (among other things). Emails may come from any number of different mail clients, and in either text or HTML format.</p>
<p>Given that most people have a tendency to top post, I'd like to be able to hide the duplicated mes... | [
{
"answer_id": 535680,
"author": "RKitson",
"author_id": 16947,
"author_profile": "https://Stackoverflow.com/users/16947",
"pm_score": 0,
"selected": false,
"text": "<p>First thing I think I'd do is strip out all the white space, or reduce white space to 1 between each word, and special ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23583/"
] | I'm working on a web application that parses and displays email messages in a threaded format (among other things). Emails may come from any number of different mail clients, and in either text or HTML format.
Given that most people have a tendency to top post, I'd like to be able to hide the duplicated message in an ... | It'll be pretty hard to duplicate the way gmail does it since it doesn't care about whether it was a quoted piece or not, like Zac says, it just seems to care about the diff.
Its actually pretty hard to get this right 100% of the time. Plain text email is "lossy", its entirely possible for you to send
```
> Here is m... |
535,670 | <p>I have an ASP.NET website which uses the jQuery dialog to present the user with a downloads terms dialog. Once the user has agreed to the terms in the dialog, the I perform a server-side postback which issues a Response.Redirect call to a page on another website which is responsible for serving the download to the b... | [
{
"answer_id": 539454,
"author": "Sergey Galashyn",
"author_id": 56604,
"author_profile": "https://Stackoverflow.com/users/56604",
"pm_score": 0,
"selected": false,
"text": "<p>Unfortunately, I can't say anything about possible reasons, but on your place I've tried to start with some deb... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19570/"
] | I have an ASP.NET website which uses the jQuery dialog to present the user with a downloads terms dialog. Once the user has agreed to the terms in the dialog, the I perform a server-side postback which issues a Response.Redirect call to a page on another website which is responsible for serving the download to the brow... | The problem seemed to be caused by an extension function my dialog was using which was positioning the jQuery dialog into the form section of the page, to ensure server-side postbacks would work correctly. I changed the behaviour of this code to instead simply close the dialog and then invoke the serverside callback ma... |
535,671 | <p>I'm trying to set a trigger to display a block of text when the value i get for the cell is a certain type.</p>
<p>I have successfully managed to display an image in the same situation, but in this circumstance i don't want an image, but some text.</p>
<p>Have commented out lines in order to test.try to make it wo... | [
{
"answer_id": 535761,
"author": "Cameron MacFarland",
"author_id": 3820,
"author_profile": "https://Stackoverflow.com/users/3820",
"pm_score": 0,
"selected": false,
"text": "<p>You need to change the type of the DataTemplate, based on your trigger, from an Image to a TextBox.</p>\n\n<pr... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535671",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64929/"
] | I'm trying to set a trigger to display a block of text when the value i get for the cell is a certain type.
I have successfully managed to display an image in the same situation, but in this circumstance i don't want an image, but some text.
Have commented out lines in order to test.try to make it work. The commented... | Set the content of the DataTemplate to the TextBlock and set the visibility based on the trigger. I'm not sure what the second DataTrigger is for because it is referring to a target name that does not exist in the current scope, so I don't know how this fits in.
```
<DataTemplate>
<TextBlock x:Name="block" Text="X... |
535,685 | <p>Now I'm curious what are possibilities to store/load settings in .net. For example I need to store user name/password for different db's and etc.., also I need to store some options and etc.</p>
<p>My though was to create [Seriazable] class and save it to file... </p>
<p>What can You suggest? what are possibilitie... | [
{
"answer_id": 535697,
"author": "scwagner",
"author_id": 3981,
"author_profile": "https://Stackoverflow.com/users/3981",
"pm_score": 2,
"selected": false,
"text": "<p>Well the most common way of storing and loading settings is to use some kind of XML data, and making a [Serializable] cl... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535685",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5369/"
] | Now I'm curious what are possibilities to store/load settings in .net. For example I need to store user name/password for different db's and etc.., also I need to store some options and etc.
My though was to create [Seriazable] class and save it to file...
What can You suggest? what are possibilities in .net and etc... | If you want to store **application configuration settings**, you can leverage the 'AppSettings' in the App.Config or Web.Config file depending on if its a windows or web application.
I believe the syntax for reading the configuration values is
```
string configValue = Configuration.AppSettings["ConfigValueName"];
```... |
535,688 | <p>I'd like to test a function that takes runtime-allocated multidimensional arrays, by passing it a hardcoded array.</p>
<p>The function has a signature of <code>void generate_all_paths(int** maze, int size)</code> and the array is defined as <code>int arr[5][5] = {REMOVED}</code>.</p>
<p>I'm not exactly sure how to... | [
{
"answer_id": 535698,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": true,
"text": "<p>This multi dimensional array topic unfortunately confuses so many C++ programmers. Well, here is the solu... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535688",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26667/"
] | I'd like to test a function that takes runtime-allocated multidimensional arrays, by passing it a hardcoded array.
The function has a signature of `void generate_all_paths(int** maze, int size)` and the array is defined as `int arr[5][5] = {REMOVED}`.
I'm not exactly sure how to properly coerce the array for the func... | This multi dimensional array topic unfortunately confuses so many C++ programmers. Well, here is the solution:
```
void generate_all_paths(int (*maze)[5], int size);
```
That is what the function declaration has to look like. An alternative, but fully equivalent is
```
void generate_all_paths(int maze[][5], int si... |
535,689 | <p>I'm in the process of writing a BSD licensed mini-ORM targeted at embedded databases (with support for ese, sqlite and sqlce out of the box) </p>
<p>After working lots with Rails in the last year I have been thinking of implementing an Active Record pattern in C#. </p>
<p>I have come up with some demo code and was... | [
{
"answer_id": 535694,
"author": "RKitson",
"author_id": 16947,
"author_profile": "https://Stackoverflow.com/users/16947",
"pm_score": 3,
"selected": true,
"text": "<p>The <a href=\"http://castleproject.org/activerecord/index.html\" rel=\"nofollow noreferrer\">Castle Active Record</a> Pr... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17174/"
] | I'm in the process of writing a BSD licensed mini-ORM targeted at embedded databases (with support for ese, sqlite and sqlce out of the box)
After working lots with Rails in the last year I have been thinking of implementing an Active Record pattern in C#.
I have come up with some demo code and was wondering if the... | The [Castle Active Record](http://castleproject.org/activerecord/index.html) Project.
Although it's not a strict implementation of the Active Record pattern, it works very well. Bonus is you will get some experience with NHibernate in the process.
As someone who has written his own, very simple, OR/M only to find it ... |
535,713 | <p>When compiling the following code:</p>
<pre><code>void DoSomething(int Numbers[])
{
int SomeArray[] = Numbers;
}
</code></pre>
<p>the VS2005 compiler complains with the error C2440: 'initializing' : cannot convert from 'int []' to 'int []'</p>
<p>I understand that really it's trying to cast a pointer to an a... | [
{
"answer_id": 535718,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>Perhaps your answer could be, \"Because the compiler doesn't know how big the array is.\"</p>\n\n<p>Your example could... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535713",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57276/"
] | When compiling the following code:
```
void DoSomething(int Numbers[])
{
int SomeArray[] = Numbers;
}
```
the VS2005 compiler complains with the error C2440: 'initializing' : cannot convert from 'int []' to 'int []'
I understand that really it's trying to cast a pointer to an array which is not going to work. B... | There are three things you need to explain to the person you're trying to help:
1. **Arrays can't be passed by value to a function in C++.** To do what you are trying to do, you need to pass the address of the start of the array to `DoSomething()`, as well as the size of the array in a separate `int` (well, `size_t`, ... |
535,715 | <p>I was trying to make a program that shows picture in a folder.
The path of each picture was stored in the database.
My problem was it only show the last images stored in the database and not all the pictures.</p>
<p>The code is:</p>
<pre><code>Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As Syste... | [
{
"answer_id": 535729,
"author": "Chuck Conway",
"author_id": 17360,
"author_profile": "https://Stackoverflow.com/users/17360",
"pm_score": 2,
"selected": false,
"text": "<p>It's always going to show the last image, because you are retrieving the entire table and retrieving all the recor... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was trying to make a program that shows picture in a folder.
The path of each picture was stored in the database.
My problem was it only show the last images stored in the database and not all the pictures.
The code is:
```
Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ... | It's always going to show the last image, because you are retrieving the entire table and retrieving all the records with the While loop. The last image will always be the winner.
There are two possible solutions:
**One**, randomly retrieve one image from the database. Check this [stackoverflow thread](https://stacko... |
535,720 | <p>In Java, i like to use constructs such as</p>
<pre><code>List<String> list = new ArrayList<String>() {{add("foo");}};
</code></pre>
<p>Is there a way to do this in 1 line in C#, too?</p>
| [
{
"answer_id": 535728,
"author": "Kyle Trauberman",
"author_id": 21461,
"author_profile": "https://Stackoverflow.com/users/21461",
"pm_score": 2,
"selected": false,
"text": "<p>You can do it in .NET 3.5 to set property values:</p>\n\n<pre><code>List<string> list = new List<strin... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39590/"
] | In Java, i like to use constructs such as
```
List<String> list = new ArrayList<String>() {{add("foo");}};
```
Is there a way to do this in 1 line in C#, too? | I think what you want is an array initializer
```
List<string> list = new List<string>() { "foo" };
```
Multiple items should be comma-separated
```
List<string> list = new List<string>() { "foo","bar","bas"};
``` |
535,721 | <p>I need to be able to determine a systems maximum integer in Ruby. Anybody know how, or if it's possible?</p>
| [
{
"answer_id": 535751,
"author": "tommym",
"author_id": 37607,
"author_profile": "https://Stackoverflow.com/users/37607",
"pm_score": 4,
"selected": false,
"text": "<p>In ruby Fixnums are automatically converted to Bignums.</p>\n\n<p>To find the highest possible Fixnum you could do somet... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/57414/"
] | I need to be able to determine a systems maximum integer in Ruby. Anybody know how, or if it's possible? | Ruby automatically converts integers to a large integer class when they overflow, so there's (practically) no limit to how big they can be.
If you are looking for the machine's size, i.e. 64- or 32-bit, I found [this trick at ruby-forum.com](http://www.ruby-forum.com/topic/177435):
```
machine_bytes = ['foo'].pack('p... |
535,741 | <p>I have a huge query that is being made dynamically, but I want the select statement to not output the column names, buut custom values. FOr example, if I am doing a normal Linq query, I can do something like this:</p>
<pre><code>var v = from p in db.items select new { name = p.item_name, price = p.item_price };
</... | [
{
"answer_id": 535839,
"author": "naspinski",
"author_id": 14777,
"author_profile": "https://Stackoverflow.com/users/14777",
"pm_score": 3,
"selected": true,
"text": "<p>ok, figured it out, this wis what was needed:</p>\n\n<pre><code>var v = db.items.Select(\"new (item_name as name,item_... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14777/"
] | I have a huge query that is being made dynamically, but I want the select statement to not output the column names, buut custom values. FOr example, if I am doing a normal Linq query, I can do something like this:
```
var v = from p in db.items select new { name = p.item_name, price = p.item_price };
```
which will ... | ok, figured it out, this wis what was needed:
```
var v = db.items.Select("new (item_name as name,item_price as price)");
``` |
535,749 | <p>I am trying to merge multiple excel files using DataTable.Merge() option</p>
<pre><code> For Each fileName As String In Directory.GetFiles("C:\TEMP\.", "*.xls")
Dim connectionString As String = String.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=""Excel 8.0;HDR=NO;IMEX=1... | [
{
"answer_id": 535760,
"author": "shahkalpesh",
"author_id": 23574,
"author_profile": "https://Stackoverflow.com/users/23574",
"pm_score": 2,
"selected": false,
"text": "<p>If the columns are numeric, correct the xls file treating that column as text.<br>\nWouldn't you want the columns t... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62889/"
] | I am trying to merge multiple excel files using DataTable.Merge() option
```
For Each fileName As String In Directory.GetFiles("C:\TEMP\.", "*.xls")
Dim connectionString As String = String.Format("Provider=Microsoft.Jet.OLEDB.4.0; data source={0}; Extended Properties=""Excel 8.0;HDR=NO;IMEX=1;""", fileName... | Use MissingSchemaAction.Ignore as MissingSchemaAction parameter in Merge
```
table1.Merge(TempTable, True, MissingSchemaAction.Ignore)
``` |
535,769 | <p>I need to strikeout the entire text(even the whitespace between text/cells) in a row in the RowDataBound event of the GridView.
Is it possible?</p>
| [
{
"answer_id": 535777,
"author": "Sachin Gaur",
"author_id": 2572740,
"author_profile": "https://Stackoverflow.com/users/2572740",
"pm_score": 2,
"selected": false,
"text": "<p>Yes, you can put all your rows cell's content into <strike> tag. Example,</p>\n\n<pre><code>row.Cell[0].T... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535769",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53270/"
] | I need to strikeout the entire text(even the whitespace between text/cells) in a row in the RowDataBound event of the GridView.
Is it possible? | C#
on RowDataBound event
```
e.Row.Style.Value = "text-decoration:line-through;"
```
this is how your GridView will be rendered, it works !
```
<table>
<tr style="text-decoration:line-through;">
<td>some text</td>
<td>some text</td>
</tr>
<tr style="text-decoration:line-through;">
<td>some text</td>
<td>some text<... |
535,779 | <p>When I use conditional breakpoint in VS2005 instead of using temporary code to check specific conditions, I noticed it takes more time and the execution speed is decreased!!
Do you know why? and how to resolve this issue?</p>
<p>Exmaple:</p>
<pre><code> int sequence = atoi(m_SequenceNumber.GetAscii());
if( ... | [
{
"answer_id": 535790,
"author": "Brian Rasmussen",
"author_id": 38206,
"author_profile": "https://Stackoverflow.com/users/38206",
"pm_score": 0,
"selected": false,
"text": "<p>I assume it is because it takes time to execute the condition. It is still a lot faster than manually stepping ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535779",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42749/"
] | When I use conditional breakpoint in VS2005 instead of using temporary code to check specific conditions, I noticed it takes more time and the execution speed is decreased!!
Do you know why? and how to resolve this issue?
Exmaple:
```
int sequence = atoi(m_SequenceNumber.GetAscii());
if( sequence == 392914)//... | It is better (if possible) to use a memory watchpoint than a conditional breakpoint. A conditional breakpoint (as others have pointed out) has to run additional code each time the execution pointer goes past that point in order to determine if it would break or not - obviously this takes additional time. A memory watch... |
535,792 | <p>Can someone help me with the getopt function?</p>
<p>When I do the following in main:</p>
<pre><code>char *argv1[] = {"testexec","-?"};
char *argv2[] = {"testexec","-m","arg1"};
int cOption;
/* test for -? */
setvbuf(stdout,(char*)NULL,_IONBF,0);
printf("\n argv1 ");
while (( cOption = getopt (2, argv1, "m:t:n:f... | [
{
"answer_id": 535807,
"author": "Diego Sevilla",
"author_id": 62365,
"author_profile": "https://Stackoverflow.com/users/62365",
"pm_score": 5,
"selected": true,
"text": "<p>argv1 and 2 must end in 0:</p>\n\n<pre><code>char* argv1[] = {\"par1\", \"par2\", 0};\n</code></pre>\n\n<p><em>Edi... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can someone help me with the getopt function?
When I do the following in main:
```
char *argv1[] = {"testexec","-?"};
char *argv2[] = {"testexec","-m","arg1"};
int cOption;
/* test for -? */
setvbuf(stdout,(char*)NULL,_IONBF,0);
printf("\n argv1 ");
while (( cOption = getopt (2, argv1, "m:t:n:fs?")) != -1) {
sw... | argv1 and 2 must end in 0:
```
char* argv1[] = {"par1", "par2", 0};
```
*Edit*: OK, I read the getopt man page and I found this:
>
> The variable optind is the index of the next element to be processed in argv. The system initializes this value
> to 1. The caller can reset it to 1 to restart scanning of the same ... |
535,794 | <p>I am looking for a free tool that allows re-arranging pages of a PDF document and combining multiple pages per sheet. The first part (re-arranging) is easily solved by many tools (I use <a href="http://pybrary.net/pyPdf/" rel="noreferrer">PyPDF</a>). </p>
<p>The problem is with the second requirement: to combine tw... | [
{
"answer_id": 535845,
"author": "David Z",
"author_id": 56541,
"author_profile": "https://Stackoverflow.com/users/56541",
"pm_score": 3,
"selected": false,
"text": "<p>On Linux, you can convert the PDF files to Postscript and use <code>psnup</code>. The exact way to invoke it depends on... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17523/"
] | I am looking for a free tool that allows re-arranging pages of a PDF document and combining multiple pages per sheet. The first part (re-arranging) is easily solved by many tools (I use [PyPDF](http://pybrary.net/pyPdf/)).
The problem is with the second requirement: to combine two (or more) pages into single page. Fo... | Check out [this answer](https://stackoverflow.com/questions/465271/gluing-imposition-pdf-documents/466110#466110) that uses [Multivalent](http://multivalent.sourceforge.net/index.html) to impose PDF pages |
535,817 | <p>I can trigger property settings on my ListBoxItem template based on properties of underlying data object using DataTrigger with something like this</p>
<pre><code><DataTrigger Binding="{Binding Path=IsMouseOver}" Value="true">
<Setter TargetName="ItemText" Property="TextBlock.TextDecorations" Value="Unde... | [
{
"answer_id": 536878,
"author": "Josh G",
"author_id": 64329,
"author_profile": "https://Stackoverflow.com/users/64329",
"pm_score": 1,
"selected": false,
"text": "<p>WPF triggers are intended for causing visual changes. Setter objects within triggers cause property changes on the contr... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19546/"
] | I can trigger property settings on my ListBoxItem template based on properties of underlying data object using DataTrigger with something like this
```
<DataTrigger Binding="{Binding Path=IsMouseOver}" Value="true">
<Setter TargetName="ItemText" Property="TextBlock.TextDecorations" Value="Underline">
</Setter>
</D... | I think that you could use an [EventSetter](http://msdn.microsoft.com/en-us/library/system.windows.eventsetter.aspx) to do in XAML what Josh G suggested in code. Maybe create one for the `MouseEnter` and `MouseLeave` events, and style the control appropriately for each?
**Update**: You can set up the events like this:... |
535,820 | <p>Does anybody know how to receive (how to know that you received) out-of-band data with Java sockets? In particular I've read the documentation for <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html#sendUrgentData(int)" rel="nofollow noreferrer">sendUrgentData</a> and <a href="http://java.sun.com/j... | [
{
"answer_id": 536878,
"author": "Josh G",
"author_id": 64329,
"author_profile": "https://Stackoverflow.com/users/64329",
"pm_score": 1,
"selected": false,
"text": "<p>WPF triggers are intended for causing visual changes. Setter objects within triggers cause property changes on the contr... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1265/"
] | Does anybody know how to receive (how to know that you received) out-of-band data with Java sockets? In particular I've read the documentation for [sendUrgentData](http://java.sun.com/j2se/1.4.2/docs/api/java/net/Socket.html#sendUrgentData(int)) and [setOOBInline](http://java.sun.com/j2se/1.5.0/docs/api/java/net/Socket... | I think that you could use an [EventSetter](http://msdn.microsoft.com/en-us/library/system.windows.eventsetter.aspx) to do in XAML what Josh G suggested in code. Maybe create one for the `MouseEnter` and `MouseLeave` events, and style the control appropriately for each?
**Update**: You can set up the events like this:... |
535,827 | <p>Is it possible, by using a stored procedure, to fetch an integer column value from resultset into a local variable, manipulate it there and then write it back to the resultset's column? </p>
<p>If so what would the syntax look like?</p>
| [
{
"answer_id": 535911,
"author": "John Sansom",
"author_id": 60308,
"author_profile": "https://Stackoverflow.com/users/60308",
"pm_score": 1,
"selected": false,
"text": "<p>Something along the following lines should do the trick.</p>\n\n<pre><code>DECLARE @iSomeDataItem INT\n\nSELECT @iS... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible, by using a stored procedure, to fetch an integer column value from resultset into a local variable, manipulate it there and then write it back to the resultset's column?
If so what would the syntax look like? | Something along the following lines should do the trick.
```
DECLARE @iSomeDataItem INT
SELECT @iSomeDataItem = TableColumName
FROM TableName
WHERE ID = ?
--Do some work on the variable
SET @iSomeDataItem = @iSomeDataItem + 21 * 2
UPDATE TableName
SET TableColumName = @iSomeDataItem
WHERE ID = ?
```
The downs... |
535,831 | <p>I've seen <a href="https://stackoverflow.com/questions/2384/read-binary-file-into-a-struct-c/534819#534819">here</a> , and also googling for "marshal" several ways to convert a byte array to a struct.</p>
<p>But what I'm looking for is if there is a way to read an array of structs from a file (ok, whatever memory i... | [
{
"answer_id": 535881,
"author": "lakshmanaraj",
"author_id": 44541,
"author_profile": "https://Stackoverflow.com/users/44541",
"pm_score": 1,
"selected": false,
"text": "<p>Following URL may be of interest to you.</p>\n\n<p><a href=\"http://www.codeproject.com/KB/files/fastbinaryfileinp... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've seen [here](https://stackoverflow.com/questions/2384/read-binary-file-into-a-struct-c/534819#534819) , and also googling for "marshal" several ways to convert a byte array to a struct.
But what I'm looking for is if there is a way to read an array of structs from a file (ok, whatever memory input) in one step?
I... | Following URL may be of interest to you.
<http://www.codeproject.com/KB/files/fastbinaryfileinput.aspx>
Or otherwise I think of pseudo code like the following:
readbinarydata in a single shot and convert back to structure..
```
public struct YourStruct
{
public int First;
public long Second;
public dou... |
535,859 | <p>Given a n*n-sized multi-headed acyclic graph where each node has at most three children and three parents, is there an non-exponential algorithm to identify whether a n-length path exists where no two nodes share the same value, and every value of a set is accounted for?</p>
<p>Basically, I have an n*n maze where e... | [
{
"answer_id": 535885,
"author": "Kevin Loney",
"author_id": 13834,
"author_profile": "https://Stackoverflow.com/users/13834",
"pm_score": 3,
"selected": false,
"text": "<p>I'm pretty sure this can be done in polynomial time. I would start with a an empty set and then loop through the ro... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26667/"
] | Given a n\*n-sized multi-headed acyclic graph where each node has at most three children and three parents, is there an non-exponential algorithm to identify whether a n-length path exists where no two nodes share the same value, and every value of a set is accounted for?
Basically, I have an n\*n maze where each spac... | This problem is NP-complete, and so it is not known whether or not there is a polynomial-time solution. (The standard provisos of possibly being easy in practice, *etc.*, all apply.) One possible reduction is from 3SAT.
Suppose we have a 3SAT instance, such as (a ∨ b ∨ c) ∧ (¬a ∨ ¬b ∨ ¬c). I will show how to use "gadg... |
535,868 | <p>I have an unordered list like this one:</p>
<pre><code> <a href="#" id="myList-toggle">Show the rest</a>
<ul id="myList">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<l... | [
{
"answer_id": 535964,
"author": "ohnoes",
"author_id": 53330,
"author_profile": "https://Stackoverflow.com/users/53330",
"pm_score": 0,
"selected": false,
"text": "<p>Quick & not-so-dirty way: wrap it with a <code>div</code> element and <code>slideToggle('#myList div.wrapper')</code... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64949/"
] | I have an unordered list like this one:
```
<a href="#" id="myList-toggle">Show the rest</a>
<ul id="myList">
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
<li>Item 4</li>
<li>Item 5</li>
<li>Item 6</li>
<li>Item 7</li>
<li>Item 8</li>
<li>Item 9</li>
<li>Item 10</li>
</ul>
```
and this jQuery code:
```
var... | Pretty clumsy solution IMHO, but if it works for you - it works for you...
For the list to collapse and expand by clicking on the same link:
```
$(document).ready(function() {
var list = $('ul#myList');
var original_height = list.height();
var new_height = $('#myList li').height()*5;
... |
535,879 | <p>I'm currently doing some HTML that with urdu, farsi and chinese simplified characters. I'm having problems finding good resources online on what charset to use:</p>
<pre><code><meta http-equiv="Content-Type" content="text/html; charset=???" />
</code></pre>
<p>Any suggestions?</p>
| [
{
"answer_id": 535897,
"author": "Chuck",
"author_id": 50742,
"author_profile": "https://Stackoverflow.com/users/50742",
"pm_score": 3,
"selected": false,
"text": "<p>UTF-8 can encode any character in any language in the Unicode standard, is ASCII-compatible and is well-supported these d... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24218/"
] | I'm currently doing some HTML that with urdu, farsi and chinese simplified characters. I'm having problems finding good resources online on what charset to use:
```
<meta http-equiv="Content-Type" content="text/html; charset=???" />
```
Any suggestions? | UTF-8 can encode any character in any language in the Unicode standard, is ASCII-compatible and is well-supported these days. There's little reason not to use it for everything. |
535,880 | <p>I write automated test with Ruby(Selenium framework) and I need to know how can I select an option from drop-down list.</p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 535907,
"author": "Aram Verstegen",
"author_id": 64234,
"author_profile": "https://Stackoverflow.com/users/64234",
"pm_score": 0,
"selected": false,
"text": "<p>It sounds like you are writing a functional test here. Selecting it probably won't do you much good on its own. ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I write automated test with Ruby(Selenium framework) and I need to know how can I select an option from drop-down list.
Thanks in advance! | building on [floehopper's answer](https://stackoverflow.com/questions/535880/automated-test-with-ruby-select-an-option-from-drop-down-list/538254#538254):
```
selenium.addSelection(locator, value)
or
selenium.select(locator, value)
```
You almost certainly want "id=my\_select\_box\_id" (with the quotes) for `locator... |
535,902 | <p>How can I read the hard disk serial number for IDE and SATA drives in VB.NET?
(I don't want the volume serial number).</p>
<p>This info should be gathered both for XP and Vista if possible without administrative rights.</p>
| [
{
"answer_id": 538548,
"author": "Phaedrus",
"author_id": 46072,
"author_profile": "https://Stackoverflow.com/users/46072",
"pm_score": 4,
"selected": true,
"text": "<p>You can use <a href=\"http://msdn.microsoft.com/en-us/library/aa394582.aspx\" rel=\"nofollow noreferrer\">WMI</a> (Wind... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59314/"
] | How can I read the hard disk serial number for IDE and SATA drives in VB.NET?
(I don't want the volume serial number).
This info should be gathered both for XP and Vista if possible without administrative rights. | You can use [WMI](http://msdn.microsoft.com/en-us/library/aa394582.aspx) (Windows Management Instrumentation) like this:
```
Dim mos As New ManagementObjectSearcher("SELECT * FROM Win32_PhysicalMedia")
For Each mo As ManagementObject In mos.Get()
Dim serial As String = mo("SerialNumber").ToString()
Next
```
Alt... |
535,903 | <p>Can someone explain me why in this example the first rule is taken not second? According to my CSS specificity knowledge, the second is more specific and should be used. But all browsers use first.</p>
<h3>Example:</h3>
<blockquote>
<p><a href="http://apblog.lv/misc/css_spec/example2.html" rel="nofollow noreferr... | [
{
"answer_id": 535914,
"author": "cjk",
"author_id": 52201,
"author_profile": "https://Stackoverflow.com/users/52201",
"pm_score": 4,
"selected": false,
"text": "<p>Your <code><span class=\"negative\"></code> is the innermost element, and so is the one with the style that shows. Y... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535903",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64952/"
] | Can someone explain me why in this example the first rule is taken not second? According to my CSS specificity knowledge, the second is more specific and should be used. But all browsers use first.
### Example:
>
> <http://apblog.lv/misc/css_spec/example2.html>
>
>
>
### CSS:
```
table.data .negative {
/* css... | Your `<span class="negative">` is the innermost element, and so is the one with the style that shows. Your `<td>` may have a different color setting, if you add text outside of the span you will see that is gray. |
535,905 | <p><strong><em>Update:</em></strong> We are still using XP at work and I got my solution working, but now knowing that Vista and beyond have the isolated session I am going to implement a WCF IPC...</p>
<p>I have a windows service that needs to notify the user of an event of some type occurring. I decided that someth... | [
{
"answer_id": 535954,
"author": "Alex Duggleby",
"author_id": 5790,
"author_profile": "https://Stackoverflow.com/users/5790",
"pm_score": 1,
"selected": false,
"text": "<p>Generally speaking I would not recommend a Windows Service to interact with the user's desktop directly at all. As ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3576/"
] | ***Update:*** We are still using XP at work and I got my solution working, but now knowing that Vista and beyond have the isolated session I am going to implement a WCF IPC...
I have a windows service that needs to notify the user of an event of some type occurring. I decided that something similar to email notificati... | On XP a service that interact with the desktop has two serious problems to overcome - what to do when no users are logged in and what to do when several user are logged in (fast user switching and terminal services are the two most common ways to log in more then one user).
On Vista, for security reasons, services run... |
535,938 | <p>I'm trying to make a XSLT conversion that generates C code, the following XML should be converted:</p>
<pre><code><enum name="anenum">
<enumValue name="a"/>
<enumValue name="b"/>
<enumValue name="c" data="10"/>
<enumValue name="d" />
<enumValue name="e" />
</enum>... | [
{
"answer_id": 536062,
"author": "Goran",
"author_id": 23164,
"author_profile": "https://Stackoverflow.com/users/23164",
"pm_score": 1,
"selected": false,
"text": "<p>You can't change \"variables\" in xsl but you can use recursion. Don't use preceding-sibling predicates unless absolutely... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26387/"
] | I'm trying to make a XSLT conversion that generates C code, the following XML should be converted:
```
<enum name="anenum">
<enumValue name="a"/>
<enumValue name="b"/>
<enumValue name="c" data="10"/>
<enumValue name="d" />
<enumValue name="e" />
</enum>
```
It should convert to some C code as following:
`... | **A nonrecursive solution, using keys**:
```
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:strip-space elements="*"/>
<xsl:output method="text"/>
<xsl:key name="koffsetEnums" match="enumValue[@data]"
use="generate-id()"/>
<xsl:template match="enum">
enum <xsl:va... |
535,966 | <p>My deployment project creates and .msi-file and an .exe-file. Is it possible to merge these into one .exe?</p>
| [
{
"answer_id": 536044,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 5,
"selected": false,
"text": "<p>Yes, you can create a self-extracting installer containing both MSI and the setup.exe bootstrapper file. </p>\n\n<... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15763/"
] | My deployment project creates and .msi-file and an .exe-file. Is it possible to merge these into one .exe? | Yes, you can create a self-extracting installer containing both MSI and the setup.exe bootstrapper file.
I think it is possible to do that with WinZip, or you can use IExpress coming with Windows. Here is a guide how to create [a self-extracting executable with IExpress](http://www.petri.co.il/create_executable_with_... |
535,967 | <p><strong>Edit:</strong> Important: It is extremely unlikely that anybody who has come across this will have the exact same problem as me - check my answer below for my very obscure solution. There were however some useful responses that may apply to other's situations. Good luck if you're having a similar problem.</p... | [
{
"answer_id": 535976,
"author": "yoavf",
"author_id": 1011,
"author_profile": "https://Stackoverflow.com/users/1011",
"pm_score": 0,
"selected": false,
"text": "<p>try</p>\n\n<pre><code>$.get(\"/woops/store/cartsummary\", {}, function(data) {\n $(\"#cart\").html(data); \n});\n</code>... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | **Edit:** Important: It is extremely unlikely that anybody who has come across this will have the exact same problem as me - check my answer below for my very obscure solution. There were however some useful responses that may apply to other's situations. Good luck if you're having a similar problem.
---
I've got a r... | ```
append
```
does not replace your div. It pastes the data at the back of your div.
You could try
```
replaceWith( content )
```
instead.
[replaceWith in jQuery documentation](http://docs.jquery.com/Manipulation/replaceWith#content) |
535,972 | <pre><code>namespace Test
{
class Test
{
delegate void HandleMessage(string message);
public void handleMessage(string message){}
static void Main(string[] args)
{
HandleMessage listener1 = new Test().handleMessage;
WeakReference w1 = new WeakReference(l... | [
{
"answer_id": 536060,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": -1,
"selected": false,
"text": "<p>The common pattern for force-collect-memory is:</p>\n\n<pre><code>GC.Collect();\nGC.WaitForPendingFinalizers();\... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
namespace Test
{
class Test
{
delegate void HandleMessage(string message);
public void handleMessage(string message){}
static void Main(string[] args)
{
HandleMessage listener1 = new Test().handleMessage;
WeakReference w1 = new WeakReference(listener... | It has nothing to do with lambdas. The same behavior can be observed for anonymous delegates. So if you change to code to
```
HandleMessage listener2 = delegate(string message) => { };
```
you get the same result.
In the first case you have an instance method on an instance of Test. Since you have no other refere... |
535,973 | <p>When my script sleeps for 50sec my IDE locks up which is very annoying. I cant switch tabs, look through my source, type code, etc. It happens in pylde and pyscripter, i havent tried other IDEs. What can i do to fix this? i'm actually doing </p>
<pre><code>for i in range(0, timeInSeconds): time.sleep(1)
</code></p... | [
{
"answer_id": 536024,
"author": "mthurlin",
"author_id": 39991,
"author_profile": "https://Stackoverflow.com/users/39991",
"pm_score": 3,
"selected": true,
"text": "<p>I'm assuming you are running your code from within the IDE?</p>\n\n<p>Your IDE is probably blocking while running your ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | When my script sleeps for 50sec my IDE locks up which is very annoying. I cant switch tabs, look through my source, type code, etc. It happens in pylde and pyscripter, i havent tried other IDEs. What can i do to fix this? i'm actually doing
```
for i in range(0, timeInSeconds): time.sleep(1)
```
hoping the IDE wil... | I'm assuming you are running your code from within the IDE?
Your IDE is probably blocking while running your code. Look for a setting of some sort which might control that behaviour, otherwise I think your only choice would be to change IDE. (Or, run your code from outside the IDE) |
535,975 | <p>In a Windows batch file, when you do the following: </p>
<blockquote>
<p><code>set myvar="c:\my music & videos"</code></p>
</blockquote>
<p>the variable <code>myvar</code> is stored with the quotes included. Honestly I find that very stupid. The quotes are just to tell where the string begins and ends, not ... | [
{
"answer_id": 536025,
"author": "Dave",
"author_id": 63378,
"author_profile": "https://Stackoverflow.com/users/63378",
"pm_score": 1,
"selected": false,
"text": "<p>Try using the escape character '^', e.g.</p>\n\n<pre><code>set myvar=c:\\my music ^& videos\n</code></pre>\n\n<p>You'l... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25700/"
] | In a Windows batch file, when you do the following:
>
> `set myvar="c:\my music & videos"`
>
>
>
the variable `myvar` is stored with the quotes included. Honestly I find that very stupid. The quotes are just to tell where the string begins and ends, not to be stored as part of the value itself.
How can I prev... | ```
set "myvar=c:\my music & videos"
```
Notice the quotes start before myvar. It's actually that simple.
Side note: myvar can't be echoed afterwards unless it's wrapped in quotes because & will be read as a command separator, but it'll still work as a path.
<http://ss64.com/nt/set.html> under "Variable names can in... |
535,981 | <p>Me again...
I have an XML File that contains different categories which I would like to query for different attributes.</p>
<pre><code> <item>
<title>Industries</title>
<category type="Channel">Automotive</category>
<categ... | [
{
"answer_id": 536045,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "<p>I'd simplify it with an extension method to do the tricky lookup:</p>\n\n<p>(updated 12/02/09 to exclude empty elem... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535981",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64620/"
] | Me again...
I have an XML File that contains different categories which I would like to query for different attributes.
```
<item>
<title>Industries</title>
<category type="Channel">Automotive</category>
<category type="Type">Cars</category>
... | I'd simplify it with an extension method to do the tricky lookup:
(updated 12/02/09 to exclude empty elements)
```
static string CategoryValue(this XElement element, string type)
{
var category = element.Elements("category").FirstOrDefault(
c => (string)c.Attribute("type") == type
&& !string.I... |
535,984 | <p>I finally found out the <a href="http://en.wikipedia.org/wiki/Coordinated_Universal_Time" rel="noreferrer">difference between UTC and GMT</a> by making the effort to look it up on Wikipedia today. Technically speaking it appears that GMT != UTC because you do not know if it is UTC or UT1 being referred to. However p... | [
{
"answer_id": 535993,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": "<p>Normal humans don't need to worry about the few seconds difference between GMT and UTC. The difference only matters to ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/535984",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33611/"
] | I finally found out the [difference between UTC and GMT](http://en.wikipedia.org/wiki/Coordinated_Universal_Time) by making the effort to look it up on Wikipedia today. Technically speaking it appears that GMT != UTC because you do not know if it is UTC or UT1 being referred to. However practically, people use the term... | Normal humans don't need to worry about the few seconds difference between GMT and UTC. The difference only matters to astronomers and time nerds.
I have seen very little software that bothers to make the distinction. Most software ends up using the labels "GMT" and "UTC" interchangeably. Typically it just means "cloc... |
536,022 | <p>I have tried the following options with unacceptable response times - creating index 'key' did not help either (NOTE:duplicate'keys'in both datasets):</p>
<pre><code>data a;
merge b
c;
by key
if b;
run;
</code></pre>
<p>=== OR ===</p>
<pre><code>proc sql;
create a
as select *
from b
left outer join c
on b.... | [
{
"answer_id": 536074,
"author": "user64972",
"author_id": 64972,
"author_profile": "https://Stackoverflow.com/users/64972",
"pm_score": 1,
"selected": false,
"text": "<p>You should first sort the two datasets before merging them. This is what will give the performance. using an index wh... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have tried the following options with unacceptable response times - creating index 'key' did not help either (NOTE:duplicate'keys'in both datasets):
```
data a;
merge b
c;
by key
if b;
run;
```
=== OR ===
```
proc sql;
create a
as select *
from b
left outer join c
on b.key;
quit;
``` | You should first sort the two datasets before merging them. This is what will give the performance. using an index when you have to scan the whole table to have a result is usually slower then presorting the datasets and merging them. |
536,034 | <p>I just wrote an if statement in the lines of</p>
<pre><code>if (value == value1 || value == value2 || value == value3 || value == value4)
//do something
</code></pre>
<p>and it annoys me that I always have to repeat the 'value ==' part. In my opinion this is serving no purpose other than making it difficult to... | [
{
"answer_id": 536040,
"author": "Richard Ev",
"author_id": 39709,
"author_profile": "https://Stackoverflow.com/users/39709",
"pm_score": 1,
"selected": false,
"text": "<p>Looks good to me, although it seems a little unconventional.</p>\n"
},
{
"answer_id": 536042,
"author": ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10779/"
] | I just wrote an if statement in the lines of
```
if (value == value1 || value == value2 || value == value3 || value == value4)
//do something
```
and it annoys me that I always have to repeat the 'value ==' part. In my opinion this is serving no purpose other than making it difficult to read.
I wrote the follow... | You haven't added functionality that is only useful to a specific application or context, your extension is clearly named and the behaviour is obvious without having to look at the implementation.
The answer is "Yes, it is" |
536,051 | <p>I want to fetch data from a mysql database using sqlalchemy and use the data in a different class.. Basically I fetch a row at a time, use the data, fetch another row, use the data and so on.. I am running into some problem doing this.. </p>
<p>Basically, how do I output data a row at a time from mysql data?.. I ha... | [
{
"answer_id": 536180,
"author": "kender",
"author_id": 4172,
"author_profile": "https://Stackoverflow.com/users/4172",
"pm_score": 0,
"selected": false,
"text": "<p>From what I understand, you're interested in something like this:</p>\n\n<pre><code># s is object returned by the .select(... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536051",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to fetch data from a mysql database using sqlalchemy and use the data in a different class.. Basically I fetch a row at a time, use the data, fetch another row, use the data and so on.. I am running into some problem doing this..
Basically, how do I output data a row at a time from mysql data?.. I have looked ... | Exactly what problems are you running into?
You can simply iterate over the ResultProxy object:
```
for row in conn_or_sess_or_engine.execute(selectable_obj_or_SQLstring):
do_something_with(row)
``` |
536,065 | <p>Is there free OpenGL support libraries for C#? If so, which one do I use and where do I find sample projects?</p>
<p>Does C# provide classes for OpenGL?</p>
| [
{
"answer_id": 536078,
"author": "korona",
"author_id": 25731,
"author_profile": "https://Stackoverflow.com/users/25731",
"pm_score": 2,
"selected": false,
"text": "<p>What would you like these support libraries to do? Just using OpenGL from C# is simple enough and does not require any a... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/279238/"
] | Is there free OpenGL support libraries for C#? If so, which one do I use and where do I find sample projects?
Does C# provide classes for OpenGL? | [OpenTK](https://github.com/opentk/opentk) is an improvement over the Tao API, as it uses idiomatic C# style with overloading, strongly-typed enums, exceptions, and standard .NET types:
```
GL.Begin(BeginMode.Points);
GL.Color3(Color.Yellow);
GL.Vertex3(Vector3.Up);
```
as opposed to Tao which merely mirrors the C A... |
536,067 | <p>So I have a module in flex in which I add a custom component. I also have a class that handles the data I want to show, lets call this class DataHandler. </p>
<p>The DataHandler receives data from the back-end solution and then starts putting the data togheter for my Module and the custom component.</p>
<p>When th... | [
{
"answer_id": 536081,
"author": "Adam Ralph",
"author_id": 49241,
"author_profile": "https://Stackoverflow.com/users/49241",
"pm_score": 0,
"selected": false,
"text": "<p>In general, the scrolling action on a trackpad simply sends the same signals to the PC as the scroll wheel on a mous... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | So I have a module in flex in which I add a custom component. I also have a class that handles the data I want to show, lets call this class DataHandler.
The DataHandler receives data from the back-end solution and then starts putting the data togheter for my Module and the custom component.
When the data is ready i... | The Lenovo drivers don't work the way that you'd hope. There's a workaround, posted here: [Link](https://learn.microsoft.com/en-us/archive/blogs/markrideout/datagridview-mouse-scrolling-button-with-ibmultranav-driver) which involves tricking the mouse driver into recognizing that you want scroll messages. |
536,077 | <p>How to Set a existing column of MS SQL table as NOT NULL? </p>
| [
{
"answer_id": 536090,
"author": "Adam Ralph",
"author_id": 49241,
"author_profile": "https://Stackoverflow.com/users/49241",
"pm_score": 7,
"selected": true,
"text": "<pre><code>ALTER TABLE tablename\nALTER COLUMN columnname datatype NOT NULL\n</code></pre>\n\n<p>You will obviously have... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] | How to Set a existing column of MS SQL table as NOT NULL? | ```
ALTER TABLE tablename
ALTER COLUMN columnname datatype NOT NULL
```
You will obviously have to make sure that the column does not contain any NULL values before doing this.
E.g.
```
ALTER TABLE orders
ALTER COLUMN customer_id INT NOT NULL
``` |
536,091 | <p>This is just a question to help me understand CSS rendering better.</p>
<p>Lets say we have a million lines of this.</p>
<pre><code><div class="first">
<div class="second">
<span class="third">Hello World</span>
</div>
</div>
</code></pre>
<p>Which would be the ... | [
{
"answer_id": 536124,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 3,
"selected": false,
"text": "<p>You have to understand how the selectors are being processed:</p>\n\n<ul>\n<li><strong><code>.third</code>:</strong> get ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22459/"
] | This is just a question to help me understand CSS rendering better.
Lets say we have a million lines of this.
```
<div class="first">
<div class="second">
<span class="third">Hello World</span>
</div>
</div>
```
Which would be the fastest way to change the font of Hello World to red?
```
.third { c... | Two things to remember:
* This is going to depend on the CSS parser /rendering engine: i.e. it varies from browser to browser.
* CSS is really, really, *really* fast anyway, even at it's slowest the human watching shouldn't notice
In general the simplest things are the fastest (as Gumbo nicely illustrates), but becau... |
536,108 | <p>I was wondering if there was a way of using HTML for the content of my ASP:Listbox items instead of plain text? The reason I ask is because I'd like to do some extra formatting on each item in the list. Not just font changes, but perhaps icons alongside the text or table rows to divide up each list item.</p>
<p>I'm... | [
{
"answer_id": 536134,
"author": "Xn0vv3r",
"author_id": 42475,
"author_profile": "https://Stackoverflow.com/users/42475",
"pm_score": 0,
"selected": false,
"text": "<p>You can use CSS Style attributes for the listitems.\nBut it <a href=\"http://www.velocityreviews.com/forums/t360823-for... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5827/"
] | I was wondering if there was a way of using HTML for the content of my ASP:Listbox items instead of plain text? The reason I ask is because I'd like to do some extra formatting on each item in the list. Not just font changes, but perhaps icons alongside the text or table rows to divide up each list item.
I'm vaguely a... | there is another related stack-overflow question here:
[Is there a way to enhance by CSS an HTML <select> and its <option> on IE 6?](https://stackoverflow.com/questions/182035/is-there-a-way-to-enhance-by-css-an-html-select-and-its-option-on-ie-6)
From that it seems like you can;t set many of the css selectors for th... |
536,109 | <p>I need to delete files of a certain type (.zip files, say) from a folder, and all of its sub-folders, using the command line. Ideally I am looking for something that can be run as a .bat file in Windows. </p>
<p>I know there is a /S switch for the DEL command to look in sub-folders, but to add to the challenge I ne... | [
{
"answer_id": 536118,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Perhaps the 'forfiles' command could be of use</p>\n\n<p><a href=\"http://technet.microsoft.com/en-us/library/cc753551.aspx... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7585/"
] | I need to delete files of a certain type (.zip files, say) from a folder, and all of its sub-folders, using the command line. Ideally I am looking for something that can be run as a .bat file in Windows.
I know there is a /S switch for the DEL command to look in sub-folders, but to add to the challenge I need to excl... | A nice trick: make the [files you want to exclude read-only](http://www.computing.net/answers/dos/excluding-folders-when-using-del-s/16548.html)!
`DEL /S` will not delete read-only file.
The following script does not do *exactly* what you want (see my remarks below) but shows you how read-only files can be used to av... |
536,147 | <p>everyone, i've got below function to return true if input is badword</p>
<pre><code>public bool isAdultKeyword(string input)
{
if (input == null || input.Length == 0)
{
return false;
}
else
{
Regex regex = new Regex(@"\b(badword1|badword2|anotherbadword)\b");
return regex... | [
{
"answer_id": 536155,
"author": "cjk",
"author_id": 52201,
"author_profile": "https://Stackoverflow.com/users/52201",
"pm_score": 1,
"selected": false,
"text": "<p>So under your logic, would you match as to ass?</p>\n\n<p>Also, remember the classic place Scunthorpe - your adult filter n... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536147",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | everyone, i've got below function to return true if input is badword
```
public bool isAdultKeyword(string input)
{
if (input == null || input.Length == 0)
{
return false;
}
else
{
Regex regex = new Regex(@"\b(badword1|badword2|anotherbadword)\b");
return regex.IsMatch(input... | So under your logic, would you match as to ass?
Also, remember the classic place Scunthorpe - your adult filter needs to be able to allow this word through. |
536,148 | <p>I love how in python I can do something like:</p>
<pre><code>points = []
for line in open("data.txt"):
a,b,c = map(float, line.split(','))
points += [(a,b,c)]
</code></pre>
<p>Basically it's reading a list of lines where each one represents a point in 3D space, the point is represented as three numbers sep... | [
{
"answer_id": 536164,
"author": "Timo Geusch",
"author_id": 29068,
"author_profile": "https://Stackoverflow.com/users/29068",
"pm_score": 2,
"selected": false,
"text": "<p>You could read the file from a std::iostream line by line, put each line into a std::string and then use boost::tok... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536148",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35364/"
] | I love how in python I can do something like:
```
points = []
for line in open("data.txt"):
a,b,c = map(float, line.split(','))
points += [(a,b,c)]
```
Basically it's reading a list of lines where each one represents a point in 3D space, the point is represented as three numbers separated by commas
How can ... | I`d do something like this:
```
ifstream f("data.txt");
string str;
while (getline(f, str)) {
Point p;
sscanf(str.c_str(), "%f, %f, %f\n", &p.x, &p.y, &p.z);
points.push_back(p);
}
```
x,y,z must be floats.
And include:
```
#include <iostream>
#include <fstream>
``` |
536,160 | <p>I'm trying to untar a file. Before untarring I would like to know free space available on the mounted volume. The plan is if there is not enough space I will not untar it! So how can I find the free space available on a mounted volume using Perl? By the way, I'm using Perl for tar and untar.</p>
<p>Everybody is say... | [
{
"answer_id": 536166,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 4,
"selected": false,
"text": "<p>You likely want the CPAN module <a href=\"https://metacpan.org/pod/Filesys::DfPortable\" rel=\"nofollow noreferrer\">File... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2639206/"
] | I'm trying to untar a file. Before untarring I would like to know free space available on the mounted volume. The plan is if there is not enough space I will not untar it! So how can I find the free space available on a mounted volume using Perl? By the way, I'm using Perl for tar and untar.
Everybody is saying about ... | Using shell commands to generate a single K-free number which Perl can use:
Change into the directory where you want to untar (if not already there) and execute:
```
df . | grep -v '^Filesystem' | awk 'NF=6{print $4}NF==5{print $3}{}'
```
Or replace "." with the actual mount point.
The grep gets rid of the header ... |
536,162 | <p>I am unable to select all the records from the parent table using Linq to Entities.</p>
<p>This is a simple DB design (image below):</p>
<p><strike><a href="http://www.thinkboard.com/myimages/tablerelation.jpg" rel="nofollow noreferrer">Image Link</a></strike> (Dead Link)</p>
<p>This is the exact output I want us... | [
{
"answer_id": 537793,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 1,
"selected": false,
"text": "<pre><code>from entity in MyContext.EntityType.Include(\"ChildEntitiesNavigationPropertyName\")\nselect entity;\n</code... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53234/"
] | I am unable to select all the records from the parent table using Linq to Entities.
This is a simple DB design (image below):
[Image Link](http://www.thinkboard.com/myimages/tablerelation.jpg) (Dead Link)
This is the exact output I want using Linq to Entities or Linq to SQL (image below):
[Image Link](http://www.th... | ```
from entity in MyContext.EntityType.Include("ChildEntitiesNavigationPropertyName")
select entity;
```
This returns all instances of EntityType, plus ChildEntitiesNavigationPropertyName when/if it exists. For tabular form use an anonymous type:
```
from entity in MyContext.EntityType.Include("ChildEntitiesNavigat... |
536,168 | <p>I'm working on porting my open source particle engine test from SDL to SDL + OpenGL. I've managed to get it compiling, and running, but the screen stays black no matter what I do.
main.cpp:</p>
<pre><code>#include "glengine.h"
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lp... | [
{
"answer_id": 536264,
"author": "heeen",
"author_id": 38893,
"author_profile": "https://Stackoverflow.com/users/38893",
"pm_score": 0,
"selected": false,
"text": "<p>Check OpenGL for error states. Use <code>glslDevil</code>, <code>glIntercept</code> or <code>gDebugger</code>. Check the ... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62122/"
] | I'm working on porting my open source particle engine test from SDL to SDL + OpenGL. I've managed to get it compiling, and running, but the screen stays black no matter what I do.
main.cpp:
```
#include "glengine.h"
int WINAPI WinMain(
HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int... | Okay, I managed to fix it using a lot of your suggestions, and some other source code I had laying around. Turns out the problem was from 3 different lines.
particlesize = 0.01; should have been bigger: particlesize = 1.01;
`glColor4i(255, 255, 255, 255)` was turning the cube the same color as the clear color because... |
536,182 | <p>When restoring my database i have a problem with the physical file of the full text catalog being in use.</p>
<pre><code>The file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\MyCatalog' cannot be overwritten. It is being used by database 'demo2'.
</code></pre>
<p>I use this restore statement</p>
<... | [
{
"answer_id": 536714,
"author": "mfazekas",
"author_id": 27048,
"author_profile": "https://Stackoverflow.com/users/27048",
"pm_score": 3,
"selected": false,
"text": "<p>Your <a href=\"http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Appl... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25792/"
] | When restoring my database i have a problem with the physical file of the full text catalog being in use.
```
The file 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\FTData\MyCatalog' cannot be overwritten. It is being used by database 'demo2'.
```
I use this restore statement
```
RESTORE database demo from... | Your [Settings bundle](http://developer.apple.com/iphone/library/documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/ApplicationSettings/chapter_12_section_4.html#//apple_ref/doc/uid/TP40007072-CH13-SW12) cannot contain any runnable code, so it's not possible to have buttons like safari (Clear History, Clear Cooki... |
536,203 | <p>For those who haven't used DrScheme, window is split in two parts: one part is a file you're editing, and the other is interactive shell. When I run a file, it is loaded into interactive environment, so I can invoke functions I've defined etc. Interactive environment still has all the features of text editor (syntax... | [
{
"answer_id": 536248,
"author": "Sebastian",
"author_id": 29909,
"author_profile": "https://Stackoverflow.com/users/29909",
"pm_score": 1,
"selected": false,
"text": "<p>I haven't worked with DrScheme yet, but Netbeans 6.5 includes a full-featured IRB. Have you given it a try?</p>\n"
... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4433/"
] | For those who haven't used DrScheme, window is split in two parts: one part is a file you're editing, and the other is interactive shell. When I run a file, it is loaded into interactive environment, so I can invoke functions I've defined etc. Interactive environment still has all the features of text editor (syntax hi... | This exact request (even up to the fact that Dr Scheme motivated it) is what finally pushed me to learn Emacs.
Here's what i did to install it under Windows Vista:
1. Download Emacs from <http://ftp.gnu.org/gnu/windows/emacs/emacs-22.3-bin-i386.zip>
2. Unzip it to the directory of your choice
3. After unzipping it c... |
536,205 | <p>I'm struggling with the design of a django application. Given the following models:</p>
<pre><code>class A(models.Model):
name = models.CharField(max_length=255)
class B(models.Model):
name = models.CharField(max_length=255)
a = models.ForeignKey(A)
class C(models.Model):
val = models.IntegerField... | [
{
"answer_id": 536275,
"author": "Joonas Pulakka",
"author_id": 59279,
"author_profile": "https://Stackoverflow.com/users/59279",
"pm_score": 1,
"selected": false,
"text": "<p>Disclaimer: I'm a Django beginner myself, but if I've understood its basic concepts right, then:</p>\n\n<p>Given... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536205",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/64998/"
] | I'm struggling with the design of a django application. Given the following models:
```
class A(models.Model):
name = models.CharField(max_length=255)
class B(models.Model):
name = models.CharField(max_length=255)
a = models.ForeignKey(A)
class C(models.Model):
val = models.IntegerField()
b = mod... | If you have that date model so you can fetch all `b`s then group them by `a` and calculate total amount. Code may look like this:
View:
```
from django.utils.itercompat import groupby
def view(request):
bs = B.objects.all().annotate(sum_of_c_val=Sum('c.val'))\
.select_related('a')
b_by_a... |
536,211 | <p>I have a jar application which process and converts file into csv file. I have made it to run in windows service using Java Service Wrapper. It got installed my jar application successfully when I run "InstallApp-NT. Bat" file and starts running my application when I run "app" command. </p>
<p>But when I try to st... | [
{
"answer_id": 536222,
"author": "Bhushan Bhangale",
"author_id": 57423,
"author_profile": "https://Stackoverflow.com/users/57423",
"pm_score": 0,
"selected": false,
"text": "<p>Check com.dnb.genericpreprocessor.process.ProcessRunner if that is your code and see what data you are setting... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51659/"
] | I have a jar application which process and converts file into csv file. I have made it to run in windows service using Java Service Wrapper. It got installed my jar application successfully when I run "InstallApp-NT. Bat" file and starts running my application when I run "app" command.
But when I try to start the ser... | Answering your [question update](https://stackoverflow.com/questions/536211/doubt-in-java-service-wrapper-while-running-jar-application-fom-window-service/536273#536273) that you phrased as an answer, you need to ensure that the variable is in fact set in the specific environment where you are running the application. ... |
536,212 | <p>I need some expect advice on how to handle the following:- I have a data field misc_text_2 that is of type varchar(25) and allows NULL. Now if I use the following syntax</p>
<pre><code><asp:Label ID="lblPrinter" runat="server" Text='<%# iif(eval("misc_text_2") is dbnull.value, "", iif(eval("misc_text_2") lik... | [
{
"answer_id": 536231,
"author": "Sani Singh Huttunen",
"author_id": 26742,
"author_profile": "https://Stackoverflow.com/users/26742",
"pm_score": -1,
"selected": true,
"text": "<p>You could in your sql query use isNull(misc_text_2, '') to return en empty string instead of DBNull.</p>\n"... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need some expect advice on how to handle the following:- I have a data field misc\_text\_2 that is of type varchar(25) and allows NULL. Now if I use the following syntax
```
<asp:Label ID="lblPrinter" runat="server" Text='<%# iif(eval("misc_text_2") is dbnull.value, "", iif(eval("misc_text_2") like "NA", "None", ii... | You could in your sql query use isNull(misc\_text\_2, '') to return en empty string instead of DBNull. |
536,214 | <p>I need to specify that a Generic type should only accept enumerated types only in the closed type. Can anyone suggest a way to do this if contraints cannot work?</p>
| [
{
"answer_id": 536226,
"author": "baretta",
"author_id": 30052,
"author_profile": "https://Stackoverflow.com/users/30052",
"pm_score": 2,
"selected": false,
"text": "<p>Closest constraint is struct:</p>\n\n<p>class C<E> where E : /* enum */ struct</p>\n\n<p>If you need to make sure it... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47342/"
] | I need to specify that a Generic type should only accept enumerated types only in the closed type. Can anyone suggest a way to do this if contraints cannot work? | You can't do this directly in C# - the enum type is not usable as a constraint. One option (grungy) is to use a type-initializer (static constructor) to do the checking at runtime. It'll stop it using inappropriate types at runtime, but not at compile time.
```
class Foo<T> where T : struct {
static Foo() {
... |
536,228 | <p><code>getRealPath()</code> is returning the actual path in the local system, but returns null when deployed with a <code>.war</code> file.</p>
<pre><code><%@ page import="java.io.*" %>
<%@ page contentType="text/html;charset=ISO-8859-1" %>
<%
int iLf = 10;
char cLf = (char)iLf;
String a= application... | [
{
"answer_id": 536260,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 5,
"selected": false,
"text": "<p>For a start, <a href=\"http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletRequest.html#getRealPa... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59649/"
] | `getRealPath()` is returning the actual path in the local system, but returns null when deployed with a `.war` file.
```
<%@ page import="java.io.*" %>
<%@ page contentType="text/html;charset=ISO-8859-1" %>
<%
int iLf = 10;
char cLf = (char)iLf;
String a= application.getResource("/");
//String myfile = application.ge... | For a start, [ServletRequest.getRealPath(String path)](http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletRequest.html#getRealPath(java.lang.String)) is deprecated. The appropriate replacement is:
```
ServletContext context = session.getServletContext();
String realContextPath = context.getRealPath(... |
536,230 | <p>are there any good tutorials online for learning about the c# 2.0 language feature "predicates"?</p>
<p>i'm trying to learn how to use predicates along with linq to sql to modify my queries</p>
<p>what i am trying to do is query a table of customers and filter it based on changing criteria. for example</p>
<ul>
<... | [
{
"answer_id": 536242,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": true,
"text": "<p>(btw - the lambda-based predicates used with LINQ-to-SQL are C# 3.0 / .NET 3.5, not C# 2.0)</p>\n\n<p>Well, what sp... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/65005/"
] | are there any good tutorials online for learning about the c# 2.0 language feature "predicates"?
i'm trying to learn how to use predicates along with linq to sql to modify my queries
what i am trying to do is query a table of customers and filter it based on changing criteria. for example
* find all customers who ha... | (btw - the lambda-based predicates used with LINQ-to-SQL are C# 3.0 / .NET 3.5, not C# 2.0)
Well, what specifically are you trying to do?
Predicates are just filters (either as a delegate or an Expression); they don't *directly* allow you to modify the TSQL etc, unless you combine them with functions that the LINQ-to... |
536,261 | <p>How would you model the references and citations to publications (articles, books, chapters, etc...)?</p>
<p>A publication can be an article, book or a chapter and it has many references to other publications and other publications refer to it (call these citations)</p>
<p>I need to be able to list the relationshi... | [
{
"answer_id": 537356,
"author": "François Beausoleil",
"author_id": 7355,
"author_profile": "https://Stackoverflow.com/users/7355",
"pm_score": 1,
"selected": false,
"text": "<p>I have an incomplete answer over at <a href=\"http://github.com/francois/so-536261/tree/master\" rel=\"nofoll... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6805/"
] | How would you model the references and citations to publications (articles, books, chapters, etc...)?
A publication can be an article, book or a chapter and it has many references to other publications and other publications refer to it (call these citations)
I need to be able to list the relationships among the publ... | Here's a solution using a self-referential relationship using single table inheritance. Use these commands to create the app:
```
$ rails myproject
$ cd myproject
$ script/generate model publication type:string name:string
$ script/generate model citation publication_id:integer reference_id:integer
```
The setup the... |
536,270 | <p>Is there an Iphone SDK API to search resource files?</p>
<p>I have a set of html file resources that I'd like the user to be able to search in, but I want to avoid reading the files into memory and searching them one by one.</p>
<p>Is there any API that can help me do this?</p>
| [
{
"answer_id": 537356,
"author": "François Beausoleil",
"author_id": 7355,
"author_profile": "https://Stackoverflow.com/users/7355",
"pm_score": 1,
"selected": false,
"text": "<p>I have an incomplete answer over at <a href=\"http://github.com/francois/so-536261/tree/master\" rel=\"nofoll... | 2009/02/11 | [
"https://Stackoverflow.com/questions/536270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42303/"
] | Is there an Iphone SDK API to search resource files?
I have a set of html file resources that I'd like the user to be able to search in, but I want to avoid reading the files into memory and searching them one by one.
Is there any API that can help me do this? | Here's a solution using a self-referential relationship using single table inheritance. Use these commands to create the app:
```
$ rails myproject
$ cd myproject
$ script/generate model publication type:string name:string
$ script/generate model citation publication_id:integer reference_id:integer
```
The setup the... |