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 |
|---|---|---|---|---|---|---|
271,938 | <p>Background: I have a kubuntu laptop right now that I can't use wirelessly, i.e. I haven't got wireless assistant installed. But I have a windows laptop that I can download the debian packages seperately on a USB memory stick.</p>
<p>How do I install a debian package on the computer locally?</p>
| [
{
"answer_id": 271952,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 3,
"selected": true,
"text": "<p>Once you have the USB stick mounted:</p>\n\n<pre><code>dpkg --install /path/to/foo_VVV-RRR.deb\n</code></pre>\n\n<p>(w... | 2008/11/07 | [
"https://Stackoverflow.com/questions/271938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713/"
] | Background: I have a kubuntu laptop right now that I can't use wirelessly, i.e. I haven't got wireless assistant installed. But I have a windows laptop that I can download the debian packages seperately on a USB memory stick.
How do I install a debian package on the computer locally? | Once you have the USB stick mounted:
```
dpkg --install /path/to/foo_VVV-RRR.deb
```
(where fooVVV-RRR.deb is the package's file name)
You can find more commands at the [Debian GNU/Linux FAQ](http://www.debian.org/doc/FAQ/ch-pkgtools.en.html).
Side note: this is from the command line. I'm not sure how to get synap... |
271,939 | <p>This question is about using getter methods of a singleton object in worker threads. Here is some pseudo code first:</p>
<pre><code>// Singleton class which contains data
class MyData
{
static MyData* sMyData ;
int mData1[1024];
int mData2[1024];
int mData3[1024];
MyData* getInstance()
... | [
{
"answer_id": 271958,
"author": "DavidK",
"author_id": 31394,
"author_profile": "https://Stackoverflow.com/users/31394",
"pm_score": 4,
"selected": true,
"text": "<p>Provided that no other thread will try to write to the data in your singleton object, you don't need to protect them: by ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/271939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23000/"
] | This question is about using getter methods of a singleton object in worker threads. Here is some pseudo code first:
```
// Singleton class which contains data
class MyData
{
static MyData* sMyData ;
int mData1[1024];
int mData2[1024];
int mData3[1024];
MyData* getInstance()
{
// s... | Provided that no other thread will try to write to the data in your singleton object, you don't need to protect them: by definition, multiple readers in the absence of a writer is thread-safe. This is a common pattern where the program's initialization code sets up a singleton, which is then only read from by worker th... |
271,944 | <p>I have a scenario where users of my ASP.NET web application submit testimonials consisting of text info and images. The submit process has the following steps:</p>
<ul>
<li>First the user inputs the content and chooses a path to an image</li>
<li>When he clicks preview, the info is once again shown so that he can c... | [
{
"answer_id": 271967,
"author": "chakrit",
"author_id": 3055,
"author_profile": "https://Stackoverflow.com/users/3055",
"pm_score": 2,
"selected": false,
"text": "<p>You can still use the normal <a href=\"https://msdn.microsoft.com/en-us/library/system.io.path.gettempfilename.aspx\" rel... | 2008/11/07 | [
"https://Stackoverflow.com/questions/271944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1801/"
] | I have a scenario where users of my ASP.NET web application submit testimonials consisting of text info and images. The submit process has the following steps:
* First the user inputs the content and chooses a path to an image
* When he clicks preview, the info is once again shown so that he can confirm
* Once confirm... | I would recommend [IsolatedStorage](http://msdn.microsoft.com/en-us/library/3ak841sy(VS.80).aspx). It's a kind of virtual folder.
Here is an excerpt from [an example on CodeProject](http://www.codeproject.com/KB/dotnet/IsolatedStorage.aspx):
```
IsolatedStorageFileStream stream =
new IsolatedStorageFileStream(ISOL... |
271,953 | <p>Got into a situation where in a schema i have a table, say table ACTION , while i got a synonym called ACTION as well which refers to another table to another schema.</p>
<p>Now, when i run the query</p>
<p>select * from ACTION</p>
<p>it will select the records from the table, but not the synonym.</p>
<p>Anyway ... | [
{
"answer_id": 271997,
"author": "Kieveli",
"author_id": 15852,
"author_profile": "https://Stackoverflow.com/users/15852",
"pm_score": 2,
"selected": false,
"text": "<p>Well, your underlying ACTION table should be renamed, let's say do LOCAL_ACTION.</p>\n\n<p>Let's pretend your ACTION sy... | 2008/11/07 | [
"https://Stackoverflow.com/questions/271953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Got into a situation where in a schema i have a table, say table ACTION , while i got a synonym called ACTION as well which refers to another table to another schema.
Now, when i run the query
select \* from ACTION
it will select the records from the table, but not the synonym.
Anyway for me to select from the syno... | I don't think that your ACTION synonym resides in the same schema as your ACTION table, as that isn't allowed in Oracle. Most likely your ACTION synonym resides in other schema, perhaps it's a PUBLIC synonym. If that's the case you can use
```
select * from ACTION
union
select * from public.ACTION
``` |
271,966 | <p>There are no builtin matrix functions in C#, but there are in the F# powerpack.</p>
<p>Rather than using a third party or open source C# library, I wonder about rolling my own in F#, and exposing the useful bits to C#. </p>
<p>Wondered if anybody has already thought of this, or tried it, and whether it's a good id... | [
{
"answer_id": 272067,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 0,
"selected": false,
"text": "<p>There are very good Matrix classes in the XNA Framework. I'd either reference that dll, or most likely use reflector and ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/271966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11410/"
] | There are no builtin matrix functions in C#, but there are in the F# powerpack.
Rather than using a third party or open source C# library, I wonder about rolling my own in F#, and exposing the useful bits to C#.
Wondered if anybody has already thought of this, or tried it, and whether it's a good idea.
Should I exp... | can you not just reference the f# library you need in c# and use it directly?
I've done a similar thing to reference the FSharp.Core.dll to get at the
```
Microsoft.FSharp.Math.BigInt class.
```
So you can probably just reference the FSharp.PowerPack.dll to get at the
```
Microsoft.FSharp.Math.Matrix<A> class
`... |
271,971 | <p>Through profiling I've discovered that the sprintf here takes a long time. Is there a better performing alternative that still handles the leading zeros in the y/m/d h/m/s fields?</p>
<pre><code>SYSTEMTIME sysTime;
GetLocalTime( &sysTime );
char buf[80];
for (int i = 0; i < 100000; i++)
{
sprintf(buf, ... | [
{
"answer_id": 271986,
"author": "LeppyR64",
"author_id": 16592,
"author_profile": "https://Stackoverflow.com/users/16592",
"pm_score": 0,
"selected": false,
"text": "<p>StringStream is the suggestion that I got from Google.</p>\n\n<p><a href=\"http://bytes.com/forum/thread132583.html\" ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/271971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] | Through profiling I've discovered that the sprintf here takes a long time. Is there a better performing alternative that still handles the leading zeros in the y/m/d h/m/s fields?
```
SYSTEMTIME sysTime;
GetLocalTime( &sysTime );
char buf[80];
for (int i = 0; i < 100000; i++)
{
sprintf(buf, "%4d-%02d-%02d %02d:%0... | If you were writing your own function to do the job, a lookup table of the string values of 0 .. 61 would avoid having to do any arithmetic for everything apart from the year.
edit: Note that to cope with leap seconds (and to match [`strftime()`](http://en.cppreference.com/w/c/chrono/strftime)) you should be able to p... |
272,007 | <p>I am using jQuery to try and trigger a method when an <a href="http://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a> (2.0) dropdown list's change event is handled by jQuery. The problem is that the drop down list is located inside a gridview and even then only when a user has decided to edit a ... | [
{
"answer_id": 272311,
"author": "MrKurt",
"author_id": 35296,
"author_profile": "https://Stackoverflow.com/users/35296",
"pm_score": 3,
"selected": true,
"text": "<p>A couple of things here.</p>\n\n<ol>\n<li>You need to wrap your selectors in quotes when you pass them to the <code>$()</... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35454/"
] | I am using jQuery to try and trigger a method when an [ASP.NET](http://en.wikipedia.org/wiki/ASP.NET) (2.0) dropdown list's change event is handled by jQuery. The problem is that the drop down list is located inside a gridview and even then only when a user has decided to edit a row within that gridview.
I think I hav... | A couple of things here.
1. You need to wrap your selectors in quotes when you pass them to the `$()` function. The code snippet above generates something like `$(#some-generated-id)`, which won't work.
2. The closing curly brace for your server side if statement was outside the onready function. It needs to be nested... |
272,035 | <p>I have a form that displays file information in a TabControl, and I'd like the pages to have the file's icon in their tab. How do I get the icon associated with a file type?</p>
<p>I'd prefer solutions that don't involve looking things up in the registry, but if that's the only way then so be it.</p>
| [
{
"answer_id": 272044,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 5,
"selected": true,
"text": "<p><a href=\"http://www.codeproject.com/KB/dotnet/System_File_Association.aspx\" rel=\"nofollow noreferrer\">CodeProj... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15371/"
] | I have a form that displays file information in a TabControl, and I'd like the pages to have the file's icon in their tab. How do I get the icon associated with a file type?
I'd prefer solutions that don't involve looking things up in the registry, but if that's the only way then so be it. | [CodeProject](http://www.codeproject.com/KB/dotnet/System_File_Association.aspx) has some classes you can download.
First get the `FileAssociationInfo`, and from that get the `ProgramAssociationInfo`. The `pai` object can give you the icon.
```
FileAssociationInfo fai = new FileAssociationInfo(".bob");
ProgramAssocia... |
272,036 | <p>I've accidentally removed Win2K compatibility from an application by using <a href="http://msdn.microsoft.com/en-us/library/ms683215(VS.85).aspx" rel="nofollow noreferrer">GetProcessID</a>.</p>
<p>I use it like this, to get the main HWND for the launched application.</p>
<pre><code>ShellExecuteEx(&info); // La... | [
{
"answer_id": 272070,
"author": "DavidK",
"author_id": 31394,
"author_profile": "https://Stackoverflow.com/users/31394",
"pm_score": 4,
"selected": true,
"text": "<p>There is an 'sort-of-unsupported' function: ZwQueryInformationProcess(): see</p>\n\n<p><a href=\"http://msdn.microsoft.co... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1737/"
] | I've accidentally removed Win2K compatibility from an application by using [GetProcessID](http://msdn.microsoft.com/en-us/library/ms683215(VS.85).aspx).
I use it like this, to get the main HWND for the launched application.
```
ShellExecuteEx(&info); // Launch application
HANDLE han = info.hProcess; // Get process
c... | There is an 'sort-of-unsupported' function: ZwQueryInformationProcess(): see
<http://msdn.microsoft.com/en-us/library/ms687420.aspx>
This will give you the process id (amongst other things), given the handle. This isn't guaranteed to work with future Windows versions, so I'd suggest having a helper function that test... |
272,038 | <p>In my Seam application, I have a Seam component that returns a (<code>@Datamodel</code>) list of items I want to transform into a set of <code><li></code> HTML elements. I have this working without a problem. </p>
<p>But now, I want to split up the list according to an EL expression. So the EL expression dete... | [
{
"answer_id": 483930,
"author": "phloopy",
"author_id": 8507,
"author_profile": "https://Stackoverflow.com/users/8507",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not familiar with the Seam Framework, but if I understand the problem correctly something like this might work.</p>\n... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6400/"
] | In my Seam application, I have a Seam component that returns a (`@Datamodel`) list of items I want to transform into a set of `<li>` HTML elements. I have this working without a problem.
But now, I want to split up the list according to an EL expression. So the EL expression determines if a new `<ul>` element should ... | You can do this using the JSF `<f:verbatim>` tag, which isn't pretty but works:
```
<f:verbatim rendered="#{action.isNewList(index)}">
<ul>
</f:verbatim>
<!-- stuff that does the <li>'s goes here -->
<f:verbatim rendered="#{action.isNewList(index)}">
</ul>
</f:verbatim>
``` |
272,045 | <p>I have two tables A and B. I would like to delete all the records from table A that are returned in the following query:</p>
<pre><code>SELECT A.*
FROM A , B
WHERE A.id = B.a_id AND
b.date < '2008-10-10'
</code></pre>
<p>I have tried:</p>
<pre><code>DELETE A
WHERE id in (
SELECT a_id
FROM B
... | [
{
"answer_id": 272056,
"author": "Fred",
"author_id": 33630,
"author_profile": "https://Stackoverflow.com/users/33630",
"pm_score": 1,
"selected": false,
"text": "<p>You were not so far from the answer!</p>\n\n<p>Post Edited: Remove alias on table A and B</p>\n\n<pre><code>DELETE FROM A\... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/939/"
] | I have two tables A and B. I would like to delete all the records from table A that are returned in the following query:
```
SELECT A.*
FROM A , B
WHERE A.id = B.a_id AND
b.date < '2008-10-10'
```
I have tried:
```
DELETE A
WHERE id in (
SELECT a_id
FROM B
WHERE date < '2008-10-10')
```
but tha... | I think this should work (works on MySQL anyway):
```
DELETE a.* FROM A a JOIN B b ON b.id = a.id WHERE b.date < '2008-10-10';
```
Without aliases:
```
DELETE A.* FROM A JOIN B ON B.id = A.id WHERE B.date < '2008-10-10';
``` |
272,097 | <p>How do I dynamically reload the app.config in a .net Windows application? I need to turn logging on and off dynamically and not just based upon the value at application start.</p>
<p>ConfigurationManager.RefreshSection("appSettings") does not work and I've also tried explicitly opening the config file using OpenEx... | [
{
"answer_id": 272103,
"author": "MusiGenesis",
"author_id": 14606,
"author_profile": "https://Stackoverflow.com/users/14606",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think there's any way to do this, unless you write your own config file reader using XML. Why not just tur... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I dynamically reload the app.config in a .net Windows application? I need to turn logging on and off dynamically and not just based upon the value at application start.
ConfigurationManager.RefreshSection("appSettings") does not work and I've also tried explicitly opening the config file using OpenExeConfigurat... | You can refresh **your own** section the way you say:
```
ConfigurationManager.RefreshSection("yoursection/subsection");
```
Just move a logging true/false into a section and you'll be fine. |
272,109 | <p>I have a csv file of the format:</p>
<pre><code>270291014011 ED HARDY - TRUE TO MY LOVE - Cap NEU 2008 NEU 0,00 € 0,00 € 0 1 0 22.10.2008 03:37:10 21.11.2008 02:37:10 21.11.2008 02:42:10 50 0 0 0 39,99 € http://i7.ebayimg.com/02/i/001/16/0d/68af_1.JPG?set_id=800005007 0 2 8.10.2008 13... | [
{
"answer_id": 272353,
"author": "Axeman",
"author_id": 11289,
"author_profile": "https://Stackoverflow.com/users/11289",
"pm_score": 2,
"selected": true,
"text": "<p>Here's the Perl for removing the non-p tags--it won't work across lines though</p>\n\n<pre><code>perl -pe 's/<\\/?(?&g... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have a csv file of the format:
```
270291014011 ED HARDY - TRUE TO MY LOVE - Cap NEU 2008 NEU 0,00 € 0,00 € 0 1 0 22.10.2008 03:37:10 21.11.2008 02:37:10 21.11.2008 02:42:10 50 0 0 0 39,99 € http://i7.ebayimg.com/02/i/001/16/0d/68af_1.JPG?set_id=800005007 0 2 8.10.2008 13:40:20 8.10.2... | Here's the Perl for removing the non-p tags--it won't work across lines though
```
perl -pe 's/<\/?(?>[^p]|p\w+)[^>]*>//ig'
```
That will print it out to standard out and you can redirect it from there.
If you have only one link, you could do this:
```
perl -pe 's/<embed\s+src="(.*?\.swf)"\/?>/<a href="$1">Click ... |
272,124 | <p>since JTree & TreeModel don't provide tooltips straight out-of-the-box, what do you think, what would be the best way to have item-specific tooltips for JTree?</p>
<p>Edit: (Answering my own question afterwards.) </p>
<p>@Zarkonnen: Thanks for the getTooltipText idea. </p>
<p>I found out another (maybe still ... | [
{
"answer_id": 272181,
"author": "Zarkonnen",
"author_id": 15255,
"author_profile": "https://Stackoverflow.com/users/15255",
"pm_score": 5,
"selected": true,
"text": "<p>See <a href=\"http://docs.oracle.com/javase/7/docs/api/javax/swing/JTree.html#getToolTipText(java.awt.event.MouseEvent... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28482/"
] | since JTree & TreeModel don't provide tooltips straight out-of-the-box, what do you think, what would be the best way to have item-specific tooltips for JTree?
Edit: (Answering my own question afterwards.)
@Zarkonnen: Thanks for the getTooltipText idea.
I found out another (maybe still a bit nicer) way with overri... | See [getTooltipText](http://docs.oracle.com/javase/7/docs/api/javax/swing/JTree.html#getToolTipText(java.awt.event.MouseEvent)) on JTree. This should allow you to show tooltips depending on what in the tree is being hovered over. (Do read the docs though, you need to register the JTree with the ToolTipManager.) |
272,131 | <h2>Setup</h2>
<p>I have a website that draws RSS feeds and displays them on the page. Currently, I use percentages on the divs that contain each feed, so that multiples can appear next to each other.</p>
<p>However, I only have two next to each other, and if the window resizes, there can be some ugly empty space on ... | [
{
"answer_id": 272183,
"author": "warp",
"author_id": 7700,
"author_profile": "https://Stackoverflow.com/users/7700",
"pm_score": 3,
"selected": true,
"text": "<p>You probably cannot get what you want with just CSS/HTML, but you can get somewhat close.</p>\n\n<p>A trick I used for a phot... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272131",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4418/"
] | Setup
-----
I have a website that draws RSS feeds and displays them on the page. Currently, I use percentages on the divs that contain each feed, so that multiples can appear next to each other.
However, I only have two next to each other, and if the window resizes, there can be some ugly empty space on the screen.
... | You probably cannot get what you want with just CSS/HTML, but you can get somewhat close.
A trick I used for a photo album is this:
1. Make sure each feed has a fixed width, I would recommend something like '20em';
2. Make sure each feed has the same height.
3. Float everything left.
Because each div has the same di... |
272,153 | <p>If I define a struct in C# using automatic properties like this:</p>
<pre><code>public struct Address
{
public Address(string line1, string line2, string city, string state, string zip)
{
Line1 = line1;
Line2 = line2;
City = city;
State = state;
Zip = zip;
}
... | [
{
"answer_id": 272164,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 7,
"selected": true,
"text": "<p><strong>Note: as of C# 6, this isn't required - but you should be using read-only automatically-implemented properties... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6146/"
] | If I define a struct in C# using automatic properties like this:
```
public struct Address
{
public Address(string line1, string line2, string city, string state, string zip)
{
Line1 = line1;
Line2 = line2;
City = city;
State = state;
Zip = zip;
}
public string ... | **Note: as of C# 6, this isn't required - but you should be using read-only automatically-implemented properties with C# 6 anyway...**
`this()` makes sure that the fields are definitely assigned as far as the compiler is concerned - it sets all fields to their default values. You have to have a fully constructed struc... |
272,157 | <p>I have a triangle mesh that has no texture, but a set color (sort of blue) and alpha (0.7f). This mesh is run time generated and the normals are correct. I find that with lighting on, the color of my object changes as it moves around the level. Also, the lighting doesn't look right. When I draw this object, this is ... | [
{
"answer_id": 272171,
"author": "mwahab",
"author_id": 35485,
"author_profile": "https://Stackoverflow.com/users/35485",
"pm_score": 1,
"selected": false,
"text": "<p>If your lighting fails when GL_FRONT_AND_BACK is disabled it's possible that your normals are flipped. </p>\n"
},
{... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25893/"
] | I have a triangle mesh that has no texture, but a set color (sort of blue) and alpha (0.7f). This mesh is run time generated and the normals are correct. I find that with lighting on, the color of my object changes as it moves around the level. Also, the lighting doesn't look right. When I draw this object, this is the... | Turns out the color changing was because a previous texture was on the texture stack, and even though it wasn't being drawn, glMaterialfv was blending with it. |
272,159 | <p>I have the following one route, registered in my global.asax.</p>
<pre><code>routes.MapRoute(
"Home", // Unique name
"", // Root url
new { controller = "Home", action = "Index",
tag = string.Empty, page = 1 }
);
</code></pre>
<p>kewl. when I start the site, it correctly picks up this route.</p... | [
{
"answer_id": 272527,
"author": "Torkel",
"author_id": 24425,
"author_profile": "https://Stackoverflow.com/users/24425",
"pm_score": 2,
"selected": true,
"text": "<p>Well the reason it returns null is because there is no route with a \"page\" route data. </p>\n\n<p>Could you expand a li... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30674/"
] | I have the following one route, registered in my global.asax.
```
routes.MapRoute(
"Home", // Unique name
"", // Root url
new { controller = "Home", action = "Index",
tag = string.Empty, page = 1 }
);
```
kewl. when I start the site, it correctly picks up this route.
Now, when I try to programm... | Well the reason it returns null is because there is no route with a "page" route data.
Could you expand a little bit on what you are trying to achieve? If you want to redirect to a page with the url /page/2 or /?page=2 , then you should be using RedirectToRoute or RedirectToAction:
```
return RedirectToRoute("Index... |
272,161 | <p>When I write code like this in VS 2008:<br><br></p>
<pre><code>.h
struct Patterns {
string ptCreate;
string ptDelete;
string ptDrop;
string ptUpdate;
string ptInsert;
string ptSelect;
};
class QueryValidate {
string query;
string pattern;
static ... | [
{
"answer_id": 272240,
"author": "Pieter",
"author_id": 5822,
"author_profile": "https://Stackoverflow.com/users/5822",
"pm_score": 4,
"selected": true,
"text": "<p>You're trying to create a non-static member (ptCreate) of a static member (pts). This won't work like this.</p>\n\n<p>You g... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28298/"
] | When I write code like this in VS 2008:
```
.h
struct Patterns {
string ptCreate;
string ptDelete;
string ptDrop;
string ptUpdate;
string ptInsert;
string ptSelect;
};
class QueryValidate {
string query;
string pattern;
static Patterns pts;
public... | You're trying to create a non-static member (ptCreate) of a static member (pts). This won't work like this.
You got two options, either use a struct initializer list for the Patterns class.
```
Patterns QueryValidate::pts = {"CREATE", "DELETE"}; // etc. for every string
```
Or, much safer (and better in my opinion)... |
272,190 | <p>I basically created some tables to play around with: I have Two main tables, and a Many-Many join table. Here is the DDL: (I am using HSQLDB)</p>
<pre><code>CREATE TABLE PERSON
(
PERSON_ID INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
NAME VARCHAR(50), MAIN_PERSON_ID INTEGER
)
CREATE TABLE JOB
... | [
{
"answer_id": 272243,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 3,
"selected": true,
"text": "<p>I'm not following.</p>\n\n<p>You cannot delete <code>JOB</code> rows which have <code>JOB_PERSON</code> rows (even one... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272190",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33863/"
] | I basically created some tables to play around with: I have Two main tables, and a Many-Many join table. Here is the DDL: (I am using HSQLDB)
```
CREATE TABLE PERSON
(
PERSON_ID INTEGER GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
NAME VARCHAR(50), MAIN_PERSON_ID INTEGER
)
CREATE TABLE JOB
(
JOB_ID INTE... | I'm not following.
You cannot delete `JOB` rows which have `JOB_PERSON` rows (even one) because of your FK contraints. Thus there is no way to delete `JOB` rows based on `PERSON` rows.
`JOB_PERSON` rows have to be deleted before either a `JOB` or `PERSON` can be deleted.
If you want to delete all `JOB` rows with no ... |
272,199 | <p>I have a solution which contains many class libraries and an ASP .NET website which references those assemblies.</p>
<p>When I build the solution from within the IDE, all assemblies referenced by the website end up in the bin directory. Great!</p>
<p>When I use MsBuild from the command line, all the referenced ass... | [
{
"answer_id": 272296,
"author": "Rob",
"author_id": 2595,
"author_profile": "https://Stackoverflow.com/users/2595",
"pm_score": 0,
"selected": false,
"text": "<p>Which msbuild are you referencing? Is it the right one?</p>\n\n<p>I generally call like this (from a batch file):</p>\n\n<blo... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5449/"
] | I have a solution which contains many class libraries and an ASP .NET website which references those assemblies.
When I build the solution from within the IDE, all assemblies referenced by the website end up in the bin directory. Great!
When I use MsBuild from the command line, all the referenced assemblies are not c... | I have found various references to this problem scattered around the Net - and I've just come across it myself. Apparently MSBuild on the command line isn't as good at tracing chains of dependencies as the IDE is.
So as I understand it, if A depends on B which depends on C, The command line may not realize that A depe... |
272,203 | <p>I'm thinking of using PDO in all of my future webapp. Currently (using what I've learned from SO so far), what I have in my site to handle database connection is a Singleton class like this :</p>
<pre><code>class DB {
private static $instance = NULL;
private static $dsn = "mysql:host=localhost;dbname=... | [
{
"answer_id": 272274,
"author": "Noah Goodrich",
"author_id": 20178,
"author_profile": "https://Stackoverflow.com/users/20178",
"pm_score": 2,
"selected": false,
"text": "<p>A couple of caveats here are:</p>\n\n<ul>\n<li>This code is written to take several legacy issues into account su... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26721/"
] | I'm thinking of using PDO in all of my future webapp. Currently (using what I've learned from SO so far), what I have in my site to handle database connection is a Singleton class like this :
```
class DB {
private static $instance = NULL;
private static $dsn = "mysql:host=localhost;dbname=mydatabase;";
... | Your implementation is just fine, and it'll work perfectly well for most purposes.
It's not necessary to put every query inside a try/catch block, and in fact in most cases you actually don't want to. The reason for this is that if a query generates an exception, it's the result of a fatal problem like a syntax error ... |
272,210 | <p>What is the accepted practice for indenting SQL statements? For example, consider the following SQL statement:</p>
<pre><code>SELECT column1, column2
FROM table1
WHERE column3 IN
(
SELECT TOP(1) column4
FROM table2
INNER JOIN table3
ON table2.column1 = table3.column1
)
</code></pre>
<p>How should this be indented... | [
{
"answer_id": 272227,
"author": "LeppyR64",
"author_id": 16592,
"author_profile": "https://Stackoverflow.com/users/16592",
"pm_score": 4,
"selected": false,
"text": "<p>This is my personal method. Depending on the length of the join condition I sometimes indent it on the line below.</p... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35483/"
] | What is the accepted practice for indenting SQL statements? For example, consider the following SQL statement:
```
SELECT column1, column2
FROM table1
WHERE column3 IN
(
SELECT TOP(1) column4
FROM table2
INNER JOIN table3
ON table2.column1 = table3.column1
)
```
How should this be indented? Many thanks. | ```
SELECT column1
, column2
FROM table1
WHERE column3 IN
(
SELECT TOP(1) column4
FROM table2
INNER JOIN table3
ON table2.column1 = table3.column1
)
```
I like to have all **"," in front**, this way I never search them when an error at line X from the SQL editor.
---
### This is an example for ... |
272,254 | <p>This piece of T-SQL is deprecated in 2005:</p>
<pre><code>BACKUP LOG [DB_NAME] WITH TRUNCATE_ONLY
</code></pre>
<p>I don't need to keep a backup the log for my db - but I do not want the piece of code to stop working if we port to SQL2008 or successive versions in future.</p>
<p>Cheers</p>
| [
{
"answer_id": 272276,
"author": "Greg Smalter",
"author_id": 34290,
"author_profile": "https://Stackoverflow.com/users/34290",
"pm_score": 1,
"selected": false,
"text": "<p>If you change the recovery model of the database to Simple, I think it will stop forcing you to backup/truncate th... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311500/"
] | This piece of T-SQL is deprecated in 2005:
```
BACKUP LOG [DB_NAME] WITH TRUNCATE_ONLY
```
I don't need to keep a backup the log for my db - but I do not want the piece of code to stop working if we port to SQL2008 or successive versions in future.
Cheers | Switch the database recovery mode to SIMPLE, and then use DBCC SHRINKFILE. Then restore your original recovery mode. If your LOG file does not shrink, you might have uncommitted transactions. For more details, see Tibor's Karaszi's article on [shrinking](http://www.karaszi.com/SQLServer/info_dont_shrink.asp). |
272,270 | <pre><code> <object height="25" width="75" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" name="movie"/>
... | [
{
"answer_id": 272306,
"author": "pbrodka",
"author_id": 33093,
"author_profile": "https://Stackoverflow.com/users/33093",
"pm_score": 1,
"selected": false,
"text": "<p>I use function AC_FL_RunContent for embedding flash objects - it's good because it supports all browsers and is recomme... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272270",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] | ```
<object height="25" width="75" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">
<param value="http://click-here-to-listen.com/players/iaPlay13.swf?x=1058286910FTRZGK" name="movie"/>
<param value="... | You can nest object elements to display alternatives. The W3C explains it [here](http://www.w3.org/TR/html401/struct/objects.html#h-13.3). I copied a snippet below:
>
> One significant consequence of the OBJECT element's design is that it offers a mechanism for specifying alternate object renderings; each embedded OB... |
272,313 | <p>I have the requirement to support different Master pages on my application (ASP.NET MVC).
What is the recommended way to:</p>
<ol>
<li>Pass the master page name to the view from.</li>
<li>Store the master page (in session, or something) so it sticks during a user's visit.</li>
</ol>
| [
{
"answer_id": 272369,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>you could throw the master page name into the session, but sessions are unreliable. i'd recommend throwing it in a db inst... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7277/"
] | I have the requirement to support different Master pages on my application (ASP.NET MVC).
What is the recommended way to:
1. Pass the master page name to the view from.
2. Store the master page (in session, or something) so it sticks during a user's visit. | Use a custom base controller and inherit from it instead:
```
Public Class CustomBaseController
Inherits System.Web.Mvc.Controller
Protected Overrides Function View(ByVal viewName As String, ByVal masterName As String, ByVal model As Object) As System.Web.Mvc.ViewResult
Return MyBase.View(viewName, Se... |
272,338 | <p>I am developing a small ASP.NET website for online shopping, when testing it out in Visual Studio, everything works fine, however that is no longer the case when I deploy it to IIS.</p>
<p>The problem seems to be in a DLL file that I reference, this DLL file contains the Classes I need to initialize and send query ... | [
{
"answer_id": 272347,
"author": "Ben Scheirman",
"author_id": 3381,
"author_profile": "https://Stackoverflow.com/users/3381",
"pm_score": 0,
"selected": false,
"text": "<p>What is fulfiller.Initialize() doing? Can you post that code?</p>\n\n<p>Clearly you have a fulfiller reference, be... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am developing a small ASP.NET website for online shopping, when testing it out in Visual Studio, everything works fine, however that is no longer the case when I deploy it to IIS.
The problem seems to be in a DLL file that I reference, this DLL file contains the Classes I need to initialize and send query requests t... | Usually, when something that works on the dev sever doesn't work on IIS, the problem is authorizations (the VS server runs under your credentials, but IIS runs as "Network Service" or another system user).
For example, I see your code breaks on fulfiller.toLog().
Could it be that the toLog() function is trying to ope... |
272,360 | <p>If so, does it effectively deprecate the <code>visibility</code> property?</p>
<p>(I realize that Internet Explorer does not yet support this CSS2 property.)
<br/>
<a href="http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)#Properties" rel="noreferrer">Comparisons of layout engines</a></p>
<p><a href=... | [
{
"answer_id": 272371,
"author": "philnash",
"author_id": 28376,
"author_profile": "https://Stackoverflow.com/users/28376",
"pm_score": 3,
"selected": false,
"text": "<p>I'm not entirely sure of this, but I think screen readers don't read things that are set to visibility hidden, but the... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14749/"
] | If so, does it effectively deprecate the `visibility` property?
(I realize that Internet Explorer does not yet support this CSS2 property.)
[Comparisons of layout engines](http://en.wikipedia.org/wiki/Comparison_of_layout_engines_(CSS)#Properties)
[See also: What is the difference between visibility:hidden and displ... | Here is a compilation of verified information from the various answers.
Each of these CSS properties is unique. In addition to rendering an element not visible, they have the following additional effect(s):
1. **Collapses** the space that the element would normally occupy
2. Responds to **events** (e.g., click, keypr... |
272,361 | <p>I wrote a PHP code like this</p>
<pre><code>$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
</code></pre>
<p>But when I remove "http://" from <code>$site</code> I get the following warning:</p>
<blockquote>
<p>Warning:
file_get_contents(www.google.com)
[function.file-get-co... | [
{
"answer_id": 272373,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 5,
"selected": false,
"text": "<p>You can prepend an @:\n<code>$content = @file_get_contents($site);</code></p>\n\n<p>This will supress any warning - <b>use... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22634/"
] | I wrote a PHP code like this
```
$site="http://www.google.com";
$content = file_get_content($site);
echo $content;
```
But when I remove "http://" from `$site` I get the following warning:
>
> Warning:
> file\_get\_contents(www.google.com)
> [function.file-get-contents]: failed
> to open stream:
>
>
>
I tri... | Step 1: check the return code: `if($content === FALSE) { // handle error here... }`
Step 2: suppress the warning by putting an [error control operator](http://php.net/manual/en/language.operators.errorcontrol.php) (i.e. `@`) in front of the call to *file\_get\_contents()*:
`$content = @file_get_contents($site);` |
272,368 | <p>If I have a method with a parameter that's an interface, whats the fasts way to see if the interface's reference is of a specific generic type?</p>
<p>More specifically, if I have:</p>
<pre><code>interface IVehicle{}
class Car<T> : IVehicle {}
CheckType(IVehicle param)
{
// How do I check that param is... | [
{
"answer_id": 272393,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "<p>To check if param is a <code>Car<int></code> you can use \"is\" and \"as\" as normal:</p>\n\n<pre><code>CheckTyp... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272368",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1946/"
] | If I have a method with a parameter that's an interface, whats the fasts way to see if the interface's reference is of a specific generic type?
More specifically, if I have:
```
interface IVehicle{}
class Car<T> : IVehicle {}
CheckType(IVehicle param)
{
// How do I check that param is Car<int>?
}
```
I'm also... | To check if param is a `Car<int>` you can use "is" and "as" as normal:
```
CheckType(IVehicle param)
{
Car<int> car = param as Car<int>;
if (car != null)
{
...
}
}
``` |
272,387 | <p>In SQL Server 2005, I want to print out a blank line with the PRINT statement, however, when I run</p>
<pre><code>PRINT ''
</code></pre>
<p>it actually prints a line with a single space.</p>
<p>Does anyone know if it's possible to just print a blank line without the space?</p>
<p>If I print a new line character,... | [
{
"answer_id": 272404,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 0,
"selected": false,
"text": "<p>AFAIK there is no way around this, it is the way the print statement works</p>\n"
},
{
"answer_id": 272... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In SQL Server 2005, I want to print out a blank line with the PRINT statement, however, when I run
```
PRINT ''
```
it actually prints a line with a single space.
Does anyone know if it's possible to just print a blank line without the space?
If I print a new line character, it doesn't print a space, but I end up ... | You could just add a newline on your previous print statement, if you have one.
Instead of:
```
PRINT 'BLABLABLA'
PRINT ''
```
You could write:
```
PRINT 'BLABLABLA
' <- the string finishes here!
``` |
272,412 | <p>i want something like this</p>
<ol>
<li><p>the user enter a website link</p></li>
<li><p>i need check the link if the link
doesn't start with 'http://' I want
to append 'http://' to the link .</p></li>
</ol>
<p>how can I do that in PHP ? </p>
| [
{
"answer_id": 272421,
"author": "Tom Haigh",
"author_id": 22224,
"author_profile": "https://Stackoverflow.com/users/22224",
"pm_score": 5,
"selected": true,
"text": "<pre><code>if (stripos($url, 'http://') !== 0) {\n $url = 'http://' . $url;\n}\n</code></pre>\n"
},
{
"answer_i... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22634/"
] | i want something like this
1. the user enter a website link
2. i need check the link if the link
doesn't start with 'http://' I want
to append 'http://' to the link .
how can I do that in PHP ? | ```
if (stripos($url, 'http://') !== 0) {
$url = 'http://' . $url;
}
``` |
272,429 | <p>I have 4 different named instances of SQL Server 2005 on a single server (for testing purposes). There is no default instance on the server.</p>
<p>Because I will eventually need to allow communication to these instances across the firewall, I have set the ports of each instance statically listening on all IPs for ... | [
{
"answer_id": 272449,
"author": "DCNYAM",
"author_id": 30419,
"author_profile": "https://Stackoverflow.com/users/30419",
"pm_score": 0,
"selected": false,
"text": "<p>Try enabling TCP/IP communication to the SQL server instances. If you are eventually going to be traversing a firewall,... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272429",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24954/"
] | I have 4 different named instances of SQL Server 2005 on a single server (for testing purposes). There is no default instance on the server.
Because I will eventually need to allow communication to these instances across the firewall, I have set the ports of each instance statically listening on all IPs for the server... | >
> The first thing to do would be to try
> adding the prefix np: or tcp: (for
> either Named Pipes or TCP/IP) before
> the name of the server. For tcp/ip,
> you can also try adding the port
> number (,1433) after the name of the
> server. If this is not the default
> instance, you must add the name of the
> i... |
272,433 | <p>Some programs read the company name that you entered when Windows was installed and display it in the program. How is this done? Are they simply reading the name from the registry?</p>
| [
{
"answer_id": 272496,
"author": "Stefan",
"author_id": 19307,
"author_profile": "https://Stackoverflow.com/users/19307",
"pm_score": 1,
"selected": false,
"text": "<p>Check the API SystemParametersInfo and a constant named SPI_GETOEMINFO </p>\n\n<pre><code>int details = SystemParameters... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272433",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Some programs read the company name that you entered when Windows was installed and display it in the program. How is this done? Are they simply reading the name from the registry? | If you want the registered company name as entered in the registry, you can get it from:
```
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization
```
Using the Registry class you can do something along these lines:
```
string org = (string)Microsoft.Win32.Registry.GetValue(@"HKEY_L... |
272,438 | <p>Suppose I create a table in Postgresql with a comment on a column:</p>
<pre><code>create table t1 (
c1 varchar(10)
);
comment on column t1.c1 is 'foo';
</code></pre>
<p>Some time later, I decide to add another column:</p>
<pre><code>alter table t1 add column c2 varchar(20);
</code></pre>
<p>I want to look up ... | [
{
"answer_id": 272525,
"author": "kasperjj",
"author_id": 34240,
"author_profile": "https://Stackoverflow.com/users/34240",
"pm_score": 1,
"selected": false,
"text": "<p>You can retrieve comments on columns using the system function col_description(table_oid, column_number). See <a href=... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18625/"
] | Suppose I create a table in Postgresql with a comment on a column:
```
create table t1 (
c1 varchar(10)
);
comment on column t1.c1 is 'foo';
```
Some time later, I decide to add another column:
```
alter table t1 add column c2 varchar(20);
```
I want to look up the comment contents of the first column, and ass... | The next thing to know is how to obtain the table oid. I think that using this as part of comment on will not work, as you suspect.
```
postgres=# create table comtest1 (id int, val varchar);
CREATE TABLE
postgres=# insert into comtest1 values (1,'a');
INSERT 0 1
postgres=# select distinct tableoi... |
272,454 | <p><a href="http://localhost:50034/Admin/Delete/723" rel="nofollow noreferrer">http://localhost:50034/Admin/Delete/723</a></p>
<p>Always needs this parameter to perform the action, however, if you go to the URL without the parameter, an exception occurs. How do you handle this and redirect back to the main page withou... | [
{
"answer_id": 272472,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<pre><code>public ActionResult Details(int? Id)\n{\n if (Id == null)\n return RedirectToAction(\"Index\");\n ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | <http://localhost:50034/Admin/Delete/723>
Always needs this parameter to perform the action, however, if you go to the URL without the parameter, an exception occurs. How do you handle this and redirect back to the main page without doing anything?
Thanks. | I am not sure what you mean, do you mean that the url <http://localhost:50034/Admin/Delete/> is generating an exception?
Try setting the id parameter as nullable, like this:
```
public class MyController : Controller
{
public void Delete(int? id)
{
if (!id.HasValue)
{
return RedirectToAction("Index... |
272,457 | <p>I'm looking into tightening up our ad code by moving it to an external jQuery script, but I obviously still need some HTML to target the ad to. So I was wondering if I can target a noscript element (or within a noscript element) since I'm going to have to leave that on the page anyway, or if I need to have some othe... | [
{
"answer_id": 272460,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 1,
"selected": false,
"text": "<p>If the browser has javascript enabled, the content inside the no-script element is NOT displayed.</p>\n\n<p>You... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16124/"
] | I'm looking into tightening up our ad code by moving it to an external jQuery script, but I obviously still need some HTML to target the ad to. So I was wondering if I can target a noscript element (or within a noscript element) since I'm going to have to leave that on the page anyway, or if I need to have some other e... | `<noscript>` content is not only not displayed when JS is active, it apparently is also not in the DOM. I tried accessing content inside a `<noscript>` area (hoping you could `clone()` it with jQuery and insert it somewhere else) but got back nothing. |
272,458 | <p>I want my validation.xml to only check for a null if certain options are selected from a dropdown. So far I have</p>
<pre><code><field property="empFDServiceStartDate" depends="requiredif, date">
<arg0 key="Service Start date" resource="false"/>
<var>
<var-name&g... | [
{
"answer_id": 272495,
"author": "Fred",
"author_id": 33630,
"author_profile": "https://Stackoverflow.com/users/33630",
"pm_score": 0,
"selected": false,
"text": "<p>If you want to check the field if moverChangeType equals \"Conversion\" try this...</p>\n\n<pre><code><field property=\... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want my validation.xml to only check for a null if certain options are selected from a dropdown. So far I have
```
<field property="empFDServiceStartDate" depends="requiredif, date">
<arg0 key="Service Start date" resource="false"/>
<var>
<var-name>field[0]</var-name>
... | You can do this multiple test in the same test, like this:
```
<field property="empFDServiceStartDate" depends="requiredif, date">
<arg0 key="Service Start date" resource="false"/>
<var>
<var-name>test</var-name>
<var-value>((moverChangeType == "Conversion") or (moverChangeType == "SomethingElse"))... |
272,459 | <p>I wonder if there is a way to set the value of #define in run time.</p>
<p>I assume that there is a query for Oracle specific and Sql Server specific at the code below.</p>
<pre><code>#define oracle
// ...
#if oracle
// some code
#else
// some different code.
#endif
</code></pre>
| [
{
"answer_id": 272475,
"author": "Ana Betts",
"author_id": 5728,
"author_profile": "https://Stackoverflow.com/users/5728",
"pm_score": 5,
"selected": true,
"text": "<p>Absolutely not, #defines are compiled out by the preprocessor before the compiler even sees it - so the token 'oracle' i... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4215/"
] | I wonder if there is a way to set the value of #define in run time.
I assume that there is a query for Oracle specific and Sql Server specific at the code below.
```
#define oracle
// ...
#if oracle
// some code
#else
// some different code.
#endif
``` | Absolutely not, #defines are compiled out by the preprocessor before the compiler even sees it - so the token 'oracle' isn't even in your code, just '1' or '0'. Change the #define to a global variable or (better) a function that returns the correct value. |
272,469 | <p>I have the following database table created thus:</p>
<pre><code>CREATE TABLE AUCTIONS (
ARTICLE_NO VARCHAR(20),
ARTICLE_NAME VARCHAR(100),
SUBTITLE VARCHAR(20),
CURRENT_BID DECIMAL(5,2),
START_PRICE DECIMAL(5,2),
BID_COUNT VARCHAR(20),
QUANT_TOTAL VARCHAR(20),
QUANT... | [
{
"answer_id": 272487,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 2,
"selected": true,
"text": "<p>You have a space after 46.44, not a tab,</p>\n"
},
{
"answer_id": 272494,
"author": "kasperjj",
"author_id"... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272469",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have the following database table created thus:
```
CREATE TABLE AUCTIONS (
ARTICLE_NO VARCHAR(20),
ARTICLE_NAME VARCHAR(100),
SUBTITLE VARCHAR(20),
CURRENT_BID DECIMAL(5,2),
START_PRICE DECIMAL(5,2),
BID_COUNT VARCHAR(20),
QUANT_TOTAL VARCHAR(20),
QUANT_SOLD VAR... | You have a space after 46.44, not a tab, |
272,504 | <p>I am using the following code fragment in a php script to safely update a shared resource. </p>
<pre><code>$lock_id = sem_get( ftok( 'tmp/this.lock', 'r'));
sem_acquire($lock_id)
//do something
sem_release($lock_id)
</code></pre>
<p>When I stress test this code with large number of requests I get an error:</p>
<p... | [
{
"answer_id": 272616,
"author": "bog",
"author_id": 20909,
"author_profile": "https://Stackoverflow.com/users/20909",
"pm_score": 2,
"selected": true,
"text": "<p>I wouldn't ignore the ENOSPC (you're getting something other than EINTR, as the code shows). You may end up in a busy loop ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25453/"
] | I am using the following code fragment in a php script to safely update a shared resource.
```
$lock_id = sem_get( ftok( 'tmp/this.lock', 'r'));
sem_acquire($lock_id)
//do something
sem_release($lock_id)
```
When I stress test this code with large number of requests I get an error:
```
Warning: semop() failed acqu... | I wouldn't ignore the ENOSPC (you're getting something other than EINTR, as the code shows). You may end up in a busy loop waiting for a resource that you have earlier exhausted. If you're out of some space somewhere, you want to make sure that you deal with that issue. ENOSPC generally means you are out of...something... |
272,509 | <p>I want to explicitly call a view from my controller.</p>
<p>Right now I have:</p>
<pre><code>def some_action
.. do something ...
respond_to do |format|
format.xml
end
end
</code></pre>
<p>... then it calls my some_action.xml.builder view. How can I call some other view? Is there a parameter in respond... | [
{
"answer_id": 272559,
"author": "Gabe Hollombe",
"author_id": 30632,
"author_profile": "https://Stackoverflow.com/users/30632",
"pm_score": 4,
"selected": false,
"text": "<p>See the <a href=\"http://api.rubyonrails.org/classes/ActionController/Base.html#M000474\" rel=\"noreferrer\">Rend... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10333/"
] | I want to explicitly call a view from my controller.
Right now I have:
```
def some_action
.. do something ...
respond_to do |format|
format.xml
end
end
```
... then it calls my some\_action.xml.builder view. How can I call some other view? Is there a parameter in respond\_to I'm missing?
Thanks,
JP | You could do something like the following using render:
```
respond_to do |format|
format.html { render :template => "weblog/show" }
end
``` |
272,511 | <p>Is it possible to write a GUI from inside a function?</p>
<p>The problem is that the callback of all GUI-functions are evaluated in the global workspace. But functions have their own workspace and can not access variables in the global workspace. Is it possible to make the GUI-functions use the workspace of the fun... | [
{
"answer_id": 272579,
"author": "Ian Hopkinson",
"author_id": 19172,
"author_profile": "https://Stackoverflow.com/users/19172",
"pm_score": 1,
"selected": false,
"text": "<p>You can declare a variable global in your function and global in the GUI code, certainly if the callback is in a ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1034/"
] | Is it possible to write a GUI from inside a function?
The problem is that the callback of all GUI-functions are evaluated in the global workspace. But functions have their own workspace and can not access variables in the global workspace. Is it possible to make the GUI-functions use the workspace of the function? For... | There are a number of ways to [build a GUI](https://www.mathworks.com/help/matlab/creating_guis/ways-to-build-matlab-guis.html), such as using the App Designer, GUIDE, or creating it programmatically (I'll illustrate this option below). It's also important to be aware of the [different ways to define callback functions... |
272,518 | <p>When I do a ReadLinesFromFile on a file in MSBUILD and go to output that file again, I get all the text on one line. All the Carriage returns and LineFeeds are stripped out.</p>
<pre><code><Project DefaultTargets = "Deploy"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<Import Project="$(M... | [
{
"answer_id": 274720,
"author": "Todd",
"author_id": 31940,
"author_profile": "https://Stackoverflow.com/users/31940",
"pm_score": 6,
"selected": true,
"text": "<p>The problem here is you are using the <code>ReadLinesFromFile</code> task in a manner it wasn't intended.</p>\n\n<blockquot... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272518",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2806/"
] | When I do a ReadLinesFromFile on a file in MSBUILD and go to output that file again, I get all the text on one line. All the Carriage returns and LineFeeds are stripped out.
```
<Project DefaultTargets = "Deploy"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003" >
<Import Project="$(MSBuildExtensionsPath)\M... | The problem here is you are using the `ReadLinesFromFile` task in a manner it wasn't intended.
>
> **ReadLinesFromFile Task**
>
> Reads a list of *items* from a text file.
>
>
>
So it's not just reading all the text from a file, it's reading individual items from a file and returning an item group of ITaskIte... |
272,523 | <p>I am using winsock and C++ to set up a server application. The problem I'm having is that the call to <code>listen</code> results in a first chance exception. I guess normally these can be ignored (?) but I've found others having the same issue I am where it causes the application to hang every once in a while. A... | [
{
"answer_id": 272668,
"author": "Harper Shelby",
"author_id": 21196,
"author_profile": "https://Stackoverflow.com/users/21196",
"pm_score": 0,
"selected": false,
"text": "<p>This won't answer your question directly, but since you're using C++, I would recommend using something like <a h... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34731/"
] | I am using winsock and C++ to set up a server application. The problem I'm having is that the call to `listen` results in a first chance exception. I guess normally these can be ignored (?) but I've found others having the same issue I am where it causes the application to hang every once in a while. Any help would be ... | On a very busy server, you may be running out of Sockets. You may have to adjust some TCPIP parameters. Adjust these two in the registry:
```
HKLM\System\CurrentControlSet\Services\Tcpip\Parameters
MaxUserPort REG_DWORD 65534 (decimal)
TcpTimedWaitDelay REG_DWORD 60 (decimal)
```
By default, there's a few mi... |
272,528 | <p>I was thinking of adding some <strong>Achievements</strong> to our internal bug-tracking and time logging system. It's connected to an SQL Server back-end.</p>
<p>At first I thought that the system could be run on the database, using triggers to, for example, know when:</p>
<ul>
<li>you've logged 1000 hours</li>
<... | [
{
"answer_id": 272542,
"author": "Loki",
"author_id": 17324,
"author_profile": "https://Stackoverflow.com/users/17324",
"pm_score": 1,
"selected": false,
"text": "<p>The backend achievements should be simple - they seem to be based on already tracked items. The front end, as you correct... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12597/"
] | I was thinking of adding some **Achievements** to our internal bug-tracking and time logging system. It's connected to an SQL Server back-end.
At first I thought that the system could be run on the database, using triggers to, for example, know when:
* you've logged 1000 hours
* created 1000 tickets
* closed your own... | The trick isn't the coding of the rules, really, those are straightforward, and can perhaps be simple expressions (number\_of\_bugs > 1000).
The trick is accumulating the statistics. You should look at a form of Event Stream Processing to record your achievements. For example, you don't really want to implement the "1... |
272,541 | <p>Is it possible to disable AJAX without disabling JavaScript completely? </p>
| [
{
"answer_id": 272558,
"author": "Jonathan Adelson",
"author_id": 8092,
"author_profile": "https://Stackoverflow.com/users/8092",
"pm_score": -1,
"selected": false,
"text": "<p>No. AJAX is just a particular use of javascript.</p>\n\n<p>If you could block the particular function call back... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18196/"
] | Is it possible to disable AJAX without disabling JavaScript completely? | If you are using Firefox, you could accomplish this with GreaseMonkey. (<https://addons.mozilla.org/en-US/firefox/addon/748>)
GM is a framework for applying scripts to some or all of the pages you visit. I have GM scripts that disable google-analytics downloads (because they slow things down), and which disable google... |
272,544 | <p>I'm reading Erica Sadun's <em>iPhone Developer's Cookbook</em>, and ran into a question.</p>
<p>She says in the book that the way to find the user's Documents directory is with the code:</p>
<pre><code>[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
</code></pre>
<p>but that seems slightly brittl... | [
{
"answer_id": 272677,
"author": "Ben Gottlieb",
"author_id": 6694,
"author_profile": "https://Stackoverflow.com/users/6694",
"pm_score": 8,
"selected": true,
"text": "<p>Objc:</p>\n\n<pre><code>NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, Y... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272544",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/735/"
] | I'm reading Erica Sadun's *iPhone Developer's Cookbook*, and ran into a question.
She says in the book that the way to find the user's Documents directory is with the code:
```
[NSHomeDirectory() stringByAppendingPathComponent:@"Documents"];
```
but that seems slightly brittle, and dissimiliar to the normal Mac way... | Objc:
```
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)
```
Swift:
```
var paths = NSSearchPathForDirectoriesInDomains(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomainMask.UserDomainMask, true)
```
You'll want the first element of the returned array. |
272,577 | <p>Wanting to build and test a bunch of Borland Delphi 6 projects that are integrated with ASP.NET services. Had been using WANT and CruiseControl for building Delphi. With TFS Build agent we can tie all together and do some testing. I am looking for guidance and direction. </p>
<p>One issue I see is that there is ... | [
{
"answer_id": 272614,
"author": "kasperjj",
"author_id": 34240,
"author_profile": "https://Stackoverflow.com/users/34240",
"pm_score": 1,
"selected": false,
"text": "<p>No.. lightroom plugins are written in the scripting language lua, photoshop plugins are written in C++.</p>\n"
},
... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272577",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35527/"
] | Wanting to build and test a bunch of Borland Delphi 6 projects that are integrated with ASP.NET services. Had been using WANT and CruiseControl for building Delphi. With TFS Build agent we can tie all together and do some testing. I am looking for guidance and direction.
One issue I see is that there is no "solution"... | No.. lightroom plugins are written in the scripting language lua, photoshop plugins are written in C++. |
272,584 | <p>I have a UITableView cell that is going to have a variable size depending on it's content (potentially several lines of text). </p>
<p>SInce it appears that heightForRowAtIndexPath is called <em>before</em> I layout the cell, I just guess the correct height by calling [NSString sizeWithFont] on my text string. Is t... | [
{
"answer_id": 273008,
"author": "Olie",
"author_id": 34820,
"author_profile": "https://Stackoverflow.com/users/34820",
"pm_score": 4,
"selected": true,
"text": "<p>It's going to sound dumb, but ...uh... \"layout your cell before you exit heightForRowAtIndexPath\" ;)</p>\n\n<p>Seriously... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272584",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1967/"
] | I have a UITableView cell that is going to have a variable size depending on it's content (potentially several lines of text).
SInce it appears that heightForRowAtIndexPath is called *before* I layout the cell, I just guess the correct height by calling [NSString sizeWithFont] on my text string. Is there a better way... | It's going to sound dumb, but ...uh... "layout your cell before you exit heightForRowAtIndexPath" ;)
Seriously, though -- the OS only ever calls this if it's going to be needed (as in: it's about to create the cell & display it on screen), so laying it out & getting ready to display is not wasted effort.
Note, you do... |
272,590 | <p>We are developing a WPF application that uses the System.AddIn framework to host add-ins that display additional WPF content. Everything seems to be working fine, but overnight, the application threw the following NullReferenceException:</p>
<pre>
Message: Error : Object reference not set to an instance of an obje... | [
{
"answer_id": 273008,
"author": "Olie",
"author_id": 34820,
"author_profile": "https://Stackoverflow.com/users/34820",
"pm_score": 4,
"selected": true,
"text": "<p>It's going to sound dumb, but ...uh... \"layout your cell before you exit heightForRowAtIndexPath\" ;)</p>\n\n<p>Seriously... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272590",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9268/"
] | We are developing a WPF application that uses the System.AddIn framework to host add-ins that display additional WPF content. Everything seems to be working fine, but overnight, the application threw the following NullReferenceException:
```
Message: Error : Object reference not set to an instance of an object.
Stack... | It's going to sound dumb, but ...uh... "layout your cell before you exit heightForRowAtIndexPath" ;)
Seriously, though -- the OS only ever calls this if it's going to be needed (as in: it's about to create the cell & display it on screen), so laying it out & getting ready to display is not wasted effort.
Note, you do... |
272,607 | <p>Is there a way to pre-compute an array of values based on templates? In the following example I would like the 'powers_of_2' array to have 256 values computed at compile-time if that is possible without having to type all of the values.</p>
<pre><code>#include <iostream>
using namespace std;
template <in... | [
{
"answer_id": 272615,
"author": "Loki",
"author_id": 17324,
"author_profile": "https://Stackoverflow.com/users/17324",
"pm_score": 1,
"selected": false,
"text": "<p>That is exactly what a macro is useful for...</p>\n"
},
{
"answer_id": 272622,
"author": "grieve",
"author... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4778/"
] | Is there a way to pre-compute an array of values based on templates? In the following example I would like the 'powers\_of\_2' array to have 256 values computed at compile-time if that is possible without having to type all of the values.
```
#include <iostream>
using namespace std;
template <int X, char Y>
struct po... | Unless you plan on using a big integer package you will overflow the integer type at 2^32 (or 2^64, depending), but to answer your real question look at this wikipedia article on [template metaprogramming](http://en.wikipedia.org/wiki/Template_metaprogramming). |
272,618 | <p>I've created a MATLAB class, something like:</p>
<pre><code>classdef myclass
properties
x_array = [];
end
methods
function increment(obj,value)
obj.x_array = [obj.x_array ; value);
end
end
end
</code></pre>
<p>The problem is, the property <code>x_array</code> is never modified when I... | [
{
"answer_id": 272920,
"author": "Azim J",
"author_id": 4612,
"author_profile": "https://Stackoverflow.com/users/4612",
"pm_score": 5,
"selected": false,
"text": "<p>This is similar to <a href=\"https://stackoverflow.com/questions/209005/object-oriented-matlab-properties\">this question<... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34830/"
] | I've created a MATLAB class, something like:
```
classdef myclass
properties
x_array = [];
end
methods
function increment(obj,value)
obj.x_array = [obj.x_array ; value);
end
end
end
```
The problem is, the property `x_array` is never modified when I invoke the `increment()` function:
e... | This is similar to [this question](https://stackoverflow.com/questions/209005/object-oriented-matlab-properties). In short all you should have to do is inherit from handle class.
Quick example
Contents of file myclass.m
```
classdef myclass<handle
properties
x_array = []
end
methods
func... |
272,620 | <p>I am trying to setup a WCF service with multiple endpoints with one of the endpoints using the enableWebScript endpoint behavior so that a Javascript proxy will be created on the client (jsdebug/js).</p>
<p>When adding the Service Reference to my AJAX ScriptManager, the jsdebug file is not found unless the address ... | [
{
"answer_id": 692198,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 2,
"selected": false,
"text": "<p><code><enableWebScript /></code> also known as AJAX-enabled endpoints essentially hard-codes everything to do... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24188/"
] | I am trying to setup a WCF service with multiple endpoints with one of the endpoints using the enableWebScript endpoint behavior so that a Javascript proxy will be created on the client (jsdebug/js).
When adding the Service Reference to my AJAX ScriptManager, the jsdebug file is not found unless the address of the end... | `<enableWebScript />` also known as AJAX-enabled endpoints essentially hard-codes everything to do with address so you can generate the client-side code.
The way it's hard-coded is that everything is directly relative to the .svc file.
See [How to: Use Configuration to Add an ASP.NET AJAX Endpoint](http://msdn.micros... |
272,633 | <p>Given the string "ThisStringHasNoSpacesButItDoesHaveCapitals" what is the best way to add spaces before the capital letters. So the end string would be "This String Has No Spaces But It Does Have Capitals"</p>
<p>Here is my attempt with a RegEx</p>
<pre><code>System.Text.RegularExpressions.Regex.Replace(value, "[A... | [
{
"answer_id": 272666,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 2,
"selected": false,
"text": "<p>What you have works perfectly. Just remember to reassign <code>value</code> to the return value of this function... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45/"
] | Given the string "ThisStringHasNoSpacesButItDoesHaveCapitals" what is the best way to add spaces before the capital letters. So the end string would be "This String Has No Spaces But It Does Have Capitals"
Here is my attempt with a RegEx
```
System.Text.RegularExpressions.Regex.Replace(value, "[A-Z]", " $0")
``` | The regexes will work fine (I even voted up Martin Browns answer), but they are expensive (and personally I find any pattern longer than a couple of characters prohibitively obtuse)
This function
```
string AddSpacesToSentence(string text, bool preserveAcronyms)
{
if (string.IsNullOrWhiteSpace(text))
... |
272,635 | <p>I'm doing some shennanigans with jQuery to put little plus/minus icons next to my expanders. Its similar to the windows file trees, or firebugs code expanders.</p>
<p>It works, but its not specific enough. </p>
<p>Hopefully this makes sense...</p>
<pre><code>$('div.toggle').hide();//hide all divs that are part ... | [
{
"answer_id": 272711,
"author": "Nathan Long",
"author_id": 4376,
"author_profile": "https://Stackoverflow.com/users/4376",
"pm_score": 1,
"selected": false,
"text": "<p>Have you tried the .siblings() method?</p>\n\n<pre><code>$(this).siblings('img.expander').attr('src','img/content/inf... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] | I'm doing some shennanigans with jQuery to put little plus/minus icons next to my expanders. Its similar to the windows file trees, or firebugs code expanders.
It works, but its not specific enough.
Hopefully this makes sense...
```
$('div.toggle').hide();//hide all divs that are part of the expand/collapse
$('ul.p... | ```
$(this).contents('img.expander')
```
This is what you want. It will select all of the nodes that are children of your list. In your case, all of your images are nested inside of the list element, so this will filter out only what you want. |
272,638 | <p>Below is what I'm trying to achieve. The problem is "errors" is not defined. If I remove my match logic, the errors are displayed on the web page. Is there anyway of evaluating the text the error contains?</p>
<pre><code><logic:messagesPresent>
<tr>
<td class="errorcicon"><img src="... | [
{
"answer_id": 272711,
"author": "Nathan Long",
"author_id": 4376,
"author_profile": "https://Stackoverflow.com/users/4376",
"pm_score": 1,
"selected": false,
"text": "<p>Have you tried the .siblings() method?</p>\n\n<pre><code>$(this).siblings('img.expander').attr('src','img/content/inf... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272638",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Below is what I'm trying to achieve. The problem is "errors" is not defined. If I remove my match logic, the errors are displayed on the web page. Is there anyway of evaluating the text the error contains?
```
<logic:messagesPresent>
<tr>
<td class="errorcicon"><img src="images/icon_caution.gif" width="18"... | ```
$(this).contents('img.expander')
```
This is what you want. It will select all of the nodes that are children of your list. In your case, all of your images are nested inside of the list element, so this will filter out only what you want. |
272,644 | <p>I have a class called <code>Ship</code> and a class called <code>Lifeboat</code></p>
<p>Lifeboat inherits from Ship.</p>
<p>Ship contains a method called <code>Validate()</code> which is called before save and it has an abstract method called <code>FurtherValidate()</code> which it calls from Validate. The reason ... | [
{
"answer_id": 272653,
"author": "Stephan Leclercq",
"author_id": 34838,
"author_profile": "https://Stackoverflow.com/users/34838",
"pm_score": 1,
"selected": false,
"text": "<p>Making it protected instead of public will at least prevent outside objects from calling it. </p>\n"
},
{
... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27412/"
] | I have a class called `Ship` and a class called `Lifeboat`
Lifeboat inherits from Ship.
Ship contains a method called `Validate()` which is called before save and it has an abstract method called `FurtherValidate()` which it calls from Validate. The reason this is in place is so when you call validate on the base it ... | The exact scenario you describe isn't possible. You can restrict access to the `FurtherValidate` method to only derived classes by using the `protected` access modifier. You could also restrict it to only classes in the same assembly by using the `internal` modifier, but this would still allow the programmer writing th... |
272,665 | <p>First of all, some background.</p>
<p>We have an order processing system, where staff enter billing data about orders in an app that stores it in a sql server 2000 database. This database isn't the real billing system: it's just a holding location so that the records can be run into a mainframe system via a nightl... | [
{
"answer_id": 272680,
"author": "kasperjj",
"author_id": 34240,
"author_profile": "https://Stackoverflow.com/users/34240",
"pm_score": 1,
"selected": false,
"text": "<p>Before you even start looking at changing your query, you should ensure that all tables have a clustered index that ma... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] | First of all, some background.
We have an order processing system, where staff enter billing data about orders in an app that stores it in a sql server 2000 database. This database isn't the real billing system: it's just a holding location so that the records can be run into a mainframe system via a nightly batch pro... | First off, you can get rid of the second LEFT JOIN.
Your WHERE was removing out any matches, anyhow... For instance, if S.OrderID was 1 and there was a R.OrderID with a value of 1, the IS NULL enforcement in the WHERE wouldn't allow it. So it'll only return records where s.OrderID IS NULL, if I'm reading it correctly.... |
272,674 | <p>I am looking for a data structure that operates similar to a hash table, but where the table has a size limit. When the number of items in the hash reaches the size limit, a culling function should be called to get rid of the least-retrieved key/value pairs in the table.</p>
<p>Here's some pseudocode of what I'm w... | [
{
"answer_id": 272675,
"author": "Marko",
"author_id": 31141,
"author_profile": "https://Stackoverflow.com/users/31141",
"pm_score": 0,
"selected": false,
"text": "<p>Take a look at <strong>WeakHashMap</strong></p>\n"
},
{
"answer_id": 272710,
"author": "kasperjj",
"autho... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272674",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18511/"
] | I am looking for a data structure that operates similar to a hash table, but where the table has a size limit. When the number of items in the hash reaches the size limit, a culling function should be called to get rid of the least-retrieved key/value pairs in the table.
Here's some pseudocode of what I'm working on:
... | You are looking for an `LRUList`/`Map`. Check out `LinkedHashMap`:
The `removeEldestEntry(Map.Entry)` method may be overridden to impose a policy for removing stale mappings automatically when new mappings are added to the map. |
272,694 | <p>I've got a strange problem with indexing PDF files in SQL Server 2005, and hope someone can help. My database has a table called MediaFile with the following fields - MediaFileId int identity pk, FileContent image, and FileExtension varchar(5). I've got my web application storing file contents in this table with no... | [
{
"answer_id": 282339,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>I've just struggled with it for an hour, but finally got it working. I did everything you did, so just try to simplify the ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/775/"
] | I've got a strange problem with indexing PDF files in SQL Server 2005, and hope someone can help. My database has a table called MediaFile with the following fields - MediaFileId int identity pk, FileContent image, and FileExtension varchar(5). I've got my web application storing file contents in this table with no pro... | Thanks Ivan. Managed to eventually get this working by starting everything from scratch. It seems like the order in which things are done makes a big difference, and the advice given on the linked blog to to turn off the 'load\_os\_resources' setting after loading the iFilter probably isn't the best option, as this wil... |
272,726 | <p>I have a Stored Procedure that is constantly failing with the error message "Timeout expired," on a specific user.</p>
<p>All other users are able to invoke the sp just fine, and even I am able to invoke the sp normally using the Query Analyzer--it finishes in just 10 seconds. However with the user in question, th... | [
{
"answer_id": 273172,
"author": "Chris Gillum",
"author_id": 2069,
"author_profile": "https://Stackoverflow.com/users/2069",
"pm_score": 0,
"selected": false,
"text": "<p>I think to answer your question, we may need a bit more information.</p>\n\n<p>For example, are you using Active dir... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12772/"
] | I have a Stored Procedure that is constantly failing with the error message "Timeout expired," on a specific user.
All other users are able to invoke the sp just fine, and even I am able to invoke the sp normally using the Query Analyzer--it finishes in just 10 seconds. However with the user in question, the logs show... | Some thoughts...
Reading the comments suggests that parameter sniffing is causing the issue.
* For the other users, the cached plan is good enough for the parameter that they send
* For this user, the cached plan is probably wrong
This could happen if this user has far more rows than other users, or has rows in anot... |
272,738 | <p>Is there any way of pulling in a CSS stylesheet into FireFox 2 or 3 that is not a static file? </p>
<p>Bellow is the code we are using to pull in a stylesheet dynamically generated by a CGI script.</p>
<pre><code><link rel="stylesheet" href="/cgi-bin/Xebra?ShowIt&s=LH4X6I2l4fSYwf4pky4k&shw=795430-0&am... | [
{
"answer_id": 272755,
"author": "scunliffe",
"author_id": 6144,
"author_profile": "https://Stackoverflow.com/users/6144",
"pm_score": 4,
"selected": true,
"text": "<p>Is the Content Type from the server the correct one for the file that is served up?</p>\n\n<pre><code>Content-type: text... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18149/"
] | Is there any way of pulling in a CSS stylesheet into FireFox 2 or 3 that is not a static file?
Bellow is the code we are using to pull in a stylesheet dynamically generated by a CGI script.
```
<link rel="stylesheet" href="/cgi-bin/Xebra?ShowIt&s=LH4X6I2l4fSYwf4pky4k&shw=795430-0&path=customer/DEMO/demo1.css" type="... | Is the Content Type from the server the correct one for the file that is served up?
```
Content-type: text/css
``` |
272,764 | <p>I want a small (< 30MB) standalone Windows executable (a single file) that creates a window which asks the user for the location of a directory and then launches a different program in that directory. </p>
<p>This executable has to run on XP, Vista, Server 2003, and Server 2008 versions of Windows in 32-bits an... | [
{
"answer_id": 272775,
"author": "Douglas Mayle",
"author_id": 8458,
"author_profile": "https://Stackoverflow.com/users/8458",
"pm_score": 2,
"selected": false,
"text": "<p>You could do this in MFC and have an executable in under 100k. In general, if you want to keep the size of your ex... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272764",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8344/"
] | I want a small (< 30MB) standalone Windows executable (a single file) that creates a window which asks the user for the location of a directory and then launches a different program in that directory.
This executable has to run on XP, Vista, Server 2003, and Server 2008 versions of Windows in 32-bits and 64 bits on x... | What about a WSH script? It won't be an exe, right, but to ask for a folder I don't see the need for an exe file, much less a 30Mb one...
A 1Kb script, save it as whatever name you like with vbs extension and run it. This, in case it's not clear, asks you for a folder name and then runs calc.exe from the system32 subd... |
272,765 | <p>I've created a c# webservice that allows our front end support teams to view and update a few selected Active Directory values using system.directoryservices</p>
<p>Fields that I want to update are [job] title, department, telephone and employeeid.</p>
<p>I can use a service account with "delegates rights" to upda... | [
{
"answer_id": 272777,
"author": "Guy",
"author_id": 993,
"author_profile": "https://Stackoverflow.com/users/993",
"pm_score": 0,
"selected": false,
"text": "<p>A sample of the code (the moving parts at least)</p>\n\n<pre><code>string distinguishedname = \"CN=Wicks\\, Guy,OU=Users,DC=ad,... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/993/"
] | I've created a c# webservice that allows our front end support teams to view and update a few selected Active Directory values using system.directoryservices
Fields that I want to update are [job] title, department, telephone and employeeid.
I can use a service account with "delegates rights" to update [job] title, d... | **ANSWER**
*The ADS\_SCHEMA\_ID\_GUID\_USER GUID allows you to update the base user class details, including the employee id*
[Based on MSDN article](http://www.microsoft.com/technet/scriptcenter/topics/security/exrights.mspx)
The vbscript used to grant to the service account user the selected delegated rights:
``... |
272,783 | <p>I have a delphi (Win32) web application that can run either as a CGI app, ISAPI or Apache DLL. I want to be able to generate a unique filename prefix (unique for all current requests at a given moment), and figure that the best way to do this would be to use processID (to handle CGI mode) as well as threadID (to han... | [
{
"answer_id": 272789,
"author": "Jamie",
"author_id": 922,
"author_profile": "https://Stackoverflow.com/users/922",
"pm_score": 2,
"selected": false,
"text": "<p>Could you not use a <a href=\"http://en.wikipedia.org/wiki/Globally_Unique_Identifier\" rel=\"nofollow noreferrer\">GUID</a> ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11820/"
] | I have a delphi (Win32) web application that can run either as a CGI app, ISAPI or Apache DLL. I want to be able to generate a unique filename prefix (unique for all current requests at a given moment), and figure that the best way to do this would be to use processID (to handle CGI mode) as well as threadID (to handle... | you have many good ideas presented here.
>
> Does it also create an empty file to "get a lock on" the name?
>
>
>
no; i believe we rely on Windows to ensure the same temp file name is never given twice on the same computer since boot time.
>
> is there *any* chance of a clash if there is a split second delay be... |
272,799 | <p>Is there a (portable) way to rotate text in a HTML table cell by 90°?</p>
<p>(I have a table with many columns and much text for the headings, so I'd like to write it vertically to save space.)</p>
| [
{
"answer_id": 272860,
"author": "Nathan Long",
"author_id": 4376,
"author_profile": "https://Stackoverflow.com/users/4376",
"pm_score": 5,
"selected": false,
"text": "<h2>Alternate Solution?</h2>\n<p>Instead of rotating the text, would it work to have it written "top to bottom?&quo... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272799",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23813/"
] | Is there a (portable) way to rotate text in a HTML table cell by 90°?
(I have a table with many columns and much text for the headings, so I'd like to write it vertically to save space.) | ```css
.box_rotate {
-moz-transform: rotate(7.5deg); /* FF3.5+ */
-o-transform: rotate(7.5deg); /* Opera 10.5 */
-webkit-transform: rotate(7.5deg); /* Saf3.1+, Chrome */
filter: progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083); /* IE6,IE7 */
-ms-filter: "progid:D... |
272,803 | <p>I have an interesting problem and would appreciate your thoughts for the best solution.
I need to parse a set of logs. The logs are produced by a multi-threaded program and a single process cycle produces several lines of logs.</p>
<p>When parsing these logs I need to pull out specific pieces of information from ea... | [
{
"answer_id": 272834,
"author": "kasperjj",
"author_id": 34240,
"author_profile": "https://Stackoverflow.com/users/34240",
"pm_score": 0,
"selected": false,
"text": "<p>You need to store lines temporarily in a queue where a single thread consumes them and passes them on once each set ha... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35033/"
] | I have an interesting problem and would appreciate your thoughts for the best solution.
I need to parse a set of logs. The logs are produced by a multi-threaded program and a single process cycle produces several lines of logs.
When parsing these logs I need to pull out specific pieces of information from each process... | It sounds like there are some existing parser classes already in use that you wish to leverage. In this scenario, I would write a [decorator](http://en.wikipedia.org/wiki/Decorator_pattern) for the parser which strips out lines not associated with the process you are monitoring.
It sounds like your classes might look ... |
272,818 | <p>Does anyone know how I can get a list of products belonging to a specific category from within a view file in <a href="http://www.magentocommerce.com/" rel="noreferrer">Magento</a>?</p>
| [
{
"answer_id": 295987,
"author": "Till",
"author_id": 2859,
"author_profile": "https://Stackoverflow.com/users/2859",
"pm_score": 3,
"selected": false,
"text": "<p>It all depends on which view you're in. ;-)</p>\n\n<p>First off, I hope you stayed within your template set (default in my e... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Does anyone know how I can get a list of products belonging to a specific category from within a view file in [Magento](http://www.magentocommerce.com/)? | You can use magento object to filter.
Example:
```
$categoryId = 123; // a category id that you can get from admin
$category = Mage::getModel('catalog/category')->load($categoryId);
$products = Mage::getModel('catalog/product')
->getCollection()
->addCategoryFilter($category)
->load();
print_r($products... |
272,826 | <p>I've got a PHP command line program running. And I want to connect to a mysql shell straight from PHP. I've done this before in Python using os.execvp But I can't get the same thing to work in PHP.</p>
<p>I've tried the following functions:</p>
<ul>
<li>system</li>
<li>passthru</li>
<li>exec</li>
<li>shell_exec</l... | [
{
"answer_id": 272845,
"author": "acrosman",
"author_id": 24215,
"author_profile": "https://Stackoverflow.com/users/24215",
"pm_score": 0,
"selected": false,
"text": "<p>Give MySQL a script to run that's separate from the PHP script:</p>\n\n<pre><code>system('mysql -u root -pxxxx db_name... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/261/"
] | I've got a PHP command line program running. And I want to connect to a mysql shell straight from PHP. I've done this before in Python using os.execvp But I can't get the same thing to work in PHP.
I've tried the following functions:
* system
* passthru
* exec
* shell\_exec
example:
```
system('mysql -u root -pxxxx... | If you want shell commands to be interactive, use:
```
system("mysql -uroot -p db_name > `tty`");
```
That will work for most cases, but will break if you aren't in a terminal. |
272,876 | <blockquote>
<p>char *strtok(char *s1, const char *s2)</p>
<p>repeated calls to this function break string s1 into "tokens"--that is
the string is broken into substrings,
each terminating with a '\0', where
the '\0' replaces any characters
contained in string s2. The first call
uses the string to be to... | [
{
"answer_id": 272904,
"author": "The Archetypal Paul",
"author_id": 21755,
"author_profile": "https://Stackoverflow.com/users/21755",
"pm_score": 5,
"selected": true,
"text": "<p>What did you initialize the <code>char *</code> to?</p>\n\n<p>If something like</p>\n\n<pre><code>char *text... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272876",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14520/"
] | >
> char \*strtok(char \*s1, const char \*s2)
>
>
> repeated calls to this function break string s1 into "tokens"--that is
> the string is broken into substrings,
> each terminating with a '\0', where
> the '\0' replaces any characters
> contained in string s2. The first call
> uses the string to be tokenized a... | What did you initialize the `char *` to?
If something like
```
char *text = "foobar";
```
then you have a pointer to some read-only characters
For
```
char text[7] = "foobar";
```
then you have a seven element array of characters that you can do what you like with.
`strtok` writes into the string you give it ... |
272,900 | <p>Can anyone explain why following code won't compile? At least on g++ 4.2.4.</p>
<p>And more interesting, why it will compile when I cast MEMBER to int?</p>
<pre><code>#include <vector>
class Foo {
public:
static const int MEMBER = 1;
};
int main(){
vector<int> v;
v.push_back( Fo... | [
{
"answer_id": 272965,
"author": "Drew Hall",
"author_id": 23934,
"author_profile": "https://Stackoverflow.com/users/23934",
"pm_score": 9,
"selected": true,
"text": "<p>You need to actually define the static member somewhere (after the class definition). Try this:</p>\n\n<pre><code>cla... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35281/"
] | Can anyone explain why following code won't compile? At least on g++ 4.2.4.
And more interesting, why it will compile when I cast MEMBER to int?
```
#include <vector>
class Foo {
public:
static const int MEMBER = 1;
};
int main(){
vector<int> v;
v.push_back( Foo::MEMBER ); // undefined r... | You need to actually define the static member somewhere (after the class definition). Try this:
```
class Foo { /* ... */ };
const int Foo::MEMBER;
int main() { /* ... */ }
```
That should get rid of the undefined reference. |
272,908 | <p>I'm trying to install RSpec as a gem after having it installed as a plugin. I've gone ahead and followed the directions found here <a href="http://github.com/dchelimsky/rspec-rails/wikis" rel="noreferrer">http://github.com/dchelimsky/rspec-rails/wikis</a> for the section titled <strong>rspec and rspec-rails gems</s... | [
{
"answer_id": 273526,
"author": "Micah",
"author_id": 19964,
"author_profile": "https://Stackoverflow.com/users/19964",
"pm_score": 1,
"selected": false,
"text": "<p>Is there supposed to be an 'rspec' generator? I've only used the following:</p>\n\n<pre><code>script/generate rspec_mode... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35564/"
] | I'm trying to install RSpec as a gem after having it installed as a plugin. I've gone ahead and followed the directions found here <http://github.com/dchelimsky/rspec-rails/wikis> for the section titled **rspec and rspec-rails gems**. When I run `ruby script/generate rspec`, I get the error `Couldn't find 'rspec' gener... | Have you installed both rspec and rspec-rails gems?
```
script/generate rspec
```
requires rspec-rails gem to be installed. |
272,910 | <p>When does java let go of a connections to a URL? I don't see a close() method on either URL or URLConnection so does it free up the connection as soon as the request finishes? I'm mainly asking to see if I need to do any clean up in an exception handler.</p>
<pre><code>try {
URL url = new URL("http://foo.bar");
... | [
{
"answer_id": 272918,
"author": "kasperjj",
"author_id": 34240,
"author_profile": "https://Stackoverflow.com/users/34240",
"pm_score": 7,
"selected": true,
"text": "<p>It depends on the specific protocol specified in the protocol. Some maintain persistent connections, other close their ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14481/"
] | When does java let go of a connections to a URL? I don't see a close() method on either URL or URLConnection so does it free up the connection as soon as the request finishes? I'm mainly asking to see if I need to do any clean up in an exception handler.
```
try {
URL url = new URL("http://foo.bar");
URLConnection... | It depends on the specific protocol specified in the protocol. Some maintain persistent connections, other close their connections when your call close in the input or outputstream given by the connection. But other than remembering to closing the streams you opened from the URLConnection, there is nothing else you can... |
272,928 | <p>I need to generate buttons initially based on quite a processor and disk intensive search. Each button will represent a selection and trigger a postback. My issue is that the postback does not trigger the command b_Command. I guess because the original buttons have not been re-created. I cannot affort to execute... | [
{
"answer_id": 272992,
"author": "tsilb",
"author_id": 11112,
"author_profile": "https://Stackoverflow.com/users/11112",
"pm_score": 0,
"selected": false,
"text": "<p>Does your ASPX have the event handler wired up?</p>\n\n<pre><code><asp:Button id=\"btnCommand\" runat=\"server\" onCli... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22100/"
] | I need to generate buttons initially based on quite a processor and disk intensive search. Each button will represent a selection and trigger a postback. My issue is that the postback does not trigger the command b\_Command. I guess because the original buttons have not been re-created. I cannot affort to execute the o... | The b\_Command Event Handler method is not being executed because on post back buttons are not being recreated (since they are dynamically generated). You need to re-create them every time your page gets recreated but in order to do this you need to explicitly cache information somewhere in state.
If this a page-scop... |
272,941 | <p>I've done development in both VB6 and VB.NET, and I've used ADODB objects in VB6 to handle recordset navigation (i.e. the MoveFirst, MoveNext, etc. methods), and I have used ADO.NET to handle queries in a row-by-row nature (i.e For Each Row In Table.Rows ...)</p>
<p>But now I seem to have come to a dilemma. I am n... | [
{
"answer_id": 272962,
"author": "DOK",
"author_id": 27637,
"author_profile": "https://Stackoverflow.com/users/27637",
"pm_score": 0,
"selected": false,
"text": "<p>In .Net, there are many ways to do this. One that I like is to use a DataReader, which can return multiple recordsets. You ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272941",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29115/"
] | I've done development in both VB6 and VB.NET, and I've used ADODB objects in VB6 to handle recordset navigation (i.e. the MoveFirst, MoveNext, etc. methods), and I have used ADO.NET to handle queries in a row-by-row nature (i.e For Each Row In Table.Rows ...)
But now I seem to have come to a dilemma. I am now building... | There is no need to go back to the bad old days. If you can give a pseudo code example, I can translate to vb.net for you.
This is kind of a generic way to do it.
```
Dim ds as DataSet
'populate your DataSet'
For each dr as DataRow in ds.Tables(<tableIndex>).Rows
'Do something with the row'
Next
```
Per Edit... |
272,964 | <p>If I have a function that returns an object, but this return value is never used by the caller, will the compiler optimize away the copy? (Possibly an always/sometimes/never answer.)</p>
<p>Elementary example:</p>
<pre><code>ReturnValue MyClass::FunctionThatAltersMembersAndNeverFails()
{
//Do stuff to members ... | [
{
"answer_id": 272971,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 0,
"selected": false,
"text": "<p>I doubt most compilers could do that if they were in different compilation objects (ie. different files). Maybe if ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272964",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22724/"
] | If I have a function that returns an object, but this return value is never used by the caller, will the compiler optimize away the copy? (Possibly an always/sometimes/never answer.)
Elementary example:
```
ReturnValue MyClass::FunctionThatAltersMembersAndNeverFails()
{
//Do stuff to members of MyClass that never... | If the ReturnValue class has a non-trivial copy constructor, the compiler must not eliminate the call to the copy constructor - it is mandated by the language that it is invoked.
If the copy constructor is inline, the compiler might be able to inline the call, which in turn might cause a elimination of much of its cod... |
272,973 | <p>I have a single form for editing an event, in which the user can (a) edit the details of the event (title, description, dates, etc.) in a FormView and (b) view and edit a ListView of contacts who are registered for the event. </p>
<p>Here's my LinqDataSource, which allows me to add and remove contacts to the event... | [
{
"answer_id": 276419,
"author": "Alexander Taran",
"author_id": 35954,
"author_profile": "https://Stackoverflow.com/users/35954",
"pm_score": 0,
"selected": false,
"text": "<p>Do you you have a foreign key set between tables?\nif you do - then it should throw an exception when saving li... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272973",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/239663/"
] | I have a single form for editing an event, in which the user can (a) edit the details of the event (title, description, dates, etc.) in a FormView and (b) view and edit a ListView of contacts who are registered for the event.
Here's my LinqDataSource, which allows me to add and remove contacts to the event.
```
<as... | So effectively you want to wrap the two LinqDataSources in a single transaction. There is a sneaky way to leverage the LinqDataSource databinding and events and still do only one commit. Using this method you can still use Dynamic Data, FormView, GridView, validation, etc. It only relies on hooking into the data source... |
272,987 | <p>We have a pretty mature COM dll, which we test using DUnit. One of our recent tests creates a few threads, and tests the object from those threads. This test works fine when running the test using the gui front-end, but hangs when running as a console application. Here's a quick pseudo view of what we have in the te... | [
{
"answer_id": 273236,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 4,
"selected": true,
"text": "<p>You need to provide more data.</p>\n<p>Note that <code>OnTerminate</code> is called via <code>Synchronize()</code>, wh... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22712/"
] | We have a pretty mature COM dll, which we test using DUnit. One of our recent tests creates a few threads, and tests the object from those threads. This test works fine when running the test using the gui front-end, but hangs when running as a console application. Here's a quick pseudo view of what we have in the test
... | You need to provide more data.
Note that `OnTerminate` is called via `Synchronize()`, which requires a call to `CheckSynchronize()` at some point somewhere. `Application.ProcessMessages()` normally does this, but depending on how the VCL has been initialized, it's possible that the `Synchronize()` mechanism hasn't bee... |
272,993 | <p>I have a rails template (.rhtml file) generating a Javascript object. It looks something like the following:</p>
<pre><code>var volumes = {
<% for volume in @volumes %>
<%= volume.id %> : <%= volume.data %>
<%= ',' unless volume === @volumes.last %>
<% end %>
};
</code></p... | [
{
"answer_id": 273010,
"author": "Jim Puls",
"author_id": 6010,
"author_profile": "https://Stackoverflow.com/users/6010",
"pm_score": 4,
"selected": true,
"text": "<p>I don't see why not, but generally if you find yourself conditionalizing a comma on the last member, you probably want to... | 2008/11/07 | [
"https://Stackoverflow.com/questions/272993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10026/"
] | I have a rails template (.rhtml file) generating a Javascript object. It looks something like the following:
```
var volumes = {
<% for volume in @volumes %>
<%= volume.id %> : <%= volume.data %>
<%= ',' unless volume === @volumes.last %>
<% end %>
};
```
Note the `unless` statement modifier to suppress... | I don't see why not, but generally if you find yourself conditionalizing a comma on the last member, you probably want to use `join` instead:
```
<%= @volumes.map {|v| "#{v.id} : #{v.data}"}.join "," %>
``` |
273,002 | <p>First of all, I will admit I am a novice to web services, although I'm familiar with HTML and basic web stuff. I created a quick-and-dirty web service using Python that calls a stored procedure in a MySQL database, that simply returns a BIGINT value. I want to return this value in the web service, and I want to ge... | [
{
"answer_id": 274366,
"author": "bhadra",
"author_id": 30289,
"author_profile": "https://Stackoverflow.com/users/30289",
"pm_score": 1,
"selected": false,
"text": "<blockquote>\n <p>I want to generate a WSDL that I can give to the web folks, ....</p>\n</blockquote>\n\n<p>You can try <a... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273002",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31319/"
] | First of all, I will admit I am a novice to web services, although I'm familiar with HTML and basic web stuff. I created a quick-and-dirty web service using Python that calls a stored procedure in a MySQL database, that simply returns a BIGINT value. I want to return this value in the web service, and I want to generat... | When I tried to write Python web service last year, I ended up using [ZSI-2.0](http://pywebsvcs.sourceforge.net/) (which is something like heir of SOAPpy) and a [paper available on its web](http://pywebsvcs.sourceforge.net/holger.pdf).
Basically I wrote my WSDL file by hand and then used ZSI stuff to generate stubs fo... |
273,009 | <p>I need to select a datetime column in a table. However, I want the select statement to return the datetime as a nvarchar with the format DD/MM/YYYY.</p>
| [
{
"answer_id": 273017,
"author": "AlexCuse",
"author_id": 794,
"author_profile": "https://Stackoverflow.com/users/794",
"pm_score": 2,
"selected": false,
"text": "<p>This should help. It contains all (or most anyway) the different date formats</p>\n\n<p><a href=\"http://wiki.lessthandot... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273009",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/889/"
] | I need to select a datetime column in a table. However, I want the select statement to return the datetime as a nvarchar with the format DD/MM/YYYY. | Here is the convert documentation:
>
> <https://learn.microsoft.com/en-us/sql/t-sql/functions/cast-and-convert-transact-sql>
>
>
>
Looking through that, it looks like you want style 103:
```
SELECT CONVERT(nvarchar(10), getdate(), 103)
``` |
273,027 | <p>I am following the <strong><em>learning</em> ASP.NET 3.5</strong> by O'REILLY to write some ASP.NET 3.5 code using Visual Studio 2008 SP1. I have gotten to the point to where I need to Configure a Data Source using the SqlDataSource control. I chose <strong>Microsoft SQL Server (SqlClient)</strong> even though I h... | [
{
"answer_id": 274821,
"author": "Alexander Prokofyev",
"author_id": 11256,
"author_profile": "https://Stackoverflow.com/users/11256",
"pm_score": 1,
"selected": false,
"text": "<p>You may investigate <a href=\"http://social.msdn.microsoft.com/forums/es-ES/Offtopic/thread/70a5cb26-6b20-4... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am following the ***learning* ASP.NET 3.5** by O'REILLY to write some ASP.NET 3.5 code using Visual Studio 2008 SP1. I have gotten to the point to where I need to Configure a Data Source using the SqlDataSource control. I chose **Microsoft SQL Server (SqlClient)** even though I have SQL Server Express 2005 - This see... | You may investigate [this](http://social.msdn.microsoft.com/forums/es-ES/Offtopic/thread/70a5cb26-6b20-43a0-8cef-a0c5716a3e1c/) recipe. |
273,029 | <p>In converting from short to a byte array I found the following solution on the web but could not quite understand the logic involved.</p>
<pre><code>//buffer is an array of bytes, bytes[]
buffer[position] = (byte)(sample & 0xff);
buffer[position+1] = (byte)((sample >> 8) & 0xff);
</code></pre>
<p>Can... | [
{
"answer_id": 273058,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 4,
"selected": false,
"text": "<p>This code probably comes from C code (or was written by a C programmer who don't parse Java as well as erickson d... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In converting from short to a byte array I found the following solution on the web but could not quite understand the logic involved.
```
//buffer is an array of bytes, bytes[]
buffer[position] = (byte)(sample & 0xff);
buffer[position+1] = (byte)((sample >> 8) & 0xff);
```
Can someone tell me why 0xff (256) is being... | This code probably comes from C code (or was written by a C programmer who don't parse Java as well as erickson does). This is because in Java a cast from a type with more information to a type with less information will discard the higher order bits and thus the & 0xff is unnecessary in both cases.
A short has 16 bit... |
273,039 | <p>In Xcode, I can use <kbd>CMD</kbd>-<kbd>R</kbd> to run (or <kbd>CMD</kbd>-<kbd>Y</kbd> to debug), and my app will compile, install on the phone & start-up. (I've already prepped my phone & Xcode so this part works as expected.)</p>
<p>What I'd <strong><em>LIKE</em></strong> to do is type CMD-<something ... | [
{
"answer_id": 273064,
"author": "sblundy",
"author_id": 4893,
"author_profile": "https://Stackoverflow.com/users/4893",
"pm_score": 0,
"selected": false,
"text": "<p>Have you looked into using <a href=\"http://en.wikipedia.org/wiki/Automator\" rel=\"nofollow noreferrer\">Automator</a>? ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273039",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34820/"
] | In Xcode, I can use `CMD`-`R` to run (or `CMD`-`Y` to debug), and my app will compile, install on the phone & start-up. (I've already prepped my phone & Xcode so this part works as expected.)
What I'd ***LIKE*** to do is type CMD-<something else> and have my program compile & install on the phone, but *NOT* start-up.
... | Hey Olie, I haven't tried this because I don't have an iPhone to deploy to at the moment, but this /should/ work:
You can create a script which runs xcodebuild in your current project directory and give it the install target. Assuming you're going to want to debug at sometime, use the Debug configuration, otherwise us... |
273,043 | <p>We have a Linux application that makes use of OpenSSL's Python bindings and I suspect it is causing random crashes. Occasionally, we see it crash with the message: </p>
<blockquote>
<p>Python Fatal Error: GC Object already tracked</p>
</blockquote>
<p>which would appear to be either a programming error on the pa... | [
{
"answer_id": 273063,
"author": "RaySl",
"author_id": 30089,
"author_profile": "https://Stackoverflow.com/users/30089",
"pm_score": 1,
"selected": false,
"text": "<p>If you have mac or sun box kicking around you could use <a href=\"http://en.wikipedia.org/wiki/DTrace\" rel=\"nofollow no... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29825/"
] | We have a Linux application that makes use of OpenSSL's Python bindings and I suspect it is causing random crashes. Occasionally, we see it crash with the message:
>
> Python Fatal Error: GC Object already tracked
>
>
>
which would appear to be either a programming error on the part of the library, or a symptom ... | Yes, you can do this kind of thing:
```
(gdb) print PyRun_SimpleString("import traceback; traceback.print_stack()")
File "<string>", line 1, in <module>
File "/var/tmp/foo.py", line 2, in <module>
i**2
File "<string>", line 1, in <module>
$1 = 0
```
It should also be possible to use the `pystack` command d... |
273,048 | <p>How can I calculate the last business day of the month in .NET?</p>
| [
{
"answer_id": 273065,
"author": "Brian Knoblauch",
"author_id": 15689,
"author_profile": "https://Stackoverflow.com/users/15689",
"pm_score": 3,
"selected": false,
"text": "<p>First, get the last day of the month. Then keep decrementing until you're either past the beginning of the mon... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273048",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4770/"
] | How can I calculate the last business day of the month in .NET? | I would do it like this for a Monday through Friday business week:
```
var holidays = new List<DateTime>{/* list of observed holidays */};
DateTime lastBusinessDay = new DateTime();
var i = DateTime.DaysInMonth(year, month);
while (i > 0)
{
var dtCurrent = new DateTime(year, month, i);
if(dtCurrent.DayOfWeek < Day... |
273,081 | <p>I have an application that needs to hit the ActiveDirectory to get user permission/roles on startup of the app, and persist throughout. </p>
<p>I don't want to hit AD on every form to recheck the user's permissions, so I'd like the user's role and possibly other data on the logged-in user to be globally available o... | [
{
"answer_id": 273098,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": 0,
"selected": false,
"text": "<p>You can use the Profile provider from the asp.net in you Windows App. Check it out @ <a href=\"http://fredrik.nsqua... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an application that needs to hit the ActiveDirectory to get user permission/roles on startup of the app, and persist throughout.
I don't want to hit AD on every form to recheck the user's permissions, so I'd like the user's role and possibly other data on the logged-in user to be globally available on any form... | Set [Thread.CurrentPrincipal](http://msdn.microsoft.com/en-us/library/system.threading.thread.currentprincipal.aspx) with either the [WindowsPrincipal](http://msdn.microsoft.com/en-us/library/system.security.principal.windowsprincipal.aspx), a [GenericPrincipal](http://msdn.microsoft.com/en-us/library/system.security.p... |
273,103 | <p>I have a class that inherits from a base class and implements the following...</p>
<pre><code> Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo
</code></pre>
<p>Now the base class it inherits from also implements this System.IComparable.CompareTo so I'm getting t... | [
{
"answer_id": 273114,
"author": "Bruno Shine",
"author_id": 28294,
"author_profile": "https://Stackoverflow.com/users/28294",
"pm_score": -1,
"selected": false,
"text": "<p>On the properties of your project, go to the build tab and use the suppress warnings textbox.</p>\n"
},
{
... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12842/"
] | I have a class that inherits from a base class and implements the following...
```
Public Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo
```
Now the base class it inherits from also implements this System.IComparable.CompareTo so I'm getting the following compiler warn... | Only use 'Implements' in the base class:
Signature in the base class:
```
Public Overridable Function CompareTo(ByVal obj As Object) As Integer Implements System.IComparable.CompareTo
```
Signature in the inherited class:
```
Public Overrides Function CompareTo(ByVal obj As Object) As Integer
``` |
273,126 | <p>I am wondering how the HttpContext is maintained given that the request-response nature of the web is essentially stateless.</p>
<p>Is an identifier being for the HttpContext object being sent as part of the __EVENTTarget / __EVENTARGUMENTS hidden fields so that the HttpRuntime class can create the HttpContext clas... | [
{
"answer_id": 273154,
"author": "Greg Smalter",
"author_id": 34290,
"author_profile": "https://Stackoverflow.com/users/34290",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think there is one answer to your question, because I don't think everything under the HttpContext umbrell... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273126",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35559/"
] | I am wondering how the HttpContext is maintained given that the request-response nature of the web is essentially stateless.
Is an identifier being for the HttpContext object being sent as part of the \_\_EVENTTarget / \_\_EVENTARGUMENTS hidden fields so that the HttpRuntime class can create the HttpContext class by r... | The HttpContext is recreated for each request. The HttpSession, however, is stored on the server across requests. Basically, HttpSession is a Dictionary<string, Dictionary<string, object>>. The initial key, the session id, is provided by either a cookie or a query string parameter (if using cookie-less sessions). If yo... |
273,141 | <p>I haven't used regular expressions at all, so I'm having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers; but with the two examples below it is matching a string that contains all numbers plus an equals sign like "1234=4321". I'm sure there's a way to change this b... | [
{
"answer_id": 273144,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 10,
"selected": true,
"text": "<p>Use the beginning and end anchors.</p>\n\n<pre><code>Regex regex = new Regex(@\"^\\d$\");\n</code></pre>\n\n<p>Us... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4660/"
] | I haven't used regular expressions at all, so I'm having difficulty troubleshooting. I want the regex to match only when the contained string is all numbers; but with the two examples below it is matching a string that contains all numbers plus an equals sign like "1234=4321". I'm sure there's a way to change this beha... | Use the beginning and end anchors.
```
Regex regex = new Regex(@"^\d$");
```
Use `"^\d+$"` if you need to match more than one digit.
---
Note that `"\d"` will match `[0-9]` and other digit characters like the Eastern Arabic numerals `٠١٢٣٤٥٦٧٨٩`. Use `"^[0-9]+$"` to restrict matches to just the Arabic numerals 0 -... |
273,142 | <p>I'm looking to patch a piece of abandonware with some code.</p>
<p>The software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea was to add a dylib reference to the mach-o header, and launch a new thread when the initialization routine is called.</p>
<p>I have mucked arou... | [
{
"answer_id": 273213,
"author": "Jason Coco",
"author_id": 34218,
"author_profile": "https://Stackoverflow.com/users/34218",
"pm_score": 4,
"selected": true,
"text": "<p>I'm not entirely sure what you're trying to accomplish, but the easiest way to do this is probably to inject a thread... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking to patch a piece of abandonware with some code.
The software is carbon based, so I can not use an InputManager (at least, I do not think I can). My idea was to add a dylib reference to the mach-o header, and launch a new thread when the initialization routine is called.
I have mucked around with the mach-... | I'm not entirely sure what you're trying to accomplish, but the easiest way to do this is probably to inject a thread into the mach task after it starts. A great source of information on doing this (as well as running code to do it) can be found here: <http://rentzsch.com/mach_inject/>.
Some caveats that you should be... |
273,151 | <p>I've used MS Word automation to save a .doc to a .htm. If there are bullet characters in the .doc file, they are saved fine to the .htm, but when I try to read the .htm file into a string (so I can subsequently send to a database for ultimate storage as a string, not a blob), the bullets are converted to question m... | [
{
"answer_id": 273171,
"author": "osp70",
"author_id": 2357,
"author_profile": "https://Stackoverflow.com/users/2357",
"pm_score": 0,
"selected": false,
"text": "<p>Did you try opening the file in binary mode. If you open in test mode I think it will chop up the unicode characters.</p>\... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273151",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29107/"
] | I've used MS Word automation to save a .doc to a .htm. If there are bullet characters in the .doc file, they are saved fine to the .htm, but when I try to read the .htm file into a string (so I can subsequently send to a database for ultimate storage as a string, not a blob), the bullets are converted to question marks... | On my system (using US-English) Word saves \*.htm files in the Windows-1252 codepage. If your system uses that codepage, then that is what you should read it in as.
```
string html = File.ReadAllText(originalFile, Encoding.GetEncoding(1252));
```
It is also possible that whatever you are using the view the results m... |
273,169 | <p>How can I dynamically invoke a class method in PHP? The class method is not static. It appears that </p>
<pre><code>call_user_func(...)
</code></pre>
<p>only works with static functions?</p>
<p>Thanks.</p>
| [
{
"answer_id": 273175,
"author": "Neil Williams",
"author_id": 9617,
"author_profile": "https://Stackoverflow.com/users/9617",
"pm_score": 2,
"selected": false,
"text": "<pre><code>call_user_func(array($object, 'methodName'));\n</code></pre>\n\n<p>For more details, see the <a href=\"http... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273169",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] | How can I dynamically invoke a class method in PHP? The class method is not static. It appears that
```
call_user_func(...)
```
only works with static functions?
Thanks. | It works both ways - you need to use the right syntax
```
// Non static call
call_user_func( array( $obj, 'method' ) );
// Static calls
call_user_func( array( 'ClassName', 'method' ) );
call_user_func( 'ClassName::method' ); // (As of PHP 5.2.3)
``` |
273,192 | <p>How do I check if the directory into which a file is going to be written does exist, and if it does not, create the directory using Python?</p>
| [
{
"answer_id": 273206,
"author": "gone",
"author_id": 26880,
"author_profile": "https://Stackoverflow.com/users/26880",
"pm_score": 6,
"selected": false,
"text": "<p>Try the <a href=\"https://docs.python.org/2/library/os.path.html#os.path.exists\" rel=\"noreferrer\" title=\"os.path.exist... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13055/"
] | How do I check if the directory into which a file is going to be written does exist, and if it does not, create the directory using Python? | On Python ≥ 3.5, use [`pathlib.Path.mkdir`](https://docs.python.org/library/pathlib.html#pathlib.Path.mkdir):
```
from pathlib import Path
Path("/my/directory").mkdir(parents=True, exist_ok=True)
```
For older versions of Python, I see two answers with good qualities, each with a small flaw, so I will give my take o... |
273,199 | <p>I'm trying to convert some Xaml to HTML using the .NET XslCompiledTransform and am running into difficulties getting the xslt to match Xaml tags. For instance with this Xaml input:</p>
<pre><code><FlowDocument PagePadding="5,0,5,0" AllowDrop="True" NumberSubstitution.CultureSource="User" xmlns="http://schemas.m... | [
{
"answer_id": 273257,
"author": "Robert Rossney",
"author_id": 19403,
"author_profile": "https://Stackoverflow.com/users/19403",
"pm_score": 6,
"selected": true,
"text": "<p>Yes, it's a problem with the namespace. All of the elements in your input document are in the namespace <code>ht... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1807/"
] | I'm trying to convert some Xaml to HTML using the .NET XslCompiledTransform and am running into difficulties getting the xslt to match Xaml tags. For instance with this Xaml input:
```
<FlowDocument PagePadding="5,0,5,0" AllowDrop="True" NumberSubstitution.CultureSource="User" xmlns="http://schemas.microsoft.com/winfx... | Yes, it's a problem with the namespace. All of the elements in your input document are in the namespace `http://schemas.microsoft.com/winfx/2006/xaml/presentation`. Your template is trying to match elements that are in the default namespace, and it's not finding any.
You need to declare this namespace in your transfor... |
273,203 | <p>I'm using python\pyodbc and would like to access the second result set of a stored procedure. As near as I can tell, pyodbc does not support multiple result sets. Additionally, I can't modify the stored procedure. Are there any options to access the second result set using SQL or some other work-around? Perhaps crea... | [
{
"answer_id": 273386,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 0,
"selected": false,
"text": "<p>There are a few possible methods <a href=\"http://www.sommarskog.se/share_data.html\" rel=\"nofollow noreferrer\">her... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using python\pyodbc and would like to access the second result set of a stored procedure. As near as I can tell, pyodbc does not support multiple result sets. Additionally, I can't modify the stored procedure. Are there any options to access the second result set using SQL or some other work-around? Perhaps create ... | No need for anything fancy. Just use the [cursor's `nextset()` method](https://github.com/mkleehammer/pyodbc/wiki/Cursor#nextset):
```
import pyodbc
db = pyodbc.connect ("")
q = db.cursor ()
q.execute ("""
SELECT TOP 5 * FROM INFORMATION_SCHEMA.TABLES
SELECT TOP 10 * FROM INFORMATION_SCHEMA.COLUMNS
""")
tables = q.f... |
273,217 | <p>Does anybody know what's going on here:</p>
<p>I run hibernate 3.2.6 against a PostgreSQL 8.3 (installed via fink) database on my Mac OS X. The setup works fine when I use Java 6 and the JDBC 4 driver (postgresql-8.3-603.jdbc4). However, I need this stuff to work with Java 5 and (hence) JDBC 3 (postgresql-8.3-603.j... | [
{
"answer_id": 273391,
"author": "shyam",
"author_id": 7616,
"author_profile": "https://Stackoverflow.com/users/7616",
"pm_score": 1,
"selected": false,
"text": "<p>did you notice that the connection url is incomplete</p>\n\n<pre><code><property name=\"connection.url\">jdbc:postgre... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4110/"
] | Does anybody know what's going on here:
I run hibernate 3.2.6 against a PostgreSQL 8.3 (installed via fink) database on my Mac OS X. The setup works fine when I use Java 6 and the JDBC 4 driver (postgresql-8.3-603.jdbc4). However, I need this stuff to work with Java 5 and (hence) JDBC 3 (postgresql-8.3-603.jdbc3). Whe... | I don't see you specifying the driver class in your Hibernate configuration. Try adding the following:
```
<hibernate-configuration>
<session-factory>
.
.
<property name="connection.driver_class">org.postgresql.Driver</property>
.
</session-factory>
</hibernate-configuration>
`... |
273,218 | <p>In layman's terms, what's a RDF triple?</p>
| [
{
"answer_id": 273240,
"author": "GEOCHET",
"author_id": 5640,
"author_profile": "https://Stackoverflow.com/users/5640",
"pm_score": 4,
"selected": false,
"text": "<blockquote>\n <p>An RDF file should parse down to a\n list of triples.</p>\n \n <p>A triple consists of a subject, a\n ... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35588/"
] | In layman's terms, what's a RDF triple? | I think the question needs to be split into two parts - what is a triple and what makes an "RDF triple" so special?
Firstly, a triple is, as most of the other commenters here have already pointed out, a statement in "subject/predicate/object" form - i.e. a statement linking one object (subject) to another object(objec... |
273,238 | <p>How do I get:</p>
<pre><code>id Name Value
1 A 4
1 B 8
2 C 9
</code></pre>
<p>to</p>
<pre><code>id Column
1 A:4, B:8
2 C:9
</code></pre>
| [
{
"answer_id": 273256,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 3,
"selected": false,
"text": "<p>This kind of question is asked here very often, and the solution is going to depend a lot on the underlying requireme... | 2008/11/07 | [
"https://Stackoverflow.com/questions/273238",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/889/"
] | How do I get:
```
id Name Value
1 A 4
1 B 8
2 C 9
```
to
```
id Column
1 A:4, B:8
2 C:9
``` | **No CURSOR, WHILE loop, or User-Defined Function needed**.
Just need to be creative with FOR XML and PATH.
[Note: This solution only works on SQL 2005 and later. Original question didn't specify the version in use.]
```
CREATE TABLE #YourTable ([ID] INT, [Name] CHAR(1), [Value] INT)
INSERT INTO #YourTable ([ID],[... |