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 |
|---|---|---|---|---|---|---|
511,452 | <p>I have the 3 following tables in a MySQL 4.x DB :</p>
<ul>
<li>hosts: <em>(300.000 records)</em>
<ul>
<li>id (UNSIGNED INT) PRIMARY KEY</li>
<li>name (VARCHAR 100)</li>
</ul></li>
<li>paths: <em>(6.000.000 records)</em>
<ul>
<li>id (UNSIGNED INT) PRIMARY KEY</li>
<li>name (VARCHAR 100)</li>
</ul></li>
<li>urls: <... | [
{
"answer_id": 511461,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 3,
"selected": false,
"text": "<p>Perhaps you should include a WHERE clause? Or do you really need ALL the data?</p>\n"
},
{
"answer_id": 511... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44554/"
] | I have the 3 following tables in a MySQL 4.x DB :
* hosts: *(300.000 records)*
+ id (UNSIGNED INT) PRIMARY KEY
+ name (VARCHAR 100)
* paths: *(6.000.000 records)*
+ id (UNSIGNED INT) PRIMARY KEY
+ name (VARCHAR 100)
* urls: *(7.000.000 records)*
+ host (UNSIGNED INT) PRIMARY KEY <--- links to hosts.id
+ path (UN... | For one thing I wouldn't do the CONCAT in the query. Do it outside.
But really you're query runs slowly because you're retrieving millions of rows. |
511,453 | <p>I'm starting to understand XAML data binding and using the DataTemplate and it's pretty nice.</p>
<p>What is the best way to take the next step and put logic into the code below,
e.g. look to see if there is anything in "Address2" and if so display it,
or format foreign addresses differently, etc.?</p>
<pre><cod... | [
{
"answer_id": 511717,
"author": "Szymon Rozga",
"author_id": 7583,
"author_profile": "https://Stackoverflow.com/users/7583",
"pm_score": 1,
"selected": false,
"text": "<p>You are looking for WPF Converters. Check out these <a href=\"http://learnwpf.com/Posts/Post.aspx?postId=05229e33-fc... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | I'm starting to understand XAML data binding and using the DataTemplate and it's pretty nice.
What is the best way to take the next step and put logic into the code below,
e.g. look to see if there is anything in "Address2" and if so display it,
or format foreign addresses differently, etc.?
```
<Window.Resources>
... | Welcome to the wonderful world of triggers, here is the code to remove blank address lines from your example:
I've added a name to the address text block and added a DataTrigger to hide it when the address is blank
```
<Window.Resources>
<DataTemplate x:Key="CustomersTemplate">
<Grid>
... snip ...
... |
511,459 | <p>I have a GridView... </p>
<pre><code><asp:GridView EnableViewState="true"
ID="grdResults"
runat="server"
CssClass="resultsGrid"
OnRowDataBound="grdResults_OnRowDataBound"
AutoGenerateColumns="false"
HeaderStyle... | [
{
"answer_id": 511717,
"author": "Szymon Rozga",
"author_id": 7583,
"author_profile": "https://Stackoverflow.com/users/7583",
"pm_score": 1,
"selected": false,
"text": "<p>You are looking for WPF Converters. Check out these <a href=\"http://learnwpf.com/Posts/Post.aspx?postId=05229e33-fc... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511459",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54182/"
] | I have a GridView...
```
<asp:GridView EnableViewState="true"
ID="grdResults"
runat="server"
CssClass="resultsGrid"
OnRowDataBound="grdResults_OnRowDataBound"
AutoGenerateColumns="false"
HeaderStyle-CssClass="header"... | Welcome to the wonderful world of triggers, here is the code to remove blank address lines from your example:
I've added a name to the address text block and added a DataTrigger to hide it when the address is blank
```
<Window.Resources>
<DataTemplate x:Key="CustomersTemplate">
<Grid>
... snip ...
... |
511,477 | <p>This may be a dumb question - but why are shared methods availible on types and instances in VB.net - am I wrong to assume they are the equivalent to C# static methods?</p>
<p>i.e</p>
<pre><code>MyClass.MySharedMethod()
dim mc as new MyClass()
mc.MySharedMethod()
</code></pre>
<p>Why am I allowed to do this? Wh... | [
{
"answer_id": 511486,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>This may be a dumb question - but why are shared methods availible on types and instances in VB.ne... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2763/"
] | This may be a dumb question - but why are shared methods availible on types and instances in VB.net - am I wrong to assume they are the equivalent to C# static methods?
i.e
```
MyClass.MySharedMethod()
dim mc as new MyClass()
mc.MySharedMethod()
```
Why am I allowed to do this? What possible advantage is there to ... | Yes, it's basically a hangover from VB6. Java lets you do this too, but most IDEs warn you these days I believe.
And yes, it's a really bad idea. The most obvious example of it being bad is Thread.Sleep:
```
Dim t as new Thread(...)
t.Sleep(1000)
```
Which thread is sleeping? The current one. Doh! |
511,488 | <p>I've been using a crude method to help the user update some cells - by having them in a sheet. Is there any way I can display the various ranges in a userform, one by one, then have the user update them, click a button and move onto the next one?</p>
<p>Essentially, can I have Excel automatically generate an input ... | [
{
"answer_id": 511486,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>This may be a dumb question - but why are shared methods availible on types and instances in VB.ne... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59790/"
] | I've been using a crude method to help the user update some cells - by having them in a sheet. Is there any way I can display the various ranges in a userform, one by one, then have the user update them, click a button and move onto the next one?
Essentially, can I have Excel automatically generate an input form based... | Yes, it's basically a hangover from VB6. Java lets you do this too, but most IDEs warn you these days I believe.
And yes, it's a really bad idea. The most obvious example of it being bad is Thread.Sleep:
```
Dim t as new Thread(...)
t.Sleep(1000)
```
Which thread is sleeping? The current one. Doh! |
511,507 | <p>I'm building a (LAN) network application, so there is always the possibility that a connection will be disconnected, for various possible reasons. I am trying to think of a good design for handling this issue, such that it doesn't affect the rest of the application. I wrote a quick thing to try to do it, but I think... | [
{
"answer_id": 511486,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 2,
"selected": false,
"text": "<blockquote>\n <p>This may be a dumb question - but why are shared methods availible on types and instances in VB.ne... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41283/"
] | I'm building a (LAN) network application, so there is always the possibility that a connection will be disconnected, for various possible reasons. I am trying to think of a good design for handling this issue, such that it doesn't affect the rest of the application. I wrote a quick thing to try to do it, but I think it... | Yes, it's basically a hangover from VB6. Java lets you do this too, but most IDEs warn you these days I believe.
And yes, it's a really bad idea. The most obvious example of it being bad is Thread.Sleep:
```
Dim t as new Thread(...)
t.Sleep(1000)
```
Which thread is sleeping? The current one. Doh! |
511,527 | <p>I need to extract the list IDs "first", "second", and "final". My List has:</p>
<pre><code><div id="wrapper">
<ul id="testnav">
<li> <a href="#">Page</a></li>
<li> <a href="#">Page.</a>
<ul id="subnav">
<l... | [
{
"answer_id": 511537,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 1,
"selected": false,
"text": "<p>\"this\" in your script is referring to the anchors, and not the list-items. You don't have the id's on the anchors, s... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511527",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I need to extract the list IDs "first", "second", and "final". My List has:
```
<div id="wrapper">
<ul id="testnav">
<li> <a href="#">Page</a></li>
<li> <a href="#">Page.</a>
<ul id="subnav">
<li id="first"><a href="#">Value1</a></li>
<li id="second"><a h... | "this" in your script is referring to the anchors, and not the list-items. You don't have the id's on the anchors, so you will get nothing back when requesting .attr("id");
I'd suggest using [.parent()](http://docs.jquery.com/Traversing/parent#expr) to access the list-items, or put your click event on the list-items i... |
511,534 | <p>I have SQL SELECT statement that returns:</p>
<pre><code> Error: ORA-00600: internal error code, arguments: [qerpfAllocateR], [], [], [], [], [], [], []
</code></pre>
<p>If I narrow my results by adding one more condition in WHERE clause everything is ok.</p>
<p>Anyone knows what is happening?</p>
<p>EDIT:</p... | [
{
"answer_id": 511553,
"author": "tehvan",
"author_id": 61848,
"author_profile": "https://Stackoverflow.com/users/61848",
"pm_score": 2,
"selected": false,
"text": "<p>What is the full query?</p>\n\n<p><a href=\"http://www.orafaq.com/wiki/ORA-00600\" rel=\"nofollow noreferrer\">http://ww... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1514822/"
] | I have SQL SELECT statement that returns:
```
Error: ORA-00600: internal error code, arguments: [qerpfAllocateR], [], [], [], [], [], [], []
```
If I narrow my results by adding one more condition in WHERE clause everything is ok.
Anyone knows what is happening?
EDIT:
```
select * from ( select tbl1.col1,... | Good luck with getting support from Oracle...
Seriously though, every time I hit this problem, rearranging the query a little bit usually helps. Maybe fiddling around with the indexes a bit. |
511,538 | <p>I'm implementing a Modified preorder tree traversal class for a category tree on a Web site, but I'm having trouble with one scenario. Typically when inserting a new category a top-level parent is specified, whose left value in the tree is used in order to determine where the new category should go in the tree. Howe... | [
{
"answer_id": 511974,
"author": "Michael Glenn",
"author_id": 9424,
"author_profile": "https://Stackoverflow.com/users/9424",
"pm_score": 3,
"selected": true,
"text": "<p>In the example you've presented, Electronics and Apparel are technically two separate trees if they have no common p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm implementing a Modified preorder tree traversal class for a category tree on a Web site, but I'm having trouble with one scenario. Typically when inserting a new category a top-level parent is specified, whose left value in the tree is used in order to determine where the new category should go in the tree. However... | In the example you've presented, Electronics and Apparel are technically two separate trees if they have no common parent. If you add "My New Category" it's also a new tree. If you're trying to traverse between Electronics, Apparel and My New Category you need a value above all three, say "All" that is your root node.
... |
511,542 | <p>Following up on <a href="https://stackoverflow.com/questions/477646/packed-vs-unpacked-vectors-in-system-verilog" title="packed vs unpacked vectors in system verilog">this</a> question about the difference between packed and unpacked vectors in SV, why would I ever want to use unpacked vectors?<br>
Packed vectors ha... | [
{
"answer_id": 981722,
"author": "Steve K",
"author_id": 121394,
"author_profile": "https://Stackoverflow.com/users/121394",
"pm_score": 3,
"selected": false,
"text": "<p>Unpacked arrays exist for several reasons.</p>\n\n<p>1) Packed arrays are stored in memory as a continuous sequence o... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511542",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1084/"
] | Following up on [this](https://stackoverflow.com/questions/477646/packed-vs-unpacked-vectors-in-system-verilog "packed vs unpacked vectors in system verilog") question about the difference between packed and unpacked vectors in SV, why would I ever want to use unpacked vectors?
Packed vectors have these advantages t... | There is another reason why I like to use unpacked. With unpacked, there is no temptation (and accidental possibility) of treating the whole array name as a variable, and make an erroneous assignment. There is also no possibility of bit-bleeding from one element to another, when you may be thinking you are accessing B ... |
511,552 | <p>I'm trying to do some Socket programming in Java, and I'm using the BufferedStreamReader.read(char[]) method.</p>
<p>the java doc states:</p>
<blockquote>
<p>Reads characters into an array. This
method will block until some input is
available, an I/O error occurs, or the
end of the stream is reached.</p>
<... | [
{
"answer_id": 511679,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": true,
"text": "<p>You need to look into <a href=\"http://java.sun.com/javase/6/docs/api/java/net/ServerSocket.html\" rel=\"nofollow noreferrer... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] | I'm trying to do some Socket programming in Java, and I'm using the BufferedStreamReader.read(char[]) method.
the java doc states:
>
> Reads characters into an array. This
> method will block until some input is
> available, an I/O error occurs, or the
> end of the stream is reached.
>
>
>
Only it's not block... | You need to look into [ServerSocket](http://java.sun.com/javase/6/docs/api/java/net/ServerSocket.html). Your Socket at the moment is not actually 'listening', it's trying to connect to localhost:8080 but not actually listen on it! |
511,560 | <p>I've got a largish (~1.5M records) table that holds text strings of varying length for which I run queries against looking for matches:</p>
<pre><code>CREATE TABLE IF NOT EXISTS `shingles` (
`id` bigint(20) NOT NULL auto_increment,
`TS` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
... | [
{
"answer_id": 514545,
"author": "Ask Bjørn Hansen",
"author_id": 62735,
"author_profile": "https://Stackoverflow.com/users/62735",
"pm_score": 0,
"selected": false,
"text": "<p>For starters, use InnoDB instead of MyISAM. That'll solve the problem of doing queries while you also do inse... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511560",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62434/"
] | I've got a largish (~1.5M records) table that holds text strings of varying length for which I run queries against looking for matches:
```
CREATE TABLE IF NOT EXISTS `shingles` (
`id` bigint(20) NOT NULL auto_increment,
`TS` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP,
`shingle` var... | First: your bigint primary key could be killing you here, it's a very expensive type to try to maintain. 1.5 million records is nowhere near the limit for unsigned int (~4.2 billion).
Using a big int for a primary key is even worse in InnoDB as it stores the PK against each entry in every other index, so that could p... |
511,578 | <p>I have some code that I want to measure the speed of while it runs continuously in automated regression tests. The purpose of this would be to alert me to changes made to the code which have had a negative impact on performance.</p>
<p>In pseudo-code, I want something like this:</p>
<pre><code>cpuTimer.start
runTe... | [
{
"answer_id": 511614,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 0,
"selected": false,
"text": "<p>One approach would be to analyze the standard xml files that are output from the junit running in both maven and ant... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/974/"
] | I have some code that I want to measure the speed of while it runs continuously in automated regression tests. The purpose of this would be to alert me to changes made to the code which have had a negative impact on performance.
In pseudo-code, I want something like this:
```
cpuTimer.start
runTest
cpuTimer.stop
dif... | You might try to look at [Perf4J](http://perf4j.codehaus.org/). I haven't used it yet, but it's on my list of things to investigate.
From their homepage:
>
> Perf4J is to System.currentTimeMillis() as log4j is to System.out.println()
>
>
>
The [Developer Guide](http://perf4j.codehaus.org/devguide.html) is a nice... |
511,579 | <p>I have a function that dynamically adds text to an image in a predesignated spot. Originally I did it with jpegs, and it was working. I switched to PNG so the images would be better quality, as the original jpegs were kind of pixely. Anyway, here is my code. It executes down to the <code>oBitmap.Save()</code>, th... | [
{
"answer_id": 511593,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>You're disposing of the bitmap before you're flushing the Response? Try flipping that around. Also, it looks like you're ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I have a function that dynamically adds text to an image in a predesignated spot. Originally I did it with jpegs, and it was working. I switched to PNG so the images would be better quality, as the original jpegs were kind of pixely. Anyway, here is my code. It executes down to the `oBitmap.Save()`, then dies with "A G... | According to [this post](http://www.vbdotnetheaven.com/UploadFile/tcurry/PNGsUsingGDIplus04222005063702AM/PNGsUsingGDIplus.aspx), Bitmap.Save requires a seekable stream to save as PNG, which HttpResponse.OutputStream isn't. You'll have to save the image into a MemoryStream first, and then copy the contents of it to Res... |
511,589 | <p>I'm new to MDX, so I assume this is a newbie question.</p>
<p><strong>Existing dimension:</strong> status
<strong>Existing Measure:</strong> count</p>
<p><strong>Existing Query:</strong></p>
<pre><code>SELECT
NON EMPTY [status].CHILDREN ON 0,
NON EMPTY Measures.count ON 1
FROM [objects]
</code></pre>
<p>I w... | [
{
"answer_id": 514552,
"author": "Darren Gosbell",
"author_id": 11860,
"author_profile": "https://Stackoverflow.com/users/11860",
"pm_score": 2,
"selected": false,
"text": "<p>The best idea, which is what most client applications do, is to query the metadata to find out what members exis... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511589",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62426/"
] | I'm new to MDX, so I assume this is a newbie question.
**Existing dimension:** status
**Existing Measure:** count
**Existing Query:**
```
SELECT
NON EMPTY [status].CHILDREN ON 0,
NON EMPTY Measures.count ON 1
FROM [objects]
```
I want count the records with status='C'. But sometimes, there're no records that ... | The best idea, which is what most client applications do, is to query the metadata to find out what members exist in a dimension and then only issue queries for members that exist.
The following article lists the various ways of getting at dimension metadata [link text](http://sqlblog.com/blogs/mosha/archive/2006/10/1... |
511,620 | <p>The code segment below prints out "The types ARE NOT the same.". Why? I am aware of the fact that using <code>interfaceOnMyType.GetGenericTypeDefinition()</code> will solve the problem, but why should I have to do that?</p>
<pre><code>class Program
{
static void Main(string[] args)
{
var myType = ... | [
{
"answer_id": 511629,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<pre><code>interfaceOnMyType.GetGenericTypeDefinition()\n</code></pre>\n<p>returns you the closed constructed type of ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511620",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26054/"
] | The code segment below prints out "The types ARE NOT the same.". Why? I am aware of the fact that using `interfaceOnMyType.GetGenericTypeDefinition()` will solve the problem, but why should I have to do that?
```
class Program
{
static void Main(string[] args)
{
var myType = typeof(Baz<>);
var ... | The reason is that `interfaceOnMyType.IsGenericTypeDefinition` returns false, whilst `myType.IsGenericTypeDefinition` and `exactType.IsGenericTypeDefinition` both return true. That is, just because you're retrieving a non-constructed generic type from a generic type definition does not mean that the type you retrieve i... |
511,630 | <p>I have a function that gets passed the document object like:</p>
<pre><code>toggle( $('username') );
function Toggle(id)
{
/// ??
}
</code></pre>
<p>How can I get the actual name of the object passed i.e. username?</p>
| [
{
"answer_id": 511656,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 3,
"selected": true,
"text": "<p>If I understand you correctly, can't you:</p>\n\n<pre><code>$(id).attr(\"id\");\n</code></pre>\n\n<p>or</p>\n\n<pre><cod... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I have a function that gets passed the document object like:
```
toggle( $('username') );
function Toggle(id)
{
/// ??
}
```
How can I get the actual name of the object passed i.e. username? | If I understand you correctly, can't you:
```
$(id).attr("id");
```
or
```
$(id).attr("name");
```
Or am I mistaken? |
511,661 | <p>I have a basic database schema as follows (dumbed down so it's easy to read):</p>
<pre><code>[Staff]
StaffId (pk)
FirstName
LastName
[RosterEvent]
EventId (pk)
StartDate
EndDate
[StaffEvents]
StaffId (pk)
EventId (pk)
</code></pre>
<p>Ok so, many Staff can have many RosterEvents, which is why I added the StaffEv... | [
{
"answer_id": 511690,
"author": "Marcin Gil",
"author_id": 5731,
"author_profile": "https://Stackoverflow.com/users/5731",
"pm_score": 3,
"selected": false,
"text": "<p>Support these guys as they spent considerable time writing this excellent tool and just buy it.</p>\n\n<p>For free alt... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a basic database schema as follows (dumbed down so it's easy to read):
```
[Staff]
StaffId (pk)
FirstName
LastName
[RosterEvent]
EventId (pk)
StartDate
EndDate
[StaffEvents]
StaffId (pk)
EventId (pk)
```
Ok so, many Staff can have many RosterEvents, which is why I added the StaffEvents table. It resolves th... | Support these guys as they spent considerable time writing this excellent tool and just buy it.
For free alternatives you can check [CTags](http://ctags.sourceforge.net/) and a [plugin for VS](http://www.codeproject.com/KB/macros/dstags.aspx). |
511,667 | <p>I need to set the 'ReadOnly' property of a BoundField in a GridView to the value of a bit field in the recordset that is being displayed by the same GridView.</p>
<p>I am aware I could achieve this in code, but I was wondering, out of interest, if it's possible to do this declaratively inside the property using a &... | [
{
"answer_id": 511710,
"author": "Steve Wright",
"author_id": 3256,
"author_profile": "https://Stackoverflow.com/users/3256",
"pm_score": 0,
"selected": false,
"text": "<p>If you need to bind to properties, I would use a TemplateField and then set the behavior there. This is only if you... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511667",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36591/"
] | I need to set the 'ReadOnly' property of a BoundField in a GridView to the value of a bit field in the recordset that is being displayed by the same GridView.
I am aware I could achieve this in code, but I was wondering, out of interest, if it's possible to do this declaratively inside the property using a <% %> snipp... | Yes you can do this. Create a TemplatedField and in the binding statement use either
```
<%# ((Employee)Container.DataItem).IsApproved ? "yes" : "no" %>
```
or you can use a method from the code-behind
```
<%# FormatBool(((Employee)Container.DataItem).IsApproved) %>
```
where FormatBool is a property in your code... |
511,680 | <p>I need the user to set a number of percentage values which should always add up to 100%. What are standard ways to archieve this? I came up with the following:</p>
<p>1) have a standard slider control for each value you need to set. Moving one slider will automatically adjust all the others so the sum will always c... | [
{
"answer_id": 511699,
"author": "Gerrie Schenck",
"author_id": 57036,
"author_profile": "https://Stackoverflow.com/users/57036",
"pm_score": 2,
"selected": true,
"text": "<p>What about vertical sliders? Like a sound mixer. I think it looks a lot better than a list of 10 horizontal slide... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511680",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62449/"
] | I need the user to set a number of percentage values which should always add up to 100%. What are standard ways to archieve this? I came up with the following:
1) have a standard slider control for each value you need to set. Moving one slider will automatically adjust all the others so the sum will always come out as... | What about vertical sliders? Like a sound mixer. I think it looks a lot better than a list of 10 horizontal sliders.
Or fixed width bar with several sliders on them, a bit like the gradient control of Photoshop if you know it. |
511,682 | <p>I'm making a custom control with a panel. I want to be able to drag and drop it so I've implemented that in the MouseDown event of my control. But I want the thing to react when you start drag to give a little feedback to the user. So in the MouseDown even I change the color. Then I want to change it back in the Mou... | [
{
"answer_id": 513190,
"author": "Jarrod",
"author_id": 62601,
"author_profile": "https://Stackoverflow.com/users/62601",
"pm_score": 0,
"selected": false,
"text": "<p>Do you capture the mouse in the custom control on the mousedown event? Try capturing on the mousedown and releasing the... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9077/"
] | I'm making a custom control with a panel. I want to be able to drag and drop it so I've implemented that in the MouseDown event of my control. But I want the thing to react when you start drag to give a little feedback to the user. So in the MouseDown even I change the color. Then I want to change it back in the MouseU... | I'm not sure if you are using Windows Forms or WPF, but in Windows forms here is what I mean:
```
public class DerivedPanel : Panel
{
protected override void OnMouseDown(MouseEventArgs e)
{
base.OnMouseDown(e);
Capture = true;
}
protected override void OnMouseUp(MouseEventArgs e)
... |
511,683 | <p>Is it possible to get, using Bash, a list of commands starting with a certain string?<br>
I would like to get what is printed hitting <tab> twice after typing the start of the command and, for example, store it inside a variable.</p>
| [
{
"answer_id": 511705,
"author": "Oliver N.",
"author_id": 39122,
"author_profile": "https://Stackoverflow.com/users/39122",
"pm_score": 0,
"selected": false,
"text": "<p>Iterate over the $PATH variable and do <code>ls beginningofword*</code> for each directory in the path?</p>\n\n<p>To ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511683",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15622/"
] | Is it possible to get, using Bash, a list of commands starting with a certain string?
I would like to get what is printed hitting <tab> twice after typing the start of the command and, for example, store it inside a variable. | You should be able to use the *compgen* command, like so:
```
compgen -A builtin [YOUR STRING HERE]
```
For example, "compgen -A builtin l" returns
```
let
local
logout
```
You can use other keywords in place of "builtin" to get other types of completion. Builtin gives you shell builtin commands. "File" gives ... |
511,693 | <p>I have 3 images that I want to rotate when a button is clicked.</p>
<p>image1, image2, image3.</p>
<p>If the image is at image1, then when clicked it should show image2 (and so on, in order of image1, .., image3).</p>
<p>When I am at image3, it should then hide the image, i.e. don't display it.</p>
<p>I need som... | [
{
"answer_id": 511728,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 2,
"selected": false,
"text": "<p>You can get a background-image by accessing it from the <a href=\"http://docs.jquery.com/CSS/css#name\" rel=\"nofollow ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511693",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I have 3 images that I want to rotate when a button is clicked.
image1, image2, image3.
If the image is at image1, then when clicked it should show image2 (and so on, in order of image1, .., image3).
When I am at image3, it should then hide the image, i.e. don't display it.
I need some help with the javascript func... | You can get a background-image by accessing it from the [.css(name) method](http://docs.jquery.com/CSS/css#name):
```
$("#sector1").css("background-image");
```
Without managing your list of images in an array or some other fashion, you're going to have to check each background-image to know when it's time to hide y... |
511,694 | <p>In bash </p>
<pre><code>echo ${!X*}
</code></pre>
<p>will print all the names of the variables whose name starts with 'X'.<br>
Is it possible to get the same with an arbitrary pattern, e.g. get all the names of the variables whose name contains an 'X' in any position?</p>
| [
{
"answer_id": 511734,
"author": "diciu",
"author_id": 2811,
"author_profile": "https://Stackoverflow.com/users/2811",
"pm_score": 4,
"selected": false,
"text": "<p>This should do it:</p>\n\n<pre><code>env | grep \".*X.*\"\n</code></pre>\n\n<p>Edit: sorry, that looks for X in the value t... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15622/"
] | In bash
```
echo ${!X*}
```
will print all the names of the variables whose name starts with 'X'.
Is it possible to get the same with an arbitrary pattern, e.g. get all the names of the variables whose name contains an 'X' in any position? | Use the builtin command compgen:
```
compgen -A variable | grep X
``` |
511,718 | <p>My problem is: I have a stripped down <code>default.aspx</code> page. Aside from a element, almost ALL the functionality has to be in the code-behind in <code>aspx.vb</code>.</p>
<p>The program retreives information from a database and compares this to another list of tables, number of both lists can vary.</p>
<p... | [
{
"answer_id": 511734,
"author": "diciu",
"author_id": 2811,
"author_profile": "https://Stackoverflow.com/users/2811",
"pm_score": 4,
"selected": false,
"text": "<p>This should do it:</p>\n\n<pre><code>env | grep \".*X.*\"\n</code></pre>\n\n<p>Edit: sorry, that looks for X in the value t... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | My problem is: I have a stripped down `default.aspx` page. Aside from a element, almost ALL the functionality has to be in the code-behind in `aspx.vb`.
The program retreives information from a database and compares this to another list of tables, number of both lists can vary.
So I need to "bind" a dynamic number of... | Use the builtin command compgen:
```
compgen -A variable | grep X
``` |
511,721 | <p>Is it time()?
Is it time().substr(microtime(), 2, 2)?
Is it time().substr(microtime(), 2, 3)?</p>
<p>Kind of lost with the following snippet.</p>
<pre><code>function updateClock ( ) {
var timeStamp = <?php echo time().substr(microtime(), 2, 2);?>;
var currentTime = new Date ( );
currentTime.setTi... | [
{
"answer_id": 511750,
"author": "phihag",
"author_id": 35070,
"author_profile": "https://Stackoverflow.com/users/35070",
"pm_score": 3,
"selected": true,
"text": "<p><a href=\"http://www.w3schools.com/jsref/jsref_setTime.asp\" rel=\"nofollow noreferrer\">Date.setTime</a> expects the num... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49318/"
] | Is it time()?
Is it time().substr(microtime(), 2, 2)?
Is it time().substr(microtime(), 2, 3)?
Kind of lost with the following snippet.
```
function updateClock ( ) {
var timeStamp = <?php echo time().substr(microtime(), 2, 2);?>;
var currentTime = new Date ( );
currentTime.setTime( timeStamp );
...
... | [Date.setTime](http://www.w3schools.com/jsref/jsref_setTime.asp) expects the number of **milliseconds** since 1970-1-1. php's [time function](http://php.net/time) yields the number of **seconds** since 1970-1-1. Therefore, you can just use
```
var TimeStamp = <?php echo time()*1000;?>
```
Due to latency issues (the ... |
511,752 | <p>I am starting a winform application[.NET 3.5, C#], where in the the main form of the application starts at a particular specified location. Am calling the following code in the constructor for this </p>
<pre><code> private void SetFormPosition()
{
this.StartPosition = FormStartPosition.Manual;
... | [
{
"answer_id": 511791,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 3,
"selected": true,
"text": "<p>I agree with others that you probably shouldn't be doing this, but if you must, read on.</p>\n\n<p>You can override t... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511752",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40981/"
] | I am starting a winform application[.NET 3.5, C#], where in the the main form of the application starts at a particular specified location. Am calling the following code in the constructor for this
```
private void SetFormPosition()
{
this.StartPosition = FormStartPosition.Manual;
this.Left = ... | I agree with others that you probably shouldn't be doing this, but if you must, read on.
You can override the SetBoundsCore method and prevent any movement. We use this to prevent vertical resizing on some UserControl implementations (such as those that contain a ComboBox or other fixed height control), but it is also... |
511,761 | <p>I have a url like <a href="http://www.example.com/blah/th.html" rel="noreferrer">http://www.example.com/blah/th.html</a></p>
<p>I need a javascript function to give me the 'th' value from that.</p>
<p>All my urls have the same format (2 letter filenames, with .html extension).</p>
<p>I want it to be a safe functi... | [
{
"answer_id": 511814,
"author": "David Morton",
"author_id": 45916,
"author_profile": "https://Stackoverflow.com/users/45916",
"pm_score": 5,
"selected": false,
"text": "<p>Use the match function. </p>\n\n<pre><code>function GetFilename(url)\n{\n if (url)\n {\n var m = url.toSt... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I have a url like <http://www.example.com/blah/th.html>
I need a javascript function to give me the 'th' value from that.
All my urls have the same format (2 letter filenames, with .html extension).
I want it to be a safe function, so if someone passes in an empty url it doesn't break.
I know how to check for lengt... | ```
var filename = url.split('/').pop()
``` |
511,768 | <p>I've a working logger class, which outputs some text into a richtextbox (Win32, C++).
Problem is, i always end up using it like this:</p>
<pre><code>stringstream ss;
ss << someInt << someString;
debugLogger.log(ss.str());
</code></pre>
<p>instead, it would be much more convenient to use it like a s... | [
{
"answer_id": 511778,
"author": "Vinay",
"author_id": 28641,
"author_profile": "https://Stackoverflow.com/users/28641",
"pm_score": -1,
"selected": false,
"text": "<p>In the Logger class, override the << operator.</p>\n\n<p>Click <a href=\"http://www.codersource.net/cpp_stream_ope... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62459/"
] | I've a working logger class, which outputs some text into a richtextbox (Win32, C++).
Problem is, i always end up using it like this:
```
stringstream ss;
ss << someInt << someString;
debugLogger.log(ss.str());
```
instead, it would be much more convenient to use it like a stream as in:
```
debugLogger << someI... | You need to implement `operator <<` appropriately for your class. The general pattern looks like this:
```
template <typename T>
logger& operator <<(logger& log, T const& value) {
log.your_stringstream << value;
return log;
}
```
Notice that this deals with (non-`const`) references since the operation modifi... |
511,777 | <p>So we ran into an interesting issue today. We have a Java EE web app that uses a bunch of 3rd party jars. This includes Hibernate.</p>
<p>We use the Java logging api that comes with the SDK for logging purposes. Typically we are pretty thin on logging but we ran into this issue with one of our 3rd party jars using ... | [
{
"answer_id": 511778,
"author": "Vinay",
"author_id": 28641,
"author_profile": "https://Stackoverflow.com/users/28641",
"pm_score": -1,
"selected": false,
"text": "<p>In the Logger class, override the << operator.</p>\n\n<p>Click <a href=\"http://www.codersource.net/cpp_stream_ope... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511777",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48773/"
] | So we ran into an interesting issue today. We have a Java EE web app that uses a bunch of 3rd party jars. This includes Hibernate.
We use the Java logging api that comes with the SDK for logging purposes. Typically we are pretty thin on logging but we ran into this issue with one of our 3rd party jars using log4j to c... | You need to implement `operator <<` appropriately for your class. The general pattern looks like this:
```
template <typename T>
logger& operator <<(logger& log, T const& value) {
log.your_stringstream << value;
return log;
}
```
Notice that this deals with (non-`const`) references since the operation modifi... |
511,781 | <p>I've been thinking on this for a while now (you know, that dangerous thing programmers tend to do) and I've been wondering, is the method of storing data that we're so accustomed to really all that efficient? The trouble with answering this question is that I really don't have anything to compare it to, since it's t... | [
{
"answer_id": 511801,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 0,
"selected": false,
"text": "<p>Well, there's always <a href=\"http://en.wikipedia.org/wiki/Pick_operating_system\" rel=\"nofollow noreferrer\">Pick... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511781",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19521/"
] | I've been thinking on this for a while now (you know, that dangerous thing programmers tend to do) and I've been wondering, is the method of storing data that we're so accustomed to really all that efficient? The trouble with answering this question is that I really don't have anything to compare it to, since it's the ... | Emails are often stored in folders. But ever since I have migrated to Gmail, I have become accustomed to classifying my emails with tags.
I often wondered if we could manage a whole file-system that way: instead of storing files in folders, you could tag files with the tags you like. A file identifier would not look l... |
511,785 | <p>I want to get the size of a file on disk in megabytes. Using the <code>-s</code> operator gives me the size in bytes, but I'm going to assume that then dividing this by a magic number is a bad idea:</p>
<pre><code>my $size_in_mb = (-s $fh) / (1024 * 1024);
</code></pre>
<p>Should I just use a read-only variable t... | [
{
"answer_id": 511795,
"author": "user54650",
"author_id": 54650,
"author_profile": "https://Stackoverflow.com/users/54650",
"pm_score": 2,
"selected": false,
"text": "<p>Well, there's not 1024 bytes in a meg, there's 1024 bytes in a K, and 1024 K in a meg...</p>\n\n<p>That said, 1024 is... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6406/"
] | I want to get the size of a file on disk in megabytes. Using the `-s` operator gives me the size in bytes, but I'm going to assume that then dividing this by a magic number is a bad idea:
```
my $size_in_mb = (-s $fh) / (1024 * 1024);
```
Should I just use a read-only variable to define 1024 or is there a programmat... | If you'd like to avoid magic numbers, try the CPAN module [Number::Bytes::Human](http://search.cpan.org/perldoc?Number::Bytes::Human).
```
use Number::Bytes::Human qw(format_bytes);
my $size = format_bytes(-s $file); # 4.5M
``` |
511,793 | <p>In a WCF service, I have two classes with the [DataContract] attribute. One of these classes has an "is-a" relationship with the other - so class B can inherit from class A. However, when I configure inheritance between these two classes, both denoted with a [DataContract] attribute, the metadata fails to load whe... | [
{
"answer_id": 511825,
"author": "David Morton",
"author_id": 45916,
"author_profile": "https://Stackoverflow.com/users/45916",
"pm_score": 6,
"selected": true,
"text": "<p>Yes, but you need to decorate the base class with the [KnownTypeAttribute] constructing it with the derived class's... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511793",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20133/"
] | In a WCF service, I have two classes with the [DataContract] attribute. One of these classes has an "is-a" relationship with the other - so class B can inherit from class A. However, when I configure inheritance between these two classes, both denoted with a [DataContract] attribute, the metadata fails to load when tes... | Yes, but you need to decorate the base class with the [KnownTypeAttribute] constructing it with the derived class's type. For instance:
```
[DataContract]
[KnownType(typeof(B))]
public class A
{
[DataMember]
public string Value { get; set; }
}
[DataContract]
public class B : A
{
[DataMember]
public string... |
511,820 | <p>I'm trying to figure out how to optimize a very slow query in MySQL (I didn't design this):</p>
<pre><code>SELECT COUNT(*) FROM change_event me WHERE change_event_id > '1212281603783391';
+----------+
| COUNT(*) |
+----------+
| 3224022 |
+----------+
1 row in set (1 min 0.16 sec)
</code></pre>
<p>Comparing th... | [
{
"answer_id": 511863,
"author": "Alnitak",
"author_id": 6782,
"author_profile": "https://Stackoverflow.com/users/6782",
"pm_score": 1,
"selected": false,
"text": "<p>Run \"<code>analyze table_name</code>\" on that table - it's possible that the indices are no longer optimal.</p>\n\n<p>Y... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8003/"
] | I'm trying to figure out how to optimize a very slow query in MySQL (I didn't design this):
```
SELECT COUNT(*) FROM change_event me WHERE change_event_id > '1212281603783391';
+----------+
| COUNT(*) |
+----------+
| 3224022 |
+----------+
1 row in set (1 min 0.16 sec)
```
Comparing that to a full count:
```
sele... | InnoDB uses clustered primary keys, so the primary key is stored along with the row in the data pages, not in separate index pages. In order to do a range scan you still have to scan through all of the potentially wide rows in data pages; note that this table contains a TEXT column.
Two things I would try:
1. run `op... |
511,829 | <p>I have a situation where I need to copy a few specific files in a MSBuild script, but they may or may not exist. If they don't exist it's fine, I don't need them then. But the standard <code><copy></code> task throws an error if it cannot find each and every item in the list...</p>
| [
{
"answer_id": 511888,
"author": "Julien Hoarau",
"author_id": 12248,
"author_profile": "https://Stackoverflow.com/users/12248",
"pm_score": 7,
"selected": true,
"text": "<p>Use the <strong>Exists</strong> condition on Copy task.</p>\n\n<pre><code><CreateItem Include=\"*.xml\">\n ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41360/"
] | I have a situation where I need to copy a few specific files in a MSBuild script, but they may or may not exist. If they don't exist it's fine, I don't need them then. But the standard `<copy>` task throws an error if it cannot find each and every item in the list... | Use the **Exists** condition on Copy task.
```
<CreateItem Include="*.xml">
<Output ItemName="ItemsThatNeedToBeCopied" TaskParameter="Include"/>
</CreateItem>
<Copy SourceFiles="@(ItemsThatNeedToBeCopied)"
DestinationFolder="$(OutputDir)"
Condition="Exists('%(RootDir)%(Directory)%(Filename)%(Extension)'... |
511,835 | <p>I know only little how to make macros in Excel.</p>
| [
{
"answer_id": 511874,
"author": "alphadogg",
"author_id": 59494,
"author_profile": "https://Stackoverflow.com/users/59494",
"pm_score": 0,
"selected": false,
"text": "<p>Search for it and look at their code. Plenty of people have made it a hobby to make full games in Excel.</p>\n\n<p>Ex... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54964/"
] | I know only little how to make macros in Excel. | Should have done this a long time ago but here's my version of Conway's Life in excel.
Here's a hack of the code. By no means a perfect solution (didn't spend an age on this) but you might be able to pick some bits out.
```
Private arrGrid(100, 100) As Boolean
Private arrGridNextGeneration(100, 100) As Boolean
Priva... |
511,873 | <p>I'm building a MySQL query to determine how many items from each of several categories appear in a given date range. My initial attempt looked like this:</p>
<pre><code>select Title,
(select count(*) from entries where CategoryID=1
and Date >= @StartDate and Date <= @EndDate) as Cat1,
(select count(*... | [
{
"answer_id": 511897,
"author": "Rik Heywood",
"author_id": 4012,
"author_profile": "https://Stackoverflow.com/users/4012",
"pm_score": 0,
"selected": false,
"text": "<pre><code>Select COUNT(*), sTitle, CategoryID FROM entries \nWHERE Date >= @StartDate and Date <= @EndDate \nGROU... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/521/"
] | I'm building a MySQL query to determine how many items from each of several categories appear in a given date range. My initial attempt looked like this:
```
select Title,
(select count(*) from entries where CategoryID=1
and Date >= @StartDate and Date <= @EndDate) as Cat1,
(select count(*) from entries where... | ```
select Title, SUM(CategoryID=1) as Cat1, SUM(categoryID=2) as Cat2,
SUM(categoryID IS NULL) as UnknownCategory
FROM entries
WHERE Date BETWEEN @StartDate AND @EndDate
GROUP BY Title
```
You can stick expressions in sum() functions: truth equals 1, false equals 0. Also I used the BETWEEN operator which is a little... |
511,881 | <p>I have a small MVC app that works locally, but when I publish it to the server (running IIS6), all the links get messed up.</p>
<p>For example, a typical link when running locally would be:</p>
<pre><code>http://localhost:3467/Exceptions?exdate=20090108
</code></pre>
<p>However, when I publish it to our dev serve... | [
{
"answer_id": 512122,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "<p>Is the IIS folder set as an application? It should have a cog icon in the IIS explorer.</p>\n"
},
{
"answe... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23935/"
] | I have a small MVC app that works locally, but when I publish it to the server (running IIS6), all the links get messed up.
For example, a typical link when running locally would be:
```
http://localhost:3467/Exceptions?exdate=20090108
```
However, when I publish it to our dev server at `\\deverserver\apps\MyProjec... | Did you performed all the steps [(here)](http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx) to deploy the MVC app in the IIS6? |
511,893 | <p>My TextBox won't update! I am using it as a Log to update what other things are doing... </p>
<p><strong>Form 1 code:</strong></p>
<pre><code>using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Data.... | [
{
"answer_id": 511919,
"author": "Pondidum",
"author_id": 1500,
"author_profile": "https://Stackoverflow.com/users/1500",
"pm_score": 0,
"selected": false,
"text": "<p>I had a problem similar once before, it was solved by calling <code>.Invalidate()</code> on the text box after writing t... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60615/"
] | My TextBox won't update! I am using it as a Log to update what other things are doing...
**Form 1 code:**
```
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO;
using System.Data.OleDb;
using System.Collections.Sp... | What thread are you calling `Logging.updateLog()` from? If it's not the UI thread, I could see that the TextBox wouldn't get updated in that case. If you try calling `logAdd()` from `synchronize_Click()` (assuming that this is called from the UI thread based on the name), does it work then? |
511,902 | <p>im trying to call a setter method in some an actionscript block of my custom component from an actionscript class.</p>
<p>I can do this fine when its the main application i want to call by using ;</p>
<pre><code>Application.application.methodName();
</code></pre>
<p>however how can i call a method from a custom c... | [
{
"answer_id": 511939,
"author": "cliff.meyers",
"author_id": 41754,
"author_profile": "https://Stackoverflow.com/users/41754",
"pm_score": 0,
"selected": false,
"text": "<p>Referencing the component in that manner requires the method to be static.</p>\n\n<p>If you want to invoke a metho... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24481/"
] | im trying to call a setter method in some an actionscript block of my custom component from an actionscript class.
I can do this fine when its the main application i want to call by using ;
```
Application.application.methodName();
```
however how can i call a method from a custom component? My component is in my c... | You don't have to make the method static; doing so would likely be useless, as you'd want the method call to do something with the component's current state, I'm guessing -- use some of its data, change its appearance, etc. What you really need is an object reference.
Since Application.application resides at the top (... |
511,916 | <p>This is a follow up to <a href="https://stackoverflow.com/questions/510461/validating-data-in-database-sql-vs-code">this question</a>.</p>
<p>Here is my schema</p>
<pre><code>CREATE TABLE A(
id serial NOT NULL,
date timestamp without time zone,
type text,
sub_type text,
filename text,
... | [
{
"answer_id": 511931,
"author": "David Grant",
"author_id": 40581,
"author_profile": "https://Stackoverflow.com/users/40581",
"pm_score": 4,
"selected": true,
"text": "<p>Sure, use <code>UPDATE ... WHERE lock_status = 0</code>. Alternatively, you could try using <a href=\"http://www.po... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29505/"
] | This is a follow up to [this question](https://stackoverflow.com/questions/510461/validating-data-in-database-sql-vs-code).
Here is my schema
```
CREATE TABLE A(
id serial NOT NULL,
date timestamp without time zone,
type text,
sub_type text,
filename text,
filepath text,
filesize in... | Sure, use `UPDATE ... WHERE lock_status = 0`. Alternatively, you could try using [stored procedures](http://www.postgresql.org/docs/8.0/interactive/plpgsql.html). |
511,925 | <p>I recently imported about 60k records into a table that relates data in one table to data in another table. However, my client has since requested that a sort order be added to all 60k records. My hope is there is a nice clean way to auto generate these sort orders in a SQL Update. The finished data should look s... | [
{
"answer_id": 511952,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 4,
"selected": true,
"text": "<p>You could use [ROW_NUMBER][1] and partition by Item1ID </p>\n\n<pre><code>UPDATE t1\nSET t1.SortOrder = t2.SortOrder \nFRO... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511925",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28701/"
] | I recently imported about 60k records into a table that relates data in one table to data in another table. However, my client has since requested that a sort order be added to all 60k records. My hope is there is a nice clean way to auto generate these sort orders in a SQL Update. The finished data should look somethi... | You could use [ROW\_NUMBER][1] and partition by Item1ID
```
UPDATE t1
SET t1.SortOrder = t2.SortOrder
FROM @t t1
INNER JOIN
(SELECT Item1ID, Item2ID, ROW_NUMBER() OVER
(PARTITION BY Item1ID ORDER BY Item1ID, Item2ID) AS SortOrder
from @t) t2
ON t1.Item1ID = t2.Item1ID
AND t1.Item2ID = t2.Item2ID
``` |
511,935 | <p>I am creating a multipage form in PHP, using a session. The <code>$stage</code> variable tracks the user's progress in filling out the form, <strong>(UPDATE) and is normally set in $_POST at each stage of the form.</strong></p>
<p>On the second page (stage 2), the form's submit button gets its value like this:</p>
<... | [
{
"answer_id": 511959,
"author": "tkotitan",
"author_id": 57625,
"author_profile": "https://Stackoverflow.com/users/57625",
"pm_score": 2,
"selected": false,
"text": "<p>This is really hard to answer without more code. One thing to check is that you are saving stage back into the sessio... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4376/"
] | I am creating a multipage form in PHP, using a session. The `$stage` variable tracks the user's progress in filling out the form, **(UPDATE) and is normally set in $\_POST at each stage of the form.**
On the second page (stage 2), the form's submit button gets its value like this:
```
echo '<input type="hidden" name=... | No, PHP will evaluate your variable when the function is called. But your function has a local [variable scope](http://de.php.net/global), i.e. without seeing your function I'd guess that you are operating on a local variable. You can import global variables into you function although this is discouraged:
```
function... |
511,936 | <p>I need a javascript function which gets a string and returns false if the string contains<br>
- Any unclosed dollar symbol<br>
- Or a closed dollar symbol with something between dollars different than a series of characters</p>
<pre><code>function validateFormat(text) {
// Do stuff
}
</code></pre>
<p>For example i... | [
{
"answer_id": 511959,
"author": "tkotitan",
"author_id": 57625,
"author_profile": "https://Stackoverflow.com/users/57625",
"pm_score": 2,
"selected": false,
"text": "<p>This is really hard to answer without more code. One thing to check is that you are saving stage back into the sessio... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] | I need a javascript function which gets a string and returns false if the string contains
- Any unclosed dollar symbol
- Or a closed dollar symbol with something between dollars different than a series of characters
```
function validateFormat(text) {
// Do stuff
}
```
For example if text:
```
validateFormat... | No, PHP will evaluate your variable when the function is called. But your function has a local [variable scope](http://de.php.net/global), i.e. without seeing your function I'd guess that you are operating on a local variable. You can import global variables into you function although this is discouraged:
```
function... |
511,947 | <p>I'm making an ajax call with jQuery. The ajax call works fine in IE 7, but FireFox 3 always does a full page refresh when making this call. The ajax call is POSTing to an ASP.NET page method. </p>
<p>Is there a problem in jQuery or am I just missing some setting?</p>
<pre><code>$.ajax({
async: false,
type: "... | [
{
"answer_id": 511969,
"author": "Carl",
"author_id": 38375,
"author_profile": "https://Stackoverflow.com/users/38375",
"pm_score": 1,
"selected": false,
"text": "<p>Is this call inside a click event? If it is, make sure the end of the click event has a \"return false\". Just a thought.... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511947",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52187/"
] | I'm making an ajax call with jQuery. The ajax call works fine in IE 7, but FireFox 3 always does a full page refresh when making this call. The ajax call is POSTing to an ASP.NET page method.
Is there a problem in jQuery or am I just missing some setting?
```
$.ajax({
async: false,
type: "POST",
url: "Default.... | return false is what you need, however if a javascript error occurs before you hit that line, then the browser will continue on carrying out a link-click or button-click event happily.
you can try try surround potential problem areas with try/catch blocks.
Alternatively you might try this:
`e.preventDefault` as the ... |
511,960 | <p>Is it possible to rotate text from a horizontal position to a vertical on a single point without using something like flash? So I would read the same text normally by tilting my head.</p>
<p>I was thinking you can do this in jquery but couldn't find a plug in.</p>
| [
{
"answer_id": 511997,
"author": "Mark Pim",
"author_id": 38883,
"author_profile": "https://Stackoverflow.com/users/38883",
"pm_score": 3,
"selected": true,
"text": "<p>I remember looking into this myself and discovering that it was either really hack-y or just not possible.</p>\n\n<p>IE... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511960",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52843/"
] | Is it possible to rotate text from a horizontal position to a vertical on a single point without using something like flash? So I would read the same text normally by tilting my head.
I was thinking you can do this in jquery but couldn't find a plug in. | I remember looking into this myself and discovering that it was either really hack-y or just not possible.
IE allows
```
<div STYLE="writing-mode: tb-rl">Content rendered vertically</div>
```
But AFAIK it doesn't work anywhere else (certainly doesn't on FF 3).
The best solution seems to be to use images (possibly... |
511,985 | <p>I'm having a heck of a time with this one. Might be the lack of sleep... or maybe I'm just getting dumb.</p>
<p>I have 2 tables:<br>
a) Person {Key, Name, LastName}<br>
b) LogEntry {Key, PersonKey, Log, EntryTime}</p>
<p>I'm trying to get a join of Person and LogEntry where LogEntry is the latest LogEntry for the... | [
{
"answer_id": 512055,
"author": "Ryan Versaw",
"author_id": 9433,
"author_profile": "https://Stackoverflow.com/users/9433",
"pm_score": 0,
"selected": false,
"text": "<p>On a partial class for Person, create a new property similar to this:</p>\n\n<pre><code>public partial Person\n{\n ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511985",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38967/"
] | I'm having a heck of a time with this one. Might be the lack of sleep... or maybe I'm just getting dumb.
I have 2 tables:
a) Person {Key, Name, LastName}
b) LogEntry {Key, PersonKey, Log, EntryTime}
I'm trying to get a join of Person and LogEntry where LogEntry is the latest LogEntry for the given Person.
I ho... | If you have the Relations in SQLServer you should have in the class Person something like
Person.LogEntries. You can do like this:
```
LogEntry logEntry =
Person.LogEntries.OrderByDescending(p => p.EntryTime).FirstOrDefault();
```
Then you can check if logEntry is null if not I should have the last log entry for... |
511,998 | <p>I am writing a Qt/C++ application, up until this month I have been using Mingw for compiling and drmingw for getting the stack trace from the QA people.</p>
<p>However I recently converted over to MSVC++ 9 so that I can use the phonon framework.</p>
<p>The downside is that now the stack traces from drmingw are use... | [
{
"answer_id": 512055,
"author": "Ryan Versaw",
"author_id": 9433,
"author_profile": "https://Stackoverflow.com/users/9433",
"pm_score": 0,
"selected": false,
"text": "<p>On a partial class for Person, create a new property similar to this:</p>\n\n<pre><code>public partial Person\n{\n ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/511998",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24459/"
] | I am writing a Qt/C++ application, up until this month I have been using Mingw for compiling and drmingw for getting the stack trace from the QA people.
However I recently converted over to MSVC++ 9 so that I can use the phonon framework.
The downside is that now the stack traces from drmingw are useless. What do oth... | If you have the Relations in SQLServer you should have in the class Person something like
Person.LogEntries. You can do like this:
```
LogEntry logEntry =
Person.LogEntries.OrderByDescending(p => p.EntryTime).FirstOrDefault();
```
Then you can check if logEntry is null if not I should have the last log entry for... |
512,010 | <p>I am using jQuery. I have a problem when alerts the IDs of a list shows two times, instead of once.</p>
<p>The list:</p>
<pre><code><ul id="testnav">
<li> <a href="#">Page 1</a></li>
<li> <a href="#">Page2..</a>
<ul id="subnav">
<... | [
{
"answer_id": 512041,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 2,
"selected": false,
"text": "<p>You are experiencing <a href=\"http://www.quirksmode.org/js/events_order.html\" rel=\"nofollow noreferrer\">event ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I am using jQuery. I have a problem when alerts the IDs of a list shows two times, instead of once.
The list:
```
<ul id="testnav">
<li> <a href="#">Page 1</a></li>
<li> <a href="#">Page2..</a>
<ul id="subnav">
<li id="content_1"><a href="#"> Page3</a></li>
</ul>
</li>
</ul>
`... | $("li").click() is applying the click event to all LIs on the page.
When you click
```
<li> <a href="#">Page2..</a>
<ul id="subnav">
<li id="content_1"><a href="#"> Page3</a></li>
</ul>
</li>
```
You're actually clicking the outer LI, and the inner-most LI, which would cause the event to fire tw... |
512,035 | <p>I am wondering if the usage of a generic <code>TList<T></code> where <code>T</code> is any interface type (except <code>IUnknown</code>/<code>IInterface</code>) might be dangerous. I am heavily using interfaces and store them in lists. Some interfaces are my own, some are provided by some COM-interfaces, so CO... | [
{
"answer_id": 517926,
"author": "Toby Allen",
"author_id": 6244,
"author_profile": "https://Stackoverflow.com/users/6244",
"pm_score": 1,
"selected": false,
"text": "<p>Would the TInterfaceList type work for you? </p>\n\n<p>This is designed specifically to work with a list of interface... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512035",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56658/"
] | I am wondering if the usage of a generic `TList<T>` where `T` is any interface type (except `IUnknown`/`IInterface`) might be dangerous. I am heavily using interfaces and store them in lists. Some interfaces are my own, some are provided by some COM-interfaces, so COM is involved.
I see a potential problem where check... | Unless the interface is downgraded to IUnknown via QueryInterface() then there is some potential for this to be an issue for you as it may not have respected the COM rules.
The default IComparer and IEqualityComparer for tkInterface simply compares the pointer values as four byte integers (so, there is on QueryInterfa... |
512,042 | <p>I have a user who is intermittently receiving an HTTP 405 when clicking a link within my application. There is nothing funny about the link, as far as I can see...</p>
<pre><code><a id="ctl00_ctlNavigationMenu_viewTransfersLink" href="Navigate.ashx?target=6">- View Transfers</a>
</code></pre>
<p>As I ... | [
{
"answer_id": 512168,
"author": "dmajkic",
"author_id": 39233,
"author_profile": "https://Stackoverflow.com/users/39233",
"pm_score": 2,
"selected": false,
"text": "<p>This request is malformed GET request is coming from the browser side. And you can pinpoint error to IP 192.168.202.204... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24289/"
] | I have a user who is intermittently receiving an HTTP 405 when clicking a link within my application. There is nothing funny about the link, as far as I can see...
```
<a id="ctl00_ctlNavigationMenu_viewTransfersLink" href="Navigate.ashx?target=6">- View Transfers</a>
```
As I said, most of the time the link execute... | This request is malformed GET request is coming from the browser side. And you can pinpoint error to IP 192.168.202.204.
It is not IIS or your server, it is not network card (TCP has error correction).
It can be that browser is buggy or that there is some proxy / firewall on that box that interceps http trafic. Cou... |
512,054 | <p>I have an image URL in a <code>imageUrl</code> variable and I am trying to set it as CSS style, using jQuery:</p>
<pre><code>$('myObject').css('background-image', imageUrl);
</code></pre>
<p>This seems to be not working, as:</p>
<pre><code>console.log($('myObject').css('background-image'));
</code></pre>
<p>retu... | [
{
"answer_id": 512067,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 11,
"selected": true,
"text": "<p>You probably want this (to make it like a normal CSS background-image declaration):</p>\n\n<pre><code>$('myObject').css('b... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | I have an image URL in a `imageUrl` variable and I am trying to set it as CSS style, using jQuery:
```
$('myObject').css('background-image', imageUrl);
```
This seems to be not working, as:
```
console.log($('myObject').css('background-image'));
```
returns `none`.
Any idea, what I am doing wrong? | You probably want this (to make it like a normal CSS background-image declaration):
```
$('myObject').css('background-image', 'url(' + imageUrl + ')');
``` |
512,070 | <p>How to add a link stylesheet reference to the head of a document ?</p>
<p>I've found this code but it's not working with all browsers, it crashes my IE7 :</p>
<pre><code>var ss = document.createElement("link");
ss.type = "text/css";
ss.rel = "stylesheet";
ss.href = "style.css";
document.getElementsByTagName("head"... | [
{
"answer_id": 512100,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": false,
"text": "<p>In IE, you could try the createStyleSheet method? That takes URL as a parameter. I don't know whether there is an equival... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512070",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59350/"
] | How to add a link stylesheet reference to the head of a document ?
I've found this code but it's not working with all browsers, it crashes my IE7 :
```
var ss = document.createElement("link");
ss.type = "text/css";
ss.rel = "stylesheet";
ss.href = "style.css";
document.getElementsByTagName("head")[0].appendChild(ss);... | That was a simple cross reference javascript bug. Have a nice day. |
512,083 | <p>I am using VSTS 2008 with both the developer and database editions installed. I have the DB edition GDR installed (version 9.0.31124). We have several places in code that we reference linked servers (DB2 mainframe, iSeries, and SQL Server). One such example is this code that we have in a store procedure:</p>
<pre><... | [
{
"answer_id": 512154,
"author": "Element",
"author_id": 50970,
"author_profile": "https://Stackoverflow.com/users/50970",
"pm_score": 0,
"selected": false,
"text": "<p>Its basically just a static string builder class with a few formatting functions, shouldn't be too hard to write your o... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/162/"
] | I am using VSTS 2008 with both the developer and database editions installed. I have the DB edition GDR installed (version 9.0.31124). We have several places in code that we reference linked servers (DB2 mainframe, iSeries, and SQL Server). One such example is this code that we have in a store procedure:
```
SELECT Ve... | try this:
<http://weblogs.asp.net/bleroy/archive/2008/07/07/using-scriptmanager-with-other-frameworks.aspx> |
512,089 | <p>How do you raise a SQL Server error event (similar to RAISERROR) from within a SQL CLR routine?</p>
| [
{
"answer_id": 512800,
"author": "gbn",
"author_id": 27535,
"author_profile": "https://Stackoverflow.com/users/27535",
"pm_score": 2,
"selected": false,
"text": "<p>In theory, based on a code sample I got from one of our devs:</p>\n\n<pre><code>try\n{\n response = service.ProcessThisI... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512089",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do you raise a SQL Server error event (similar to RAISERROR) from within a SQL CLR routine? | In theory, based on a code sample I got from one of our devs:
```
try
{
response = service.ProcessThisInfo(info);
}
catch (Exception ex)
{
returnCode = Convert.ToInt32(ErrorEnum.SomeError);
string msg = string.Format("RAISERROR('{0}',16,1)", ex.Message.Replace('\'', ' '));
SqlCommand cmd = new Sq... |
512,090 | <p>I was trying to implement Rick's adding meta refresh via header on this <a href="http://www.west-wind.com/Weblog/posts/6841.aspx" rel="nofollow noreferrer">article</a></p>
<p>For some reason my url look like this </p>
<p><a href="http://localhost/pickweb/(S(hp5mypqznxgquf45vzz4fi55))/Login.aspx" rel="nofollow nore... | [
{
"answer_id": 512107,
"author": "Jack",
"author_id": 28647,
"author_profile": "https://Stackoverflow.com/users/28647",
"pm_score": 0,
"selected": false,
"text": "<p>Hmmm...I think I figure out where it come from. I think it's because my web.config have set session in InProc. Could that ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28647/"
] | I was trying to implement Rick's adding meta refresh via header on this [article](http://www.west-wind.com/Weblog/posts/6841.aspx)
For some reason my url look like this
<http://localhost/pickweb/(S(hp5mypqznxgquf45vzz4fi55))/Login.aspx>
What is this "(S(hp5mypqznxgquf45vzz4fi55))" in my url? Even if i remove the co... | Looks like you are using cookieless sessions:
<http://msdn.microsoft.com/en-us/library/aa479314.aspx> |
512,097 | <p>I have an application which uses 2 forms, a Main Form and a Splash Form being used in the following configuration:</p>
<pre><code>public class MainForm : Form
{
public MainForm()
{
SplashScreen splash = new SplashScreen();
// configure Splash Screen
}
}
public class SplashScreen
{
p... | [
{
"answer_id": 512130,
"author": "Yes - that Jake.",
"author_id": 5287,
"author_profile": "https://Stackoverflow.com/users/5287",
"pm_score": 0,
"selected": false,
"text": "<p>Use splash.Open() rather than splash.OpenDialog() and this won't happen.</p>\n"
},
{
"answer_id": 512131... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1816/"
] | I have an application which uses 2 forms, a Main Form and a Splash Form being used in the following configuration:
```
public class MainForm : Form
{
public MainForm()
{
SplashScreen splash = new SplashScreen();
// configure Splash Screen
}
}
public class SplashScreen
{
public SplashScr... | I already replied to you with a working example on the other question you asked for the same thing:
[C# winforms startup (Splash) form not hiding](https://stackoverflow.com/questions/510765/510786#510786) |
512,105 | <p>I have several Multi-Select parameters in my report. I am trying to find a way to pass in multiple values for a single parameter in the web query string? If I pass in a single value, it works fine.</p>
<p>The report runs fine selecting multiple choices for a single param. My trouble lies in the web query string.</p... | [
{
"answer_id": 512300,
"author": "John Sansom",
"author_id": 60308,
"author_profile": "https://Stackoverflow.com/users/60308",
"pm_score": 4,
"selected": false,
"text": "<p>This is one of the poor supported features in SQL Reporting Services.</p>\n\n<p>What you need to do is pass all of ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5633/"
] | I have several Multi-Select parameters in my report. I am trying to find a way to pass in multiple values for a single parameter in the web query string? If I pass in a single value, it works fine.
The report runs fine selecting multiple choices for a single param. My trouble lies in the web query string. | Although John Sansom's solution works, there's another way to do this, without having to use a potentially inefficient scalar valued UDF.
In the SSRS report, on the parameters tab of the query definition, set the parameter value to
```
=join(Parameters!<your param name>.Value,",")
```
In your query, you can then re... |
512,106 | <p>I'm having an issue understanding the MixColumns step described <a href="http://en.wikipedia.org/wiki/Advanced_Encryption_Standard" rel="nofollow noreferrer">here</a>.</p>
<p>I know about diffusion and it all makes sense up the the point where it states that each column is treated as a polynomial and multiplied mod... | [
{
"answer_id": 1005017,
"author": "Theran",
"author_id": 40180,
"author_profile": "https://Stackoverflow.com/users/40180",
"pm_score": 2,
"selected": false,
"text": "<p>The multiplication in MixColumns is indeed reversible, and it is not modulo 256. <a href=\"http://samiam.org/mix-column... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53915/"
] | I'm having an issue understanding the MixColumns step described [here](http://en.wikipedia.org/wiki/Advanced_Encryption_Standard).
I know about diffusion and it all makes sense up the the point where it states that each column is treated as a polynomial and multiplied modulo over GF(2^8).
BUT..multiplying in GF(2^8).... | MixColumns is probably the hardest part to AES, but it was exciting for me to work out the math and actually see where the numbers came from. I worked out the math of it in detail in my blog post "[A Stick Figure Guide to the Advanced Encryption Standard (AES)](http://www.moserware.com/2009/09/stick-figure-guide-to-adv... |
512,119 | <p>Before I call:</p>
<pre><code>$('myObject').show();
</code></pre>
<p>I want to know if it is currently hidden or visible.</p>
| [
{
"answer_id": 512136,
"author": "Adam Lassek",
"author_id": 1249,
"author_profile": "https://Stackoverflow.com/users/1249",
"pm_score": 4,
"selected": true,
"text": "<p>You can test this with the css() function:</p>\n\n<pre><code>if ($('myObject').css('display') == 'none') {\n $('myObj... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | Before I call:
```
$('myObject').show();
```
I want to know if it is currently hidden or visible. | You can test this with the css() function:
```
if ($('myObject').css('display') == 'none') {
$('myObject').show();
}
```
EDIT:
Wasn't aware of how cool the :hidden selector is. My suggestion is still useful for testing other attributes, but Alex's suggestion is nicer in this case. |
512,120 | <p>What surprises have other people found with writing PHP web applications? There's the well known and to be fixed issue with compile time class inheritance but I know of a couple others and wanted to try and build a list of the top gotcha's of the language.</p>
<p>Note: </p>
<p>I've held several positions as a Sr.... | [
{
"answer_id": 512146,
"author": "David",
"author_id": 9908,
"author_profile": "https://Stackoverflow.com/users/9908",
"pm_score": 3,
"selected": false,
"text": "<p>It was kind of obvious after the fact but a well known gotcha has to do with scope and references when used in foreach.</p>... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512120",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9908/"
] | What surprises have other people found with writing PHP web applications? There's the well known and to be fixed issue with compile time class inheritance but I know of a couple others and wanted to try and build a list of the top gotcha's of the language.
Note:
I've held several positions as a Sr. PHP5 developer so... | require\_once and include\_once can often result in major performance killers when used excessively. If your including/require a file that holds a class... a pattern like so can save some serious processing time.
```
class_exists("myFoo") or require("myFoo.someClass.php");
```
Update:
This is still a issue - <http:... |
512,135 | <p>I have a requirement, wherein i need to show a wait message while an excel report is being executed and when execution is complete, excel is written to response for user to save. Once save is done i need to hide the wait message.</p>
<p>I was able to show wait message but i am not able to hide the same when the exe... | [
{
"answer_id": 512171,
"author": "ScottG",
"author_id": 3047,
"author_profile": "https://Stackoverflow.com/users/3047",
"pm_score": 2,
"selected": false,
"text": "<p>I did something like this a few years ago. I opened a new thread to do the background processing, then redirected to a \"... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21195/"
] | I have a requirement, wherein i need to show a wait message while an excel report is being executed and when execution is complete, excel is written to response for user to save. Once save is done i need to hide the wait message.
I was able to show wait message but i am not able to hide the same when the execution is ... | Here's how I'd do this:
* Create an HttpHandler that generates the document, saves it (in cache/on disk/database, your call) and returns an identifier for the generated document
* Call the HttpHandler using an AJAX call (use [jQuery](http://jquery.com) to make this really easy)
* Use javascript/jQuery to display a wai... |
512,138 | <p>I am currently trying to optimize a few queries and scripts, and I wonder if there is a way to cut off a certain percentage of a MySQL Result Set?</p>
<p>for example, I have a Query like this:</p>
<pre><code>SELECT TrackingID, OpenTime, FirstPoint
FROM PointsTable
</code></pre>
<p>I need the "middle" 74%, ordered... | [
{
"answer_id": 512162,
"author": "mthurlin",
"author_id": 39991,
"author_profile": "https://Stackoverflow.com/users/39991",
"pm_score": 1,
"selected": false,
"text": "<p>Cutting off a certain percent would mean that the query still have to be evaluated in full, since the amount of result... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91/"
] | I am currently trying to optimize a few queries and scripts, and I wonder if there is a way to cut off a certain percentage of a MySQL Result Set?
for example, I have a Query like this:
```
SELECT TrackingID, OpenTime, FirstPoint
FROM PointsTable
```
I need the "middle" 74%, ordered by the difference between FirstP... | You need to LIMIT the data you are returning by what percentile the returned rows in the resultset are at.
Try this:
```
SELECT TrackingID, OpenTime, FirstPoint
FROM PointsTable
ORDER BY FirstPointGMT - OpenTimeGMT
LIMIT (13*((SELECT COUNT(*) FROM PointsTable) +1) / 100),
((SELECT COUNT(*) FROM PointsTable)
-
(26*... |
512,142 | <p>I know that double-buffering is an often-talked subject but no matter how much I searched and tried different approaches, I still can't get the control to re-draw itself without a flicker. Here's my code:</p>
<pre><code>using System;
using System.Drawing;
using System.Windows.Forms;
namespace Emgu.UI
{
public ... | [
{
"answer_id": 512181,
"author": "scottm",
"author_id": 53007,
"author_profile": "https://Stackoverflow.com/users/53007",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried setting the controls <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.control.doubl... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I know that double-buffering is an often-talked subject but no matter how much I searched and tried different approaches, I still can't get the control to re-draw itself without a flicker. Here's my code:
```
using System;
using System.Drawing;
using System.Windows.Forms;
namespace Emgu.UI
{
public class DoubleBu... | Oh my God...
Like I said in my comments, the pictureBox is contained within another Control that I didn't write (but have the source to). It turns out that the flicker is caused by these two lines:
```
if (pictureBox.Width != _displayedImage.Width) pictureBox.Width = _displayedImage.Width;
if (pictureBox.Height != _... |
512,143 | <p>I've written some VBA code in an Excel workbook to retrieve data from an Access database in the same directory on a desktop. It works fine on my machine and several other machines running Windows XP, but when we tested this on a Vista machine, we encountered the following error:</p>
<blockquote>
<p>Could not fin... | [
{
"answer_id": 512187,
"author": "BIBD",
"author_id": 685,
"author_profile": "https://Stackoverflow.com/users/685",
"pm_score": 4,
"selected": false,
"text": "<p>Try putting single quotes around the data source:</p>\n\n<pre><code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source='D:\\ptdb\\Pr... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45109/"
] | I've written some VBA code in an Excel workbook to retrieve data from an Access database in the same directory on a desktop. It works fine on my machine and several other machines running Windows XP, but when we tested this on a Vista machine, we encountered the following error:
>
> Could not find installable ISAM
> ... | Place single quotes around the `Extended Properties`:
```
OleDbConnection oconn =
new OleDbConnection(
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + path + ";Extended Properties='Excel 8.0;HDR=YES;IMEX=1;';");
```
Try it, it really works. |
512,144 | <p>How do I customize a create content form for a certain content type. In this instance I have a CCK type, of Products but every time I create a product I use 4 fields Name, Price, Picture and dimensions. </p>
<p>Is there a way to slim down the create content form to just have these options? Is this what Contemplate ... | [
{
"answer_id": 512533,
"author": "ceejayoz",
"author_id": 1902010,
"author_profile": "https://Stackoverflow.com/users/1902010",
"pm_score": 4,
"selected": true,
"text": "<p>You'll want to use the <a href=\"http://api.drupal.org/api/function/hook_form_alter\" rel=\"noreferrer\">hook_form_... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3208/"
] | How do I customize a create content form for a certain content type. In this instance I have a CCK type, of Products but every time I create a product I use 4 fields Name, Price, Picture and dimensions.
Is there a way to slim down the create content form to just have these options? Is this what Contemplate does? | You'll want to use the [hook\_form\_alter](http://api.drupal.org/api/function/hook_form_alter) hook.
In Drupal 6, I use this to hide most of the extraneous stuff in the node edit/add form.
```
function mymodule_form_alter(&$form, $form_state, $form_id) {
// hide extraneous options in the node form for nodetype node... |
512,157 | <p>I am attempting to learn OCaml by using compiled code instead of the top-level; however, much of the sample code online seems to appeal to the latter.</p>
<p>I would like to create a new Foo within a method of an object per below. This code does not compile, citing a syntax error with the doFooProc definition.</p>
... | [
{
"answer_id": 512169,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 3,
"selected": true,
"text": "<p>You can't. Make your own dialog using a JProgressBar, as described in <a href=\"http://java.sun.com/docs/books/tutor... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25985/"
] | I am attempting to learn OCaml by using compiled code instead of the top-level; however, much of the sample code online seems to appeal to the latter.
I would like to create a new Foo within a method of an object per below. This code does not compile, citing a syntax error with the doFooProc definition.
```
class bar... | You can't. Make your own dialog using a JProgressBar, as described in [The Java Tutorial](http://java.sun.com/docs/books/tutorial/uiswing/components/progress.html). |
512,164 | <p>I need to make an existing app thread safe. Due circumstances (see below), I decided to use one single ReaderWriterLock for the entire graph of business objects. All methods/properties must look like these:</p>
<pre><code>public int MyReadOperation(string inputParam)
{
rwLock.AcquireReaderLock(10000);
try
... | [
{
"answer_id": 512172,
"author": "Andrew Rollings",
"author_id": 40410,
"author_profile": "https://Stackoverflow.com/users/40410",
"pm_score": 3,
"selected": false,
"text": "<p>I would do something like that using <a href=\"http://www.postsharp.org/aop-net/overview\" rel=\"nofollow noref... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512164",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24451/"
] | I need to make an existing app thread safe. Due circumstances (see below), I decided to use one single ReaderWriterLock for the entire graph of business objects. All methods/properties must look like these:
```
public int MyReadOperation(string inputParam)
{
rwLock.AcquireReaderLock(10000);
try
{
// do ... | First of all, thanx to Andrew pointing me to [PostSharp](http://www.postsharp.org/ "PostSharp"). Based on his answer, I ended up with this final one.
```
[Serializable]
public class ReadOperationAttribute : PostSharp.Laos.OnMethodInvocationAspect
{
public override void OnInvocation(MethodInvocationEventArgs event... |
512,166 | <p>In the two following snippets, is the first one safe or must you do the second one?</p>
<p>By safe I mean is each thread guaranteed to call the method on the Foo from the same loop iteration in which the thread was created?</p>
<p>Or must you copy the reference to a new variable "local" to each iteration of the lo... | [
{
"answer_id": 512192,
"author": "Matze ",
"author_id": 47694,
"author_profile": "https://Stackoverflow.com/users/47694",
"pm_score": -1,
"selected": false,
"text": "<pre><code>Foo f2 = f;\n</code></pre>\n\n<p>points to the same reference as </p>\n\n<pre><code>f \n</code></pre>\n\n<p>So ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82/"
] | In the two following snippets, is the first one safe or must you do the second one?
By safe I mean is each thread guaranteed to call the method on the Foo from the same loop iteration in which the thread was created?
Or must you copy the reference to a new variable "local" to each iteration of the loop?
```
var thre... | Edit: this all changes in C# 5, with a change to where the variable is defined (in the eyes of the compiler). From **C# 5 onwards, they are the same**.
---
**Before C#5**
The second is safe; the first isn't.
With `foreach`, the variable is declared **outside** the loop - i.e.
```
Foo f;
while(iterator.MoveNext())
... |
512,184 | <p>Should I initialize class fields at declaration like this?</p>
<pre><code>public class SomeTest extends TestCase
{
private final List list = new ArrayList();
public void testPopulateList()
{
// Add stuff to the list
// Assert the list contains what I expect
}
}
</code></pre>
<p>Or ... | [
{
"answer_id": 512220,
"author": "Alex B",
"author_id": 6180,
"author_profile": "https://Stackoverflow.com/users/6180",
"pm_score": 3,
"selected": false,
"text": "<p>I prefer readability first which most often does not use the setup method. I make an exception when a basic setup operat... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23572/"
] | Should I initialize class fields at declaration like this?
```
public class SomeTest extends TestCase
{
private final List list = new ArrayList();
public void testPopulateList()
{
// Add stuff to the list
// Assert the list contains what I expect
}
}
```
Or in setUp() like this?
```... | If you're wondering specifically about the examples in the JUnit FAQ, such as the [basic test template](http://junit.sourceforge.net/doc/faq/faq.htm#tests_16), I think the best practice being shown off there is that the *class under test* should be instantiated in your setUp method (or in a test method).
When the JUni... |
512,195 | <p>One requirement of a project I'm working on is to export a file to a network share based on certain criteria. When I run the code in visual studio it works just fine but when I deploy it the actions that would initiate saving the file end in failure. the users see an alert with:</p>
<pre><code>Could not find file '... | [
{
"answer_id": 512242,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "<p>I suspect the better approach here would be to set the app-pool's identity to have access (no impersonation). Also... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4491/"
] | One requirement of a project I'm working on is to export a file to a network share based on certain criteria. When I run the code in visual studio it works just fine but when I deploy it the actions that would initiate saving the file end in failure. the users see an alert with:
```
Could not find file '<full filename... | There are many variables that could cause user impersonation to fail, in which case IIS would attempt to perform the action as the anonymous user. Are you verifying that the user is properly authenticated before attempting to write to file?
>
> If impersonation is enabled for an
> ASP.NET application, that applicati... |
512,196 | <pre><code>$sql = "SELECT count(u_id) AS num_replies FROM `replies` WHERE `u_id`='".$uid."'";
$res = mysql_query($sql) or die(myqsl_error());
</code></pre>
<p>Will that return the number of replies a user with id $uid has made? If not, can anyone suggest something that will?</p>
<p>Thx for the help.</p>
| [
{
"answer_id": 512204,
"author": "Notorious2tall",
"author_id": 9809,
"author_profile": "https://Stackoverflow.com/users/9809",
"pm_score": 3,
"selected": false,
"text": "<p>It difficult to answer this question without knowing more about the replies table, but just looking at your query,... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512196",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
$sql = "SELECT count(u_id) AS num_replies FROM `replies` WHERE `u_id`='".$uid."'";
$res = mysql_query($sql) or die(myqsl_error());
```
Will that return the number of replies a user with id $uid has made? If not, can anyone suggest something that will?
Thx for the help. | It difficult to answer this question without knowing more about the replies table, but just looking at your query, then yes your query looks like it will. |
512,222 | <p>In the past I've worked with -Wall and other switches for gcc to eliminate every compiler warning for projects I've been involved in. Similarly, in Perl, I always program with use strict and use warnings (and often -T as well) to try to achieve the best code quality I can. I understand that a few years ago, the Pe... | [
{
"answer_id": 512243,
"author": "JesperE",
"author_id": 13051,
"author_profile": "https://Stackoverflow.com/users/13051",
"pm_score": 6,
"selected": true,
"text": "<p>Yes, definitely. A warning is an indication that something may be wrong in your code. Either you fix it, or you should d... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18103/"
] | In the past I've worked with -Wall and other switches for gcc to eliminate every compiler warning for projects I've been involved in. Similarly, in Perl, I always program with use strict and use warnings (and often -T as well) to try to achieve the best code quality I can. I understand that a few years ago, the Perl po... | Yes, definitely. A warning is an indication that something may be wrong in your code. Either you fix it, or you should disable the warning -- if you're not going to act on it, having the warning is just preventing you from detecting when new warnings appear.
Easiest way to get and keep the code warning-free is simply ... |
512,223 | <p>Can I set a Range Object to be equal to a set of non-sequential cells? I want my Range to be equal to cells A1, A3, A5 etc, where I can pick and choose the rows and columns at will.</p>
| [
{
"answer_id": 512259,
"author": "andynormancx",
"author_id": 46354,
"author_profile": "https://Stackoverflow.com/users/46354",
"pm_score": 3,
"selected": true,
"text": "<p>Sure, for example this selects a fairly random set of cells:</p>\n\n<pre><code>Range(\"A1:C8,E13:G21,C20:D26,L13:N2... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59790/"
] | Can I set a Range Object to be equal to a set of non-sequential cells? I want my Range to be equal to cells A1, A3, A5 etc, where I can pick and choose the rows and columns at will. | Sure, for example this selects a fairly random set of cells:
```
Range("A1:C8,E13:G21,C20:D26,L13:N22").Select
```
and this selects the cells you mentioned:
```
Range("A1,A3,A5").Select
```
You can also combine **Range** objects with the **Union** method. |
512,254 | <p>I'm using Mockito to write a unit test in Java, and I'd like to verify that a certain method is the <em>last one</em> called on an object.</p>
<p>I'm doing something like this in the code under test:</p>
<pre><code>row.setSomething(value);
row.setSomethingElse(anotherValue);
row.editABunchMoreStuff();
row.saveToDa... | [
{
"answer_id": 514452,
"author": "Kent Lai",
"author_id": 2085392,
"author_profile": "https://Stackoverflow.com/users/2085392",
"pm_score": 7,
"selected": true,
"text": "<p>I think it requires more custom work.</p>\n\n<pre><code>verify(row, new LastCall()).saveToDatabase();\n</code></pre... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13210/"
] | I'm using Mockito to write a unit test in Java, and I'd like to verify that a certain method is the *last one* called on an object.
I'm doing something like this in the code under test:
```
row.setSomething(value);
row.setSomethingElse(anotherValue);
row.editABunchMoreStuff();
row.saveToDatabase();
```
In my mock, ... | I think it requires more custom work.
```
verify(row, new LastCall()).saveToDatabase();
```
and then
```
public class LastCall implements VerificationMode {
public void verify(VerificationData data) {
List<Invocation> invocations = data.getAllInvocations();
InvocationMatcher matcher = data.getW... |
512,258 | <p>I'm trying to figure out a simple to draw some text in OpenGL. My research has shown its a fairly complex task. It involves creating (or generating at runtime) a font atlas texture, and then creating a quad for each letter with just the right placement and texture coordinates.</p>
<p>I've heard some good things a... | [
{
"answer_id": 512280,
"author": "Nick Van Brunt",
"author_id": 30470,
"author_profile": "https://Stackoverflow.com/users/30470",
"pm_score": 1,
"selected": false,
"text": "<p>Check the crash landing demo. The Texture2D class that is provided allows for creation of textures with text and... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62076/"
] | I'm trying to figure out a simple to draw some text in OpenGL. My research has shown its a fairly complex task. It involves creating (or generating at runtime) a font atlas texture, and then creating a quad for each letter with just the right placement and texture coordinates.
I've heard some good things about freetyp... | Your description of using freetype to create a texture atlas along with all the glyph information is exactly what I'm doing in my current iPhone project.
I do all the parsing of the font in a pre-process step (All in C# on Windows as it happens). The atlas itself gets generated and contains only the characters needed ... |
512,266 | <p>I wrote a method to convert a given number from days to milliseconds:</p>
<pre><code>private long expireTimeInMilliseconds;
...
public void setExpireTimeInDays(int expireTimeInDays)
{
expireTimeInMilliseconds = expireTimeInDays * 24 * 60 * 60 * 1000;
}
</code></pre>
<p>I had a hard time to figure out what I did... | [
{
"answer_id": 512328,
"author": "Nils Pipenbrinck",
"author_id": 15955,
"author_profile": "https://Stackoverflow.com/users/15955",
"pm_score": 2,
"selected": false,
"text": "<p>No, it's not obvious. </p>\n\n<p>But trust me, after some more years of practice and fixing bugs like this you... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512266",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45869/"
] | I wrote a method to convert a given number from days to milliseconds:
```
private long expireTimeInMilliseconds;
...
public void setExpireTimeInDays(int expireTimeInDays)
{
expireTimeInMilliseconds = expireTimeInDays * 24 * 60 * 60 * 1000;
}
```
I had a hard time to figure out what I did wrong. Now my question:
*... | Is it obvious? I guess it depends on how long you've been using Java and how many times you've had to deal with milliseconds. Of course, it should be okay for up to about 24 days...
I think the biggest hint should be that `System.currentTimeMillis()` returns a `long`. That's a good indication that a number of millisec... |
512,276 | <p>I am using the ASP.NET AJAX ModalPopupExtender on a page. The popup contains details of one or more customer orders that need to be printed out. Each order needs to be on a separate page.</p>
<p>I should be able to use the CSS <code>page-break-after</code> style, but this does not work in this scenario as the Modal... | [
{
"answer_id": 513094,
"author": "Ken Hanson",
"author_id": 62597,
"author_profile": "https://Stackoverflow.com/users/62597",
"pm_score": 1,
"selected": false,
"text": "<p>Can you not just add this bit of code to your print style?</p>\n\n<pre><code>div.outer { position: relative; }\n</co... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] | I am using the ASP.NET AJAX ModalPopupExtender on a page. The popup contains details of one or more customer orders that need to be printed out. Each order needs to be on a separate page.
I should be able to use the CSS `page-break-after` style, but this does not work in this scenario as the ModalPopupExtender causes ... | Can you not just add this bit of code to your print style?
```
div.outer { position: relative; }
```
It's deceptively simple, but when printing, I would doubt the client / report viewer would want anything to do with positioning and would care most about the content yeah? |
512,279 | <p>Let's say I have a resource that can have two different behaviors when delete is called</p>
<ol>
<li>The resource is deleted. </li>
<li>The resource is moved to the recycle bin.</li>
</ol>
<p>How would model it in a REST compliant way?</p>
<p>I thought about the following solution:</p>
<pre><code>DELETE /myresou... | [
{
"answer_id": 512316,
"author": "Swanand",
"author_id": 18768,
"author_profile": "https://Stackoverflow.com/users/18768",
"pm_score": 2,
"selected": false,
"text": "<p>Why not? You are already passing a parameter to identify which resource, so send another one to establish a different c... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52954/"
] | Let's say I have a resource that can have two different behaviors when delete is called
1. The resource is deleted.
2. The resource is moved to the recycle bin.
How would model it in a REST compliant way?
I thought about the following solution:
```
DELETE /myresource
```
moves the resource to the recycle bin... | A pure REST strategy should prefer non changing resources. In my opinion, you are not changing the resource by appending a parameter, so it sounds like good strategy to me.
If you were to perform the same action like so:
```
DELETE /myresource.force
```
that would act like another resource, which wouldn't be optima... |
512,285 | <p>I have a List<code><string</code>> of variable count, and I want to query (via LINQ) a table to find any items that contain any of those strings in the Text column.</p>
<p>Tried this (doesn't work):</p>
<pre><code>items = from dbt in database.Items
where (stringList.FindAll(s => dbt.Text.Contains(s)... | [
{
"answer_id": 512348,
"author": "Matthew Doyle",
"author_id": 53904,
"author_profile": "https://Stackoverflow.com/users/53904",
"pm_score": 3,
"selected": false,
"text": "<p>kind of new to the whole LINQ to SQL game, but does this syntax help?</p>\n\n<pre><code>string[] items = new stri... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62494/"
] | I have a List`<string`> of variable count, and I want to query (via LINQ) a table to find any items that contain any of those strings in the Text column.
Tried this (doesn't work):
```
items = from dbt in database.Items
where (stringList.FindAll(s => dbt.Text.Contains(s)).Count > 0)
select dbt;
```... | Check this article out to do what you want:
<http://www.albahari.com/nutshell/predicatebuilder.aspx>
This works like a dream. I essentially cut and pasted their code and got this back (with my own data-scheme of course):
```
SELECT [t0].[Id], [t0].[DateCreated], [t0].[Name] ...
FROM [dbo].[Companies] AS [t0]
WHE... |
512,296 | <p>I've read elsewhere on here that to capture "Enter" key stroke in a text box and use it as if pushing a button I should set the KeyPreview property of the form to true and check the value of KeyDown. </p>
<p>I want to be able to use this functionality on several TextBox controls which each are associated with a dif... | [
{
"answer_id": 512302,
"author": "G-.",
"author_id": 61999,
"author_profile": "https://Stackoverflow.com/users/61999",
"pm_score": 4,
"selected": true,
"text": "<p>I've found a solution which appears to be working.</p>\n\n<pre><code> private void DeviceForm_KeyDown(object sender, KeyE... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61999/"
] | I've read elsewhere on here that to capture "Enter" key stroke in a text box and use it as if pushing a button I should set the KeyPreview property of the form to true and check the value of KeyDown.
I want to be able to use this functionality on several TextBox controls which each are associated with a different But... | I've found a solution which appears to be working.
```
private void DeviceForm_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyValue == 13 && tstxtDeviceFilter.Focused)
{
filterByDeviceSN();
}
}
```
I can't help but think there must be a better way though!
--EDIT--... |
512,304 | <p>If the user name and password do not match it displays an alert but if I click ok to the alert the form is logged in. Can anyone tell me how to avoid it? Thanks.</p>
<pre><code><html>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
... | [
{
"answer_id": 512318,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 3,
"selected": true,
"text": "<pre><code>... onclick=\"checkPassword(this.form); return false;\" ...\n</code></pre>\n"
},
{
"answer_id": 5123... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40933/"
] | If the user name and password do not match it displays an alert but if I click ok to the alert the form is logged in. Can anyone tell me how to avoid it? Thanks.
```
<html>
<f:view>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<h:form i... | ```
... onclick="checkPassword(this.form); return false;" ...
``` |
512,310 | <p>A niave beginners question about database design.<br>
I have an app managing some logger data eg. 1000s of sequential measurements of time, voltage, current, temperature. In addition each sequence run has meta data (date, location, etc).<br>
So I need a table for each set of measurements and a master table listing t... | [
{
"answer_id": 512356,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 0,
"selected": false,
"text": "<p>If a single measurement has all of the values (time, voltage, current, temp) then you'd use a field ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512310",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10897/"
] | A niave beginners question about database design.
I have an app managing some logger data eg. 1000s of sequential measurements of time, voltage, current, temperature. In addition each sequence run has meta data (date, location, etc).
So I need a table for each set of measurements and a master table listing these ... | BTW, I want to address the question of whether it's a pain to manage all the data in one table, versus having multiple tables.
Starting assumption: you're going to want to at least have a meta-data table to store the experiment meta-data, and one-or-more table(s) to store the measurements.
If you take the "I want a t... |
512,320 | <p>So I'm trying to call a function that is a manged wrapper around an OCX object. Having great difficulty. Function is;</p>
<pre><code>foo(System::Object ^% theBuffer)
</code></pre>
<p>where 'theBuffer' is an array of bytes. The template for the unmanaged OCX which 'foo' wraps is</p>
<pre><code>goo(VARIANT* theBuff... | [
{
"answer_id": 512386,
"author": "arul",
"author_id": 15409,
"author_profile": "https://Stackoverflow.com/users/15409",
"pm_score": 1,
"selected": false,
"text": "<p>You can't convert a <code>VARIANT</code> to the buffer directly.</p>\n\n<p>First you need to check what kind of object is ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | So I'm trying to call a function that is a manged wrapper around an OCX object. Having great difficulty. Function is;
```
foo(System::Object ^% theBuffer)
```
where 'theBuffer' is an array of bytes. The template for the unmanaged OCX which 'foo' wraps is
```
goo(VARIANT* theBuffer);
```
So I've tried;
```
System... | You can't convert a `VARIANT` to the buffer directly.
First you need to check what kind of object is stored in it by checking `theBuffer->vt`. The returned value will be of the type `VARTYPE`. |
512,342 | <p>I am trying to find data within a HTML document. I don't need a full blown parser as it is just the data between one tag.</p>
<p>But, I want to detect the 'select' tag and the data in between. </p>
<pre><code>return Pattern.compile(pattern,
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE |
... | [
{
"answer_id": 512426,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 1,
"selected": false,
"text": "<p>I would use something that looked like:</p>\n\n<pre><code>\"<select>([^<>]+)</select>\"\n</code><... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10522/"
] | I am trying to find data within a HTML document. I don't need a full blown parser as it is just the data between one tag.
But, I want to detect the 'select' tag and the data in between.
```
return Pattern.compile(pattern,
Pattern.CASE_INSENSITIVE | Pattern.MULTILINE |
P... | If you really want to stich with regular expressions (which are not the best choice) I’d use:
```
"<select[^>]*>(.+?)</select\s*>"
``` |
512,350 | <p>This question was suggested by <a href="https://stackoverflow.com/users/5486/kyralessa">Kyralessa</a> in the <a href="https://stackoverflow.com/questions/488020/what-is-your-most-useful-sql-trick-to-avoid-writing-more-code">What is your most useful sql trick to avoid writing more sql?.</a> I got so many good ideas... | [
{
"answer_id": 512377,
"author": "Cade Roux",
"author_id": 18255,
"author_profile": "https://Stackoverflow.com/users/18255",
"pm_score": 2,
"selected": false,
"text": "<p>Generate SQL SPs, Views, etc. from the metadata in <code>INFORMATION_SCHEMA</code>. That code generation can then be... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512350",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7734/"
] | This question was suggested by [Kyralessa](https://stackoverflow.com/users/5486/kyralessa) in the [What is your most useful sql trick to avoid writing more sql?.](https://stackoverflow.com/questions/488020/what-is-your-most-useful-sql-trick-to-avoid-writing-more-code) I got so many good ideas to try from the last quest... | Where I work we've done several things to reduce SQL and to reduce the associated overhead of using SQL in Java. (We run Java with MSSQL, MySQL, and Oracle).
The most useful trick is to use Java's setObject method for binding parameters. This, combined with Varargs, lets you write a utility method for executing SQL:
... |
512,355 | <p>I want to write URL that work regardless whether the base URL is either of:</p>
<blockquote>
<p><a href="http://example.com/myfolder/" rel="nofollow noreferrer">http://example.com/myfolder/</a></p>
<p><a href="http://example.com/" rel="nofollow noreferrer">http://example.com/</a></p>
</blockquote>
<p>E.g.</... | [
{
"answer_id": 512380,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Are you doing this in static HTML? \"../other.html\" might be a safe bet (assuming you dont get any more nested). </p>\n"... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6691/"
] | I want to write URL that work regardless whether the base URL is either of:
>
> <http://example.com/myfolder/>
>
>
> <http://example.com/>
>
>
>
E.g.
```
<a href="other.html">Other</a>
```
Should go to
>
> <http://example.com/myfolder/other.html>
>
>
> <http://example.com/other.html>
>
>
>
respectiv... | Relative URIs are always resolved from the base URI which is the URI of the document if not explicitly declared otherwise (see the `base` element). So what is the base URI in your case? |
512,363 | <p>In the code below. I expected true but i am getting false instead. What am I missing?</p>
<pre><code>var text = "Sentence $confirmationlink$ fooo";
alert(placeHolderExists(text,'confirmationlink'); // alerts false
function placeHolderExists(text,placeholdername) {
var pattern = new RegExp('\$'+placehold... | [
{
"answer_id": 512404,
"author": "meouw",
"author_id": 12161,
"author_profile": "https://Stackoverflow.com/users/12161",
"pm_score": 2,
"selected": false,
"text": "<p>Should be</p>\n\n<pre><code>function placeHolderExists(text,placeholdername) { \n var pattern = new RegExp('\\\\$'+p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2138/"
] | In the code below. I expected true but i am getting false instead. What am I missing?
```
var text = "Sentence $confirmationlink$ fooo";
alert(placeHolderExists(text,'confirmationlink'); // alerts false
function placeHolderExists(text,placeholdername) {
var pattern = new RegExp('\$'+placeholdername+'\$'); ... | The "\" in the RegExp expression builder is treated as an escape character when building the string, just as it is in the actual RegExp. You need to escape twice, try:
```
new RegExp('\\$'+placeholdername+'\\$');
``` |
512,366 | <p>What is the best and easiest way to send a string from one instance of my program to another instance of my program? The receiving program has to execute a procedure, using the received string as a parameter.</p>
<p>I started reading about DDE but I got confused. What other options do I have, and what is the easies... | [
{
"answer_id": 512405,
"author": "PetriW",
"author_id": 1604,
"author_profile": "https://Stackoverflow.com/users/1604",
"pm_score": 4,
"selected": false,
"text": "<p>I use named pipes for this, it was the easiest one I found. I'll post the code when I get home from work.</p>\n\n<p>Here's... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512366",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53915/"
] | What is the best and easiest way to send a string from one instance of my program to another instance of my program? The receiving program has to execute a procedure, using the received string as a parameter.
I started reading about DDE but I got confused. What other options do I have, and what is the easiest way to i... | Use named Pipes, but I would recommend Russell Libby's named Pipe components. There is a TPipeClient and TPipeServer component.
As of (2013-10-04) [Francoise Piette and arno.garrels@gmx.de updated this source code](http://francois-piette.blogspot.com/2013/04/inter-process-communication-using-pipes.html) to compile wit... |
512,369 | <p>In the code below, what is the value of x and why?</p>
<pre><code>bool x =true;
x &= false;
</code></pre>
| [
{
"answer_id": 512387,
"author": "moonshadow",
"author_id": 11834,
"author_profile": "https://Stackoverflow.com/users/11834",
"pm_score": 5,
"selected": true,
"text": "<p>x is false, becase (true & false) == false.</p>\n\n<p>&= is to & as += is to +.</p>\n"
},
{
"answ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512369",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49881/"
] | In the code below, what is the value of x and why?
```
bool x =true;
x &= false;
``` | x is false, becase (true & false) == false.
&= is to & as += is to +. |
512,371 | <p>If I have the following code being called from multiple threads in an application, is there a deadlock risk? The transaction used to connect to the database for this is opened just before this call and closed once it returns.
Application : Java
Database: Oracle</p>
<pre><code> FUNCTION reserveWork(in_batch_id NUM... | [
{
"answer_id": 512526,
"author": "cagcowboy",
"author_id": 19629,
"author_profile": "https://Stackoverflow.com/users/19629",
"pm_score": 1,
"selected": false,
"text": "<p>There is a definite deadlock risk if you're running multiple UPDATEs on the same table.</p>\n\n<p>Particularly since ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30381/"
] | If I have the following code being called from multiple threads in an application, is there a deadlock risk? The transaction used to connect to the database for this is opened just before this call and closed once it returns.
Application : Java
Database: Oracle
```
FUNCTION reserveWork(in_batch_id NUMBER,
... | In order for deadlock to happen you must have these two conditions.
1. Each transaction must multiple locks.
2. The locks must be grabbed in a different order.
Condition 1 is true because each of your threads locks multiple rows.
Condition 2 is true in theory because the order of the rows returned is not deterministi... |
512,385 | <p>I can't seem to get my ComboBox to refresh after I add new data to the Access database.</p>
<p>Here's the code I use to add the new data:</p>
<pre><code>private void btnAddUser_Click(object sender, EventArgs e)
{
AccountForm actFrm = new AccountForm();
if (actFrm.ShowDialog() == DialogResult.OK)
... | [
{
"answer_id": 512427,
"author": "Austin Salonen",
"author_id": 4068,
"author_profile": "https://Stackoverflow.com/users/4068",
"pm_score": 2,
"selected": false,
"text": "<p>Is your BindingSource using a DataSet? If so, you need to do the insert through the DataSet and, maybe, refresh y... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512385",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I can't seem to get my ComboBox to refresh after I add new data to the Access database.
Here's the code I use to add the new data:
```
private void btnAddUser_Click(object sender, EventArgs e)
{
AccountForm actFrm = new AccountForm();
if (actFrm.ShowDialog() == DialogResult.OK)
{
... | Is your BindingSource using a DataSet? If so, you need to do the insert through the DataSet and, maybe, refresh your binding source. If you do it this way, you'll avoid the duplicated insert logic as well.
Alternatively, you can just refresh the DataSet but this method doesn't take advantage of the DataSet's powers an... |
512,398 | <p>I have a 2 monitors and a WinForm app that launches a WPF window. I want to get the screen that the WinForm is on, and show the WPF window on the same screen. How can I do this?</p>
| [
{
"answer_id": 512691,
"author": "Adrian",
"author_id": 55160,
"author_profile": "https://Stackoverflow.com/users/55160",
"pm_score": 5,
"selected": true,
"text": "<p>WPF doesn't include the handy System.Windows.Forms.<strong>Screen</strong> class, but you can still use its properties to... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] | I have a 2 monitors and a WinForm app that launches a WPF window. I want to get the screen that the WinForm is on, and show the WPF window on the same screen. How can I do this? | WPF doesn't include the handy System.Windows.Forms.**Screen** class, but you can still use its properties to accomplish your task in your WinForms application.
Assume that **this** means the WinForms window and **\_wpfWindow** is a defined variable referencing the WPF Window in the example below (this would be in what... |
512,411 | <p>I would like do do the following in Javascript (pseudo code):</p>
<pre><code>myString.replace(/mypattern/g, f(currentMatch));
</code></pre>
<p>that is, replace string isn't fixed, but function of current match.</p>
| [
{
"answer_id": 512464,
"author": "Pop Catalin",
"author_id": 4685,
"author_profile": "https://Stackoverflow.com/users/4685",
"pm_score": 2,
"selected": false,
"text": "<p>\"Is there a way to write to the console without destroying the performance to the game?\"</p>\n\n<p>Well, you could ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4433/"
] | I would like do do the following in Javascript (pseudo code):
```
myString.replace(/mypattern/g, f(currentMatch));
```
that is, replace string isn't fixed, but function of current match. | Are you able to write to a log file instead of the console? That may well be faster due to buffering and the lack of scrolling, displaying etc.
Do you actually have a console up while this is running? If so, try minimising it when you're not interested. My guess is it's the scrolling which is causing the problem.
EDI... |
512,436 | <p>I am trying to build a java drum machine that needs to play WAV sound samples of the various drum parts (bass drum, snare, etc). Because I need to play the sounds in a tight sequence, I need high performance. Currently I'm using:</p>
<pre><code>import sun.audio.*;
import java.io.*;
public class MusicPlayer {
... | [
{
"answer_id": 513362,
"author": "Ryan Guill",
"author_id": 7186,
"author_profile": "https://Stackoverflow.com/users/7186",
"pm_score": 1,
"selected": false,
"text": "<p>I think what you are looking for is:</p>\n\n<pre><code>showDataTips=\"true\"\n</code></pre>\n"
},
{
"answer_id... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21613/"
] | I am trying to build a java drum machine that needs to play WAV sound samples of the various drum parts (bass drum, snare, etc). Because I need to play the sounds in a tight sequence, I need high performance. Currently I'm using:
```
import sun.audio.*;
import java.io.*;
public class MusicPlayer {
private String... | To turn off the datatips for a particular series, set the series.interactive property to false. |
512,451 | <p>I'm adding a new, "NOT NULL" column to my Postgresql database using the following query (sanitized for the Internet):</p>
<pre><code>ALTER TABLE mytable ADD COLUMN mycolumn character varying(50) NOT NULL;
</code></pre>
<p>Each time I run this query, I receive the following error message:</p>
<blockquote>
<pre><co... | [
{
"answer_id": 512465,
"author": "Sean Bright",
"author_id": 21926,
"author_profile": "https://Stackoverflow.com/users/21926",
"pm_score": 6,
"selected": false,
"text": "<p>Since rows already exist in the table, the <code>ALTER</code> statement is trying to insert <code>NULL</code> into ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10040/"
] | I'm adding a new, "NOT NULL" column to my Postgresql database using the following query (sanitized for the Internet):
```
ALTER TABLE mytable ADD COLUMN mycolumn character varying(50) NOT NULL;
```
Each time I run this query, I receive the following error message:
>
>
> ```
> ERROR: column "mycolumn" contains nu... | You have to set a default value.
```
ALTER TABLE mytable ADD COLUMN mycolumn character varying(50) NOT NULL DEFAULT 'foo';
... some work (set real values as you want)...
ALTER TABLE mytable ALTER COLUMN mycolumn DROP DEFAULT;
``` |
512,466 | <p>I know there is no concept of an abstract class in Ruby. But if it needs to be implemented, how do I go about it? I tried something like this:</p>
<pre><code>class A
def self.new
raise 'Doh! You are trying to write Java in Ruby!'
end
end
class B < A
...
...
end
</code></pre>
<p>But, when I try to ins... | [
{
"answer_id": 512482,
"author": "Zack",
"author_id": 62052,
"author_profile": "https://Stackoverflow.com/users/62052",
"pm_score": 2,
"selected": false,
"text": "<p>Personally, I raise <code>NotImplementedError</code> in methods of abstract classes. But you may want to leave it out of t... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45942/"
] | I know there is no concept of an abstract class in Ruby. But if it needs to be implemented, how do I go about it? I tried something like this:
```
class A
def self.new
raise 'Doh! You are trying to write Java in Ruby!'
end
end
class B < A
...
...
end
```
But, when I try to instantiate B, it is internall... | I don't like using abstract classes in Ruby (there's almost always a better way). If you really think it's the best technique for the situation though, you can use the following snippet to be more declarative about which methods are abstract:
```
module Abstract
def abstract_methods(*args)
args.each do |name|
... |
512,487 | <p>Does anyone know the best way to check to see if an optional protocol method has been implemented.</p>
<p>I tried this:</p>
<pre><code>if ([self.delegate respondsToSelector:@selector(optionalProtocolMethod:)] )
</code></pre>
<p>where delegate is:</p>
<pre><code>id<MyProtocol> delegate;
</code></pre>
<p>Ho... | [
{
"answer_id": 512630,
"author": "Will Harris",
"author_id": 4702,
"author_profile": "https://Stackoverflow.com/users/4702",
"pm_score": 8,
"selected": true,
"text": "<p><code>respondsToSelector:</code> is part of the <code>NSObject</code> protocol. Including <code>NSObject</code> in <co... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1221378/"
] | Does anyone know the best way to check to see if an optional protocol method has been implemented.
I tried this:
```
if ([self.delegate respondsToSelector:@selector(optionalProtocolMethod:)] )
```
where delegate is:
```
id<MyProtocol> delegate;
```
However, I get an error saying that the function `respondsToSele... | `respondsToSelector:` is part of the `NSObject` protocol. Including `NSObject` in `MyProtocol` should solve your problem:
```
@protocol MyProtocol <NSObject>
@optional
-(void)optionalProtocolMethod:(id)anObject;
@end
``` |
512,497 | <p>I'm in the process of moving SQL server to a separate machine. Currently we are running our web server and sql server on the same box. So we have a production server with IIS and SQLServer and then a separate development server that mirrors this setup.</p>
<p>When it comes to our asp.net control's app.config and ... | [
{
"answer_id": 512538,
"author": "David Morton",
"author_id": 45916,
"author_profile": "https://Stackoverflow.com/users/45916",
"pm_score": 1,
"selected": false,
"text": "<p>I may not completely understand your question here, but it seems to me that when you deploy the application, you c... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21717/"
] | I'm in the process of moving SQL server to a separate machine. Currently we are running our web server and sql server on the same box. So we have a production server with IIS and SQLServer and then a separate development server that mirrors this setup.
When it comes to our asp.net control's app.config and web site's w... | Here's the solution I use. In the Web.Config, place the following "include" line:
```
<connectionStrings configSource="WebCS.config"/>
```
Then, create the WebCS.config file and enter the following:
```
<connectionStrings>
<add name="ConnString"
connectionString="Data Source=YourServer;Initial Catalog=YourDB;... |
512,502 | <p>I am writing a little Shoes app that requires a library I wrote with my regular Ruby installation. My library uses the 'net-ssh' gem and a bunch of other Ruby libraries.</p>
<p>When I run my library directly with regular ruby (it has its own command-line interface) like this:</p>
<pre><code>ruby my_lib.rb
</code><... | [
{
"answer_id": 512529,
"author": "baxter",
"author_id": 61846,
"author_profile": "https://Stackoverflow.com/users/61846",
"pm_score": 5,
"selected": true,
"text": "<p>Hey, <a href=\"http://hackety.org/2008/05/08/clearingUpTheWholeShoesAndRubyGemsDeal.html\" rel=\"noreferrer\">_why posted... | 2009/02/04 | [
"https://Stackoverflow.com/questions/512502",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/407003/"
] | I am writing a little Shoes app that requires a library I wrote with my regular Ruby installation. My library uses the 'net-ssh' gem and a bunch of other Ruby libraries.
When I run my library directly with regular ruby (it has its own command-line interface) like this:
```
ruby my_lib.rb
```
...all is fine. But whe... | Hey, [\_why posted on his blog](http://hackety.org/2008/05/08/clearingUpTheWholeShoesAndRubyGemsDeal.html), hackety.org, about using gems within Shoes. I hope it helps!
```
Shoes.setup do
gem 'json >= 1.1.1'
gem 'activerecord'
end
require 'json'
require 'activerecord'
Shoes.app do
@msg = para "ALL SYSTEMS GO"... |