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 |
|---|---|---|---|---|---|---|
365,427 | <p>I have problems with Boost.Spirit parsing a string. </p>
<p>The string looks like </p>
<pre><code>name1 has this and that.\n
name 2 has this and that.\n
na me has this and that.\n
</code></pre>
<p>and I have to extract the names. The text "has this and that" is always the same but the name can consist of space... | [
{
"answer_id": 365742,
"author": "Mr.Ree",
"author_id": 37946,
"author_profile": "https://Stackoverflow.com/users/37946",
"pm_score": 0,
"selected": false,
"text": "<p>I presume there is a reason why you are using <a href=\"http://www.boost.org/doc/libs/1_37_0/libs/spirit/classic/index.h... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have problems with Boost.Spirit parsing a string.
The string looks like
```
name1 has this and that.\n
name 2 has this and that.\n
na me has this and that.\n
```
and I have to extract the names. The text "has this and that" is always the same but the name can consist of spaces therefore I can't use graph\_p.... | I think this will do the trick:
```
vector<string> names;
string name;
parse(str,
*(
(*(anychar_p - "has this and that.")) [assign_a(name)]
>> "has this and that.\n") [push_back_a(names, name)]
))
``` |
365,458 | <p>Is there a way to identify at run-time of an executable is being run from within valgrind? I have a set of C++ unit tests, and one of them expects <code>std::vector::reserve</code> to throw <code>std::bad_alloc</code>. When I run this under valgrind, it bails out completely, preventing me from testing for both mem... | [
{
"answer_id": 365624,
"author": "Norman Ramsey",
"author_id": 41661,
"author_profile": "https://Stackoverflow.com/users/41661",
"pm_score": 1,
"selected": false,
"text": "<p>I looked at the valgrind doucmentation and didn't find an easy answer. But here are a couple of things you can t... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40620/"
] | Is there a way to identify at run-time of an executable is being run from within valgrind? I have a set of C++ unit tests, and one of them expects `std::vector::reserve` to throw `std::bad_alloc`. When I run this under valgrind, it bails out completely, preventing me from testing for both memory leaks (using valgrind) ... | You should look at [this page](http://valgrind.org/docs/manual/manual-core-adv.html#manual-core-adv.clientreq) from the Valgrind manual, it contains a `RUNNING_ON_VALGRIND` macro (included from valgrind.h) which does what you want. |
365,460 | <p>I want to select an option in select tag through the value. - javascript</p>
<pre><code>var selectbox=document.getElementById("Lstrtemplate");
var TemplateName=selectbox.options[selectbox.selectedIndex].text;
</code></pre>
<p>Now i am having the option text in TemplateName, using this i want to update an another ... | [
{
"answer_id": 365463,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 1,
"selected": false,
"text": "<p>Try it like this : </p>\n\n<pre><code>var TemplateName = selectbox.options[selectbox.selectedIndex].value;\n</cod... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38172/"
] | I want to select an option in select tag through the value. - javascript
```
var selectbox=document.getElementById("Lstrtemplate");
var TemplateName=selectbox.options[selectbox.selectedIndex].text;
```
Now i am having the option text in TemplateName, using this i want to update an another select tag, which is having... | Try it like this :
```
var TemplateName = selectbox.options[selectbox.selectedIndex].value;
``` |
365,472 | <p>I get the above error whenever I try and use ActionLink ? I've only just started playing around with MVC and don't really understand what it's problem is with the code (below):</p>
<pre><code><%= Html.ActionLink("Lists", "Index", "Lists"); %>
</code></pre>
<p>This just seems to be a parsing issue but it only... | [
{
"answer_id": 365478,
"author": "maxnk",
"author_id": 45862,
"author_profile": "https://Stackoverflow.com/users/45862",
"pm_score": 3,
"selected": false,
"text": "<p>Use it without trailing semicolon:</p>\n\n<pre><code><%= Html.ActionLink(\"Lists\", \"Index\", \"Lists\") %>\n</cod... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365472",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26081/"
] | I get the above error whenever I try and use ActionLink ? I've only just started playing around with MVC and don't really understand what it's problem is with the code (below):
```
<%= Html.ActionLink("Lists", "Index", "Lists"); %>
```
This just seems to be a parsing issue but it only happens when I run the page. Th... | Remove the semi-colon from the ActionLink line.
Note: when using `<%= ... %>` there's no semi-colon and the code should return something, usually a string. When using `<% ...; %>`, i.e. no equals after the percent, the code should return void and you need a semi-colon before the closing percent.
When using Html metho... |
365,496 | <p>I have an update query being run by a cron task that's timing out. The query takes, on average, five minutes to execute when executed in navicat.</p>
<p>The code looks roughly like this. It's quite simple:</p>
<pre><code>// $db is a mysqli link
set_time_limit (0); // should keep the script from timing out
$query... | [
{
"answer_id": 365502,
"author": "Tuminoid",
"author_id": 40657,
"author_profile": "https://Stackoverflow.com/users/40657",
"pm_score": 2,
"selected": false,
"text": "<p>Is your php running in safe-mode? Quote from <a href=\"http://fi.php.net/set_time_limit\" rel=\"nofollow noreferrer\">... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1430/"
] | I have an update query being run by a cron task that's timing out. The query takes, on average, five minutes to execute when executed in navicat.
The code looks roughly like this. It's quite simple:
```
// $db is a mysqli link
set_time_limit (0); // should keep the script from timing out
$query = "SLOW QUERY";
$resul... | I had the same problem somwhere, and "solved" it with the following code (first two lines of my file):
```
set_time_limit(0);
ignore_user_abort(1);
``` |
365,522 | <p>A friend and I are going back and forth with brain-teasers and I have no idea how to solve this one. My assumption is that it's possible with some bitwise operators, but not sure.</p>
| [
{
"answer_id": 365527,
"author": "Oliver Friedrich",
"author_id": 44532,
"author_profile": "https://Stackoverflow.com/users/44532",
"pm_score": 2,
"selected": false,
"text": "<p>Why not just incremet the first number as often, as the second number?</p>\n"
},
{
"answer_id": 365528... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23126/"
] | A friend and I are going back and forth with brain-teasers and I have no idea how to solve this one. My assumption is that it's possible with some bitwise operators, but not sure. | In C, with bitwise operators:
```c
#include<stdio.h>
int add(int x, int y) {
int a, b;
do {
a = x & y;
b = x ^ y;
x = a << 1;
y = b;
} while (a);
return b;
}
int main( void ){
printf( "2 + 3 = %d", add(2,3));
return 0;
}
```
XOR (`x ^ y`) is addition without ... |
365,525 | <p>How would you solve this problem?</p>
<p>You're scraping HTML of blogs. Some of the HTML of a blog is blog posts, some of it is formatting, sidebars, etc. You want to be able to tell what text in the HTML belongs to which post (i.e. a permalink) if any.</p>
<p>I know what you're thinking: You could just look at th... | [
{
"answer_id": 366384,
"author": "Osama Al-Maadeed",
"author_id": 25544,
"author_profile": "https://Stackoverflow.com/users/25544",
"pm_score": 0,
"selected": false,
"text": "<p><strong>RSS</strong> is actually quite simple to parse using XPath any XML parser (or regexes, but that's not... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41613/"
] | How would you solve this problem?
You're scraping HTML of blogs. Some of the HTML of a blog is blog posts, some of it is formatting, sidebars, etc. You want to be able to tell what text in the HTML belongs to which post (i.e. a permalink) if any.
I know what you're thinking: You could just look at the RSS and ignore ... | I would create a scraper for each of the major blogging engines. Start with the main text for a single post per page.
If you're lucky then the engine will provide reasonable XHTML, so you can come up with a number of useful XPath expressions to get the node which corresponds to the article. If not, then I'm afraid it'... |
365,559 | <p>i am trying to produce clouds effect in my flash animation using as3</p>
<p>i am able to generate clouds through action script but the real problem is how to make them be generated at one end of the screen and travel diagonally to the other end... </p>
<p>any thoughts?</p>
| [
{
"answer_id": 367080,
"author": "grapefrukt",
"author_id": 914,
"author_profile": "https://Stackoverflow.com/users/914",
"pm_score": 2,
"selected": false,
"text": "<p>This is the barebones version of what you want to do, the handleEnterFrame function will run once each frame (and for ea... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16458/"
] | i am trying to produce clouds effect in my flash animation using as3
i am able to generate clouds through action script but the real problem is how to make them be generated at one end of the screen and travel diagonally to the other end...
any thoughts? | This is the barebones version of what you want to do, the handleEnterFrame function will run once each frame (and for each cloud, but I'm guessing you'll prefer the simpler solution)
```
package {
import flash.display.Sprite;
import flash.events.Event;
public class Cloud extends Sprite{
public v... |
365,591 | <p>I thought 2048 security violation error were mean to happen when trying to access other domains. </p>
<p>I got:</p>
<p><strong>"Security sandbox violation: <a href="http://127.0.0.1/site_media/main.swf" rel="nofollow noreferrer">http://127.0.0.1/site_media/main.swf</a> cannot load data from 127.0.0.1:80"</strong>,... | [
{
"answer_id": 365859,
"author": "Jon Romero",
"author_id": 42153,
"author_profile": "https://Stackoverflow.com/users/42153",
"pm_score": 0,
"selected": false,
"text": "<p>Try using, localhost. If that doesn't work just create a crossdomain file.</p>\n"
},
{
"answer_id": 367492,
... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32032/"
] | I thought 2048 security violation error were mean to happen when trying to access other domains.
I got:
**"Security sandbox violation: <http://127.0.0.1/site_media/main.swf> cannot load data from 127.0.0.1:80"**, isn it the same domain? what is the solution ?
on doing
```
var loader:MultipartLoader = new Multipart... | Despite being called "crossdomain" policy files, the policy actually applies to the combination of both the domain and port: localhost:80 and localhost:443 are not the same thing as far as FP's security policy is concerned. I also don't think that the Flash Player itself assumes a default port of 80 so "localhost" and ... |
365,608 | <p>I have a simple php script on a server that's using fsockopen to connect to a server.</p>
<pre><code><?php
$fp = fsockopen("smtp.gmail.com", 25, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
echo fgets($fp, 1024);
fclose($fp);
}
?>
</code></pre>
<p>The problem ... | [
{
"answer_id": 365619,
"author": "maxnk",
"author_id": 45862,
"author_profile": "https://Stackoverflow.com/users/45862",
"pm_score": 3,
"selected": true,
"text": "<p>Interesting...\nSome firewalls can block specific program's connections to specific ports.\nPlease check it again, try to ... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9789/"
] | I have a simple php script on a server that's using fsockopen to connect to a server.
```
<?php
$fp = fsockopen("smtp.gmail.com", 25, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
echo fgets($fp, 1024);
fclose($fp);
}
?>
```
The problem is the the script times out and fails ... | Interesting...
Some firewalls can block specific program's connections to specific ports.
Please check it again, try to stop firewall completely. Also try to stop any anti-spyware. |
365,657 | <p>On my main form, there is another (floatable) window. This floatable window works sort of like a popupwindow in that it will close when the user clicks somewhere else outside of this window. This is handled by the Deactivate event. But what I want to do is, if the user clicks on a different control (say a button), I... | [
{
"answer_id": 365684,
"author": "faulty",
"author_id": 20007,
"author_profile": "https://Stackoverflow.com/users/20007",
"pm_score": 0,
"selected": false,
"text": "<p>I had a slightly hacky solution. In your Deactivate event, fire another custom event to your main form. Then when you ma... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365657",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36258/"
] | On my main form, there is another (floatable) window. This floatable window works sort of like a popupwindow in that it will close when the user clicks somewhere else outside of this window. This is handled by the Deactivate event. But what I want to do is, if the user clicks on a different control (say a button), I wa... | ```
foreach(Control c in parentForm.Controls)
{
c.Click += delegate(object sender, EventArgs e)
{
if(floatyWindow != null && floatyWindow.IsFloating)
{
floatyWindow.Close();
}
};
}
```
And then add your handler... |
365,669 | <p>I typically use the .markdown or .md extension for markdown documents. Unfortunately spotlight refuses to index them unless they have the .txt file extension.</p>
<p>I've seen a possible solution involving <a href="http://blog.macromates.com/2007/leopard-issues/" rel="noreferrer">editing Info.plist files</a> on the... | [
{
"answer_id": 365675,
"author": "Chris Hanson",
"author_id": 714,
"author_profile": "https://Stackoverflow.com/users/714",
"pm_score": 2,
"selected": false,
"text": "<p>You'll have to write a Spotlight importer. There's an Xcode project template that will set the basic stuff up for you... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365669",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18751/"
] | I typically use the .markdown or .md extension for markdown documents. Unfortunately spotlight refuses to index them unless they have the .txt file extension.
I've seen a possible solution involving [editing Info.plist files](http://blog.macromates.com/2007/leopard-issues/) on the textmate blog. Is there a better way?... | You can do this without disabling SIP by creating a copy of the system RichText.mdimporter, modifying its Info.plist and saving it in /Library/Spotlight.
```
cp -r /System/Library/Spotlight/RichText.mdimporter .
patch -p2 RichText.mdimporter/Contents/Info.plist < Markdown.patch
mv RichText.mdimporter Markdown.mdimport... |
365,699 | <p>I find myself doing 2 things quite often in JS, at the moment using jQuery:</p>
<p>The first is the populating of an HTML element, which might look like:</p>
<pre><code>$.get('http://www.example.com/get_result.php', { id: 1 }, function (data) {
$('#elementId').html(data);
});
</code></pre>
<p>The second is po... | [
{
"answer_id": 365790,
"author": "Kevin Gorski",
"author_id": 35806,
"author_profile": "https://Stackoverflow.com/users/35806",
"pm_score": 1,
"selected": false,
"text": "<p>For filling an element with the results of an AJAH call, check out the <a href=\"http://docs.jquery.com/Ajax/load#... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] | I find myself doing 2 things quite often in JS, at the moment using jQuery:
The first is the populating of an HTML element, which might look like:
```
$.get('http://www.example.com/get_result.php', { id: 1 }, function (data) {
$('#elementId').html(data);
});
```
The second is populating a select element with a ... | Here's a quick jQuery plugin I wrote that makes your first example more re-usable:
```
(function ($) {
$.fn.populateWith = function(sUrl, oData, fCallback) {
if (!oData) oData = false;
if (!fCallback) fCallback = false;
$(this).load(sUrl, oData, fCallback);
};
})(jQuery);
```
You targ... |
365,719 | <p>I got a little stuck and I'm hoping someone can point me in the right direction. I have an NSMutableArray that stores a sequence. I created an enumerator so that a while loop can get the content of the array one by one.</p>
<p>Everything works fine however I want the methods to be called with a 10 second gap in bet... | [
{
"answer_id": 365731,
"author": "Chris Hanson",
"author_id": 714,
"author_profile": "https://Stackoverflow.com/users/714",
"pm_score": 2,
"selected": false,
"text": "<p>This is what NSTimer is for. Use NSTimer to get each element in the array sequentially.</p>\n"
},
{
"answer_i... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46022/"
] | I got a little stuck and I'm hoping someone can point me in the right direction. I have an NSMutableArray that stores a sequence. I created an enumerator so that a while loop can get the content of the array one by one.
Everything works fine however I want the methods to be called with a 10 second gap in between each ... | You almost certainly don't want to stick a "delay" in your loop, which will block the thread until it's over (and, unless your app is multi-threaded, block the entire thing). You could use multiple threads, but instead I'd probably split the loop out over repeated timed calls of another selector. Store the enumerator (... |
365,743 | <p>I have a small app that has a Render thread. All this thread does is draw my objects at their current location.</p>
<p>I have some code like:</p>
<pre><code>public void render()
{
// ... rendering various objects
if (mouseBall != null) mouseBall.draw()
}
</code></pre>
<p>Then I also have some mouse han... | [
{
"answer_id": 365748,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 5,
"selected": true,
"text": "<p>The problem lies in the fact that you are accessing <code>mouseBall</code> twice, once to check whether it is not <code... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365743",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a small app that has a Render thread. All this thread does is draw my objects at their current location.
I have some code like:
```
public void render()
{
// ... rendering various objects
if (mouseBall != null) mouseBall.draw()
}
```
Then I also have some mouse handler that creates and sets mouseBa... | The problem lies in the fact that you are accessing `mouseBall` twice, once to check whether it is not `null` and another to call a function on it. You can avoid this problem by using a temporary like this:
```
public void render()
{
// ... rendering various objects
tmpBall = mouseBall;
if (tmpBall != null... |
365,750 | <p>I'm using VB.net (2003), and calling the SelectNodes method on an xml document.<br>
If I have a document:</p>
<pre><code><InqRs>
<DetRs>
<RefInfo>
<RefType>StopNum</RefType>
<RefId>0</RefId>
</RefInfo>
<RefInfo>
<... | [
{
"answer_id": 365957,
"author": "Toby White",
"author_id": 45891,
"author_profile": "https://Stackoverflow.com/users/45891",
"pm_score": 1,
"selected": false,
"text": "<p>Like so. You don't need the top-level InqRs in your XPath expression, though it doesn't hurt. You may not care about... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm using VB.net (2003), and calling the SelectNodes method on an xml document.
If I have a document:
```
<InqRs>
<DetRs>
<RefInfo>
<RefType>StopNum</RefType>
<RefId>0</RefId>
</RefInfo>
<RefInfo>
<RefType>Id</RefType>
<RefId>0</RefId>
</RefInfo>
</Det... | You want all **`DetRs`** children of the top element:
`/*/DetRs`
That have a **`RefInfo`** child:
`/*/DetRs`
`[RefInfo]`
That has **`RefType`** with value "**`Id`**":
`/*/DetRs`
`[RefInfo`
[`RefType`='`Id`']
]
and that has a **`Re... |
365,773 | <p>How do I detect when my Compact Framework application is being smart-minimized (smart minimize is what happens when the user clicks the "X" button in the top-right corner on a Pocket PC)?</p>
<p>The Deactivate event isn't the right way because it occurs in circumstances other than minimization, such as when a messa... | [
{
"answer_id": 367682,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": -1,
"selected": false,
"text": "<p>What exactly do you mean by smart-minimized? I suppose you mean your app being automatically minimised on no acti... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22820/"
] | How do I detect when my Compact Framework application is being smart-minimized (smart minimize is what happens when the user clicks the "X" button in the top-right corner on a Pocket PC)?
The Deactivate event isn't the right way because it occurs in circumstances other than minimization, such as when a message box or ... | I think the way to go here is processing the [WM\_ACTIVE](http://msdn.microsoft.com/en-us/library/aa922525.aspx) message and then checking if the fMinimized parameter is not zero. You can find more information on how to declare this messages in your code in [here](http://www.pinvoke.net/default.aspx/Enums/WindowsMessag... |
365,780 | <p>As you can see in the image below I have a tree datamodel consisting of groups that can contain other groups plus an arbitary number of items wich again can hold Parameters. The Parameters itself are defined globally and just reoccur in the items. Only the parameter's actual value may differ from parameter usage to ... | [
{
"answer_id": 366208,
"author": "Boyan",
"author_id": 38106,
"author_profile": "https://Stackoverflow.com/users/38106",
"pm_score": 0,
"selected": false,
"text": "<p>You could try just what you suppose in the title of the question - create a TreeListDataGridView. It will be a custom con... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4227/"
] | As you can see in the image below I have a tree datamodel consisting of groups that can contain other groups plus an arbitary number of items wich again can hold Parameters. The Parameters itself are defined globally and just reoccur in the items. Only the parameter's actual value may differ from parameter usage to par... | I'm not a tree view expert, but it's easy to build something like that without a tree view.
Start with an empty VS2008 Wpf Application named WpfTreeGridWhatever
First, let's define our model:
```
using System;
using System.Collections.Generic;
namespace WpfTreeGridWhatever
{
public class ItemBase
{
}
... |
365,782 | <p>What is the accepted/most commonly used way to manipulate dynamic (with all dimensions not known until runtime) multi-dimensional arrays in C and/or C++.</p>
<p>I'm trying to find the cleanest way to accomplish what this Java code does:</p>
<pre><code>public static void main(String[] args){
Scanner sc=new Scanner... | [
{
"answer_id": 365788,
"author": "Andy",
"author_id": 3857,
"author_profile": "https://Stackoverflow.com/users/3857",
"pm_score": -1,
"selected": false,
"text": "<p>There is no way to determine the length of a given array in C++. The best way would probably be to pass in the length of ea... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34957/"
] | What is the accepted/most commonly used way to manipulate dynamic (with all dimensions not known until runtime) multi-dimensional arrays in C and/or C++.
I'm trying to find the cleanest way to accomplish what this Java code does:
```
public static void main(String[] args){
Scanner sc=new Scanner(System.in);
int row... | Use **[boost::multi\_array](http://www.boost.org/doc/libs/1_37_0/libs/multi_array/doc/user.html)**.
As in your example, the only thing you need to know at compile time is the number of dimensions. Here is the first example in the documentation :
```
#include "boost/multi_array.hpp"
#include <cassert>
int
main () {
... |
365,805 | <p>W3c validator didn't ding me on this, but I was curious if anyone else had an opinion on placing html comments outside of the html tags?</p>
<pre>
...
</body>
</html>
<!-- byee -->
</pre>
<p>I have an application and am outputting some data and want it to be the absolute last thing that is done, ... | [
{
"answer_id": 365812,
"author": "krusty.ar",
"author_id": 43981,
"author_profile": "https://Stackoverflow.com/users/43981",
"pm_score": 1,
"selected": false,
"text": "<p>Any client should completely ignore comments, so they should not cause any problems. Anyway if the validator didn't c... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | W3c validator didn't ding me on this, but I was curious if anyone else had an opinion on placing html comments outside of the html tags?
```
...
</body>
</html>
<!-- byee -->
```
I have an application and am outputting some data and want it to be the absolute last thing that is done, which unfortunately means I've ... | I can't see this being a problem - allowable comments are not specified in a DTD (as they're effectively for humans, not computers). Also, the DOM API (<http://www.w3.org/TR/REC-DOM-Level-1/level-one-core.html>) explicitly allows many comments directly under the document node (i.e. not the root HTML element, the logica... |
365,820 | <p>How do you rotate an image using <a href="http://code.google.com/p/jquery-rotate/" rel="nofollow noreferrer">jQuery-rotate</a> plugin?</p>
<p>I have tried the following and it doesn't seem to work:</p>
<pre><code><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252"... | [
{
"answer_id": 365865,
"author": "mqsoh",
"author_id": 8710,
"author_profile": "https://Stackoverflow.com/users/8710",
"pm_score": 6,
"selected": true,
"text": "<p>You've got a 404 on jQuery and the jQuery plugin. Because of that, your page is throwing a JavaScript error, that $ is not d... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45974/"
] | How do you rotate an image using [jQuery-rotate](http://code.google.com/p/jquery-rotate/) plugin?
I have tried the following and it doesn't seem to work:
```
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>View Photo</title>
<script type="text/javascript" src="scripts/j... | You've got a 404 on jQuery and the jQuery plugin. Because of that, your page is throwing a JavaScript error, that $ is not defined.
You need to learn basic JavaScript debugging techniques. A quick search found this article that looks like a good place for you to start:
* [JavaScript Debugging Techniques with Firebug]... |
365,826 | <p>How do I calculate distance between two GPS coordinates (using latitude and longitude)?</p>
| [
{
"answer_id": 365840,
"author": "Guge",
"author_id": 37771,
"author_profile": "https://Stackoverflow.com/users/37771",
"pm_score": 2,
"selected": false,
"text": "<p>I guess you want it along the curvature of the earth. Your two points and the center of the earth are on a plane. The cent... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14635/"
] | How do I calculate distance between two GPS coordinates (using latitude and longitude)? | [Calculate the distance between two coordinates by latitude and longitude](http://www.movable-type.co.uk/scripts/latlong.html), including a Javascript implementation.
*West* and *South* locations are negative.
Remember minutes and seconds are out of 60 so S31 30' is -31.50 degrees.
Don't forget to *convert degrees t... |
365,887 | <p>I know how they are different syntactically, and that C++ uses new, and C uses malloc. But how do they work, in a high-level explanation?</p>
<p>See <a href="https://stackoverflow.com/questions/240212/what-is-the-difference-between-newdelete-and-mallocfree#240308">What is the difference between new/delete and mall... | [
{
"answer_id": 365889,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 0,
"selected": false,
"text": "<p>\"new\" does a lot more than malloc. malloc simply allocates the memory - it doesn't even zero it for you. new initiali... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25632/"
] | I know how they are different syntactically, and that C++ uses new, and C uses malloc. But how do they work, in a high-level explanation?
See [What is the difference between new/delete and malloc/free?](https://stackoverflow.com/questions/240212/what-is-the-difference-between-newdelete-and-mallocfree#240308) | I'm just going to direct you to this answer: [What is the difference between new/delete and malloc/free?](https://stackoverflow.com/questions/240212/what-is-the-difference-between-newdelete-and-mallocfree#240308) . Martin provided an excellent overview. Quick overview on how they *work* (without diving into how you cou... |
365,935 | <p>All of my methods are failing me in various ways.
different lighting can mess it all up too.</p>
<p>has anyone every trying to return a name given a rgb value? "red" "green" "blue" would be enough to satisfy my needs for today.</p>
<p>i have unsafe byte processing of images from my web cam.</p>
<p><a href="https:... | [
{
"answer_id": 365942,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 0,
"selected": false,
"text": "<p>Well, Red/Green/Blue are fairly easy to identify by inspection; what range of values do you need to support?</p>\n... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/146637/"
] | All of my methods are failing me in various ways.
different lighting can mess it all up too.
has anyone every trying to return a name given a rgb value? "red" "green" "blue" would be enough to satisfy my needs for today.
i have unsafe byte processing of images from my web cam.
[:
```
let Diff (c1:Color) (c2:Color) =
let dr = (c1.R - c2.R) |> int
let dg = (c1.G - c2.G) |> int
let db = (c1.B - c2.B) |> ... |
365,952 | <p>I'm sure this sounds like a n00b question, but how do I add sub items programmically while populating a TreeView list in VB.NET 3.5? I have the following code, but haven't been able to figure out how to add the sub items for each of the folders/files I'm populating the TreeView with:</p>
<pre><code>Private Sub Add... | [
{
"answer_id": 365956,
"author": "Ian Nelson",
"author_id": 2084,
"author_profile": "https://Stackoverflow.com/users/2084",
"pm_score": 3,
"selected": true,
"text": "<p>Q1 - the GDR has a pre-requisite of VS2008 SP1, so switch those last two around.</p>\n\n<p>Q2 - I believe that each dev... | 2008/12/13 | [
"https://Stackoverflow.com/questions/365952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1391/"
] | I'm sure this sounds like a n00b question, but how do I add sub items programmically while populating a TreeView list in VB.NET 3.5? I have the following code, but haven't been able to figure out how to add the sub items for each of the folders/files I'm populating the TreeView with:
```
Private Sub AddToList(ByVal ta... | Q1 - the GDR has a pre-requisite of VS2008 SP1, so switch those last two around.
Q2 - I believe that each dev should be working with their own sandboxed database instance, yes. If you don't want to install instances of SQL Server on your workstations, then using multiple instances of SQL on a development server sounds... |
365,975 | <p>Namely, how does the following code:</p>
<pre><code>var sup = new Array(5);
sup[0] = 'z3ero';
sup[1] = 'o3ne';
sup[4] = 'f3our';
document.write(sup.length + "<br />");
</code></pre>
<p>output '5' for the length, when all you've done is set various elements?</p>
<p>My 'problem' with this code is that ... | [
{
"answer_id": 365992,
"author": "finpingvin",
"author_id": 46054,
"author_profile": "https://Stackoverflow.com/users/46054",
"pm_score": 2,
"selected": false,
"text": "<p>It is important to know that when you do <code>sup['look'] = 4;</code> you are not using an associative array, but r... | 2008/12/14 | [
"https://Stackoverflow.com/questions/365975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | Namely, how does the following code:
```
var sup = new Array(5);
sup[0] = 'z3ero';
sup[1] = 'o3ne';
sup[4] = 'f3our';
document.write(sup.length + "<br />");
```
output '5' for the length, when all you've done is set various elements?
My 'problem' with this code is that I don't understand how `length` changes withou... | Everything in JavaScript is an object. In the case of an `Array`, the `length` property returns the size of the internal storage area for indexed items of the array. Some of the confusion may come into play in that the `[]` operator works for both numeric and string arguments. For an array, if you use it with a numeric... |
366,031 | <p>Is there any way to create an array-like object in JavaScript, without using the built-in array? I'm specifically concerned with behavior like this:</p>
<pre><code>var sup = new Array(5);
//sup.length here is 0
sup[0] = 'z3ero';
//sup.length here is 1
sup[1] = 'o3ne';
//sup.length here is 2
sup[4] = 'f3our'; ... | [
{
"answer_id": 366034,
"author": "Mark Renouf",
"author_id": 758,
"author_profile": "https://Stackoverflow.com/users/758",
"pm_score": -1,
"selected": false,
"text": "<p>Sure, you can replicate almost any data structure in JavaScript, all the basic building blocks are there. What you'll ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | Is there any way to create an array-like object in JavaScript, without using the built-in array? I'm specifically concerned with behavior like this:
```
var sup = new Array(5);
//sup.length here is 0
sup[0] = 'z3ero';
//sup.length here is 1
sup[1] = 'o3ne';
//sup.length here is 2
sup[4] = 'f3our';
//sup.length... | Now we have ECMAScript 2015 (ECMA-262 6th Edition; ES6), we have [proxy objects](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy), and they allow us to implement the `Array` behaviour in the language itself, something along the lines of:
```
function FakeArray() {
const target ... |
366,042 | <p>I'm trying the following command on my shell:</p>
<pre><code>curl -b usptoCookies -L -d "patentNum=6836866&applicationNum=10007391&maintFeeAction=Get+Bibliographic+Data&maintFeeYear=04" https://ramps.uspto.gov/eram/getMaintFeesInfo.do;jsessionid=0000Nmdd1Q_YsDF90HKmb9EIIgq:11g0uehq7
</code></pre>
<p>Pr... | [
{
"answer_id": 366050,
"author": "Kibbee",
"author_id": 1862,
"author_profile": "https://Stackoverflow.com/users/1862",
"pm_score": 2,
"selected": false,
"text": "<p>There's a bunch of other hidden fields in that form including a \"signature\". Which seems to be some unique string each ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366042",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying the following command on my shell:
```
curl -b usptoCookies -L -d "patentNum=6836866&applicationNum=10007391&maintFeeAction=Get+Bibliographic+Data&maintFeeYear=04" https://ramps.uspto.gov/eram/getMaintFeesInfo.do;jsessionid=0000Nmdd1Q_YsDF90HKmb9EIIgq:11g0uehq7
```
Pretty straighforward. It is attempting ... | There's a bunch of other hidden fields in that form including a "signature". Which seems to be some unique string each time you request a page. This is probably a feature used to ensure that you aren't scraping all the information off their database.
When I emptied out the hidden signature field, it returned an error.... |
366,047 | <p>Looking at the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array" rel="noreferrer">mozilla documentation</a>, looking at the regular expression example (headed "Creating an array using the result of a match"), we have statements like:</p>
<blockquote>
<p>input: A ... | [
{
"answer_id": 366082,
"author": "Ryan Doherty",
"author_id": 956,
"author_profile": "https://Stackoverflow.com/users/956",
"pm_score": 3,
"selected": false,
"text": "<p>It is possible to have read-only properties in JavaScript which are available via getter methods. This is usually call... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] | Looking at the [mozilla documentation](https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array), looking at the regular expression example (headed "Creating an array using the result of a match"), we have statements like:
>
> input: A read-only property that reflects the original string ag... | **Edit:** Since this answer was written, a new, better way using `Object.defineProperty` has been standardized in EcmaScript 5, with support in newer browsers. See [Aidamina's answer](https://stackoverflow.com/questions/366047/can-read-only-properties-be-implemented-in-pure-javascript/2964881#2964881). If you need to s... |
366,054 | <p>i have a string that looks like</p>
<pre><code>"<input id=a/>"<input id=b/>"<input id=c/>etc.
</code></pre>
<p>I need to change it to</p>
<pre><code>"<input id='a'/>"<input id='b'/>"<input id='c'/>etc,
</code></pre>
<p>any ideas how? </p>
| [
{
"answer_id": 366090,
"author": "foxdonut",
"author_id": 26353,
"author_profile": "https://Stackoverflow.com/users/26353",
"pm_score": 1,
"selected": false,
"text": "<p>How about this:</p>\n\n<pre><code>%s/\"<input id=\\(.\\)\\/>/\"<input id='\\1'\\/>/g\n</code></pre>\n\n<p>... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366054",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i have a string that looks like
```
"<input id=a/>"<input id=b/>"<input id=c/>etc.
```
I need to change it to
```
"<input id='a'/>"<input id='b'/>"<input id='c'/>etc,
```
any ideas how? | In C# you could write it as:
```
resultString = Regex.Replace(subjectString, @"(<.*?id\s*=\s*)(\w+)(.*?>)", "$1'$2'$3", RegexOptions.Multiline);
```
In VB.Net it would simply be:
```
ResultString = Regex.Replace(SubjectString, "(<.*?id\s*=\s*)(\w+)(.*?>)", "$1'$2'$3", RegexOptions.Multiline)
```
In canonical Perl... |
366,093 | <p>If I check out a tagged version of my source code without creating a branch, Git indicates that I'm not associated with any branch at all. It's happy to let me make changes and check them in though. Where do those changes go? If I switch back to 'master' they disappear (overwritten by what was in master) and I can't... | [
{
"answer_id": 366103,
"author": "Dustin",
"author_id": 39975,
"author_profile": "https://Stackoverflow.com/users/39975",
"pm_score": 3,
"selected": false,
"text": "<p>Yes, they'll be in reflogs.</p>\n\n<p>You can name the branch at any time like this:</p>\n\n<pre><code>git checkout -b m... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/826/"
] | If I check out a tagged version of my source code without creating a branch, Git indicates that I'm not associated with any branch at all. It's happy to let me make changes and check them in though. Where do those changes go? If I switch back to 'master' they disappear (overwritten by what was in master) and I can't se... | Because your **commit isn't on any branch**, you can't see it in the working directory unless you checkout that specific commit, using its SHA1. You can find the commit by looking at the `reflog` which tracks changes in what you have checked out from the repo. If your tag was `XXX` you'll see something like:
```
$ git... |
366,104 | <p>Make a <strong>new AS3 Document</strong> in Flash, <strong>paste</strong> in the following code and <strong>run it:</strong></p>
<pre><code>var a:Number=0;
trace(a) // 0
a+=0.3;
trace(a) // 0.3
a+=0.3;
trace(a) // 0.6
a+=0.3;
trace(a) // 0.8999999999999999
a+=0.3;
trace(a) // 1.2
a+=0.3;
trace(a) // 1.... | [
{
"answer_id": 366108,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 4,
"selected": true,
"text": "<p>This is a standard floating point problem. Binary floating point numbers do not represent the full range of decimal nu... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366104",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41021/"
] | Make a **new AS3 Document** in Flash, **paste** in the following code and **run it:**
```
var a:Number=0;
trace(a) // 0
a+=0.3;
trace(a) // 0.3
a+=0.3;
trace(a) // 0.6
a+=0.3;
trace(a) // 0.8999999999999999
a+=0.3;
trace(a) // 1.2
a+=0.3;
trace(a) // 1.5
a+=0.3;
trace(a) // 1.8
a+=0.3;
trace(a) // 2.1... | This is a standard floating point problem. Binary floating point numbers do not represent the full range of decimal numbers with perfect accuracy, you need to do something along the lines of
```
trace (round (a, 1))
```
or, better yet, turn it into a string and strip off everything past the first fractional digit (s... |
366,115 | <p>I found the following code to create a tinyurl.com url:</p>
<pre><code>http://tinyurl.com/api-create.php?url=http://myurl.com
</code></pre>
<p>This will automatically create a tinyurl url. Is there a way to do this using code, specifically C# in ASP.NET?</p>
| [
{
"answer_id": 366120,
"author": "Michael Stum",
"author_id": 91,
"author_profile": "https://Stackoverflow.com/users/91",
"pm_score": 2,
"selected": false,
"text": "<p>You have to call that URL from your code, then read back the output from the server and process it.</p>\n\n<p>Have a loo... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1768/"
] | I found the following code to create a tinyurl.com url:
```
http://tinyurl.com/api-create.php?url=http://myurl.com
```
This will automatically create a tinyurl url. Is there a way to do this using code, specifically C# in ASP.NET? | You should probably add some error checking, etc, but this is probably the easiest way to do it:
```
System.Uri address = new System.Uri("http://tinyurl.com/api-create.php?url=" + YOUR ADDRESS GOES HERE);
System.Net.WebClient client = new System.Net.WebClient();
string tinyUrl = client.DownloadString(address);
Console... |
366,124 | <p>I'm building an application where I should capture several values and build a text with them: <code>Name</code>, <code>Age</code>, etc.</p>
<p>The output will be a plain text into a <code>TextBox</code>.</p>
<p>I am trying to make those information appear in kind of <code>columns</code>, therefore I am trying to sep... | [
{
"answer_id": 366126,
"author": "DShook",
"author_id": 370,
"author_profile": "https://Stackoverflow.com/users/370",
"pm_score": 10,
"selected": true,
"text": "<p>Try using the <code>\\t</code> character in your strings</p>\n"
},
{
"answer_id": 366131,
"author": "Dan R",
... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366124",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19159/"
] | I'm building an application where I should capture several values and build a text with them: `Name`, `Age`, etc.
The output will be a plain text into a `TextBox`.
I am trying to make those information appear in kind of `columns`, therefore I am trying to separate them with `tab` to make it clearer.
For example, ins... | Try using the `\t` character in your strings |
366,137 | <pre><code><?php
function data_info($data)
{
if ($data) {
while (!feof($data)) {
$buffer = fgets($data);
if (file_exists($buffer)) {
$bufferArray[$buffer]['Exists'] = (file_exists($buffer));
$bufferArray[$buffer]['Readable'] = (is_readable($buffer));
... | [
{
"answer_id": 366150,
"author": "Athena",
"author_id": 17846,
"author_profile": "https://Stackoverflow.com/users/17846",
"pm_score": 3,
"selected": true,
"text": "<p>Hmm, well that works in Linux (though I have to trim the filename <code>$buffer</code> first).</p>\n"
},
{
"answe... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366137",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46071/"
] | ```
<?php
function data_info($data)
{
if ($data) {
while (!feof($data)) {
$buffer = fgets($data);
if (file_exists($buffer)) {
$bufferArray[$buffer]['Exists'] = (file_exists($buffer));
$bufferArray[$buffer]['Readable'] = (is_readable($buffer));
$bu... | Hmm, well that works in Linux (though I have to trim the filename `$buffer` first). |
366,145 | <p>I'm trying to write a greasemonkey script, and it would be preferable for it to be able to work with images (specifically, find the darkest pixel in an image). Is there a way to do this or must I embed flash?</p>
| [
{
"answer_id": 366165,
"author": "Matthew Crumley",
"author_id": 2214,
"author_profile": "https://Stackoverflow.com/users/2214",
"pm_score": 4,
"selected": true,
"text": "<p>Since it's Firefox specific, you can use a canvas element. I've never written a greasemonkey script, so I don't kn... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29595/"
] | I'm trying to write a greasemonkey script, and it would be preferable for it to be able to work with images (specifically, find the darkest pixel in an image). Is there a way to do this or must I embed flash? | Since it's Firefox specific, you can use a canvas element. I've never written a greasemonkey script, so I don't know exactly how you would do it, but the idea is, you create a new canvas element and draw the image onto the canvas. Then, you can get the pixel values from the canvas.
```
// Create the canvas element
var... |
366,156 | <p>According to Martin Fowler "Something can be public but that does not mean you have published it." Does this mean something like this:</p>
<pre><code>public interface IRollsRoyceEngine
{
void Start();
void Stop();
String GenerateEngineReport();
}
public class RollsRoyceEngine : IRollsRoyceEngine
{
... | [
{
"answer_id": 366161,
"author": "Steve Jessop",
"author_id": 13005,
"author_profile": "https://Stackoverflow.com/users/13005",
"pm_score": 3,
"selected": false,
"text": "<p>I assume he means that the contract is king - just because a method in your class is public, doesn't entitle clien... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5558/"
] | According to Martin Fowler "Something can be public but that does not mean you have published it." Does this mean something like this:
```
public interface IRollsRoyceEngine
{
void Start();
void Stop();
String GenerateEngineReport();
}
public class RollsRoyceEngine : IRollsRoyceEngine
{
public bool En... | In my opinion mentioned white paper talks about target audience of the API rather than the distinction between interface and its implementation.
You can find analogy in [Framework Design Guidelines](https://rads.stackoverflow.com/amzn/click/com/0321246756) which says that once your API shipped you have a contract wit... |
366,160 | <p>First, let me explain what I am doing. I need to take an order, which is split up into different databases, and print out this very large order. What I need from the orders is about 100 or so columns from different databases. The way I was doing in was querying with a join and assigning all of the column values to a... | [
{
"answer_id": 366169,
"author": "Joel",
"author_id": 13713,
"author_profile": "https://Stackoverflow.com/users/13713",
"pm_score": 0,
"selected": false,
"text": "<p>It really just sounds like your preference to me. How would you prefer to work with it? Would it be easier for you to work... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366160",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45429/"
] | First, let me explain what I am doing. I need to take an order, which is split up into different databases, and print out this very large order. What I need from the orders is about 100 or so columns from different databases. The way I was doing in was querying with a join and assigning all of the column values to a va... | I'm going against the grain here, but I'd say that keeping this object mapped to the result set, and keeping the join in the database, might be a better idea.
For the business logic, an "order" is usually a single cohesive concept (at least, that's how you started out framing it). Could the fact that it is mapped int... |
366,187 | <p>I'm looking for help getting started working programmatically with audio.</p>
<p>Specifically, the platform I'm working with exposes APIs to extract audio data from a resource (like an MP3), or to play back arbitrary data as audio. In both cases the actual data is byte arrays of 32bit floats representing 44.1 KHz s... | [
{
"answer_id": 366221,
"author": "some",
"author_id": 36866,
"author_profile": "https://Stackoverflow.com/users/36866",
"pm_score": 3,
"selected": false,
"text": "<p>Looks like you want to know more about <a href=\"http://en.wikipedia.org/wiki/Pulse-code_modulation\" rel=\"noreferrer\">P... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10651/"
] | I'm looking for help getting started working programmatically with audio.
Specifically, the platform I'm working with exposes APIs to extract audio data from a resource (like an MP3), or to play back arbitrary data as audio. In both cases the actual data is byte arrays of 32bit floats representing 44.1 KHz stereo. Wha... | As some has pointed out in the comments, what you want to look into is [PCM audio](http://en.wikipedia.org/wiki/Pulse-code_modulation).
In a nutshell, [sound](http://en.wikipedia.org/wiki/Sound) is a wave that travels through air. In order to capture that sound, we use a [microphone](http://en.wikipedia.org/wiki/Micro... |
366,189 | <p>i've got a commenting system in our database. Just like stackoverflow -> each post has a list of comments. kewl.</p>
<p>Anonymous people can add a comment or registered users also.</p>
<p>In my table, i'm thinking of having the following:</p>
<ul>
<li>Userid int NULLABLE</li>
<li>AnonymousNickname varchar(100) NU... | [
{
"answer_id": 366199,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": true,
"text": "<p>A simple constraint would be</p>\n\n<pre><code>(Userid is not null and AnonymousNickname is null and AnonymousEmail i... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30674/"
] | i've got a commenting system in our database. Just like stackoverflow -> each post has a list of comments. kewl.
Anonymous people can add a comment or registered users also.
In my table, i'm thinking of having the following:
* Userid int NULLABLE
* AnonymousNickname varchar(100) NULLABLE
* AnonymousEmail varchar(200... | A simple constraint would be
```
(Userid is not null and AnonymousNickname is null and AnonymousEmail is null)
or (Userid is null and AnonymousNickname is not null and AnonymousEmail is not null)
```
This will force only one or the other to be set. It sounds like this would be reasonable based on your application. I... |
366,202 | <p>I'm new to regular expressions and would appreciate your help. I'm trying to put together an expression that will split the example string using all spaces that are not surrounded by single or double quotes. My last attempt looks like this: <code>(?!")</code> and isn't quite working. It's splitting on the space bef... | [
{
"answer_id": 366216,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 1,
"selected": false,
"text": "<p>It'll probably be easier to search the string, grabbing each part, vs. split it.</p>\n\n<p>Reason being, you ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46077/"
] | I'm new to regular expressions and would appreciate your help. I'm trying to put together an expression that will split the example string using all spaces that are not surrounded by single or double quotes. My last attempt looks like this: `(?!")` and isn't quite working. It's splitting on the space before the quote.
... | I don't understand why all the others are proposing such complex regular expressions or such long code. Essentially, you want to grab two kinds of things from your string: sequences of characters that aren't spaces or quotes, and sequences of characters that begin and end with a quote, with no quotes in between, for tw... |
366,237 | <p>Here's an example:</p>
<pre><code>Double d = (1/3);
System.out.println(d);
</code></pre>
<p>This returns 0, not 0.33333... as it should.</p>
<p>Does anyone know?</p>
| [
{
"answer_id": 366240,
"author": "Firas Assaad",
"author_id": 23153,
"author_profile": "https://Stackoverflow.com/users/23153",
"pm_score": 6,
"selected": true,
"text": "<p>That's because <code>1</code> and <code>3</code> are treated as <code>integers</code> when you don't specify otherw... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46084/"
] | Here's an example:
```
Double d = (1/3);
System.out.println(d);
```
This returns 0, not 0.33333... as it should.
Does anyone know? | That's because `1` and `3` are treated as `integers` when you don't specify otherwise, so `1/3` evaluates to the `integer` `0` which is then cast to the `double` `0`. To fix it, try `(1.0/3)`, or maybe `1D/3` to explicitly state that you're dealing with double values. |
366,251 | <p>I'm trying to use prototype and scriptaculous to hide and display a div element but the function (below) to take advantage of the prototype setStyle property isn't working and I'm not sure what the problem is.</p>
<pre><code><script type="text/javascript" language="javascript">
function bodyOnload() {
... | [
{
"answer_id": 366297,
"author": "maxnk",
"author_id": 45862,
"author_profile": "https://Stackoverflow.com/users/45862",
"pm_score": 1,
"selected": false,
"text": "<p>If you want to initially hide elements, its not enough to write the \"function bodyOnload\".\nThis function should be cal... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40376/"
] | I'm trying to use prototype and scriptaculous to hide and display a div element but the function (below) to take advantage of the prototype setStyle property isn't working and I'm not sure what the problem is.
```
<script type="text/javascript" language="javascript">
function bodyOnload() {
$('content1... | [maxnk](https://stackoverflow.com/questions/366251/#366297) already covered the main issue.
But, Prototype recommends using the [`dom:loaded`](http://www.prototypejs.org/api/document/observe) event instead of `window.onload`:
```
document.observe("dom:loaded", bodyOnload);
```
Also, you might try Prototype's [`Elem... |
366,255 | <p>MSIE v7 does not (in my hands) open a Modeless Dialog or trigger an onLoad event if there is a Javascript alert in the target page. The following fails in MSIE v7 but is OK in v6 (zip file of full source available if required). </p>
<p>Would appreciate others confirming this and discussing why this should be so.</p... | [
{
"answer_id": 372300,
"author": "w4g3n3r",
"author_id": 36745,
"author_profile": "https://Stackoverflow.com/users/36745",
"pm_score": 0,
"selected": false,
"text": "<p>Are you sure it's not your inline onload event that's stopping it? The code below works for me.</p>\n\n<p>Index.htm</p>... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46085/"
] | MSIE v7 does not (in my hands) open a Modeless Dialog or trigger an onLoad event if there is a Javascript alert in the target page. The following fails in MSIE v7 but is OK in v6 (zip file of full source available if required).
Would appreciate others confirming this and discussing why this should be so.
index.htm (... | It appears that IE7 is displaying the proper behavior. HTML is read and parsed sequentially, including scripts. When the parser reaches the javascript alert, it executes it and waits for a return. Then, it can finish parsing the page and raise the onLoad event.
If you want the alert to be displayed after the page has ... |
366,262 | <p>I need to know how I can search an array for some literal text and have it used as a condition whether to continue.</p>
<p>Here's why:
Each time I execute a function I am pushing the ID of the property it acts upon into an array. I need my function to check if that ID is in the array already and if it is, remove it... | [
{
"answer_id": 366271,
"author": "Supernovah",
"author_id": 36076,
"author_profile": "https://Stackoverflow.com/users/36076",
"pm_score": 1,
"selected": false,
"text": "<pre><code>function arraytest(){\n var myArray = new Array(); \n myArray.push([\"test1\"]); \n myArray.push(... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366262",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36076/"
] | I need to know how I can search an array for some literal text and have it used as a condition whether to continue.
Here's why:
Each time I execute a function I am pushing the ID of the property it acts upon into an array. I need my function to check if that ID is in the array already and if it is, remove it and execu... | Grep isn't a standard javascript Array method. Are you using a javascript library that has added this method to Array? If so, you may want to look at its implementation. Since you are pushing arrays into the array, it would need to be able to search the elements of each element of the array, instead of the array itself... |
366,273 | <p>Can anyone send me a c code to divide 2 64bit numbers. My compiler only supports 32/32 division.</p>
<p>Thanx & Regards</p>
<p>Mani</p>
| [
{
"answer_id": 366286,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 3,
"selected": false,
"text": "<p>The code is available in linux, see <a href=\"http://lxr.linux.no/linux+v2.6.22/lib/div64.c\" rel=\"noreferrer\"... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can anyone send me a c code to divide 2 64bit numbers. My compiler only supports 32/32 division.
Thanx & Regards
Mani | Are you positive your compiler doesn't support 64-bit division? If your C compiler supports C99, this should work:
```
#include <stdint.h>
#include <stdio.h>
int main(void)
{
int64_t numerator = 123;
int64_t denominator = 10;
int64_t quotient = numerator / denominator
printf("%" PRId64 " / %" PRId64 " ... |
366,311 | <p>I'm pretty happy with <a href="http://whatcodecraves.com/posts/2008/12/13/rails-flash-with-ajax.html" rel="noreferrer">the solution</a> that I came up with. Basically, I have a helper method that reloads the flash inline, and then I have an after_filter that clear out the flash if the request is xhr. Does anyone h... | [
{
"answer_id": 368061,
"author": "krusty.ar",
"author_id": 43981,
"author_profile": "https://Stackoverflow.com/users/43981",
"pm_score": 0,
"selected": false,
"text": "<p>The only improvement I can think of is making the page.reload_flash default (not having to put it on every rjs file, ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25024/"
] | I'm pretty happy with [the solution](http://whatcodecraves.com/posts/2008/12/13/rails-flash-with-ajax.html) that I came up with. Basically, I have a helper method that reloads the flash inline, and then I have an after\_filter that clear out the flash if the request is xhr. Does anyone have a simpler solution than that... | You can also store the flash messages in the response headers using a after\_filter block and display them using javascript:
```
class ApplicationController < ActionController::Base
after_filter :flash_to_headers
def flash_to_headers
return unless request.xhr?
response.headers['X-Message'] = flash[:error] unless... |
366,324 | <p>Just for the sake of experimentation, I've been trying to determine different ways to non-destructively chain <code>window.onload</code> functions in a web browser. This is the idea of what I have so far:</p>
<pre><code>var load = window.onload;
var newFunction = function(){
alert("ha!");
}
window.onload = func... | [
{
"answer_id": 366330,
"author": "Patryk Kordylewski",
"author_id": 30927,
"author_profile": "https://Stackoverflow.com/users/30927",
"pm_score": 0,
"selected": false,
"text": "<p>You could have a look at <a href=\"http://jquery.com/\" rel=\"nofollow noreferrer\">jQuery</a> how they hand... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1370/"
] | Just for the sake of experimentation, I've been trying to determine different ways to non-destructively chain `window.onload` functions in a web browser. This is the idea of what I have so far:
```
var load = window.onload;
var newFunction = function(){
alert("ha!");
}
window.onload = function(){
load();
n... | May be it will be better to use addEventListener/attachEvent?
[Advanced event registration models](http://www.quirksmode.org/js/events_advanced.html) |
366,326 | <p>We all know and love Process.WaitForExit().</p>
<p>Given a pid of a process on a remote machine (created by WMI/psexec), how do I wait for it to end?</p>
| [
{
"answer_id": 366385,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 1,
"selected": true,
"text": "<pre><code>Process.GetProcessById(processId, machineName).WaitForExit();\n</code></pre>\n"
},
{
"answer_id": 36... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11236/"
] | We all know and love Process.WaitForExit().
Given a pid of a process on a remote machine (created by WMI/psexec), how do I wait for it to end? | ```
Process.GetProcessById(processId, machineName).WaitForExit();
``` |
366,332 | <pre><code>public class Address
{
public string ZipCode {get; set;}
}
public class Customer
{
public Address Address {get; set;}
}
</code></pre>
<p>how can I access eitther "ZipCode" or "Address.ZipCode" with reflection? For example: </p>
<pre><code>Typeof(Customer).GetProperty("ZipCode")?
</code></pre>
| [
{
"answer_id": 366337,
"author": "maxnk",
"author_id": 45862,
"author_profile": "https://Stackoverflow.com/users/45862",
"pm_score": 2,
"selected": false,
"text": "<pre><code>typeof (Customer).GetProperty(\"Address\").PropertyType.GetProperty(\"ZipCode\")\n</code></pre>\n"
},
{
"... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31624/"
] | ```
public class Address
{
public string ZipCode {get; set;}
}
public class Customer
{
public Address Address {get; set;}
}
```
how can I access eitther "ZipCode" or "Address.ZipCode" with reflection? For example:
```
Typeof(Customer).GetProperty("ZipCode")?
``` | You'd need something like:
```
PropertyInfo addressProperty = typeof(Customer).GetProperty("Address");
ProportyInfo zipCodeProperty = addressProperty.PropertyType.GetProperty("ZipCode");
object address = addressProperty.GetValue(customer, null);
object zipCode = zipCodeProperty.GetValue(address, null);
```
Basicall... |
366,364 | <p>I just got a weird idea about how to configure environment-dependent parameters. Sort of like parameters you can find in Rails' config/database.yml</p>
<p>In my current project I use PHP and Litespeed Web Server (though the same technique applies to PHP + Apache), and I thought... 'why not use mod_rewrite for this?... | [
{
"answer_id": 366397,
"author": "Sydius",
"author_id": 43496,
"author_profile": "https://Stackoverflow.com/users/43496",
"pm_score": 2,
"selected": false,
"text": "<p>I don't believe rewrite rules are a particularly intuitive place to put configuration information like that. Maybe I am... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45652/"
] | I just got a weird idea about how to configure environment-dependent parameters. Sort of like parameters you can find in Rails' config/database.yml
In my current project I use PHP and Litespeed Web Server (though the same technique applies to PHP + Apache), and I thought... 'why not use mod\_rewrite for this?'. I have... | I don't believe rewrite rules are a particularly intuitive place to put configuration information like that. Maybe I am misunderstanding something, but is the only difference between the development, staging, and production environments the database connection? Typically the code is also different (at least once change... |
366,375 | <p>Can someone explain to or link to an article that explains how the parameters passed into the action of a controller are populated? I understand the basic mapping when you have the Controller/Action/ID and the ID is passed in as a variable, if it doesn't convert to the type that you are asking for then it won't be p... | [
{
"answer_id": 366386,
"author": "maxnk",
"author_id": 45862,
"author_profile": "https://Stackoverflow.com/users/45862",
"pm_score": 3,
"selected": true,
"text": "<p>Generally, its a function of ControllerActionInvoker. Objects are passing into the action after they instantiated in custo... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26081/"
] | Can someone explain to or link to an article that explains how the parameters passed into the action of a controller are populated? I understand the basic mapping when you have the Controller/Action/ID and the ID is passed in as a variable, if it doesn't convert to the type that you are asking for then it won't be pass... | Generally, its a function of ControllerActionInvoker. Objects are passing into the action after they instantiated in custom ControllerActionInvoker implementation. For more info about how ControllerActionInvoker works take a look at [ASP.NET MVC - ControllerActionInvoker: Part 1](http://lostintangent.com/2008/07/03/asp... |
366,379 | <p>I want to show first element that is hidden by jquery. my html code is:</p>
<pre><code><ol>
<li>1</li>
<li style="display:none">2</li>
<li style="display:none">3</li>
<li style="display:none">4</li>
<li style="display:none">5</li>... | [
{
"answer_id": 366395,
"author": "user38526",
"author_id": 38526,
"author_profile": "https://Stackoverflow.com/users/38526",
"pm_score": 2,
"selected": false,
"text": "<p>Here is the solution:</p>\n\n<pre><code>$(\"a.add\").click(function(){\n $(\":hidden:first\").show();\n});\n</code... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46110/"
] | I want to show first element that is hidden by jquery. my html code is:
```
<ol>
<li>1</li>
<li style="display:none">2</li>
<li style="display:none">3</li>
<li style="display:none">4</li>
<li style="display:none">5</li>
<li><a class="add">Add More ...</a></li>
</ol>
```
I want to show first h... | Just add a :first selector after you get :hidden set so you get the first element from set found by :hidden selector
```
$("a.add").click(function(){
$(":hidden:first").slideToggle("fast");
});
``` |
366,380 | <p>I write this tiny C++ example in Eclipse 3.4.1 (CDT 5.0.1):</p>
<pre><code>#include <iostream>
#include <vector>
#include <boost/foreach.hpp>
int foo()
{
std::vector<int> numbers;
BOOST_FOREACH(int n, numbers)
{
std::cout << n << std::endl;
}
std::cout << num... | [
{
"answer_id": 481481,
"author": "Giovanni Funchal",
"author_id": 55935,
"author_profile": "https://Stackoverflow.com/users/55935",
"pm_score": 0,
"selected": false,
"text": "<p>Euh... you can't ? Try next version of CDT... :_(</p>\n"
},
{
"answer_id": 495939,
"author": "Mart... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20444/"
] | I write this tiny C++ example in Eclipse 3.4.1 (CDT 5.0.1):
```
#include <iostream>
#include <vector>
#include <boost/foreach.hpp>
int foo()
{
std::vector<int> numbers;
BOOST_FOREACH(int n, numbers)
{
std::cout << n << std::endl;
}
std::cout << numbers.size << std::endl;
}
```
Then I hit Shift+Ctrl+F ... | You might want to try the [astyle eclipse plugin](http://astyleclipse.sourceforge.net/). It seems to be much nicer than the default eclipse style of C++ indentation. |
366,422 | <p>Sometimes it seems natural to have a default parameter which is an empty list. Yet <a href="https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument">Python produces unexpected behavior in these situations</a>.</p>
<p>If for example, I have a function:</p>
<pre><code>def my_fun... | [
{
"answer_id": 366430,
"author": "HenryR",
"author_id": 2827,
"author_profile": "https://Stackoverflow.com/users/2827",
"pm_score": 9,
"selected": true,
"text": "<pre class=\"lang-py prettyprint-override\"><code>def my_func(working_list=None):\n if working_list is None: \n work... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2242/"
] | Sometimes it seems natural to have a default parameter which is an empty list. Yet [Python produces unexpected behavior in these situations](https://stackoverflow.com/questions/1132941/least-astonishment-and-the-mutable-default-argument).
If for example, I have a function:
```
def my_func(working_list=[]):
workin... | ```py
def my_func(working_list=None):
if working_list is None:
working_list = []
# alternative:
# working_list = [] if working_list is None else working_list
working_list.append("a")
print(working_list)
```
[The docs](https://docs.python.org/reference/compound_stmts.html#function-defini... |
366,432 | <p>I need to use lists for my program and needed to decide if I use std::vector or std::list.
The problem with vector is that there is no remove method and with list that there is no operator []. So I decided to write my own class extending std::list and overloading the [] operator.</p>
<p>My code looks like this:</p>... | [
{
"answer_id": 366435,
"author": "Sydius",
"author_id": 43496,
"author_profile": "https://Stackoverflow.com/users/43496",
"pm_score": 3,
"selected": false,
"text": "<p>Vectors have the <a href=\"http://www.cppreference.com/wiki/stl/vector/erase\" rel=\"noreferrer\">erase method</a> that ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2450/"
] | I need to use lists for my program and needed to decide if I use std::vector or std::list.
The problem with vector is that there is no remove method and with list that there is no operator []. So I decided to write my own class extending std::list and overloading the [] operator.
My code looks like this:
```
#include... | All template code should be put in header file. This fill fix linking problems (that's the simplest way).
The reason it happens is because compilers compiles every source (.cc) file separately from other files. On the other hand it needs to know what code exactly it needs to create (i.e. what is the T in template is su... |
366,507 | <p>A lot of times in code on the internet or code from my co-workers I see them creating an Object with just one method which only gets used once in the whole application. Like this:</p>
<pre><code> class iOnlyHaveOneMethod{
public function theOneMethod(){
//loads and loads of code, say 100's of lines
// ... | [
{
"answer_id": 366515,
"author": "Eran Galperin",
"author_id": 10585,
"author_profile": "https://Stackoverflow.com/users/10585",
"pm_score": 2,
"selected": false,
"text": "<p>Well, if there really is \"loads and loads\" of code in the method, then it should be broken down into several pr... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35197/"
] | A lot of times in code on the internet or code from my co-workers I see them creating an Object with just one method which only gets used once in the whole application. Like this:
```
class iOnlyHaveOneMethod{
public function theOneMethod(){
//loads and loads of code, say 100's of lines
// but it only ge... | The problem is not whether it's in a function or an object.
The problem is that you have hundreds of lines in one blob. Whether that mass of code is in a method of an object or just a class seems more or less irrelevant to me, just being minor syntatic sugar.
What are those hundreds of lines doing? That's the place... |
366,533 | <p>How to run the first process from a list of processes stored in a file and immediately delete the first line as if the file was a queue and I called "pop"?</p>
<p>I'd like to call the first command listed in a simple text file with \n as the separator in a pop-like fashion:</p>
<p><em>Figure 1:</em></p>
<pre><cod... | [
{
"answer_id": 366544,
"author": "frankodwyer",
"author_id": 42404,
"author_profile": "https://Stackoverflow.com/users/42404",
"pm_score": 1,
"selected": false,
"text": "<p>I think you would need to rewrite the file - e.g. run a command to list all lines but the first, write that to a te... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366533",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4085/"
] | How to run the first process from a list of processes stored in a file and immediately delete the first line as if the file was a queue and I called "pop"?
I'd like to call the first command listed in a simple text file with \n as the separator in a pop-like fashion:
*Figure 1:*
```
cmdqueue.lst :
proc_C1
proc_C2
p... | pop-cmd.py:
```
#!/usr/bin/env python
import os, shlex, sys
from subprocess import call
filename = sys.argv[1]
lines = open(filename).readlines()
if lines:
command = lines[0].rstrip()
open(filename, "w").writelines(lines[1:])
if command:
sys.exit(call(shlex.split(command) + sys.argv[2:]))
```
Exa... |
366,541 | <p>I want to serialize a Dictionary that has a custom <code>IEqualityComparer</code>.</p>
<p>I've tried using <code>DataContractSerializer</code> but I can't get the <code>Comparer</code> to be serialized.</p>
<p>I can't use <code>BinaryFormatter</code> because of <a href="https://connect.microsoft.com/VisualStudio/f... | [
{
"answer_id": 366544,
"author": "frankodwyer",
"author_id": 42404,
"author_profile": "https://Stackoverflow.com/users/42404",
"pm_score": 1,
"selected": false,
"text": "<p>I think you would need to rewrite the file - e.g. run a command to list all lines but the first, write that to a te... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19956/"
] | I want to serialize a Dictionary that has a custom `IEqualityComparer`.
I've tried using `DataContractSerializer` but I can't get the `Comparer` to be serialized.
I can't use `BinaryFormatter` because of [this](https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=303278&wa=wsignin1.0).
I ... | pop-cmd.py:
```
#!/usr/bin/env python
import os, shlex, sys
from subprocess import call
filename = sys.argv[1]
lines = open(filename).readlines()
if lines:
command = lines[0].rstrip()
open(filename, "w").writelines(lines[1:])
if command:
sys.exit(call(shlex.split(command) + sys.argv[2:]))
```
Exa... |
366,550 | <p>I am currently reading "Beginning CakePHP:From Novice to Professional" by David Golding. At one point I have to use the CLI-command "cake bake", I get the welcome-screen but when I try to bake e.g. a Controller I get the following error messages:</p>
<pre><code>Warning: mysql_connect(): Can't connect to local MySQL... | [
{
"answer_id": 366556,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 5,
"selected": true,
"text": "<p>From the error, it looks like it's trying to connect to an actual IP address and not a UNIX socket, look:</p>\n\n<... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24218/"
] | I am currently reading "Beginning CakePHP:From Novice to Professional" by David Golding. At one point I have to use the CLI-command "cake bake", I get the welcome-screen but when I try to bake e.g. a Controller I get the following error messages:
```
Warning: mysql_connect(): Can't connect to local MySQL server throug... | From the error, it looks like it's trying to connect to an actual IP address and not a UNIX socket, look:
```
'/Applications/MAMP/tmp/mysql/mysql.sock:3306'
```
It's appending a port to the socket, which is wrong.
So, I'd first try to configure MySQL to listen to TCP/IP requests (edit the proper section in my.cnf... |
366,586 | <p>I use codeigniter as my main install on the main domain. I have created a subdomain and a folder called live e.g. live.domain.com maps to public/live . However in public I use codeigniter.</p>
<p>I now have the dynamic codeigniter url: </p>
<pre>http://domain.com/api/</pre>
<p>which I want to map to my subdomain:... | [
{
"answer_id": 366590,
"author": "Simon B. Jensen",
"author_id": 46128,
"author_profile": "https://Stackoverflow.com/users/46128",
"pm_score": 3,
"selected": false,
"text": "<p>How about something like the following:</p>\n\n<pre>\nRewriteEngine On\nRewriteCond %{HTTP_HOST} ^live\\.domain... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I use codeigniter as my main install on the main domain. I have created a subdomain and a folder called live e.g. live.domain.com maps to public/live . However in public I use codeigniter.
I now have the dynamic codeigniter url:
```
http://domain.com/api/
```
which I want to map to my subdomain:
```
https://live.... | How about something like the following:
```
RewriteEngine On
RewriteCond %{HTTP_HOST} ^live\.domain\.com$ [NC]
RewriteRule (.+)$ "https://domain.com/api/$1" [L,P]
``` |
366,595 | <p>I'm trying to use <a href="http://www.appelsiini.net/projects/jeditable" rel="nofollow noreferrer">Jeditable</a> as an inline editing solution.</p>
<p>The default behavior (click on the element to edit it) works quite well, but I would like to activate an element by clicking on another element.</p>
<p>For example ... | [
{
"answer_id": 366704,
"author": "Ata",
"author_id": 46110,
"author_profile": "https://Stackoverflow.com/users/46110",
"pm_score": 2,
"selected": false,
"text": "<p>You can place this code in click function of another element. example:</p>\n\n<p>HTML:</p>\n\n<pre><code><a class=\"clic... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1011/"
] | I'm trying to use [Jeditable](http://www.appelsiini.net/projects/jeditable) as an inline editing solution.
The default behavior (click on the element to edit it) works quite well, but I would like to activate an element by clicking on another element.
For example clicking on a.activateEdit will activate the next div.... | Above code is not quite correct either. It triggers click event on ALL Jeditable instances.
There are many ways to do it and it all depends on your HTML, but for example if you have following HTML:
```
<div class="edit" id="unique_id">Editable text</div>
<a href="#" class="edit_trigger">Edit me!!</a>
```
Then you ... |
366,601 | <p>I'm having issues getting Firefox to update a webpage when its class is changed dynamically.</p>
<p>I'm using an HTML <code>table</code> element. When the user clicks a cell in the table header, my script toggles the class back and forth between <code>sorted_asc</code> and <code>sorted_des</code>. I have pseudo ele... | [
{
"answer_id": 366646,
"author": "I.devries",
"author_id": 6388,
"author_profile": "https://Stackoverflow.com/users/6388",
"pm_score": 3,
"selected": true,
"text": "<p>It's kind of cheesy, but since you're using javascript anyway, try this after you changed the className:</p>\n\n<pre><co... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366601",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4939/"
] | I'm having issues getting Firefox to update a webpage when its class is changed dynamically.
I'm using an HTML `table` element. When the user clicks a cell in the table header, my script toggles the class back and forth between `sorted_asc` and `sorted_des`. I have pseudo element which adds an arrow glyph (pointing up... | It's kind of cheesy, but since you're using javascript anyway, try this after you changed the className:
```
document.body.style.display = 'none';
document.body.style.display = 'block';
```
This will re-render the layout and often solves these kind of bugs. Not always, though. |
366,603 | <p>Having a table with a column like: <code>mydate DATETIME</code> ...</p>
<p>I have a query such as:</p>
<pre><code>SELECT SUM(foo), mydate FROM a_table GROUP BY a_table.mydate;
</code></pre>
<p>This will group by the full <code>datetime</code>, including hours and minutes. I wish to make the group by, only by the dat... | [
{
"answer_id": 366610,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 9,
"selected": true,
"text": "<p>Cast the datetime to a date, then GROUP BY using this syntax:</p>\n\n<pre><code>SELECT SUM(foo), DATE(mydate) FROM a_tab... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26004/"
] | Having a table with a column like: `mydate DATETIME` ...
I have a query such as:
```
SELECT SUM(foo), mydate FROM a_table GROUP BY a_table.mydate;
```
This will group by the full `datetime`, including hours and minutes. I wish to make the group by, only by the date `YYYY/MM/DD` not by the `YYYY/MM/DD/HH/mm`.
How t... | Cast the datetime to a date, then GROUP BY using this syntax:
```
SELECT SUM(foo), DATE(mydate) FROM a_table GROUP BY DATE(a_table.mydate);
```
Or you can GROUP BY the alias as @orlandu63 suggested:
```
SELECT SUM(foo), DATE(mydate) DateOnly FROM a_table GROUP BY DateOnly;
```
Though I don't think it'll make any ... |
366,629 | <p>This is the code I wrote:</p>
<pre><code> MailMessage mail = new MailMessage("test@gmail.com", "me@myurl.com");
mail.Subject = "This is a test!!";
mail.Body = "testing...";
SmtpPermission connectAccess = new SmtpPermission(SmtpAccess.Connect);
System.Console.WriteLine("Acces... | [
{
"answer_id": 366638,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 2,
"selected": false,
"text": "<p>Is the destination address on the same host as your smtp server? If not, this would explain a relaying error.</p>\n\n<p... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44004/"
] | This is the code I wrote:
```
MailMessage mail = new MailMessage("test@gmail.com", "me@myurl.com");
mail.Subject = "This is a test!!";
mail.Body = "testing...";
SmtpPermission connectAccess = new SmtpPermission(SmtpAccess.Connect);
System.Console.WriteLine("Access? " + connec... | @ Michael: thanks for the link. It's very helpful.
I *think* I figured out my problem. I did need to add the login credentials after I created my "client" object. I added the following line:
```
client.Credentials = new System.Net.NetworkCredential("myloginat+myurl.com", "mypassword");
```
(sorry - I have this hab... |
366,631 | <p>I am working on a ASP.NET app and i have a need to post back to the server after a file is chosen in a FileUpload control without having to have the user explicitly click a 'submit' button. Is this possible? and if so, how?</p>
| [
{
"answer_id": 366644,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 6,
"selected": true,
"text": "<p>I'm assuming you want to make the upload start right away. If so, you should react to the <code>change</code> event in J... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366631",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18811/"
] | I am working on a ASP.NET app and i have a need to post back to the server after a file is chosen in a FileUpload control without having to have the user explicitly click a 'submit' button. Is this possible? and if so, how? | I'm assuming you want to make the upload start right away. If so, you should react to the `change` event in JavaScript, and simply make it submit the form.
```
<!-- HTML code --->
<input
type="file"
onchange="if (confirm('Upload ' + this.value + '?')) this.form.submit();"
>
```
Asking the users for confirmatio... |
366,682 | <p>There is a socket related function call in my code, that function is from another module thus out of my control, the problem is that it blocks for hours occasionally, which is totally unacceptable, How can I limit the function execution time from my code? I guess the solution must utilize another thread.</p>
| [
{
"answer_id": 366745,
"author": "Dickon Reed",
"author_id": 22668,
"author_profile": "https://Stackoverflow.com/users/22668",
"pm_score": 3,
"selected": false,
"text": "<p>You don't have to use threads. You can use another process to do the blocking work, for instance, maybe using the <... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366682",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1925263/"
] | There is a socket related function call in my code, that function is from another module thus out of my control, the problem is that it blocks for hours occasionally, which is totally unacceptable, How can I limit the function execution time from my code? I guess the solution must utilize another thread. | I'm not sure how cross-platform this might be, but using signals and alarm might be a good way of looking at this. With a little work you could make this completely generic as well and usable in any situation.
<http://docs.python.org/library/signal.html>
So your code is going to look something like this.
```
import ... |
366,696 | <p>Im trying to do a dialog box with jquery. In this dialog box Im going to have terms and conditions. The problem is that the dialog box is only displayed for the FIRST TIME.</p>
<p>This is the code.</p>
<p>JavaScript:</p>
<pre><code>function showTOC()
{
$("#TOC").dialog({
modal: true,
overlay... | [
{
"answer_id": 366730,
"author": "carlsz",
"author_id": 46077,
"author_profile": "https://Stackoverflow.com/users/46077",
"pm_score": 6,
"selected": true,
"text": "<p>Looks like there is an issue with the code you posted. Your function to display the T&C is referencing the wrong div ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44973/"
] | Im trying to do a dialog box with jquery. In this dialog box Im going to have terms and conditions. The problem is that the dialog box is only displayed for the FIRST TIME.
This is the code.
JavaScript:
```
function showTOC()
{
$("#TOC").dialog({
modal: true,
overlay: {
opacity: 0.... | Looks like there is an issue with the code you posted. Your function to display the T&C is referencing the wrong div id. You should consider assigning the showTOC function to the onclick attribute once the document is loaded as well:
```
$(document).ready({
$('a.TOClink').click(function(){
showTOC();
}... |
366,697 | <p>I have the following code which adapts linq entities to my Domain objects:</p>
<pre><code>return from g in DBContext.Gigs
select new DO.Gig
{
ID = g.ID,
Name = g.Name,
Description = g.Description,
StartDate ... | [
{
"answer_id": 366721,
"author": "Mike Two",
"author_id": 23659,
"author_profile": "https://Stackoverflow.com/users/23659",
"pm_score": 1,
"selected": false,
"text": "<p>Why are you doing a join and a sub select? You can just use the results of your join in the creation of a new Venue. B... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have the following code which adapts linq entities to my Domain objects:
```
return from g in DBContext.Gigs
select new DO.Gig
{
ID = g.ID,
Name = g.Name,
Description = g.Description,
StartDate = g.Date,
... | Your inner LINQ query returns several objects, not just one. You want to wrap it with a call like:
```
Venue = (from v in DBContext.Venues
where v.ID == g.VenueID
select new DO.Venue
{
ID = v.ID,
Name = v.Name,
Address = v.Address... |
366,706 | <p>This is a follow-up to <a href="https://stackoverflow.com/questions/365522/what-is-the-best-way-to-add-two-numbers-without-using-the-operator">my question yesterday</a>:</p>
<p>CMS kindly provided this example of using bitwise operators to add two numbers in C:</p>
<pre><code>#include<stdio.h>
int add(int x... | [
{
"answer_id": 366734,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 2,
"selected": false,
"text": "<p>Shifting negative numbers doesn't have consistent interpretation between python and C.</p>\n"
},
{
"answer... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23126/"
] | This is a follow-up to [my question yesterday](https://stackoverflow.com/questions/365522/what-is-the-best-way-to-add-two-numbers-without-using-the-operator):
CMS kindly provided this example of using bitwise operators to add two numbers in C:
```
#include<stdio.h>
int add(int x, int y) {
int a, b;
do {
... | As I pointed out in my response to CMS' answer yesterday, left-shifting a negative number is undefined behavior in C so this isn't even guaranteed to work in C (the problem is how to handle the signed bit, do you shift it like a value bit or is it not affected by a shift? The standards committee couldn't agree on a beh... |
366,718 | <p>So I am sold on the concept of attempting to collect data automatically from a program - i.e., popping up a dialog box that asks the user to send the report when something goes wrong.</p>
<p>I'm working in MS Visual Studio C#.</p>
<p>From an implementation point of view, does it make sense to put a try/catch loop ... | [
{
"answer_id": 366731,
"author": "chakrit",
"author_id": 3055,
"author_profile": "https://Stackoverflow.com/users/3055",
"pm_score": 3,
"selected": false,
"text": "<p>I think you are right, you would not know what's going to go wrong, which is the point.</p>\n\n<p>However, you might as w... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44004/"
] | So I am sold on the concept of attempting to collect data automatically from a program - i.e., popping up a dialog box that asks the user to send the report when something goes wrong.
I'm working in MS Visual Studio C#.
From an implementation point of view, does it make sense to put a try/catch loop in my main progra... | I think you are right, you would not know what's going to go wrong, which is the point.
However, you might as well consider adding a handler to the [ThreadException](http://www.digcode.com/default.aspx?page=ed51cde3-d979-4daf-afae-fa6192562ea9&article=5c26d313-2435-442f-91e8-a73e9aff021b) event instead.
The code abov... |
366,719 | <h1>Premise</h1>
<p>I believe that there is a way to objectively define "Good" and "Bad" Object-Oriented design techniques and that, as a community we can determine what these are. This is an academic exercise. If done with seriousness and resolve, I believe it can be of great benefit to the commu... | [
{
"answer_id": 366791,
"author": "Tom",
"author_id": 40620,
"author_profile": "https://Stackoverflow.com/users/40620",
"pm_score": 2,
"selected": true,
"text": "<p>Separation of Concerns</p>\n\n<h2>Prefer Aggregation to Mixin-style Inheritance</h2>\n\n<p>While functionality can be gained... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10862/"
] | Premise
=======
I believe that there is a way to objectively define "Good" and "Bad" Object-Oriented design techniques and that, as a community we can determine what these are. This is an academic exercise. If done with seriousness and resolve, I believe it can be of great benefit to the community as a whole. The comm... | Separation of Concerns
Prefer Aggregation to Mixin-style Inheritance
---------------------------------------------
While functionality can be gained by inheriting from a utility class, in many cases it can all be gained using a member of said class.
### Example (Boost.Noncopyable):
Boost.Noncopyable is a C++ class ... |
366,720 | <p>Currently my code is organized in the following tree structure:</p>
<pre><code>src/
module1.py
module2.py
test_module1.py
test_module2.py
subpackage1/
__init__.py
moduleA.py
moduleB.py
test_moduleA.py
test_moduleB.py
</code></pre>
<p>Where the <code>modul... | [
{
"answer_id": 366770,
"author": "Tom",
"author_id": 40620,
"author_profile": "https://Stackoverflow.com/users/40620",
"pm_score": 2,
"selected": false,
"text": "<p>This is probably a hotly-contested topic, but I would suggest that you separate your tests out from your modules. Set up s... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36131/"
] | Currently my code is organized in the following tree structure:
```
src/
module1.py
module2.py
test_module1.py
test_module2.py
subpackage1/
__init__.py
moduleA.py
moduleB.py
test_moduleA.py
test_moduleB.py
```
Where the `module*.py` files contains the sourc... | If they all begin with `test` then just `nosetest` should work. Nose automatically searches for any files beginning with 'test'. |
366,758 | <p>I would like to access the contacts field on an email message (Email options) in outlook. Normally this field ties an email to a contact. Since it is a freeform text field available from the options dialog box, I am trying to use it to store a "next action" for my email message. I would like to set the next action b... | [
{
"answer_id": 380413,
"author": "Oliver Giesen",
"author_id": 9784,
"author_profile": "https://Stackoverflow.com/users/9784",
"pm_score": 0,
"selected": false,
"text": "<p>Hmm, I also couldn't figure out how to access the Contacts field but from your description it sounds like you're no... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I would like to access the contacts field on an email message (Email options) in outlook. Normally this field ties an email to a contact. Since it is a freeform text field available from the options dialog box, I am trying to use it to store a "next action" for my email message. I would like to set the next action base... | I think this will answer it: the field is buried in a semi-generic 'Links' property, with a type of olContact. To test the following code, open a new email, put something in the contacts field, and then run the code:
```
Sub ShowContactsField()
Dim objApp As Outlook.Application
Dim ActiveMailItem As Inspector
Di... |
366,775 | <p>Im trying to add a connection to a database in SQL Server 2008 using Visual Studio 2008. When testing the connection, it says that it is successful. However, once I said okay, it complains and say: "Cannot add data connection. Object reference not set to an instance of an object."</p>
<p>How do I go about adding a ... | [
{
"answer_id": 366811,
"author": "JamesSugrue",
"author_id": 1075,
"author_profile": "https://Stackoverflow.com/users/1075",
"pm_score": 1,
"selected": false,
"text": "<p>Via code would be something like:</p>\n\n<pre><code>var conn = new SqlConnection([connectionString]);\nconn.Open();\n... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Im trying to add a connection to a database in SQL Server 2008 using Visual Studio 2008. When testing the connection, it says that it is successful. However, once I said okay, it complains and say: "Cannot add data connection. Object reference not set to an instance of an object."
How do I go about adding a data conne... | Via code would be something like:
```
var conn = new SqlConnection([connectionString]);
conn.Open();
``` |
366,794 | <pre><code><?php
$string = 'The quick brown fox jumped over the lazy dog.';
$patterns[0] = '/quick/';
$patterns[1] = '/brown/';
$patterns[2] = '/fox/';
$replacements[0] = 'slow';
$replacements[1] = 'black';
$replacements[2] = 'bear';
echo preg_replace($patterns, $replacements, $string);
?>
</code></pre>
<p>Ok gu... | [
{
"answer_id": 366797,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 3,
"selected": true,
"text": "<p>You can use pipes for <a href=\"http://perldoc.perl.org/perlre.html#Regular-Expressions\" rel=\"nofollow noref... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366794",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
<?php
$string = 'The quick brown fox jumped over the lazy dog.';
$patterns[0] = '/quick/';
$patterns[1] = '/brown/';
$patterns[2] = '/fox/';
$replacements[0] = 'slow';
$replacements[1] = 'black';
$replacements[2] = 'bear';
echo preg_replace($patterns, $replacements, $string);
?>
```
Ok guys,
Now I have the above ... | You can use pipes for ["Alternation"](http://perldoc.perl.org/perlre.html#Regular-Expressions):
```
$patterns[0] = '/quick|lazy|dog/';
``` |
366,805 | <p>How can I change <code>CSS</code> from <code>javascript</code>. </p>
<p>I'm using <code>jQuery-ui Dialog</code> and I want to change the style of a <code>DIV</code> from javascript.</p>
<p>Thanks</p>
| [
{
"answer_id": 366808,
"author": "cLFlaVA",
"author_id": 45109,
"author_profile": "https://Stackoverflow.com/users/45109",
"pm_score": 1,
"selected": false,
"text": "<p>There are a couple of ways to manipulate elements styles using the jQuery framework. Take a look through the documenta... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366805",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44973/"
] | How can I change `CSS` from `javascript`.
I'm using `jQuery-ui Dialog` and I want to change the style of a `DIV` from javascript.
Thanks | Check out [the jQuery documentation](http://docs.jquery.com/CSS/css). If you want anything it will be there.
Anyhow, if you want to add styles to elements, you need to use the `css` function, which has a few variants.
```
$(selector).css(properties); // option 1
$(selector).css(name, value); // option 2
```
So if ... |
366,822 | <p>I have always written regexes like this</p>
<pre><code><A HREF="([^"]*)" TARGET="_blank">([^<]*)</A>
</code></pre>
<p>but I just learned about this <a href="http://www.regular-expressions.info/examples.html" rel="nofollow noreferrer">lazy thing</a> and that I can write it like this</p>
<pre><code>&... | [
{
"answer_id": 366826,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 1,
"selected": false,
"text": "<p>“lazy” is the wrong word here. You mean non-greedy as opposed to greedy. There's no disadvantage in using it, that... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366822",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] | I have always written regexes like this
```
<A HREF="([^"]*)" TARGET="_blank">([^<]*)</A>
```
but I just learned about this [lazy thing](http://www.regular-expressions.info/examples.html) and that I can write it like this
```
<A HREF="(.*?)" TARGET="_blank">(.*?)</A>
```
is there any disadvantage to using this se... | Another thing to consider is how long the target text is, and how much of it is going to be matched by the quantified subexpression. For example, if you were trying to match the whole <BODY> element in a large HTML document, you might be tempted to use this regex:
```
/<BODY>.*?<\/BODY>/is
```
But that's going to do... |
366,854 | <p>I have a problem with the <a href="https://jqueryui.com/dialog/" rel="nofollow noreferrer"><code>jquery-ui dialog box</code></a>. </p>
<p><strong>The problem is that when I close the dialog box and then I click on the link that triggers it, it does not pop-up again unless I refresh the page.</strong> </p>
<p>How c... | [
{
"answer_id": 366893,
"author": "Darko",
"author_id": 32943,
"author_profile": "https://Stackoverflow.com/users/32943",
"pm_score": 4,
"selected": false,
"text": "<p>on the last line, don't use <code>$(this).remove()</code> use <code>$(this).hide()</code> instead.</p>\n\n<p>EDIT: To cla... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366854",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44973/"
] | I have a problem with the [`jquery-ui dialog box`](https://jqueryui.com/dialog/).
**The problem is that when I close the dialog box and then I click on the link that triggers it, it does not pop-up again unless I refresh the page.**
How can I call the dialog box back without refreshing the actual page.
Below is m... | I solved it.
I used destroy instead close function (it doesn't make any sense), but it worked.
```
$(document).ready(function() {
$('#showTerms').click(function()
{
$('#terms').css('display','inline');
$('#terms').dialog({resizable: false,
modal: true,
width: 400,
height: 450,
... |
366,856 | <p>I'm about to put my head thru this sliding glass door. I can't figure out how to execute the following code in VB.NET to save my life. </p>
<pre><code>private static void InitStructureMap()
{
ObjectFactory.Initialize(x =>
{
... | [
{
"answer_id": 366878,
"author": "Pete OHanlon",
"author_id": 43635,
"author_profile": "https://Stackoverflow.com/users/43635",
"pm_score": 1,
"selected": false,
"text": "<p>My VB.NET isn't up to scratch, so I can't help you with the code directly. What I can tell you, however, is how to... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34133/"
] | I'm about to put my head thru this sliding glass door. I can't figure out how to execute the following code in VB.NET to save my life.
```
private static void InitStructureMap()
{
ObjectFactory.Initialize(x =>
{
x.AddRegistry(ne... | At the moment, it's simply not possible. The current version of VB does not support multiline (or statement) lambdas. Each lambda can only comprise one single expression. The next version of VB will fix that (there simply wasn't enough time in the last release).
In the meantime, you'll have to make do with a delegate:... |
366,857 | <p>Remember the little div that shows up at the top of the page to notify us of things (like new badges)?</p>
<p>I would like to implement something like that as well and am looking for some best practices or patterns.</p>
<p>My site is an ASP.NET MVC app as well. Ideally the answers would include specifics like "put... | [
{
"answer_id": 366864,
"author": "Tom",
"author_id": 20,
"author_profile": "https://Stackoverflow.com/users/20",
"pm_score": 2,
"selected": false,
"text": "<p>Though these are by no means official, the common practices that I follow would result in something like this:</p>\n\n<ul>\n<li>C... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2595/"
] | Remember the little div that shows up at the top of the page to notify us of things (like new badges)?
I would like to implement something like that as well and am looking for some best practices or patterns.
My site is an ASP.NET MVC app as well. Ideally the answers would include specifics like "put *this* in the ma... | After snooping around the code a bit, here's a guess:
The following notification container is always in the view markup:
```
<div id="notify-container"> </div>
```
That notification container is hidden by default, and is populated by javascript given certain circumstances. It can contain any number of messages.
**... |
366,860 | <p>From the man page on git-merge, there are a number of merge strategies you can use. </p>
<ul>
<li><p><em>resolve</em> -
This can only resolve two heads (i.e. the current branch and another branch you pulled from) using 3-way merge algorithm. It tries to carefully detect criss-cross merge ambiguities and is consid... | [
{
"answer_id": 366940,
"author": "Dustin",
"author_id": 39975,
"author_profile": "https://Stackoverflow.com/users/39975",
"pm_score": 9,
"selected": true,
"text": "<p>I'm not familiar with resolve, but I've used the others:</p>\n\n<h2>Recursive</h2>\n\n<p>Recursive is the default for non... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366860",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9594/"
] | From the man page on git-merge, there are a number of merge strategies you can use.
* *resolve* -
This can only resolve two heads (i.e. the current branch and another branch you pulled from) using 3-way merge algorithm. It tries to carefully detect criss-cross merge ambiguities and is considered generally safe and f... | I'm not familiar with resolve, but I've used the others:
Recursive
---------
Recursive is the default for non-fast-forward merges. We're all familiar with that one.
Octopus
-------
I've used octopus when I've had several trees that needed to be merged. You see this in larger projects where many branches have had in... |
366,861 | <p>Pretty straightforward stuff, here -- I'm just not good enough with mysql to understand what it wants from me.</p>
<p>I've got a short java test-case that opens a connection on mysql on my dev system but, when I try to put it to my server, it fails.</p>
<p>Any help in tracking this down would be most appreciated.<... | [
{
"answer_id": 366869,
"author": "Milhous",
"author_id": 17712,
"author_profile": "https://Stackoverflow.com/users/17712",
"pm_score": 0,
"selected": false,
"text": "<p>Have you verified that you can connect to the database on the server, with the name and password. </p>\n\n<p>Also if y... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34820/"
] | Pretty straightforward stuff, here -- I'm just not good enough with mysql to understand what it wants from me.
I've got a short java test-case that opens a connection on mysql on my dev system but, when I try to put it to my server, it fails.
Any help in tracking this down would be most appreciated.
Thanks!
**Test ... | Bah! My apologies -- I just had "local connections only" set up. I was confused by the fact that the java app was running locally (so seemed a "local connection" but, because it is connecting via TCP, it's a "remote" connection, even though it originates on localhost.
I will eventually learn how to administer these th... |
366,883 | <p>Is there a way to avoid row deletion on an specific table using constrains?</p>
<p>I'd like to (for example) deny row deletion if the id is 0,1 or 2</p>
<p>This is in order to avoid users deleting master accounts for an application, and I'd like to avoid it even if someone tries it (by mistake) using sql directly.... | [
{
"answer_id": 366892,
"author": "Milhous",
"author_id": 17712,
"author_profile": "https://Stackoverflow.com/users/17712",
"pm_score": -1,
"selected": false,
"text": "<p>You could try filtering your queries by use of a function that checks to make sure that the user does not try to delet... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366883",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7595/"
] | Is there a way to avoid row deletion on an specific table using constrains?
I'd like to (for example) deny row deletion if the id is 0,1 or 2
This is in order to avoid users deleting master accounts for an application, and I'd like to avoid it even if someone tries it (by mistake) using sql directly.
Thanks!
**EDIT... | As far as enforcing this in a *constraint*, my solution would be to create a dependent table, so referenced rows cannot be deleted.
```
CREATE TABLE NoKillI (
id INT NOT NULL, FOREIGN KEY (id) REFERENCES Accounts(id) ON DELETE RESTRICT
);
INSERT INTO NoKillI (id) VALUES (0);
INSERT INTO NoKillI (id) VALUES (1);
INS... |
366,887 | <p>On Stackers' recommendation, I have been reading Crockford's excellent <em>Javascript: The Good Parts</em>.</p>
<p>It's a great book, but since so much of it is devoted to describing the best way to use Javascript's basic functionality, I'm not sure how I can put his advice into practice without duplicating the eff... | [
{
"answer_id": 366917,
"author": "Tautologistics",
"author_id": 44481,
"author_profile": "https://Stackoverflow.com/users/44481",
"pm_score": 4,
"selected": true,
"text": "<p><a href=\"http://prototypejs.org/\" rel=\"nofollow noreferrer\">Prototype</a> has many great features, including ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366887",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25068/"
] | On Stackers' recommendation, I have been reading Crockford's excellent *Javascript: The Good Parts*.
It's a great book, but since so much of it is devoted to describing the best way to use Javascript's basic functionality, I'm not sure how I can put his advice into practice without duplicating the efforts of many othe... | [Prototype](http://prototypejs.org/) has many great features, including a [Class helper](http://prototypejs.org/api/class) that handles the details of JS "inheritance" via the object prototype.
Edit: damn, I keep forgetting that jQuery (my own library of choice) has [jQuery.extend](http://docs.jquery.com/Utilities/jQu... |
366,896 | <p>I've got a custom TObjectList descendant in Delphi 2009, and I'd like to play with its enumerator a bit and add some filtering functionality to the MoveNext method, to cause it to skip certain objects. MoveNext is called by DoMoveNext, which is a virtual method, so this shouldn't be difficult to override... except ... | [
{
"answer_id": 366935,
"author": "Rob Kennedy",
"author_id": 33732,
"author_profile": "https://Stackoverflow.com/users/33732",
"pm_score": 3,
"selected": false,
"text": "<p>The enumerator <em>is</em> its own class. It just has a nested scope. To write a descendant for it, you simply decl... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32914/"
] | I've got a custom TObjectList descendant in Delphi 2009, and I'd like to play with its enumerator a bit and add some filtering functionality to the MoveNext method, to cause it to skip certain objects. MoveNext is called by DoMoveNext, which is a virtual method, so this shouldn't be difficult to override... except for ... | The enumerator *is* its own class. It just has a nested scope. To write a descendant for it, you simply declare a class as you normally would, and when you specify the new class's ancestor, you give the fully qualified type name.
```
type
TMasonEnumerator = class(TObjectList.TEnumerator)
protected
function DoM... |
366,897 | <p>I've got a big file on which I'm opening a FileInputStream. This file contains some files each having an offset from the beginning and a size. Furthermore, I've got a parser that should evaluate such a contained file.</p>
<pre><code>File file = ...; // the big file
long offset = 1734; // a contained file's offset
l... | [
{
"answer_id": 366903,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 2,
"selected": false,
"text": "<p>This sounds like a typical nested file aka \"zip\" file problem.</p>\n\n<p>A common way to handle this is to actuall... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12463/"
] | I've got a big file on which I'm opening a FileInputStream. This file contains some files each having an offset from the beginning and a size. Furthermore, I've got a parser that should evaluate such a contained file.
```
File file = ...; // the big file
long offset = 1734; // a contained file's offset
long size = 256... | It sounds like what you really want is a sort of "partial" input stream - one a bit like the ZipInputStream, where you've got a stream within a stream.
You could write this yourself, proxying all InputStream methods to the original input stream making suitable adjustments for offset and checking for reading past the e... |
366,913 | <p>I'm learning Rails and it's going well so far. My biggest question at the moment is: how do I go about manually inserting a row into my database? I've got the scaffolding in place for creating rows of DataTypeOne, but I want a row for DataTypeTwo to be created when the form for DataTypeOne is submitted (and have it ... | [
{
"answer_id": 366921,
"author": "TonyLa",
"author_id": 1295,
"author_profile": "https://Stackoverflow.com/users/1295",
"pm_score": 4,
"selected": true,
"text": "<p>You create rows in your database by creating and saving new ActiveRecord Objects (your models). </p>\n\n<p>So in your contr... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34795/"
] | I'm learning Rails and it's going well so far. My biggest question at the moment is: how do I go about manually inserting a row into my database? I've got the scaffolding in place for creating rows of DataTypeOne, but I want a row for DataTypeTwo to be created when the form for DataTypeOne is submitted (and have it ref... | You create rows in your database by creating and saving new ActiveRecord Objects (your models).
So in your controller code you could create a new row of DataTypeTwo by doing
```
new_record = DataTypeTwo.new
new_record.save!
``` |
366,915 | <p>I have an articles table and a categories table. I want to fetch 7 articles for each category. Currently I have this but it's terrible slow on large tables so it's not really a solution:</p>
<pre><code>SELECT id,
title,
categories_id,
body,
DATE_FORMAT(pubdate, "%d/%m/%y %H:%i") as p... | [
{
"answer_id": 366939,
"author": "Jennifer",
"author_id": 22360,
"author_profile": "https://Stackoverflow.com/users/22360",
"pm_score": 0,
"selected": false,
"text": "<p>You have several options - some might result in performance issues but it depends on many factors.</p>\n\n<p>You could... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46183/"
] | I have an articles table and a categories table. I want to fetch 7 articles for each category. Currently I have this but it's terrible slow on large tables so it's not really a solution:
```
SELECT id,
title,
categories_id,
body,
DATE_FORMAT(pubdate, "%d/%m/%y %H:%i") as pubdate
FROM... | Here's how I'd solve this problem:
```
SELECT a1.id,
a1.title,
a1.categories_id,
a1.body,
DATE_FORMAT(a1.pubdate, "%d/%m/%y %H:%i") as pubdate
FROM articles AS a1
LEFT OUTER JOIN articles AS a2
ON (a1.categories_id = a2.categories_id AND
(a1.pubdate < a2.pubdate OR (a1.pubda... |
366,928 | <p>I'm heavily using Cygwin (with <a href="http://en.wikipedia.org/wiki/PuTTY" rel="noreferrer">PuTTY </a> shell). But, it's quite tricky to invoke <code>cl.exe</code> (that is, the Visual C++ compiler toolchain) in the Cygwin Bash shell. Running <code>vcvars*.bat</code> in the Bash shell doesn't work obviously. I trie... | [
{
"answer_id": 366934,
"author": "Diomidis Spinellis",
"author_id": 20520,
"author_profile": "https://Stackoverflow.com/users/20520",
"pm_score": 4,
"selected": false,
"text": "<p>I understand that your problem is converting vcvars32.bat into a shell script.</p>\n\n<p>One way around the ... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46185/"
] | I'm heavily using Cygwin (with [PuTTY](http://en.wikipedia.org/wiki/PuTTY) shell). But, it's quite tricky to invoke `cl.exe` (that is, the Visual C++ compiler toolchain) in the Cygwin Bash shell. Running `vcvars*.bat` in the Bash shell doesn't work obviously. I tried to migrate VC++'s environment variables to Cygwin, ... | I usually solve this by adding
```
call "%VS80COMNTOOLS%vsvars32.bat" >NUL:
```
to c:/cygwin/cygwin.bat. Note that the VS80COMNTOOLS variable is extremely useful, since it gives you a foolproof (hm) way of locating vsvars32.bat.
Another approach is this, which allows you to easily switch between different Studio v... |
366,938 | <p>I have an NSView subclass which has property which I want to be bindable. I've implemented the following in the subclass:</p>
<p>myView.h:</p>
<pre><code>@property (readwrite, retain) NSArray *representedObjects;
</code></pre>
<p>myView.m:</p>
<pre><code>@synthesize representedObjects;
+(void)initialize
{
[self... | [
{
"answer_id": 366987,
"author": "Jens Ayton",
"author_id": 6443,
"author_profile": "https://Stackoverflow.com/users/6443",
"pm_score": 1,
"selected": false,
"text": "<p>No, you shouldn’t need that glue code.</p>\n\n<p>What do you mean by “doesn’t seem to be the case”? What happens if yo... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have an NSView subclass which has property which I want to be bindable. I've implemented the following in the subclass:
myView.h:
```
@property (readwrite, retain) NSArray *representedObjects;
```
myView.m:
```
@synthesize representedObjects;
+(void)initialize
{
[self exposeBinding: @"representedObjects"];
... | No, you shouldn’t need that glue code.
What do you mean by “doesn’t seem to be the case”? What happens if you omit it? |
366,955 | <p>how do I bind a <code>std::ostream</code> to either <code>std::cout</code> or to an <code>std::ofstream</code> object, depending on a certain program condition? Although this invalid for many reasons, I would like to achieve something that is semantically equivalent to the following:</p>
<pre><code>std::ostream out... | [
{
"answer_id": 366967,
"author": "Tom",
"author_id": 40620,
"author_profile": "https://Stackoverflow.com/users/40620",
"pm_score": 5,
"selected": false,
"text": "<p>This is exception-safe:</p>\n\n<pre><code>void process(std::ostream &os);\n\nint main(int argc, char *argv[]) {\n st... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1170277/"
] | how do I bind a `std::ostream` to either `std::cout` or to an `std::ofstream` object, depending on a certain program condition? Although this invalid for many reasons, I would like to achieve something that is semantically equivalent to the following:
```
std::ostream out = condition ? &std::cout : std::ofstream(filen... | ```
std::streambuf * buf;
std::ofstream of;
if(!condition) {
of.open("file.txt");
buf = of.rdbuf();
} else {
buf = std::cout.rdbuf();
}
std::ostream out(buf);
```
That associates the underlying streambuf of either cout or the output file stream to out. After that you can write to "out" and it will end u... |
366,968 | <p>I have been searching for a way to insert linebreaks in my code for when I view my source. I am not looking for <code><br /></code></p>
<p>Something like the PHP equiv to <code>\n</code></p>
<p>Any ideas on how to do this in ASP? I will be placing this inside a string.</p>
| [
{
"answer_id": 366979,
"author": "John Sheehan",
"author_id": 1786,
"author_profile": "https://Stackoverflow.com/users/1786",
"pm_score": 6,
"selected": true,
"text": "<p>There's no way to do it inside a string. You will have to append vbCrLf like so:</p>\n\n<pre><code>Response.Write \"h... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have been searching for a way to insert linebreaks in my code for when I view my source. I am not looking for `<br />`
Something like the PHP equiv to `\n`
Any ideas on how to do this in ASP? I will be placing this inside a string. | There's no way to do it inside a string. You will have to append vbCrLf like so:
```
Response.Write "hello" & vbCrLf & "world"
```
If you want to include it in the string, you could do a replace after like so:
```
output = "hello\nworld"
output = Replace(output, "\n", vbCrLf)
Response.Write output
``` |
366,972 | <p>I am trying to do some very simple form validation checking for null or '' (empty) using a conditional, but when I submit my form with ALL BLANK FIELDS, it does the latter section of my code.</p>
<p>And when I fill out all of my fields it does that other part. So when they are blank, tell the user, which is the fir... | [
{
"answer_id": 366978,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": -1,
"selected": true,
"text": "<ol>\n<li>you do not need all the parentheses</li>\n<li>if fname et al are the textboxes, you need fname.Text instead... | 2008/12/14 | [
"https://Stackoverflow.com/questions/366972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to do some very simple form validation checking for null or '' (empty) using a conditional, but when I submit my form with ALL BLANK FIELDS, it does the latter section of my code.
And when I fill out all of my fields it does that other part. So when they are blank, tell the user, which is the first section... | 1. you do not need all the parentheses
2. if fname et al are the textboxes, you need fname.Text instead |
367,020 | <p>What's the best way to animate a background image sliding to the left, and looping it? Say I've got a progress bar with a background I want to animate when it's active (like in Gnome or OS X).</p>
<p>I've been playing with the <code>$(...).animate()</code> function and trying to modify the relevant CSS property, bu... | [
{
"answer_id": 367028,
"author": "Wilco",
"author_id": 5291,
"author_profile": "https://Stackoverflow.com/users/5291",
"pm_score": 5,
"selected": true,
"text": "<p>As soon as I posted this I figured it out. In case it helps anyone else, here's the function I came up with:</p>\n\n<pre><co... | 2008/12/14 | [
"https://Stackoverflow.com/questions/367020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5291/"
] | What's the best way to animate a background image sliding to the left, and looping it? Say I've got a progress bar with a background I want to animate when it's active (like in Gnome or OS X).
I've been playing with the `$(...).animate()` function and trying to modify the relevant CSS property, but I keep hitting a br... | As soon as I posted this I figured it out. In case it helps anyone else, here's the function I came up with:
```
function animateBar(self) {
// Setup
var bar = self.element.find('.ui-progress-bar');
bar.css('background-position', '0px 0px');
bar.animate({
backgroundPosition: '-20px 0px'
}... |
367,030 | <p>Is it possible to get a list of all descendant classes of a particular class in objective-c?</p>
<p>Something like:</p>
<pre><code> @interface A : NSObject
@end
@interface B : A
@end
@interface C : A
@end
NSArray *descendants = [A allDescendants]; // descendants = [B, C]
</code></pre>
| [
{
"answer_id": 367078,
"author": "Matt Gallagher",
"author_id": 36103,
"author_profile": "https://Stackoverflow.com/users/36103",
"pm_score": 3,
"selected": false,
"text": "<p>The only way I can think is to enumerate the entire list of classes in the runtime (obtained with <code>objc_get... | 2008/12/14 | [
"https://Stackoverflow.com/questions/367030",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it possible to get a list of all descendant classes of a particular class in objective-c?
Something like:
```
@interface A : NSObject
@end
@interface B : A
@end
@interface C : A
@end
NSArray *descendants = [A allDescendants]; // descendants = [B, C]
``` | The only way I can think is to enumerate the entire list of classes in the runtime (obtained with `objc_getClassList`) and test each one for `isKindOfClass:A`.
This is likely the only solution because classes do not maintain links to their descendants (only to their superclass). |
367,040 | <p>In Matlab, how can I find value of K, in a system that has oscillation?</p>
<blockquote>
<p>(system's tf, if needed: (K * (s +
25))/(s^3 + 24 s^2 + 100 s) )</p>
</blockquote>
<p>PS. I'm using root locus.</p>
| [
{
"answer_id": 367215,
"author": "Will Robertson",
"author_id": 4161,
"author_profile": "https://Stackoverflow.com/users/4161",
"pm_score": 0,
"selected": false,
"text": "<p>Does the <code>dcgain</code> function do what you need?</p>\n"
},
{
"answer_id": 425417,
"author": "St... | 2008/12/14 | [
"https://Stackoverflow.com/questions/367040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In Matlab, how can I find value of K, in a system that has oscillation?
>
> (system's tf, if needed: (K \* (s +
> 25))/(s^3 + 24 s^2 + 100 s) )
>
>
>
PS. I'm using root locus. | I assume this is the plant for a closed-loop system with gain compensation only (that would be K). In that case I would express it as a transfer function and then use the root-locus command to see where it hits on the x-axis:
```
num = [1 25];
den = [1 24 100 0];
sys=tf(num,den)
rlocus(sys)
```
Unfortunately your s... |
367,052 | <p>There seems to be no built-in support for case preserving find/replace in VisualStudio (see also a respective <a href="https://developercommunity.visualstudio.com/t/case-preserving-search-replace/580810" rel="nofollow noreferrer">feature request</a>).</p>
<p>What I mean is: searching for 'BadJob' and replacing with ... | [
{
"answer_id": 367093,
"author": "Ray Tayek",
"author_id": 51292,
"author_profile": "https://Stackoverflow.com/users/51292",
"pm_score": 2,
"selected": false,
"text": "<p>open up the find options when you do the find/replace. check the case-sensitive option. you will have to do the flavo... | 2008/12/14 | [
"https://Stackoverflow.com/questions/367052",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45637/"
] | There seems to be no built-in support for case preserving find/replace in VisualStudio (see also a respective [feature request](https://developercommunity.visualstudio.com/t/case-preserving-search-replace/580810)).
What I mean is: searching for 'BadJob' and replacing with 'GoodJob' would do the following replacements
... | It's **not possible** in Visual Studio at the moment.
You can vote for this feature:
<https://developercommunity.visualstudio.com/content/idea/580810/case-preserving-search-replace.html>
I usually end up opening Sublime Text, Copy & Paste the code there, perform the case-preserving replacements there and Copy & Past... |
367,069 | <p>I'm looking for a simple, but cross-platform <em>negate</em>-process that negates the value a process returns. It should map 0 to some value != 0 and any value != 0 to 0, i.e. the following command should return "yes, nonexistingpath doesn't exist":</p>
<pre><code> ls nonexistingpath | negate && echo "yes, ... | [
{
"answer_id": 367075,
"author": "Jay Conrod",
"author_id": 1891,
"author_profile": "https://Stackoverflow.com/users/1891",
"pm_score": 6,
"selected": false,
"text": "<p>In Bash, use the ! operator before the command. For instance:</p>\n\n<pre><code>! ls nonexistingpath && echo \... | 2008/12/14 | [
"https://Stackoverflow.com/questions/367069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4085/"
] | I'm looking for a simple, but cross-platform *negate*-process that negates the value a process returns. It should map 0 to some value != 0 and any value != 0 to 0, i.e. the following command should return "yes, nonexistingpath doesn't exist":
```
ls nonexistingpath | negate && echo "yes, nonexistingpath doesn't exist... | *Previously, the answer was presented with what's now the first section as the last section.*
### POSIX Shell includes a `!` operator
Poking around the shell specification for other issues, I recently (September 2015) noticed that the POSIX shell supports a `!` operator. For example, it is listed as a [reserved word]... |
367,090 | <p>I was intending on use the Title attribute in the @Page directive to customise each pages title, but it simply doesn't appear to do anything.</p>
<p>The site uses master pages - I don't know if that is a consideration.</p>
<p>Master Page snippet:</p>
<pre><code><%@ Master Language="VB" CodeFile="brightnorth.ma... | [
{
"answer_id": 367100,
"author": "Strelok",
"author_id": 2788,
"author_profile": "https://Stackoverflow.com/users/2788",
"pm_score": 0,
"selected": false,
"text": "<p>You've got to use the HTML tag as well :)</p>\n\n<p>In your master page, inside the head tag you should have:</p>\n\n<pr... | 2008/12/14 | [
"https://Stackoverflow.com/questions/367090",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6898/"
] | I was intending on use the Title attribute in the @Page directive to customise each pages title, but it simply doesn't appear to do anything.
The site uses master pages - I don't know if that is a consideration.
Master Page snippet:
```
<%@ Master Language="VB" CodeFile="brightnorth.master.vb" Inherits="brightnorth"... | Oops... A basic error! [aren't they always?]
Anyone spot a missing `runat="server"` in the element?
Oops. |