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 |
|---|---|---|---|---|---|---|
518,210 | <p>I'm looking for a good tool that can take a full mailing address, formatted for display or use with a mailing label, and convert it into a structured object.</p>
<p>So for instance:</p>
<pre><code>// Start with a formatted address in a single string
string f = "18698 E. Main Street\r\nBig Town, AZ, 86011";
// Par... | [
{
"answer_id": 518372,
"author": "Steve B.",
"author_id": 19479,
"author_profile": "https://Stackoverflow.com/users/19479",
"pm_score": 2,
"selected": false,
"text": "<p>You could try <a href=\"https://www.edq.com/address-verification/\" rel=\"nofollow noreferrer\">Experian Address Verif... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518210",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking for a good tool that can take a full mailing address, formatted for display or use with a mailing label, and convert it into a structured object.
So for instance:
```
// Start with a formatted address in a single string
string f = "18698 E. Main Street\r\nBig Town, AZ, 86011";
// Parse into address
Addre... | The Googlemaps API works pretty well for this. E.g., suppose you are given the string "120 w 45 st nyc". Pass it into the Googlemaps API like so: `http://maps.google.com/maps/geo?q=120+w+45+st+nyc` and you get this response:
```
{
"name": "120 w 45 st nyc",
"Status": {
"code": 200,
"request": "geocode"
}... |
518,228 | <p>MSDN says that the function <a href="http://msdn.microsoft.com/en-us/library/ms686203.aspx" rel="nofollow noreferrer">SetDllDirectory()</a> can be used to insert a directory into the <a href="http://msdn.microsoft.com/en-us/library/ms682586.aspx" rel="nofollow noreferrer">DLL Search Path</a>. Can this function be ac... | [
{
"answer_id": 518289,
"author": "Tron",
"author_id": 22290,
"author_profile": "https://Stackoverflow.com/users/22290",
"pm_score": 5,
"selected": true,
"text": "<p>You can place the DLL in the same path as the executable, which is searched first before <code>%WINDIR%</code>. There's no ... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518228",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14420/"
] | MSDN says that the function [SetDllDirectory()](http://msdn.microsoft.com/en-us/library/ms686203.aspx) can be used to insert a directory into the [DLL Search Path](http://msdn.microsoft.com/en-us/library/ms682586.aspx). Can this function be accessed from a batch file or cmd script, perhaps using via [cscript](http://te... | You can place the DLL in the same path as the executable, which is searched first before `%WINDIR%`. There's no way to call `SetDllDirectory` from a batch file directly.
But, you can insert your DLL directory in the `%PATH%` variable, and Windows will then find the DLL there.
```
set PATH=C:\path to your dll;%PATH%
... |
518,239 | <p>My project that I am working on is almost finished. I am loading a .MDB file, displaying the contents on a DataGrid and attempting to get those changes on the DataGrid and save them back into the .MDB file. I am also going to create a function that allows me to take the tables from one .MDB file and save it to anoth... | [
{
"answer_id": 518264,
"author": "Yes - that Jake.",
"author_id": 5287,
"author_profile": "https://Stackoverflow.com/users/5287",
"pm_score": 0,
"selected": false,
"text": "<p>There are actually more than one format of file with the .mdb extension. So, if I guess the wrong one, this will... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518239",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60615/"
] | My project that I am working on is almost finished. I am loading a .MDB file, displaying the contents on a DataGrid and attempting to get those changes on the DataGrid and save them back into the .MDB file. I am also going to create a function that allows me to take the tables from one .MDB file and save it to another ... | I'm not sure how far you've gotten, but if you looking for a quick drag and drop operation you might want to look at creating a strongly-typed dataset that connects, and using the drag-drop features of the DataSources Tool Window in Visual Studio.
There are definately samples out there, but you will want to.
1. Creat... |
518,240 | <p>Well I guess this is a two part question.</p>
<p>Firstly how can I make an image have partial transparency (I think you can do this with PNGs but don't know how -- I have photoshop just need instructions?)</p>
<p>Secondly how do I use that image in a layout using CSS? I think I need some kind of "PNG Hack"</p>
| [
{
"answer_id": 518255,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 1,
"selected": false,
"text": "<p>The easy option which probably won't work for you:</p>\n\n<p>Webkit browsers (Safari, Chrome) can use the <a href=\"http://... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428190/"
] | Well I guess this is a two part question.
Firstly how can I make an image have partial transparency (I think you can do this with PNGs but don't know how -- I have photoshop just need instructions?)
Secondly how do I use that image in a layout using CSS? I think I need some kind of "PNG Hack" | 1. Create a new photoshop document
2. Add new layers and draw on them
3. Delete the layer named *Background*
4. File > Save for Web
5. Choose a 24 bit PNG format.
Getting it to work well in IE6 is going to be the issue. You should use a separate stylesheet that only ie6 loads via conditional comments that loads the ba... |
518,254 | <p>What's the best way to use an external log4j.properties file within Grails? I'd like to use the traditional log4j.properties format rather than a log4j.groovy style configuration.</p>
<p>I'm also curious if the external configuration will play nicely with the log4j.properties file that's created by <code>grails war... | [
{
"answer_id": 518707,
"author": "j pimmel",
"author_id": 52175,
"author_profile": "https://Stackoverflow.com/users/52175",
"pm_score": 2,
"selected": false,
"text": "<p>Check out the <a href=\"http://www.grails.org/Log4j+XML+Plugin\" rel=\"nofollow noreferrer\">Log4J Plugin</a> which st... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518254",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29995/"
] | What's the best way to use an external log4j.properties file within Grails? I'd like to use the traditional log4j.properties format rather than a log4j.groovy style configuration.
I'm also curious if the external configuration will play nicely with the log4j.properties file that's created by `grails war` and put into ... | In Grails 1 and 2, there's a [logging DSL](http://grails.org/doc/latest/guide/conf.html#logging) that is configured and used in an out-of-the-box webapp, so you'll want to remove the `log4j = { ... }` code from `grails-app/conf/Config.groovy`
If you want to use an external configuration file for logging like in a typi... |
518,261 | <p>What does the following x86 assembler instruction do?</p>
<pre><code>call dword ptr ds:[00923030h]
</code></pre>
<p>It's an indirect call I suspect, but exactly how does it compute the address to the call?</p>
| [
{
"answer_id": 518306,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 4,
"selected": false,
"text": "<p><strong>[EDIT] Updated</strong></p>\n\n<p>Whenever you see a memory operand that looks something like <code>ds:0x... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What does the following x86 assembler instruction do?
```
call dword ptr ds:[00923030h]
```
It's an indirect call I suspect, but exactly how does it compute the address to the call? | **[EDIT] Updated**
Whenever you see a memory operand that looks something like `ds:0x00923030`, that's a *segment-relative* addressing mode. The actual address being referred tp is at linear address 0x00923030 relative to the base address of the `ds` segment register.
Memory segmentation in the x86 architecture is so... |
518,267 | <p>I have a Hibernate entity, with a getter that is mapped as a @OneToMany:</p>
<pre><code>@Entity
class Parent extends BaseParent {
@OneToMany(cascade = {CascadeType.ALL}, mappedBy = "parent")
public List<Child> getChildren() {
return super.children;
}
public void setChildren(List<C... | [
{
"answer_id": 518863,
"author": "Matt Sidesinger",
"author_id": 1481472,
"author_profile": "https://Stackoverflow.com/users/1481472",
"pm_score": 0,
"selected": false,
"text": "<p>I recommend reading the following section in the Hibernate documentation for Annotations:</p>\n\n<p><a href... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a Hibernate entity, with a getter that is mapped as a @OneToMany:
```
@Entity
class Parent extends BaseParent {
@OneToMany(cascade = {CascadeType.ALL}, mappedBy = "parent")
public List<Child> getChildren() {
return super.children;
}
public void setChildren(List<Child> list) {
s... | You may be having issues related to the mixing of fields and methods in your annotations. For example, if you have an @Id annotation in your parent class BaseParent, then Hibernate will by default look at fields and not methods.
So basically if you had something like this:
```
public class BaseParent {
@Id
pr... |
518,283 | <p>I can use this jQuery code to dynamically change the RSS link in the DOM in Firefox & Chrome. <a href="http://path.com/feed" rel="nofollow noreferrer">http://path.com/feed</a> is normally replaced by a variable, but not for this example.</p>
<pre><code>$('#rssfeed').remove();
$('head').append('<link id="rssf... | [
{
"answer_id": 528304,
"author": "geowa4",
"author_id": 50214,
"author_profile": "https://Stackoverflow.com/users/50214",
"pm_score": 0,
"selected": false,
"text": "<pre><code>$('#rssfeed').attr('href, 'http://path.com/feed?id=25463456');\n</code></pre>\n\n<p>Setting the url with a rando... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/68788/"
] | I can use this jQuery code to dynamically change the RSS link in the DOM in Firefox & Chrome. <http://path.com/feed> is normally replaced by a variable, but not for this example.
```
$('#rssfeed').remove();
$('head').append('<link id="rssfeed" rel="alternate" type="application/rss+xml" href="http://path.com/feed"/>');... | Unfortunately, the short answers to your questions are "No" and "Sort of" because of a lack of browser support for udpating the list of feeds that are modified/added/removed in IE and Firefox.
First, in order to add elements to the document `HEAD` in IE (remember this applies to CSS as well), you must be sure to speci... |
518,292 | <p>Given this code:</p>
<pre><code>using (var conn = new SqlConnection("..."))
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "...";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
// ...
... | [
{
"answer_id": 518303,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 3,
"selected": false,
"text": "<p>Using statements have nothing to do with Exceptions. Using blocks just insure that Dispose is called on the object in the... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38317/"
] | Given this code:
```
using (var conn = new SqlConnection("..."))
{
conn.Open();
using (var cmd = conn.CreateCommand())
{
cmd.CommandText = "...";
using (var reader = cmd.ExecuteReader())
{
while (reader.Read())
{
// ...
}
}... | `using` isn't designed to catch exceptions; it's designed to give you an easy way to wrap a `try`/`finally` around an object that needs to be disposed. If you need to catch and handle exceptions then you'll need to expand it into a full `try`/`catch`/`finally` or put a containing `try`/`catch` around the whole thing.
... |
518,323 | <p>Some of my forms show errors when i load them in the designer. This is because in their constructors they use system settings loaded from a configuration file. When the form is loaded in the designer it uses some random path and unsurprisingly the config file isn't there. </p>
<p>eg.
The configuration file C:\Docu... | [
{
"answer_id": 518337,
"author": "Tron",
"author_id": 22290,
"author_profile": "https://Stackoverflow.com/users/22290",
"pm_score": 0,
"selected": false,
"text": "<pre><code>Page.DesignMode\n</code></pre>\n\n<p>This can be used in all pages and user controls.</p>\n"
},
{
"answer_... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8479/"
] | Some of my forms show errors when i load them in the designer. This is because in their constructors they use system settings loaded from a configuration file. When the form is loaded in the designer it uses some random path and unsurprisingly the config file isn't there.
eg.
The configuration file C:\Documents and ... | How about simply putting that logic into `OnLoad` instead, and check `DesignMode`?
```
protected override void OnLoad(System.EventArgs e)
{
base.OnLoad(e);
if (!this.DesignMode)
{
/* do stuff */
}
}
``` |
518,329 | <p>If you have, for example, a database table called Person (ID,Name etc) what kind of object should the data access tier return to the business tier?
I'm thinking something like this:</p>
<pre><code>//data access tier
public class DataAccess{
public interface IPerson{
int ID{ get; set; }
string Name{ ... | [
{
"answer_id": 518386,
"author": "Adam Ralph",
"author_id": 49241,
"author_profile": "https://Stackoverflow.com/users/49241",
"pm_score": 5,
"selected": true,
"text": "<p>You don't need to repeat the class definition in your data access layer (DAL).</p>\n\n<p>You can create your business... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15613/"
] | If you have, for example, a database table called Person (ID,Name etc) what kind of object should the data access tier return to the business tier?
I'm thinking something like this:
```
//data access tier
public class DataAccess{
public interface IPerson{
int ID{ get; set; }
string Name{ get; set; }
... | You don't need to repeat the class definition in your data access layer (DAL).
You can create your business entities as 'dumb' containers in a separate assembly, e.g. your Person class can just be:-
```
public class Person
{
int ID { get; set: }
string Name { get; set: }
}
```
Then, you can give your DAL a ... |
518,335 | <p>Have check boxes 1-300. This JS function alerts user when nothing is selected. Function works great for the first 290 elements. For example, when item 291 is selected it alerts that nothing is selected. document.checks.user.length is coming out to 298, not sure why that is either. Any suggestions? Thanks.</p>
<pre>... | [
{
"answer_id": 518344,
"author": "Adam Ralph",
"author_id": 49241,
"author_profile": "https://Stackoverflow.com/users/49241",
"pm_score": 1,
"selected": false,
"text": "<p>Disable the button until the request is complete?</p>\n"
},
{
"answer_id": 518346,
"author": "ine",
... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52256/"
] | Have check boxes 1-300. This JS function alerts user when nothing is selected. Function works great for the first 290 elements. For example, when item 291 is selected it alerts that nothing is selected. document.checks.user.length is coming out to 298, not sure why that is either. Any suggestions? Thanks.
```
function... | Why not disable the button after it is clicked, and then re-enable it once you have received the response from the server? |
518,352 | <p>In the example below, is the connection going to close and disposed when an exception is thrown if it is within a <code>using</code> statement?</p>
<pre><code>using (var conn = new SqlConnection("..."))
{
conn.Open();
// stuff happens here and exception is thrown...
}
</code></pre>
<p>I know this code belo... | [
{
"answer_id": 518365,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 8,
"selected": true,
"text": "<p>Yes, <code>using</code> wraps your code in a try/finally block where the <code>finally</code> portion will call <code... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5704/"
] | In the example below, is the connection going to close and disposed when an exception is thrown if it is within a `using` statement?
```
using (var conn = new SqlConnection("..."))
{
conn.Open();
// stuff happens here and exception is thrown...
}
```
I know this code below will make sure that it does, but I'... | Yes, `using` wraps your code in a try/finally block where the `finally` portion will call `Dispose()` if it exists. It won't, however, call `Close()` directly as it only checks for the `IDisposable` interface being implemented and hence the `Dispose()` method.
See also:
* [Intercepting an exception inside IDisposable... |
518,354 | <p>I have an instance of the following object in the jsp page context: </p>
<pre><code>Class User{
private boolean isAdmin;
public boolean isAdmin(){return isAdmin}
}
</code></pre>
<p>How can I query the isAdmin property from the EL? This doesn't seem to work:</p>
<pre><code>${user.admin}
</code></pre>
<p>nor d... | [
{
"answer_id": 518417,
"author": "Eddie",
"author_id": 57752,
"author_profile": "https://Stackoverflow.com/users/57752",
"pm_score": 0,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>${user.Admin}\n</code></pre>\n\n<p>just in case capitalization is the problem. Sometimes EL ... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518354",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44683/"
] | I have an instance of the following object in the jsp page context:
```
Class User{
private boolean isAdmin;
public boolean isAdmin(){return isAdmin}
}
```
How can I query the isAdmin property from the EL? This doesn't seem to work:
```
${user.admin}
```
nor does this:
```
${user.isAdmin}
```
thanks!
-Mo... | Ok. I'm stupid. Vote this question down, ridicule me, etc. The problem was in the method that isAdmin() was delegating to. There was a null pointer exception in that method. In my defense, however, I'll say that the stack trace I got was a bit unclear, and made it look like it was an EL issue rather than a simple null ... |
518,379 | <p>Given the following controller class:</p>
<pre><code>public class ProjectController : Controller
{
public ActionResult List()
{
return View(new List<string>());
}
}
</code></pre>
<p>How can I get a reference to the model object in the following unit test?</p>
<pre><code>public class Proj... | [
{
"answer_id": 518414,
"author": "Troy",
"author_id": 5047,
"author_profile": "https://Stackoverflow.com/users/5047",
"pm_score": 3,
"selected": false,
"text": "<p>In the Release Candidate version of the Asp.Net Mvc framework, the model is made available via the \"Model\" property of the... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/169/"
] | Given the following controller class:
```
public class ProjectController : Controller
{
public ActionResult List()
{
return View(new List<string>());
}
}
```
How can I get a reference to the model object in the following unit test?
```
public class ProjectControllerTests
{
private readonly P... | Try:
```
result.ViewData.Model
```
Hope this helps. |
518,382 | <p>I want to add small images-arrows for moving up and down on table row in Javascript (maybe jQuery) and save the reordered table (only the order) in cookie for further use. An example would be - Joomla, inside the admin area in the Articles area (but that is done with php). Thanks.</p>
| [
{
"answer_id": 518434,
"author": "Chad Birch",
"author_id": 41665,
"author_profile": "https://Stackoverflow.com/users/41665",
"pm_score": 2,
"selected": false,
"text": "<p>For the jQuery part of things, you could look into modifying <a href=\"http://www.isocra.com/2008/02/table-drag-and-... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63098/"
] | I want to add small images-arrows for moving up and down on table row in Javascript (maybe jQuery) and save the reordered table (only the order) in cookie for further use. An example would be - Joomla, inside the admin area in the Articles area (but that is done with php). Thanks. | Probably can be refactored a bit more, but I leave the saving to you:
```
function swap(a, b, direction){
var html = a.wrapInner('<tr></tr>').html()
a.replaceWith(b.wrapInner('<tr></tr>').html())
b.replaceWith(html)
}
function getParent(cell){ return $(cell).parent('tr') }
$(document).ready(function(){
$('.upA... |
518,428 | <p>Is it possible to specify which X display the JVM is to launch it's windows on through the JVM? I am thinking something like this</p>
<pre><code>java -DISPLAY=THE_DISPLAY_I_WANT:0.1 -jar my.jar
</code></pre>
<p>I looked at the man pages and I can't find anything.</p>
<p>or do I need to wrap my call to the jvm in ... | [
{
"answer_id": 518452,
"author": "Peter Lawrey",
"author_id": 57695,
"author_profile": "https://Stackoverflow.com/users/57695",
"pm_score": 0,
"selected": false,
"text": "<p>If you are using sh, bash or the like you can just do</p>\n\n<pre><code>DISPLAY=THE_DISPLAY_I_WANT:0.1 java -jar m... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518428",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42303/"
] | Is it possible to specify which X display the JVM is to launch it's windows on through the JVM? I am thinking something like this
```
java -DISPLAY=THE_DISPLAY_I_WANT:0.1 -jar my.jar
```
I looked at the man pages and I can't find anything.
or do I need to wrap my call to the jvm in a shell script like this
```
#/... | Given your constraints on the answer, the answer you're looking for is "**It can't be done**"
I'm still curious why the second solution doesn't work for you. I realize it's not what you *want* to do, I just want to know *why* |
518,443 | <p>I'm developing a website with a custom search function and I want to collect statistics on what the users search for. </p>
<p>It is not a full text search of the website content, but rather a search for companies with search modes like:</p>
<ul>
<li>by company name</li>
<li>by area code</li>
<li>by provided servic... | [
{
"answer_id": 518451,
"author": "MarlonRibunal",
"author_id": 10385,
"author_profile": "https://Stackoverflow.com/users/10385",
"pm_score": 0,
"selected": false,
"text": "<p>You may want to check this:</p>\n\n<p><a href=\"http://www.microsoft.com/sqlserver/2005/en/us/express-starter-sch... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518443",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4186/"
] | I'm developing a website with a custom search function and I want to collect statistics on what the users search for.
It is not a full text search of the website content, but rather a search for companies with search modes like:
* by company name
* by area code
* by provided services
* ...
How to design the databas... | Well, it's dependent on how the different search modes work, but generally I would say that a table with 3 columns would work:
```
SearchType SearchValue Count
```
Whenever someone does a search, say they search for "Company Name: Initech", first query to see if there are any rows in the table with SearchType ... |
518,447 | <p>I'm showing a popup menu to select some values in a QTableWidget. The lowest item is a "Modify list" entry, when I select it a new window should automatically appear and the QComboBox should vanish and the cell return to a Qt::DisplayRole state.</p>
<p>Now Qt has all those nice API-calls like <code>QTableWidget.edi... | [
{
"answer_id": 518469,
"author": "Nick Presta",
"author_id": 40906,
"author_profile": "https://Stackoverflow.com/users/40906",
"pm_score": 4,
"selected": true,
"text": "<p><a href=\"https://doc.qt.io/qt-4.8/qtablewidget.html\" rel=\"nofollow noreferrer\">QTableWidget</a> inherits 19 publ... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518447",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24587/"
] | I'm showing a popup menu to select some values in a QTableWidget. The lowest item is a "Modify list" entry, when I select it a new window should automatically appear and the QComboBox should vanish and the cell return to a Qt::DisplayRole state.
Now Qt has all those nice API-calls like `QTableWidget.edit()` and `QTabl... | [QTableWidget](https://doc.qt.io/qt-4.8/qtablewidget.html) inherits 19 public slots from QWidget. One of those is setDisabled(), which should disable input events for that widget and all of its children.
I would try:
```
table.setDisabled( true );
table.setDisabled( false );
```
Although you said it does not work f... |
518,471 | <p>Whenever I click a JSlider it gets positioned one majorTick in the direction of the click instead of jumping to the spot I actually click. (If slider is at point 47 and I click 5 it'll jump to 37 instead of 5). Is there any way to change this while using JSliders, or do I have to use another datastructure?</p>
| [
{
"answer_id": 518672,
"author": "ninesided",
"author_id": 1030,
"author_profile": "https://Stackoverflow.com/users/1030",
"pm_score": 5,
"selected": true,
"text": "<p>As bizarre as this might seem, it's actually the Look and Feel which controls this behaviour. Take a look at <code>Basic... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518471",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63107/"
] | Whenever I click a JSlider it gets positioned one majorTick in the direction of the click instead of jumping to the spot I actually click. (If slider is at point 47 and I click 5 it'll jump to 37 instead of 5). Is there any way to change this while using JSliders, or do I have to use another datastructure? | As bizarre as this might seem, it's actually the Look and Feel which controls this behaviour. Take a look at `BasicSliderUI`, the method that you need to override is [`scrollDueToClickInTrack(int)`](http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/plaf/basic/BasicSliderUI.html#scrollDueToClickInTrack(int)).
In ord... |
518,475 | <p>Is there better way than declare enumeration as</p>
<pre><code>public enum DepthNumberSize
{
Bit1 = 1,
Bit4 = 4,
Bit8 = 8,
Bit16 = 16,
Bit32 = 32
}
</code></pre>
<p>and every time when operations with related data chunk performed switch statements are used, like:</p>
<pre><code>switch(size)
{
c... | [
{
"answer_id": 518529,
"author": "Nathan W",
"author_id": 6335,
"author_profile": "https://Stackoverflow.com/users/6335",
"pm_score": 2,
"selected": true,
"text": "<p>You could do something like this:</p>\n\n<pre><code> interface IBitSize\n {\n object DoStuff();\n }\n\n ... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518475",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62672/"
] | Is there better way than declare enumeration as
```
public enum DepthNumberSize
{
Bit1 = 1,
Bit4 = 4,
Bit8 = 8,
Bit16 = 16,
Bit32 = 32
}
```
and every time when operations with related data chunk performed switch statements are used, like:
```
switch(size)
{
case DepthNumberSize.Bit1:
buff... | You could do something like this:
```
interface IBitSize
{
object DoStuff();
}
class Bit1 : IBitSize
{
public object DoStuff()
{
buffer[i++] = input[j] & 1;
buffer[i++] = (input[j] >> 1) & 1;
return something.
}
}
class B... |
518,511 | <p>I seem to be running into an issue (Cannot access a property or method of a null object reference) binding events in actionscript to a viewstack layer not currently showing. Are those objects not created until that layer is visible for the first time? I remember something about a creation policy, if this is the case... | [
{
"answer_id": 518526,
"author": "benjismith",
"author_id": 22979,
"author_profile": "https://Stackoverflow.com/users/22979",
"pm_score": 2,
"selected": false,
"text": "<p>Yeah, I had this same problem myself while working on an application with a PureMVC structure. I was unable to creat... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518511",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10357/"
] | I seem to be running into an issue (Cannot access a property or method of a null object reference) binding events in actionscript to a viewstack layer not currently showing. Are those objects not created until that layer is visible for the first time? I remember something about a creation policy, if this is the case, c... | Yes, that's right -- ViewStack children are created only when needed by default ("deferred instantiation" is a phrase you'll hear thrown around in this context). If instead you want to instruct Flex to create all of the ViewStack container's children up front, consider using the **creationPolicy** property common to al... |
518,513 | <p>I have</p>
<pre><code>var previous = new BitArray(new bool[]{true});
var current = new BitArray(new bool[]{false});
</code></pre>
<p>I want to concatenate them. I have already tried:</p>
<pre><code>var next = new BitArray(previous.Count + current.Count);
var index = 0;
for(;index < previous.Count; index++)
... | [
{
"answer_id": 518558,
"author": "Erik Forbes",
"author_id": 16942,
"author_profile": "https://Stackoverflow.com/users/16942",
"pm_score": 4,
"selected": true,
"text": "<p>Unfortunately it looks like your method might be as good as it gets - if BitArray implemented IEnumerable<T> (... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518513",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | I have
```
var previous = new BitArray(new bool[]{true});
var current = new BitArray(new bool[]{false});
```
I want to concatenate them. I have already tried:
```
var next = new BitArray(previous.Count + current.Count);
var index = 0;
for(;index < previous.Count; index++)
next[index] = previous[index];
var j = ... | Unfortunately it looks like your method might be as good as it gets - if BitArray implemented IEnumerable<T> (instead of just IEnumerable) then we could use LINQ extension methods to make it a bit prettier.
If I were you, I'd wrap this up into an extension method on BitArray:
```
public static BitArray Prepend(this B... |
518,517 | <pre><code>template <class T>
struct scalar_log_minimum {
public:
typedef T value_type;
typedef T result_type;
static
result_type initial_value(){
return std::log(std::numeric_limits<result_type>::max());
}
static
void update(result_type& t, const value_ty... | [
{
"answer_id": 518533,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 3,
"selected": false,
"text": "<p>You're including a header file somewhere that <code>#define</code>s <code>max</code> as a macro. The best soluti... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
template <class T>
struct scalar_log_minimum {
public:
typedef T value_type;
typedef T result_type;
static
result_type initial_value(){
return std::log(std::numeric_limits<result_type>::max());
}
static
void update(result_type& t, const value_type& x){
if ... | I find the many #defines that you encounter once you included windows.h very disturbing (not only max and min, but I also had problems with other generic words like Rectangle if I'm not mistaken). Therefore, I have developed the habit to include windows.h only when absolutely necessary, and never in header files. This ... |
518,530 | <p>I'm trying to rotate some <code>UIView</code> around its center, so the simple code goes something like
(in pseudocode):</p>
<pre><code>[UIView beginAnimations:@"crazyRotate" context:nil];
[UIView setAnimationDuration:1.0];
someview.transform = CGAffineTransformMakeRotation(angle);
[UIView commitAnimations]
</code... | [
{
"answer_id": 518620,
"author": "Jason Medeiros",
"author_id": 19255,
"author_profile": "https://Stackoverflow.com/users/19255",
"pm_score": 5,
"selected": false,
"text": "<p>You can use the following animation on your UIView's layer property. I've tested it.</p>\n\n<p><strong>Objective... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to rotate some `UIView` around its center, so the simple code goes something like
(in pseudocode):
```
[UIView beginAnimations:@"crazyRotate" context:nil];
[UIView setAnimationDuration:1.0];
someview.transform = CGAffineTransformMakeRotation(angle);
[UIView commitAnimations]
```
now if I set angle to say... | You can use the following animation on your UIView's layer property. I've tested it.
**Objective-C**
```
UIView *viewToSpin = ...;
CABasicAnimation* spinAnimation = [CABasicAnimation
animationWithKeyPath:@"transform.rotation"];
spinAnimation.toValue = [NSNumber numberWithFloat:5*... |
518,535 | <ol>
<li>I have an existing asp.net website that uses an SqlConnection.</li>
<li>I have added the ADO.net Entity Framework.</li>
<li>I have successfully connected to the database and created the .edmx file.</li>
<li>I am able to connect through the Entity Framework with the connectionstring that is automatically genera... | [
{
"answer_id": 519054,
"author": "Andrew Peters",
"author_id": 608,
"author_profile": "https://Stackoverflow.com/users/608",
"pm_score": 1,
"selected": false,
"text": "<p>You can do this by using the <a href=\"http://msdn.microsoft.com/en-us/library/bb738714.aspx\" rel=\"nofollow norefer... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518535",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53234/"
] | 1. I have an existing asp.net website that uses an SqlConnection.
2. I have added the ADO.net Entity Framework.
3. I have successfully connected to the database and created the .edmx file.
4. I am able to connect through the Entity Framework with the connectionstring that is automatically generated.
I want to use the ... | That forum post has the answer:
```
MetadataWorkspace workspace = new MetadataWorkspace(
new string[] { "res://*/" },
new Assembly[] { Assembly.GetExecutingAssembly() });
using (SqlConnection sqlConnection = new SqlConnection(connectionString))
using (EntityConnection entityConnection = new EntityConnection(work... |
518,548 | <p>I've tried both</p>
<pre><code>wget --user=myuser --password=mypassword myfile
</code></pre>
<p>and</p>
<pre><code>wget --ftp-user=myuser --ftp-password=mypassword myfile
</code></pre>
<p>but I keep getting the error</p>
<pre><code>HTTP request sent, awaiting response... 401 Authorization Required
Authorization... | [
{
"answer_id": 518563,
"author": "Marc Novakowski",
"author_id": 27020,
"author_profile": "https://Stackoverflow.com/users/27020",
"pm_score": 3,
"selected": true,
"text": "<p>Are you using an \"ftp://\" URL? From the error message it appears that you're making a request for an \"http:/... | 2009/02/05 | [
"https://Stackoverflow.com/questions/518548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/112/"
] | I've tried both
```
wget --user=myuser --password=mypassword myfile
```
and
```
wget --ftp-user=myuser --ftp-password=mypassword myfile
```
but I keep getting the error
```
HTTP request sent, awaiting response... 401 Authorization Required
Authorization failed.
```
I know the file is there, and I know the user... | Are you using an "ftp://" URL? From the error message it appears that you're making a request for an "http://" URL. |
518,571 | <p>how do you make a default table and then use it when making other tables?</p>
<p>example</p>
<pre><code>--default table
Button = {
x = 0,
y = 0,
w = 10,
h = 10,
Texture = "buttonimg.png",
onClick = function() end
}
newbutton = Button {
onClick = function()
print("button 1 pressed")
end
}
newbutton2 = ... | [
{
"answer_id": 519041,
"author": "Doug Currie",
"author_id": 33252,
"author_profile": "https://Stackoverflow.com/users/33252",
"pm_score": 0,
"selected": false,
"text": "<p>If you set the new table's metatable's <code>__index</code> to point to <code>Button</code> it will use the default... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518571",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63115/"
] | how do you make a default table and then use it when making other tables?
example
```
--default table
Button = {
x = 0,
y = 0,
w = 10,
h = 10,
Texture = "buttonimg.png",
onClick = function() end
}
newbutton = Button {
onClick = function()
print("button 1 pressed")
end
}
newbutton2 = Button {
x = 12,
onC... | You can achieve what you want by merging Doug's answer with your original scenario, like this:
```
Button = {
x = 0,
y = 0,
w = 10,
h = 10,
Texture = "buttonimg.png",
onClick = function() end
}
setmetatable(Button,
{ __call = function(self, init)
return setmetatable(in... |
518,576 | <p>I have a table with a charge/credit column:</p>
<pre><code>Item | PriceVal | CostVal | CHARGE_CODE
1 5 3 CH
2 8 5 CH
1 -5 -3 CR
3 7 1 CH
4 15 10 CH
1 5 3 CH
<... | [
{
"answer_id": 518584,
"author": "Ryan Guill",
"author_id": 7186,
"author_profile": "https://Stackoverflow.com/users/7186",
"pm_score": 4,
"selected": true,
"text": "<p>count() is going to count one for every value thats not null, so I don't think thats exactly what you want. Take the c... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/405066/"
] | I have a table with a charge/credit column:
```
Item | PriceVal | CostVal | CHARGE_CODE
1 5 3 CH
2 8 5 CH
1 -5 -3 CR
3 7 1 CH
4 15 10 CH
1 5 3 CH
```
I've got ... | count() is going to count one for every value thats not null, so I don't think thats exactly what you want. Take the count out and just take the
```
sum(case when charge_code = CH then costval else 0 end)
- sum(case when charge_code = 'CR' then costval else 0 end)
``` |
518,579 | <p>In WPF, it seems to be impossible to select (with the mouse) a "null" value from a ComboBox. <strong>Edit</strong> To clarify, this is .NET 3.5 SP1.</p>
<p>Here's some code to show what I mean. First, the C# declarations:</p>
<pre><code>public class Foo
{
public Bar Bar { get; set; }
}
public class Bar
{
... | [
{
"answer_id": 518680,
"author": "Ric Tokyo",
"author_id": 42019,
"author_profile": "https://Stackoverflow.com/users/42019",
"pm_score": 1,
"selected": false,
"text": "<p>this might not address your answer completely, but hopefully its a hit in the right direction:</p>\n\n<ol>\n<li>Have ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/615/"
] | In WPF, it seems to be impossible to select (with the mouse) a "null" value from a ComboBox. **Edit** To clarify, this is .NET 3.5 SP1.
Here's some code to show what I mean. First, the C# declarations:
```
public class Foo
{
public Bar Bar { get; set; }
}
public class Bar
{
public string Name { get; set; }
... | **The null "item" is not being selected by the keyboard at all - rather the previous item is being unselected and no subsequent item is (able to be) selected.** This is why, after "selecting" the null item with the keyboard, you are thereafter unable to re-select the previously selected item ("Hello") - except via the ... |
518,581 | <p>I have some UI code that needs to be updated from my background presenter thread.
So, I do the following:
from my background thread, I set my property in the UI:</p>
<pre><code>_ui.ConnectionStatus = "A";
</code></pre>
<p>then, my set is as follows:</p>
<pre><code>public string ConnectionStatus
{
set
{
... | [
{
"answer_id": 518628,
"author": "itowlson",
"author_id": 61700,
"author_profile": "https://Stackoverflow.com/users/61700",
"pm_score": 0,
"selected": false,
"text": "<p>You don't say what object this setter is executing inside, but it looks like this object's Dispatcher is not the same ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2341/"
] | I have some UI code that needs to be updated from my background presenter thread.
So, I do the following:
from my background thread, I set my property in the UI:
```
_ui.ConnectionStatus = "A";
```
then, my set is as follows:
```
public string ConnectionStatus
{
set
{
if (Dispatcher.CheckAccess())
... | Another question: what type is value? is this a string?
I could imagine that the error might be that value is in fact a UIElement (maybe a Label?) that you create in which case the exception refers to the value object and not to your user control. |
518,582 | <p>This pertains to embedding ESRI MapControls into Access Database Forms.</p>
<p>I have two access files, split into a frontend and backend. My backend is also a PersonalGeoDatabase that ArcGIS uses to store a feature class for display on a From embedded ESRI map control.</p>
<p>The feature class stores polylines, ... | [
{
"answer_id": 520771,
"author": "BIBD",
"author_id": 685,
"author_profile": "https://Stackoverflow.com/users/685",
"pm_score": 1,
"selected": false,
"text": "<p>In answer to your questions:<br>\n1) Form_ Current will always run whenever you switch records. No choice. So the next best op... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63068/"
] | This pertains to embedding ESRI MapControls into Access Database Forms.
I have two access files, split into a frontend and backend. My backend is also a PersonalGeoDatabase that ArcGIS uses to store a feature class for display on a From embedded ESRI map control.
The feature class stores polylines, points, and polygo... | In answer to your questions:
1) Form\_ Current will always run whenever you switch records. No choice. So the next best option is to move the call to CenterPoint to another event. I would use the form timer event, and reset the timer every time you go through Form\_ Current, when the timer runs out, it will fire Cen... |
518,618 | <p>As far as I understand, all JavaScript code is event-driven and executes on a single browser thread.</p>
<p>However, I have some JavaScript functions that are called from within a SWF object sitting on the same page. Is this code run in the same manner as regular JS code, or is it on some separate Flash thread?</p>... | [
{
"answer_id": 518638,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 4,
"selected": true,
"text": "<p>It's still on the same thread. However, for most practical purposes if you have such a long-running JavaScript that you're worri... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58728/"
] | As far as I understand, all JavaScript code is event-driven and executes on a single browser thread.
However, I have some JavaScript functions that are called from within a SWF object sitting on the same page. Is this code run in the same manner as regular JS code, or is it on some separate Flash thread?
If it is on ... | It's still on the same thread. However, for most practical purposes if you have such a long-running JavaScript that you're worried your "main" task might block the call from setTimeout, you should consider revisiting your underlying approach.
**Update for the bounty:**
To expand on the more general question of thread... |
518,625 | <p>I almost have the same problem as the guy in this thread:</p>
<p><a href="https://stackoverflow.com/questions/359298/convert-float-that-has-period-instead-of-comma">Convert Float that has period instead of comma?</a></p>
<p>So that my</p>
<pre><code>double x = 234.4;
string y = x.ToString();
</code></pre>
<p>I g... | [
{
"answer_id": 518650,
"author": "Florin Sabau",
"author_id": 21765,
"author_profile": "https://Stackoverflow.com/users/21765",
"pm_score": 4,
"selected": false,
"text": "<p>You could try to use </p>\n\n<pre><code>double.Parse(\"...\", CultureInfo.InvariantCulture)\n</code></pre>\n\n<p>a... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15763/"
] | I almost have the same problem as the guy in this thread:
[Convert Float that has period instead of comma?](https://stackoverflow.com/questions/359298/convert-float-that-has-period-instead-of-comma)
So that my
```
double x = 234.4;
string y = x.ToString();
```
I get `y == "234,4"`;
Even worse ... `Double.Parse("2... | Thanks to Florin Sabaus comment I found the solution, which was to place
```
Application.CurrentCulture = System.Globalization.CultureInfo.CreateSpecificCulture("en-US");
```
in Main() right before I created my form.
Now I won't have to change all my .ToString() and Double.Parse() :-) Yey! |
518,679 | <p>In the computer algebra system <a href="http://www.sagemath.org/" rel="nofollow noreferrer">Sage</a>,
I need to multiply a list by 2.</p>
<p>I tried the code</p>
<pre><code>sage: list = [1, 2, 3];
sage: 2 * list
</code></pre>
<p>which returns</p>
<pre><code>[1, 2, 3, 1, 2, 3]
</code></pre>
<p>How can I just m... | [
{
"answer_id": 518895,
"author": "sykora",
"author_id": 53850,
"author_profile": "https://Stackoverflow.com/users/53850",
"pm_score": 3,
"selected": true,
"text": "<p>Do you want to multiply each element by 2? That would be:</p>\n\n<pre><code>[2*i for i in List]\n</code></pre>\n"
},
... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54964/"
] | In the computer algebra system [Sage](http://www.sagemath.org/),
I need to multiply a list by 2.
I tried the code
```
sage: list = [1, 2, 3];
sage: 2 * list
```
which returns
```
[1, 2, 3, 1, 2, 3]
```
How can I just multiply each element by two? | Do you want to multiply each element by 2? That would be:
```
[2*i for i in List]
``` |
518,701 | <p>My clipboard is populated with text, but when I run</p>
<pre><code>string clipboardData = Clipboard.GetText(System.Windows.Forms.TextDataFormat.Text);
</code></pre>
<p>I get back an empty string. I've toyed with various forms of the call including:</p>
<pre><code>string clipboardData = Clipboard.GetText();
string... | [
{
"answer_id": 518724,
"author": "BoltBait",
"author_id": 20848,
"author_profile": "https://Stackoverflow.com/users/20848",
"pm_score": 7,
"selected": true,
"text": "<p>You can only access the clipboard from an STA thread. Rick Brewster ran into this with some refactoring of the regular ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46249/"
] | My clipboard is populated with text, but when I run
```
string clipboardData = Clipboard.GetText(System.Windows.Forms.TextDataFormat.Text);
```
I get back an empty string. I've toyed with various forms of the call including:
```
string clipboardData = Clipboard.GetText();
string clipboardData = Clipboard.GetText(Sy... | You can only access the clipboard from an STA thread. Rick Brewster ran into this with some refactoring of the regular Edit->Paste command, in Paint.NET.
Code:
```
IDataObject idat = null;
Exception threadEx = null;
Thread staThread = new Thread(
delegate ()
{
try
{
idat = Clipboar... |
518,711 | <p>I have a web app that up until now has been skinned (just basic colours and logos, nothing complicated) to a single company , however now since the merging with another company the site needs to be branded as two seperate companies (operation is exactly the same for both, and they share the same data). The simplest ... | [
{
"answer_id": 518725,
"author": "Florin Sabau",
"author_id": 21765,
"author_profile": "https://Stackoverflow.com/users/21765",
"pm_score": -1,
"selected": false,
"text": "<p>In MasterPage.PreInit event use:</p>\n\n<pre><code>Page.Theme = (Request.RawUrl.Contains(\"...\") ? \"yellow\": \... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56940/"
] | I have a web app that up until now has been skinned (just basic colours and logos, nothing complicated) to a single company , however now since the merging with another company the site needs to be branded as two seperate companies (operation is exactly the same for both, and they share the same data). The simplest way... | In your page (or base page), get on the PreInit handler (only Page has this event, not MasterPage) and do something like the following:
```
protected void Page_PreInit(..)
{
this.Theme = GetThemeByUrl(Request.Url);
}
private string GetThemeByUrl(Uri url)
{
string host = url.Host; //gets 'subdomain.company.com... |
518,727 | <p>I'm extracting the host from my url and am getting jammed up by making the last / optional.
the regexp needs to be prepared to receive the following:</p>
<pre><code>http://a.b.com:8080/some/path/file.txt
or
ftp://a.b.com:8080/some/path
or
ftp://user@a.b.com/some/path
or
http://a.b.com
or
a.b.com/some/path
and ret... | [
{
"answer_id": 518746,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 3,
"selected": false,
"text": "<p>Do you need to use a regex? Most languages have support for parsing URLs. For instance, Java has its java.net.URL, Pyth... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518727",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59947/"
] | I'm extracting the host from my url and am getting jammed up by making the last / optional.
the regexp needs to be prepared to receive the following:
```
http://a.b.com:8080/some/path/file.txt
or
ftp://a.b.com:8080/some/path
or
ftp://user@a.b.com/some/path
or
http://a.b.com
or
a.b.com/some/path
and return a.b.com
`... | Jeremy Ruten's answer is close but will fail if an @ appears anywhere after the hostname. I'd suggest:
>
> (everything that isn't an '@') //optional
>
>
>
(?:[^@:/]\*@)?
The colon and slash prevent matching past the domain if @ appears after the domain. Note the non-capturing parens.
>
> (everything that isn't... |
518,762 | <p>When using jQuery to hookup an event handler, is there any difference between using the click method</p>
<pre><code>$().click(fn)
</code></pre>
<p>versus using the bind method</p>
<pre><code>$().bind('click',fn);
</code></pre>
<p>Other than bind's optional data parameter.</p>
| [
{
"answer_id": 518772,
"author": "nickohrn",
"author_id": 59907,
"author_profile": "https://Stackoverflow.com/users/59907",
"pm_score": 3,
"selected": false,
"text": "<p>There is one difference in that you can bind custom events using the second form that you have. Otherwise, they seem ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4668/"
] | When using jQuery to hookup an event handler, is there any difference between using the click method
```
$().click(fn)
```
versus using the bind method
```
$().bind('click',fn);
```
Other than bind's optional data parameter. | For what it's worth, from the [jQuery source](http://code.google.com/p/jqueryjs/source/browse/trunk/jquery/src/event.js#661):
```
jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
"mousedown,mouseup,mousemove,mouseover,mouseout,mouseenter,mouseleave," +
"change,select,submit,keydown,keypre... |
518,767 | <p>I'm trying to understand why this test is failing. (I'm kind of new to testing.) I'm using the built-in Rails testing framework with the addition of the Shoulda gem.</p>
<p>The test:</p>
<pre><code>require 'shoulda'
context "on GET to :new" do
setup do
get(:new)
end
should_render_template :new
shoul... | [
{
"answer_id": 519229,
"author": "Milan Novota",
"author_id": 26123,
"author_profile": "https://Stackoverflow.com/users/26123",
"pm_score": 4,
"selected": true,
"text": "<p>The failure says that no template has been rendered. Try to make sure you are not being redirected with</p>\n\n<pre... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42595/"
] | I'm trying to understand why this test is failing. (I'm kind of new to testing.) I'm using the built-in Rails testing framework with the addition of the Shoulda gem.
The test:
```
require 'shoulda'
context "on GET to :new" do
setup do
get(:new)
end
should_render_template :new
should_not_set_the_flash
... | The failure says that no template has been rendered. Try to make sure you are not being redirected with
```
should_respond_with :success
```
and assert the contents of the @response.body just to see what's been sent back
```
# This will fail but should give you some clue about what was sent back.
should "sent somet... |
518,782 | <p>I'm trying to make a program that checks an array to make sure there are four folders with partially same names.</p>
<p>So</p>
<p>For a date like 0103 (jan 3rd), there should be 0103-1, 0103-2, 0103-3, and 0103-4. Other folders are like 0107-1, 0107-2, 0107-3, 0107-4. How do I go about doing this? I thought about ... | [
{
"answer_id": 518798,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 2,
"selected": false,
"text": "<pre><code>import os\n\ndef myfunc(date, num):\n for x in range(1, num+1):\n filename = str(date) + \"-\" + str(x)... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51518/"
] | I'm trying to make a program that checks an array to make sure there are four folders with partially same names.
So
For a date like 0103 (jan 3rd), there should be 0103-1, 0103-2, 0103-3, and 0103-4. Other folders are like 0107-1, 0107-2, 0107-3, 0107-4. How do I go about doing this? I thought about using glob.glob (... | ```
import os
def myfunc(date, num):
for x in range(1, num+1):
filename = str(date) + "-" + str(x)
if os.path.exists(filename):
print(filename+" exists")
else:
print(filename+" does not exist")
myfunc('0102', 3);
```
*0102-1 does not exist*
*0102-2 does not exist... |
518,790 | <p>I know this is an easy one, but it's driving me nuts...</p>
<p>I have a users table, comments table, and pictures table.</p>
<p>I want a list of the top 10 users based on submissions (total of their comments and their submitted photos).</p>
<p>That's it.</p>
<p>Shame me.</p>
<hr>
<p>UPDATE: based on Ed's answ... | [
{
"answer_id": 518799,
"author": "Ryan Guill",
"author_id": 7186,
"author_profile": "https://Stackoverflow.com/users/7186",
"pm_score": 2,
"selected": false,
"text": "<p>psuedocode of course but you want something like this:</p>\n\n<pre><code>select \n u.userid\n, count(commentID) + cou... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24708/"
] | I know this is an easy one, but it's driving me nuts...
I have a users table, comments table, and pictures table.
I want a list of the top 10 users based on submissions (total of their comments and their submitted photos).
That's it.
Shame me.
---
UPDATE: based on Ed's answer.
here's my setup:
* users table (us... | Maybe something kind of like this:
```
select username, sum(submissions)
from
(select username, count(picture_id) from
pictures group by username
union
select username, count(comment_id) from
comments group by username
)
group by username
order by sum(submissions) desc... |
518,795 | <p>I'd like to take a CSV file living server-side and display it dynamically as an html table.
E.g., this:</p>
<pre><code>Name, Age, Sex
"Cantor, Georg", 163, M
</code></pre>
<p>should become this:</p>
<pre><code><html><body><table>
<tr> <td>Name</td> <td>Age</td> <... | [
{
"answer_id": 518806,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": -1,
"selected": false,
"text": "<p>Does it work if you escape the quoted commas with \\ ? </p>\n\n<blockquote>\n <p>Name, Age, Sex </p>\n \n <p>\"Cantor... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4234/"
] | I'd like to take a CSV file living server-side and display it dynamically as an html table.
E.g., this:
```
Name, Age, Sex
"Cantor, Georg", 163, M
```
should become this:
```
<html><body><table>
<tr> <td>Name</td> <td>Age</td> <td>Sex</td> </tr>
<tr> <td>Cantor, Georg</td> <td>163</td> <td>M</td> </td>
</table></bo... | The [previously linked solution](http://www.codewalkers.com/c/a/File-Manipulation-Code/Simple-CSV-to-HTML-Table/) is a horrible piece of code; nearly every line contains a bug. Use [fgetcsv](http://php.net/fgetcsv) instead:
```
<?php
echo "<html><body><table>\n\n";
$f = fopen("so-csv.csv", "r");
while (($line = fgetcs... |
518,833 | <p>For some reason, the event listener I define never seems to receive any events, although I believe it should. Here's a very short description of the MXML code I'm using:</p>
<pre><code>WindowedApplication
VBox (root box)
MenuBar
TabNavigator
VBox (first tab)
Canvas
... | [
{
"answer_id": 617784,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>I haven't seen anything on \"Grand Central\" specifically, but there has been some discussion about the OpenCL standard ove... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518833",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | For some reason, the event listener I define never seems to receive any events, although I believe it should. Here's a very short description of the MXML code I'm using:
```
WindowedApplication
VBox (root box)
MenuBar
TabNavigator
VBox (first tab)
Canvas
VBox... | Snow Leopard is now out of NDA:
[GCD Conceptual Documentation](http://developer.apple.com/mac/library/documentation/General/Conceptual/ConcurrencyProgrammingGuide/Introduction/Introduction.html)
[GCD API Reference](http://developer.apple.com/mac/library/documentation/Performance/Reference/GCD_libdispatch_Ref/Refere... |
518,837 | <p>You can obtain the width of a string in the current font with <code>stringwidth</code> and although this actually pushes offset coordinates on the stack, the y-value always seems to be useless. Is there a way to determine the exact height of a string, that may or may not include descenders?</p>
| [
{
"answer_id": 628138,
"author": "dreamlax",
"author_id": 10320,
"author_profile": "https://Stackoverflow.com/users/10320",
"pm_score": 2,
"selected": false,
"text": "<p>This seems to work most of the time:</p>\n\n<pre><code>/fontheight { currentfont /FontMatrix get 3 get } bind def\n/li... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10320/"
] | You can obtain the width of a string in the current font with `stringwidth` and although this actually pushes offset coordinates on the stack, the y-value always seems to be useless. Is there a way to determine the exact height of a string, that may or may not include descenders? | `stringwidth`, as it says, doesn't return string's height. (In all cases I looked at, the second integer on the stack after executing `stringwidth` was `0` -- for strings that run in horizontal direction.) `stringwidth` gives the relative coordinates of the currentpoint after executing a `(string) show`.
The PLRM has... |
518,839 | <p>I am trying to create a view for a UNION of 2 select statements that I have created.</p>
<p>The UNION is working fine when executed individually</p>
<p>But the problem is only the 1st part of the UNION is getting executed when I am executing it as a view.</p>
<p>The query I am using is as below</p>
<pre><code>SE... | [
{
"answer_id": 518857,
"author": "caiokf",
"author_id": 54545,
"author_profile": "https://Stackoverflow.com/users/54545",
"pm_score": -1,
"selected": false,
"text": "<p>i think your fields userid and location are swapped in the two selects from the union, if of diferent data types, you w... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to create a view for a UNION of 2 select statements that I have created.
The UNION is working fine when executed individually
But the problem is only the 1st part of the UNION is getting executed when I am executing it as a view.
The query I am using is as below
```
SELECT DISTINCT products.pid AS id,
... | If you could give the result set for each individual query above and then also give the result set for the UNION query, we could probably provide a better answer to your question. My gut reaction is that the second query may be returning a duplicate value, and since you are using UNION, duplicates are being removed. If... |
518,880 | <p>I'm using the WPF 3.5SP1 WebBrowser control to display a page containing some javascript functions.
My program then needs to invoke a javascript function which will make an asynchronous call. I need a way to get the result of that asynchronous call back to C# so I can process the result.</p>
<p>Is there a way I can... | [
{
"answer_id": 518894,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 3,
"selected": true,
"text": "<blockquote>\n <p>Is there a way I can make the first\n javascript function sleep until\n something happens (with out locking ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33536/"
] | I'm using the WPF 3.5SP1 WebBrowser control to display a page containing some javascript functions.
My program then needs to invoke a javascript function which will make an asynchronous call. I need a way to get the result of that asynchronous call back to C# so I can process the result.
Is there a way I can make the ... | >
> Is there a way I can make the first
> javascript function sleep until
> something happens (with out locking up
> the browser)?
>
>
>
Yes - you can use the asynchronous function as it was intended to be used: pass it a callback, and let it do its thing. You should be able to pass a callback from C# into your... |
518,917 | <p>First and foremost, I apologize for any vagueness in this question. At this point, I'm simply trying to get some new ideas of things to try in order to diagnose this bug.</p>
<p>Anyway, the problem I'm having is with an application that's using a custom moduleloader. That moduleloader has been compiled into an s... | [
{
"answer_id": 521646,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 4,
"selected": true,
"text": "<p>I've been dealing with this issue myself, off and on and in various forms, for a year, and while I haven't fi... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28701/"
] | First and foremost, I apologize for any vagueness in this question. At this point, I'm simply trying to get some new ideas of things to try in order to diagnose this bug.
Anyway, the problem I'm having is with an application that's using a custom moduleloader. That moduleloader has been compiled into an swc and the mo... | I've been dealing with this issue myself, off and on and in various forms, for a year, and while I haven't figured out just what's causing it yet, there's clearly a mismeasurement happening somewhere along the line.
What I have been able to to, though, is work around it, essentially by subclassing button-type controls... |
518,935 | <p>I added an XML file as an embedded resource in my class library by using the accessing the project properties in Visual Studio and then Resources | Add Resource | Add Existing File...</p>
<p>I've tried to access the file using the following code, but I keep getting a null reference returned. Anyone have any ideas?<... | [
{
"answer_id": 518945,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 3,
"selected": true,
"text": "<p>The <a href=\"http://msdn.microsoft.com/en-us/library/xc4235zt.aspx\" rel=\"nofollow noreferrer\">MSDN page for GetMan... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56864/"
] | I added an XML file as an embedded resource in my class library by using the accessing the project properties in Visual Studio and then Resources | Add Resource | Add Existing File...
I've tried to access the file using the following code, but I keep getting a null reference returned. Anyone have any ideas?
```
var p... | The [MSDN page for GetManifestResourceStream](http://msdn.microsoft.com/en-us/library/xc4235zt.aspx) makes this note:
>
> This method returns a null reference
> (Nothing in Visual Basic) if a private
> resource in another assembly is
> accessed and the caller does not have
> ReflectionPermission with the
> Refle... |
518,942 | <p>I am designing a Highly Concurrent CCR Application in which it is imperative that I DO NOT Block or Send to sleep a Thread.</p>
<p>I am hitting SQLConnection Pool issues - Specifically getting InvalidOperationExceptions when trying to call SqlConnection.Open</p>
<p>I can potentially retry a hand full of times, but... | [
{
"answer_id": 525597,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Harry, I've run into this as well, also whilst using the CCR. My experience was that having completely decoupled my dispatc... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518942",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30576/"
] | I am designing a Highly Concurrent CCR Application in which it is imperative that I DO NOT Block or Send to sleep a Thread.
I am hitting SQLConnection Pool issues - Specifically getting InvalidOperationExceptions when trying to call SqlConnection.Open
I can potentially retry a hand full of times, but this isn't reall... | Harry, I've run into this as well, also whilst using the CCR. My experience was that having completely decoupled my dispatcher threads from blocking on any I/O, I could consume and process work items much faster than the SqlConnection pool could cope with. Once the maximum-pool-limit was hit, I ran into the sort of err... |
518,958 | <p>I'm really new to HTML, but I can't find anywhere how to return the variable from a check box. I've figured out how to get variables from forms and inputs, but I don't know how to get them from check boxes. Basically, I want a check box that if checked, will return the value yes. If not checked, it doesn't have to r... | [
{
"answer_id": 518963,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 2,
"selected": false,
"text": "<p>When submitting a form, if a checkbox is checked, it will be included in the values collection submitted to the server. If not ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60318/"
] | I'm really new to HTML, but I can't find anywhere how to return the variable from a check box. I've figured out how to get variables from forms and inputs, but I don't know how to get them from check boxes. Basically, I want a check box that if checked, will return the value yes. If not checked, it doesn't have to retu... | Assign something to the value attribute. You should get the value of the checked box, if there is one in the form values on postback. Note that I've made it a radio input in the case where you want yes or no. For a radio you need to assign the same name, but different ids (if you assign an id at all). You'd want to use... |
518,959 | <pre><code> #include "iostream"
class A {
private:
int a;
public :
A(): a(-1) {}
int getA() {
return a;
}
};
class A;
class B : public A {
private:
int b;
public:
B() : b(-1) {}
int getB() {
... | [
{
"answer_id": 519055,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 1,
"selected": false,
"text": "<p>The reason is that auto_ptr is not actually a pointer. It's a smart pointer which is a pointer wrapper but not actual... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43756/"
] | ```
#include "iostream"
class A {
private:
int a;
public :
A(): a(-1) {}
int getA() {
return a;
}
};
class A;
class B : public A {
private:
int b;
public:
B() : b(-1) {}
int getB() {
... | Well, `std::auto_ptr<B>` is not derived from `std::auto_ptr<A>`. But `B` is derived from `A`. The auto\_ptr does not know about that (it's not that clever). Looks like you want to use a shared ownership pointer. `boost::shared_ptr` is ideal, it also provides a dynamic\_pointer\_cast:
```
boost::shared_ptr<A> a = new A... |
518,966 | <p>I know you can specify fieldsets in django for Admin helpers. However, I cannot find anything useful for ModelForms. Just some patches which I cannot use. Am I missing something? Is there a way I could achieve something like fieldsets without manually writing out each field on my template in the appropriate tag.</p... | [
{
"answer_id": 519425,
"author": "Van Gale",
"author_id": 34258,
"author_profile": "https://Stackoverflow.com/users/34258",
"pm_score": 6,
"selected": true,
"text": "<p>Fieldsets in modelforms are still in \"design\" stage. There's a <a href=\"http://code.djangoproject.com/ticket/6630\" ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518966",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45226/"
] | I know you can specify fieldsets in django for Admin helpers. However, I cannot find anything useful for ModelForms. Just some patches which I cannot use. Am I missing something? Is there a way I could achieve something like fieldsets without manually writing out each field on my template in the appropriate tag.
I wou... | Fieldsets in modelforms are still in "design" stage. There's a [ticket](http://code.djangoproject.com/ticket/6630) in Django trac with low activity.
It's something I've been interested in researching myself in the near future, but since I haven't done it yet the best I can offer are these snippets:
* [Form splitting/... |
518,971 | <pre><code>var foo = { someKey: "someValue" };
var bar = "someKey";
</code></pre>
<p>How do I get the value "someValue" using foo and bar? OK, the PHP equivalent:</p>
<pre><code>$foo = array("someKey" => "someValue");
$bar = "someKey";
print $foo[$bar]; // someValue
</code></pre>
<p>So... I'm looking for the JS e... | [
{
"answer_id": 518972,
"author": "Luca Matteis",
"author_id": 50394,
"author_profile": "https://Stackoverflow.com/users/50394",
"pm_score": 3,
"selected": true,
"text": "<p>Like this: </p>\n\n<blockquote>\n <p>foo[bar]</p>\n</blockquote>\n\n<p>You use <em>square brackets</em> to referen... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518971",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11011/"
] | ```
var foo = { someKey: "someValue" };
var bar = "someKey";
```
How do I get the value "someValue" using foo and bar? OK, the PHP equivalent:
```
$foo = array("someKey" => "someValue");
$bar = "someKey";
print $foo[$bar]; // someValue
```
So... I'm looking for the JS equivalent for the above, except I don't wanna... | Like this:
>
> foo[bar]
>
>
>
You use *square brackets* to reference string key values.
`foo.someKey` is equal to `foo["someKey"]` |
518,992 | <p>I'm trying to handle the possibility that no arguments and no piped data is passed to a Perl script. I'm assuming that if there are no arguments then input is being piped via STDIN. However if the user provides no arguments and does not pipe anything to the script, it will try to get keyboard input. My objective is ... | [
{
"answer_id": 519169,
"author": "ysth",
"author_id": 17389,
"author_profile": "https://Stackoverflow.com/users/17389",
"pm_score": 3,
"selected": false,
"text": "<pre><code>use POSIX 'isatty';\nif ( ! @ARGV && isatty(*STDIN) ) {\n die \"usage: ...\";\n}\n</code></pre>\n\n<p>S... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63166/"
] | I'm trying to handle the possibility that no arguments and no piped data is passed to a Perl script. I'm assuming that if there are no arguments then input is being piped via STDIN. However if the user provides no arguments and does not pipe anything to the script, it will try to get keyboard input. My objective is to ... | Perl comes with the `-t` file-test operator, which tells you if a particular filehandle is open to a TTY. So, you should be able to do this:
```
if ( -t STDIN and not @ARGV ) {
# We're talking to a terminal, but have no command line arguments.
# Complain loudly.
}
else {
# We're either reading from a file ... |
518,994 | <p>Here's a simplified version of my class:</p>
<pre><code>public abstract class Task
{
private static object LockObject = new object();
protected virtual void UpdateSharedData() { }
protected virtual void UpdateNonSharedData() { }
public void Method()
{
lock(LockObject)
{
... | [
{
"answer_id": 519026,
"author": "Chris Hynes",
"author_id": 8037,
"author_profile": "https://Stackoverflow.com/users/8037",
"pm_score": 3,
"selected": false,
"text": "<p>You can do this check with a smidge of reflection:</p>\n\n<pre><code>bool IsUpdateSharedDataOverridden()\n{\n Type... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19403/"
] | Here's a simplified version of my class:
```
public abstract class Task
{
private static object LockObject = new object();
protected virtual void UpdateSharedData() { }
protected virtual void UpdateNonSharedData() { }
public void Method()
{
lock(LockObject)
{
UpdateSharedD... | What if you defined an abstract Task and a IHasSharedData interface, then in Method you check if the derived Task implements IHasSharedData before doing the lock. Only classes that implement the interface need wait. I realize that this avoids answering the actual question, but I think it would be a cleaner solution tha... |
518,995 | <p>Is there a #define compiler (nvcc) macro of CUDA which I can use? (Like _WIN32 for Windows and so on.)</p>
<p>I need this for header code that will be common between nvcc and VC++ compilers. I know I can go ahead and define my own and pass it as an argument to the nvcc compiler (-D), but it would be great if there ... | [
{
"answer_id": 519021,
"author": "basszero",
"author_id": 287,
"author_profile": "https://Stackoverflow.com/users/287",
"pm_score": 5,
"selected": true,
"text": "<pre><code>__CUDACC__\n</code></pre>\n\n<p>I don't think it will be that trivial. Check the following thread</p>\n\n<p><a href... | 2009/02/06 | [
"https://Stackoverflow.com/questions/518995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1630/"
] | Is there a #define compiler (nvcc) macro of CUDA which I can use? (Like \_WIN32 for Windows and so on.)
I need this for header code that will be common between nvcc and VC++ compilers. I know I can go ahead and define my own and pass it as an argument to the nvcc compiler (-D), but it would be great if there is one al... | ```
__CUDACC__
```
I don't think it will be that trivial. Check the following thread
<http://forums.nvidia.com/index.php?showtopic=32369&st=0&p=179913&#entry179913> |
519,008 | <p>im running on windows xp and i am an administrator,<br> im using the latest xampp bundle available from their site and i receive these kinds of errors when i use file manipulation functions on php...</p>
<pre><code>Warning: chmod() [function.chmod]: Permission denied in...
Warning: opendir(/feeds) [function.opendir... | [
{
"answer_id": 519013,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 1,
"selected": false,
"text": "<p>Does your php worker process have the necessary permissions?</p>\n\n<p>Make sure whatever user the process is runn... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24744/"
] | im running on windows xp and i am an administrator,
im using the latest xampp bundle available from their site and i receive these kinds of errors when i use file manipulation functions on php...
```
Warning: chmod() [function.chmod]: Permission denied in...
Warning: opendir(/feeds) [function.opendir]: failed to op... | Does your php worker process have the necessary permissions?
Make sure whatever user the process is running as has proper permissions for the directory it is puking on.
right click on the folder, permissions... |
519,010 | <p>In MS Access, I have a query where I want to use a column in the outer query as a condition in the inner query:</p>
<pre><code>SELECT P.FirstName, P.LastName, Count(A.attendance_date) AS CountOfattendance_date,
First(A.attendance_date) AS FirstOfattendance_date,
(SELECT COUNT (*)
FROM(SELEC... | [
{
"answer_id": 519045,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Can you change </p>\n\n<p>B.attendance_date >= FirstOfattendance_date </p>\n\n<p>to</p>\n\n<p>B.attendance_date >= First(A.... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14253/"
] | In MS Access, I have a query where I want to use a column in the outer query as a condition in the inner query:
```
SELECT P.FirstName, P.LastName, Count(A.attendance_date) AS CountOfattendance_date,
First(A.attendance_date) AS FirstOfattendance_date,
(SELECT COUNT (*)
FROM(SELECT DISTINCT att... | How about:
```
SELECT
p.FirstName,
p.LastName,
Count(a.attendance_date) AS CountOfattendance_date,
First(a.attendance_date) AS FirstOfattendance_date,
c.total
FROM (
tblPeople AS p
INNER JOIN tblEventAttendance AS a ON
a.people_id = p.ID)
INNER JOIN (SELECT people_id, Count (atte... |
519,018 | <p>I am trying to lock-down a few controllers based on role and the 'posts' controller by whether or not they ANY permissions assigned. This appears to be working, but I'm wondering if there is a clean way to handle this. This is what I have in the application controller, which I'm calling as a before filter...</p>
<p... | [
{
"answer_id": 519091,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 3,
"selected": false,
"text": "<p>You shouldn't make a code snippet that checks for a controller name to take a specific action in application.rb. Yo... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519018",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to lock-down a few controllers based on role and the 'posts' controller by whether or not they ANY permissions assigned. This appears to be working, but I'm wondering if there is a clean way to handle this. This is what I have in the application controller, which I'm calling as a before filter...
```
if co... | You shouldn't make a code snippet that checks for a controller name to take a specific action in application.rb. You should define that before filters only in the controllers that need them
Make 2 methods in ApplicationController:
```
private
def require_master_or_power_user
unless @current_user.master? || @current... |
519,034 | <p>I was just wondering whether there is some way to do this:</p>
<p>I have a form in a web page, after the user submits the form, the page is redirected to another static HTML page.</p>
<p>Is there any way to manipulate the data in the second HTML page without the help of any server code?</p>
<p>I mean can I displa... | [
{
"answer_id": 519046,
"author": "Thilo",
"author_id": 14955,
"author_profile": "https://Stackoverflow.com/users/14955",
"pm_score": 1,
"selected": false,
"text": "<p>You can access the pages GET parameters from JavaScript (<em>window.location.search</em>, which you still need to parse),... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184/"
] | I was just wondering whether there is some way to do this:
I have a form in a web page, after the user submits the form, the page is redirected to another static HTML page.
Is there any way to manipulate the data in the second HTML page without the help of any server code?
I mean can I display the form data that the... | You can use a `<form>` with GET method to go to another static HTML page with some query parameters and then grab those parameters with JavaScript:
First page:
```
<form method="GET" action="page2.html">
<input type="text" name="value1"/>
<input type="text" name="value2"/>
<input type="submit"/>
</form>
... |
519,044 | <p>I can do something like this:</p>
<pre><code>validator.showErrors({ "nameOfField" : "ErrorMessage" });
</code></pre>
<p>And that works fine, however if I try and do something like this:</p>
<pre><code>var propertyName = "nameOfField";
var errorMessage = "ErrorMessage";
validator.showErrors({ propertyName : errorM... | [
{
"answer_id": 519061,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 0,
"selected": false,
"text": "<p>That should work fine. maybe the lack of a ; after the error message is throwing something off. What browser are you... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519044",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23300/"
] | I can do something like this:
```
validator.showErrors({ "nameOfField" : "ErrorMessage" });
```
And that works fine, however if I try and do something like this:
```
var propertyName = "nameOfField";
var errorMessage = "ErrorMessage";
validator.showErrors({ propertyName : errorMessage });
```
It throws an 'elemen... | What about:
```
var propertyName = "nameOfField";
var errorMessage = "ErrorMessage";
var obj = new Object();
obj[propertyName] = errorMessage;
validator.showErrors(obj);
```
---
Is worth to notice that the following three syntaxes are equivalent:
```
var a = {'a':0, 'b':1, 'c':2};
var b = new Object();
b['a'] =... |
519,077 | <p>I'm using the Tablesorter Jquery plugin to sort a table, but the images background images specified in the stylesheet fall behind the text on columns in which the actual content of the column isn't long enough to push the column width beyond the length of the header text.</p>
<p>For an example, go here: <a href="ht... | [
{
"answer_id": 519552,
"author": "Kennethvr",
"author_id": 60143,
"author_profile": "https://Stackoverflow.com/users/60143",
"pm_score": 2,
"selected": true,
"text": "<p>This is what is in your cell now:</p>\n\n<pre><code><th class=\"header\">Last Name</th>\n</code></pre>\n\n... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519077",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3442/"
] | I'm using the Tablesorter Jquery plugin to sort a table, but the images background images specified in the stylesheet fall behind the text on columns in which the actual content of the column isn't long enough to push the column width beyond the length of the header text.
For an example, go here: <http://tablesorter.c... | This is what is in your cell now:
```
<th class="header">Last Name</th>
```
The background image is set in the class header so you can order asc or desc
I guess the only solution is to try something like this
```
<th class="header">
<div style="margin-right: 10px;">Last Name</div>
</th>
```
in this way your imag... |
519,078 | <p>I have a variable on the global scope that is named <code>${SYSTEM}</code>, where SYSTEM is a defined constant. I've got a lot of classes with functions that need to have access to this variable and I'm finding it annoying declaring <code>global ${SYSTEM};</code> every single time.</p>
<p>I tried declaring a class ... | [
{
"answer_id": 519094,
"author": "phihag",
"author_id": 35070,
"author_profile": "https://Stackoverflow.com/users/35070",
"pm_score": 1,
"selected": false,
"text": "<p>The direct specification of member variables can not contain any references to other variables (<code>class {public $mem... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519078",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24416/"
] | I have a variable on the global scope that is named `${SYSTEM}`, where SYSTEM is a defined constant. I've got a lot of classes with functions that need to have access to this variable and I'm finding it annoying declaring `global ${SYSTEM};` every single time.
I tried declaring a class variable: `public ${SYSTEM} = $G... | Ok, hopefully I've got the gist of what you're trying to achieve
```
<?php
// the global array you want to access
$GLOBALS['uname'] = array('kernel-name' => 'Linux', 'kernel-release' => '2.6.27-11-generic', 'machine' => 'i686');
// the defined constant used to reference the global var
define(_SYSTEM_,... |
519,080 | <p>I'm using Java SE 1.6 on Mac OS X 10.5.6. The code for my applet is as follows:</p>
<pre><code>import java.awt.Graphics;
import javax.swing.JApplet;
public class HelloWorld extends JApplet {
public void paint( Graphics g ) {
super.paint( g );
g.drawString( "Hello World!", 25, 25 );
... | [
{
"answer_id": 519112,
"author": "pyon",
"author_id": 46571,
"author_profile": "https://Stackoverflow.com/users/46571",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not an expert in Web programming, but I think the applet tag is not standard. You have to use the object tag with the ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63153/"
] | I'm using Java SE 1.6 on Mac OS X 10.5.6. The code for my applet is as follows:
```
import java.awt.Graphics;
import javax.swing.JApplet;
public class HelloWorld extends JApplet {
public void paint( Graphics g ) {
super.paint( g );
g.drawString( "Hello World!", 25, 25 );
}
}
```
I ... | Thank you for all your answers. Some of them pointed me in the right direction to figure out the source of the problem.
I turned on the Java Console in Java Preferences. When I ran the applet again, the following output is what I received:
Java Plug-in 1.5.0
Using JRE version 1.5.0\_16 Java HotSpot(TM) Client VM ... |
519,085 | <p>On the SO blog and podcast Joel and Jeff have been discussing the, often ignored, times when unit testing a particular feature simply isn't worth the effort. Those times when unit testing a simple feature is so complicated, unpredictable, or impractical that the cost of the test doesn't reflect the value of the fea... | [
{
"answer_id": 519478,
"author": "Morendil",
"author_id": 61168,
"author_profile": "https://Stackoverflow.com/users/61168",
"pm_score": 0,
"selected": false,
"text": "<p>Once I wrote a unit test to expose a concurrency bug, in response to a <a href=\"http://c2.com/cgi-bin/wiki?ExtremePro... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46914/"
] | On the SO blog and podcast Joel and Jeff have been discussing the, often ignored, times when unit testing a particular feature simply isn't worth the effort. Those times when unit testing a simple feature is so complicated, unpredictable, or impractical that the cost of the test doesn't reflect the value of the feature... | ```
@Test
public void testSetName() {
UnderTest u = new UnderTest();
u.setName("Hans");
assertEquals("Hans", u.getName());
}
```
Testing set/get methods is just stupid, you don't need that. If you're forced to do this, your architecture has some serious flaws. |
519,088 | <p>I'm looking to find a decent calendar control for an ASP.Net application that allows each day to have an "ItemTemplate" type of declaration so that I can list things that are happening within each day. Something like the Club Starter Kit, only more robust and that can handle other datasources besides DataSets and Da... | [
{
"answer_id": 519478,
"author": "Morendil",
"author_id": 61168,
"author_profile": "https://Stackoverflow.com/users/61168",
"pm_score": 0,
"selected": false,
"text": "<p>Once I wrote a unit test to expose a concurrency bug, in response to a <a href=\"http://c2.com/cgi-bin/wiki?ExtremePro... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3442/"
] | I'm looking to find a decent calendar control for an ASP.Net application that allows each day to have an "ItemTemplate" type of declaration so that I can list things that are happening within each day. Something like the Club Starter Kit, only more robust and that can handle other datasources besides DataSets and DataT... | ```
@Test
public void testSetName() {
UnderTest u = new UnderTest();
u.setName("Hans");
assertEquals("Hans", u.getName());
}
```
Testing set/get methods is just stupid, you don't need that. If you're forced to do this, your architecture has some serious flaws. |
519,099 | <p>I wrote a couple of Java classes—<code>SingleThreadedCompute</code> and <code>MultithreadedCompute</code>—to demonstrate the fact (or what I always thought was a fact!) that if you parallelize a compute-centric (no I/O) task on a single core machine, you don't get a speedup. Indeed my understanding is th... | [
{
"answer_id": 519116,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 2,
"selected": false,
"text": "<p>What's the rest of your environment like? Is this repeatable?</p>\n<p>At least on a UNIX box, a long running si... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wrote a couple of Java classes—`SingleThreadedCompute` and `MultithreadedCompute`—to demonstrate the fact (or what I always thought was a fact!) that if you parallelize a compute-centric (no I/O) task on a single core machine, you don't get a speedup. Indeed my understanding is that parallelizing such tasks actually ... | I tried turning off the JIT as Pax suggested in the comment above. Pax, if you want to post a quick "Turn off the JIT" answer I'll credit your solution.
Anyway turning off the JIT worked (meaning that it brought the actual results in line with the expected results). I had to back away from one billion as it was taking... |
519,106 | <p>Based on information in Chapter 7 of <a href="http://www.charlespetzold.com/3D/" rel="noreferrer">3D Programming For Windows (Charles Petzold)</a>, I've attempted to write as helper function that projects a Point3D to a standard 2D Point that contains the corresponding screen coordinates (x,y):</p>
<pre><code>publi... | [
{
"answer_id": 519212,
"author": "user57697",
"author_id": 57697,
"author_profile": "https://Stackoverflow.com/users/57697",
"pm_score": 1,
"selected": false,
"text": "<ol>\n<li><p>It's not clear what you are trying to achieve with aspectRatio coeff. If the point is on the edge of field ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519106",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5023/"
] | Based on information in Chapter 7 of [3D Programming For Windows (Charles Petzold)](http://www.charlespetzold.com/3D/), I've attempted to write as helper function that projects a Point3D to a standard 2D Point that contains the corresponding screen coordinates (x,y):
```
public Point Point3DToScreen2D(Point3D point3D,... | Since Windows coordinates are z into the screen (x cross y), I would use something like
```
screenY = viewPort.ActualHeight * (1 - screenY);
```
instead of
```
screenY = screenY * viewPort.ActualHeight;
```
to correct screenY to accomodate Windows.
Alternately, you could use OpenGL. When you set the viewport x/... |
519,108 | <p>I am exporting the HTML Content to PDF.</p>
<pre><code> System.IO.StringWriter sWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new HtmlTextWriter(sWriter);
Response.Buffer = true;
FormId.RenderControl(htmlWriter);
Response.ContentType = "application/pdf";
/... | [
{
"answer_id": 519115,
"author": "Chris Hynes",
"author_id": 8037,
"author_profile": "https://Stackoverflow.com/users/8037",
"pm_score": 2,
"selected": false,
"text": "<p>You're rendering out the html (div as you said) before the pdf in the output stream, so the two are combined. That's ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519108",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22162/"
] | I am exporting the HTML Content to PDF.
```
System.IO.StringWriter sWriter = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWriter = new HtmlTextWriter(sWriter);
Response.Buffer = true;
FormId.RenderControl(htmlWriter);
Response.ContentType = "application/pdf";
// Added approp... | You're rendering out the html (div as you said) before the pdf in the output stream, so the two are combined. That's causing any app looking at the output to interpret it as a corrupted file. I'd try removing the first two lines:
```
Response.Buffer = true;
FormId.RenderControl(htmlWriter);
```
If that doesn't solve... |
519,132 | <p>Below code is used to get a <em>std::string</em> representation from ASCII code. </p>
<pre><code>string Helpers::GetStringFromASCII(const int asciiCode) const
{
return string(1,char(asciiCode));
}
</code></pre>
<p>It works well. But in my application, I know the ASCII codes at compile time. So I will be callin... | [
{
"answer_id": 519147,
"author": "Mr Fooz",
"author_id": 25050,
"author_profile": "https://Stackoverflow.com/users/25050",
"pm_score": 0,
"selected": false,
"text": "<p>How about something like this:</p>\n\n<pre><code>#include <iostream>\n#include <string>\n\nusing namespace ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50419/"
] | Below code is used to get a *std::string* representation from ASCII code.
```
string Helpers::GetStringFromASCII(const int asciiCode) const
{
return string(1,char(asciiCode));
}
```
It works well. But in my application, I know the ASCII codes at compile time. So I will be calling it like
```
string str = GetS... | Instead of feeding an int constant to a string conversion function, use a string constant directly:
>
> `string str("\xAF"); // 0xAF = 175`
>
>
>
By the way, except for heavy performance needs in a loop, trading code readability for some CPU cycles is rarely money effective overall. |
519,135 | <p>I just added some extra functionality to a <a href="http://blogs.msdn.com/coding4fun/archive/2006/11/13/1067250.aspx" rel="nofollow noreferrer">Coding4Fun</a> project. I have my project set up with an extra option to allow it to automatically change the background after X amount of time. X is set from a ComboBox. Ho... | [
{
"answer_id": 519147,
"author": "Mr Fooz",
"author_id": 25050,
"author_profile": "https://Stackoverflow.com/users/25050",
"pm_score": 0,
"selected": false,
"text": "<p>How about something like this:</p>\n\n<pre><code>#include <iostream>\n#include <string>\n\nusing namespace ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519135",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62506/"
] | I just added some extra functionality to a [Coding4Fun](http://blogs.msdn.com/coding4fun/archive/2006/11/13/1067250.aspx) project. I have my project set up with an extra option to allow it to automatically change the background after X amount of time. X is set from a ComboBox. However, I know I've done this in a terrib... | Instead of feeding an int constant to a string conversion function, use a string constant directly:
>
> `string str("\xAF"); // 0xAF = 175`
>
>
>
By the way, except for heavy performance needs in a loop, trading code readability for some CPU cycles is rarely money effective overall. |
519,180 | <p>I've got a function inside of a class that returns a string. Inside this function, I can only get it to work when I add <code>cout<<endl</code> to the function before the return statement. Any idea why this is, or how I can fix it? I'm running this in Eclipse on a Mac</p>
<p>In "main.cpp":</p>
<pre><code>#... | [
{
"answer_id": 519195,
"author": "Nitin Bhide",
"author_id": 52395,
"author_profile": "https://Stackoverflow.com/users/52395",
"pm_score": 5,
"selected": true,
"text": "<p>actually <em>getName()</em> function is probably working correctly. However, the cout 'caches' the output (i.e. it p... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519180",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60989/"
] | I've got a function inside of a class that returns a string. Inside this function, I can only get it to work when I add `cout<<endl` to the function before the return statement. Any idea why this is, or how I can fix it? I'm running this in Eclipse on a Mac
In "main.cpp":
```
#include <iostream>
#include <fstream>
#i... | actually *getName()* function is probably working correctly. However, the cout 'caches' the output (i.e. it prints the output on screen when it's internal text buffer is full). 'endl' flushes the buffer and forces cout to dump the text (in cache) to screen.
Try cout.flush() in main.cpp |
519,222 | <p>I'm trying to implement routing such as the following:</p>
<p>posts/535434/This-is-a-post-title</p>
<pre><code>posts/tagged/tags+here
// Matches {controller}/{action}/{id} - Default
// Displays all posts with the specified tags
// uses PostsController : ActionTagged(string tags)
posts?pageSize=50&pageIndex=4
... | [
{
"answer_id": 519269,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 2,
"selected": true,
"text": "<p>Two things:</p>\n\n<p>First, you should always order your routes in decreasing specificity (e.g. most specific case first, least... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] | I'm trying to implement routing such as the following:
posts/535434/This-is-a-post-title
```
posts/tagged/tags+here
// Matches {controller}/{action}/{id} - Default
// Displays all posts with the specified tags
// uses PostsController : ActionTagged(string tags)
posts?pageSize=50&pageIndex=4
// Matches {controller}/{... | Two things:
First, you should always order your routes in decreasing specificity (e.g. most specific case first, least specific case last) so that routes will "fall through", if one doesn't match it will try the next.
So we want to define {controller}/{postid}/... (must be a postid) before we define {controller}/{act... |
519,232 | <p>I'm configuring the logging for a Java application. What I'm aiming for is two logs: one for all messages and one for just messages above a certain level.</p>
<p>The app uses the <code>java.util.logging.*</code> classes: I'm using it as is, so I'm limited to configuration through a <code>logging.properties</code> f... | [
{
"answer_id": 519399,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 0,
"selected": false,
"text": "<p>I think you should be able to just subclass a handler and then override the methods to allow output to go to multiple... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63196/"
] | I'm configuring the logging for a Java application. What I'm aiming for is two logs: one for all messages and one for just messages above a certain level.
The app uses the `java.util.logging.*` classes: I'm using it as is, so I'm limited to configuration through a `logging.properties` file.
I don't see a way to confi... | <http://java.sun.com/j2se/1.4.2/docs/guide/util/logging/overview.html> is helpful. You can only set one Level for any individual logger (as you can tell from the setLevel() method on the logger). However, you can take the lowest of the two common levels, and then filter programmatically.
Unfortunately, you can't do th... |
519,233 | <p>I cannot figure out how to make a C# Windows Form application write to a textbox from a thread. For example in the Program.cs we have the standard main() that draws the form:</p>
<pre><code>static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Appl... | [
{
"answer_id": 519249,
"author": "bendewey",
"author_id": 37881,
"author_profile": "https://Stackoverflow.com/users/37881",
"pm_score": 7,
"selected": true,
"text": "<p>On your MainForm make a function to set the textbox the checks the InvokeRequired</p>\n\n<pre><code>public void AppendT... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519233",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I cannot figure out how to make a C# Windows Form application write to a textbox from a thread. For example in the Program.cs we have the standard main() that draws the form:
```
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new... | On your MainForm make a function to set the textbox the checks the InvokeRequired
```
public void AppendTextBox(string value)
{
if (InvokeRequired)
{
this.Invoke(new Action<string>(AppendTextBox), new object[] {value});
return;
}
ActiveForm.Text += value;
}
```
although in your static... |
519,234 | <p>I've come across a few examples recently that do things like:</p>
<pre class="lang-html prettyprint-override"><code><dl>
<dt>Full Name:</dt>
<dd><input type="text" name="fullname"></dd>
<dt>Email Address:</dt>
<dd><input type="text" name="email">&l... | [
{
"answer_id": 519254,
"author": "Bret",
"author_id": 982630,
"author_profile": "https://Stackoverflow.com/users/982630",
"pm_score": 4,
"selected": false,
"text": "<p>Definition lists have semantic meaning. They are for listing terms (<dt>) and their associated definitions (<dd... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18393/"
] | I've come across a few examples recently that do things like:
```html
<dl>
<dt>Full Name:</dt>
<dd><input type="text" name="fullname"></dd>
<dt>Email Address:</dt>
<dd><input type="text" name="email"></dd>
</dl>
```
for doing HTML forms. Why is that? What is the advantage over using tables? | I guess it's up to you to determine the semantics, but in my opinion:
Rather than a definition list, form-related properties should be used.
```html
<form>
<label for="fullname">Full Name:</label>
<input type="text" name="fullname" id="fullname">
<label for="email">Email Address:</label>
<input type="text" n... |
519,288 | <p>I need an example algorithm that will draw pixels one at a time on a grid based (x,y) system, and also color them based on an rbg value based on binary data that is provided in some form. I am looking for anything written in php or a php like language such as C, but that does not use any sort of library or graphics ... | [
{
"answer_id": 519302,
"author": "Scott Evernden",
"author_id": 11397,
"author_profile": "https://Stackoverflow.com/users/11397",
"pm_score": 2,
"selected": false,
"text": "<p>Not really sure i quite understand your question but .. PHP has GD functions that include image allocate and set... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63203/"
] | I need an example algorithm that will draw pixels one at a time on a grid based (x,y) system, and also color them based on an rbg value based on binary data that is provided in some form. I am looking for anything written in php or a php like language such as C, but that does not use any sort of library or graphics car... | It seem you are trying to output JavaScript commands for drawing on a `<canvas>` tag. A faster way to draw the pixels might be to use `moveTo` and `lineTo`. Btw, why isn't you outer loop a for loop as well?
Doesn't
```
for($row=0; $row<=$r_max; ++$row) {
for($column=0; $column<=$c_max; ++$column) {
# draw... |
519,300 | <p>I'm trying to do some basic paging in MSSQL. The problem I'm having is that I'm sorting the paging on a row that (potentially) has similar values, and the ORDER BY clause is returning "random" results, which doesn't work well.</p>
<p>So for example.</p>
<p>If I have three rows, and I'm sorting them by a "rating", ... | [
{
"answer_id": 519332,
"author": "tehvan",
"author_id": 61848,
"author_profile": "https://Stackoverflow.com/users/61848",
"pm_score": 3,
"selected": true,
"text": "<p>Try ordering by both, e.g.:\nORDER BY Rating DESC, DateEdit ASC</p>\n"
},
{
"answer_id": 520395,
"author": "A... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53084/"
] | I'm trying to do some basic paging in MSSQL. The problem I'm having is that I'm sorting the paging on a row that (potentially) has similar values, and the ORDER BY clause is returning "random" results, which doesn't work well.
So for example.
If I have three rows, and I'm sorting them by a "rating", and all of the ra... | Try ordering by both, e.g.:
ORDER BY Rating DESC, DateEdit ASC |
519,309 | <p>I want to read UTF-8 input in Perl, no matter if it comes from the standard input or from a file, using the diamond operator: <code>while(<>){...}</code>.</p>
<p>So my script should be callable in these two ways, as usual, giving the same output:</p>
<pre><code>./script.pl utf8.txt
cat utf8.txt | ./script.pl... | [
{
"answer_id": 519359,
"author": "Emmanuel Rodriguez",
"author_id": 59223,
"author_profile": "https://Stackoverflow.com/users/59223",
"pm_score": 7,
"selected": true,
"text": "<p>Try to use the pragma open instead:</p>\n\n<pre><code>use strict;\nuse warnings;\nuse open qw(:std :utf8);\n\... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60628/"
] | I want to read UTF-8 input in Perl, no matter if it comes from the standard input or from a file, using the diamond operator: `while(<>){...}`.
So my script should be callable in these two ways, as usual, giving the same output:
```
./script.pl utf8.txt
cat utf8.txt | ./script.pl
```
But the outputs differ! Only th... | Try to use the pragma open instead:
```
use strict;
use warnings;
use open qw(:std :utf8);
while(<>){
my @chars = split //, $_;
print "$_" foreach(@chars);
}
```
You need to do this because the <> operator is magical. As you know it will read from STDIN or from the files in @ARGV. Reading from STDIN causes ... |
519,314 | <p>At what stage does my input in the textarea change from being this raw text, and become HTML?
For example, say I indent 4 spaces</p>
<pre><code>like this
</code></pre>
<p>Then the WMD Showdown.js will render it properly below this textarea I type in. But the text area still literally contains </p>
<pre><code> ... | [
{
"answer_id": 519320,
"author": "Justin Yost",
"author_id": 657,
"author_profile": "https://Stackoverflow.com/users/657",
"pm_score": 1,
"selected": false,
"text": "<p>Well first of all StackOverflow is built on ASP.NET, but yes essentially the characters in the rich text box gets trans... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | At what stage does my input in the textarea change from being this raw text, and become HTML?
For example, say I indent 4 spaces
```
like this
```
Then the WMD Showdown.js will render it properly below this textarea I type in. But the text area still literally contains
```
like this
```
So is PHP server side... | There are some other posts here about this, but basically it works like this. Or at least this is how I do it on my website using WMD; see my profile if you're interested in checking out my WMD implementation.
1. User enters the Markdown on the client, and `showdown.js` runs in real time in the browser (pure client-si... |
519,324 | <p>What am I missing here?</p>
<p>I want to do a simple call to Select() like this:</p>
<pre><code>List<int> list = new List<int>();
//fill the list
List<int> selections = (List<int>)list.Select(i => i*i); //for example
</code></pre>
<p>And I keep having trouble casting it. What am I mi... | [
{
"answer_id": 519331,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 4,
"selected": true,
"text": "<p>Select() will return you an IEnumerable<int> type, you have to use the <a href=\"http://www.hookedonlin... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47630/"
] | What am I missing here?
I want to do a simple call to Select() like this:
```
List<int> list = new List<int>();
//fill the list
List<int> selections = (List<int>)list.Select(i => i*i); //for example
```
And I keep having trouble casting it. What am I missing? | Select() will return you an IEnumerable<int> type, you have to use the [ToList() operator](http://www.hookedonlinq.com/ToListOperator.ashx):
```
List<int> selections = list.Select(i => i*i).ToList();
``` |
519,336 | <p>I'm using YUI's browser history manager, and my browsers no longer report runtime errors. They will still show a parse error in the error console, but if I call a bogus function, for example, inside some event handler, the browser just stops all js processing it seems. Even firebug's debugger will just quit when I g... | [
{
"answer_id": 519331,
"author": "Christian C. Salvadó",
"author_id": 5445,
"author_profile": "https://Stackoverflow.com/users/5445",
"pm_score": 4,
"selected": true,
"text": "<p>Select() will return you an IEnumerable<int> type, you have to use the <a href=\"http://www.hookedonlin... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45767/"
] | I'm using YUI's browser history manager, and my browsers no longer report runtime errors. They will still show a parse error in the error console, but if I call a bogus function, for example, inside some event handler, the browser just stops all js processing it seems. Even firebug's debugger will just quit when I get ... | Select() will return you an IEnumerable<int> type, you have to use the [ToList() operator](http://www.hookedonlinq.com/ToListOperator.ashx):
```
List<int> selections = list.Select(i => i*i).ToList();
``` |
519,342 | <p>What is the usage of the -I and -L flags in a makefile?</p>
| [
{
"answer_id": 519356,
"author": "Nathan Fellman",
"author_id": 1084,
"author_profile": "https://Stackoverflow.com/users/1084",
"pm_score": 7,
"selected": false,
"text": "<p>These are typically part of the linker command line, and are either supplied directly in a target action, or more ... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52913/"
] | What is the usage of the -I and -L flags in a makefile? | These are typically part of the linker command line, and are either supplied directly in a target action, or more commonly assigned to a `make` variable that will be expanded to form link command. In that case:
`-L` is the path to the directories containing the libraries. A search path for libraries.
`-l` is the name... |
519,349 | <p>I'm working on a <strong>Firefox extension</strong> that will manipulate highlighted text.</p>
<p>On a stand-alone page, I can get the selected text with:</p>
<pre><code>selectedText = document.selection?document.selection.createRange().text;
</code></pre>
<p>Then I'd manipulate the selected text with string oper... | [
{
"answer_id": 519370,
"author": "Scott Evernden",
"author_id": 11397,
"author_profile": "https://Stackoverflow.com/users/11397",
"pm_score": 0,
"selected": false,
"text": "<p>you need to get the range object from your user selection:</p>\n\n<pre><code>var userSelection;\nif (window.getS... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1464733/"
] | I'm working on a **Firefox extension** that will manipulate highlighted text.
On a stand-alone page, I can get the selected text with:
```
selectedText = document.selection?document.selection.createRange().text;
```
Then I'd manipulate the selected text with string operations on the textarea in question. Unfortunat... | ```
selectedText = content.getSelection().toString();
``` |
519,395 | <p>Can someone help explain the following:</p>
<p>If I type:</p>
<pre><code>a=`ls -l`
</code></pre>
<p>Then the output of the ls command is saved in the variable <code>a</code></p>
<p>but if I try:</p>
<pre><code>a=`sh ./somefile`
</code></pre>
<p>The result is outputed to the shell (<code>stdout</code>) rather t... | [
{
"answer_id": 519418,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 5,
"selected": true,
"text": "<p>I think because the shell probably attaches itself to /dev/tty but I may be wrong. Why wouldn't you just set execute p... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519395",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14587/"
] | Can someone help explain the following:
If I type:
```
a=`ls -l`
```
Then the output of the ls command is saved in the variable `a`
but if I try:
```
a=`sh ./somefile`
```
The result is outputed to the shell (`stdout`) rather than the variable `a`
What I expected was the result operation of the shell trying to... | I think because the shell probably attaches itself to /dev/tty but I may be wrong. Why wouldn't you just set execute permissions on the script and use:
```
a=`./somefile`
```
If you want to capture stderr **and** stdout to a, just use:
```
a=`./somefile 2>&1`
```
To check file is executable first:
```
if [[ -x .... |
519,404 | <p>Im looking for a way to delete Windows restore points using C# perhaps by invoking WMI.</p>
<p>Any code snippet would be very helpful.</p>
| [
{
"answer_id": 519601,
"author": "Morten Christiansen",
"author_id": 4055,
"author_profile": "https://Stackoverflow.com/users/4055",
"pm_score": 0,
"selected": false,
"text": "<p>While I know nothing about WMI, <a href=\"http://www.csharphelp.com/archives2/archive334.html\" rel=\"nofollo... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519404",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/254/"
] | Im looking for a way to delete Windows restore points using C# perhaps by invoking WMI.
Any code snippet would be very helpful. | Touching on what Morten said you can use that API. WMI doesn't provide a method to delete a Restore Point as far as I can tell. The SRRemoveRestorePoint can remove a restore point, provided you have the sequence number. You can get that through WMI. Here is my code to Remove a restore point.
```
[DllImport("Srclient.d... |
519,410 | <p>What is the best way to find out where notepad.exe and mspaint.exe are that will work across various versions of Windows?</p>
<p>Should I get the Windows directory via <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx" rel="noreferrer"><code>SHGetFolderPath(NULL, CSIDL_WINDOWS... | [
{
"answer_id": 519428,
"author": "tehvan",
"author_id": 61848,
"author_profile": "https://Stackoverflow.com/users/61848",
"pm_score": 0,
"selected": false,
"text": "<p>Try opening a DOS prompt, change to the Windows folder and do:</p>\n\n<pre><code>dir notepad.exe /s\n</code></pre>\n\n<p... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519410",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6904/"
] | What is the best way to find out where notepad.exe and mspaint.exe are that will work across various versions of Windows?
Should I get the Windows directory via [`SHGetFolderPath(NULL, CSIDL_WINDOWS, NULL, SHGFP_TYPE_CURRENT, dir)`](https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181(v=vs.85).aspx), and ... | This works on every Windows box I've got access to (XP+).
```
c:\> for %i in (cmd.exe) do @echo %~$PATH:i
C:\WINDOWS\system32\cmd.exe
c:\> for %i in (python.exe) do @echo %~$PATH:i
C:\Python25\python.exe
```
The great thing is, you don't *have* to use the actual `%PATH%`, you can substitute your own search path by ... |
519,413 | <p>i'm pretty sure it's not possible, but i'll throw this out there anyways. </p>
<p>I have about 10 asp:checkbox controls on the page, and I need to go and update the database every time any of them gets checked/unchecked. </p>
<p>Right now i have all of them tied to one event handler that fires on CheckedChanged, ... | [
{
"answer_id": 519426,
"author": "colithium",
"author_id": 61332,
"author_profile": "https://Stackoverflow.com/users/61332",
"pm_score": 0,
"selected": false,
"text": "<p>You could inherit from it and add the property you need.</p>\n\n<p>Or use a Dictionary to map control IDs to your dat... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3661/"
] | i'm pretty sure it's not possible, but i'll throw this out there anyways.
I have about 10 asp:checkbox controls on the page, and I need to go and update the database every time any of them gets checked/unchecked.
Right now i have all of them tied to one event handler that fires on CheckedChanged, then i cast the se... | Why not make your own custom server checkbox control.
```
namespace CustomControls
{
public class CustomCheckBox : CheckBox
{
string _myValue;
public string MyValue
{
get { return _myValue; }
set { _myValue = value; }
}
public CustomCheckBox()
{
... |
519,422 | <p>This question is motivated by something I've lately started to see a bit too often, the <code>if..else if..else</code> structure. While it's simple and has its uses, something about it keeps telling me again and again that it could be substituted with something that's more fine-grained, elegant and just generally ea... | [
{
"answer_id": 519434,
"author": "fmsf",
"author_id": 26004,
"author_profile": "https://Stackoverflow.com/users/26004",
"pm_score": 2,
"selected": false,
"text": "<p>Use a switch/case it's cleaner :p</p>\n"
},
{
"answer_id": 519438,
"author": "colithium",
"author_id": 613... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519422",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44523/"
] | This question is motivated by something I've lately started to see a bit too often, the `if..else if..else` structure. While it's simple and has its uses, something about it keeps telling me again and again that it could be substituted with something that's more fine-grained, elegant and just generally easier to keep u... | These constructs can often be replaced by polymorphism. This will give you shorter and less brittle code. |
519,449 | <p>I'm currently using a combination of CSS and Div tags to achieve rounded corners on a text element. This is the CSS I'm using:</p>
<pre><code>div#installerSearch {
float: left;
position: relative;
color: #000055;
width: 154px;
border: 1px solid #2A5390;
padding: 8px;
background-image: ur... | [
{
"answer_id": 519463,
"author": "vava",
"author_id": 6258,
"author_profile": "https://Stackoverflow.com/users/6258",
"pm_score": 0,
"selected": false,
"text": "<p>You can write JavaScript that will add those divs for you. But it's a huge problem in CSS, it does depend on the content any... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19521/"
] | I'm currently using a combination of CSS and Div tags to achieve rounded corners on a text element. This is the CSS I'm using:
```
div#installerSearch {
float: left;
position: relative;
color: #000055;
width: 154px;
border: 1px solid #2A5390;
padding: 8px;
background-image: url('images/back... | Short answer: there is [not currently a well-supported CSS-only](http://www.css3.info/preview/rounded-border/) way to do this.
If you can't wait around for CSS3 support, you may want to look in to JavaScript alternatives. [Nifty Corners Cube](http://www.html.it/articoli/niftycube/index.html) will add rounded corners, ... |
519,456 | <p>Why does the SQL Standard accept this? Which are the benefits?</p>
<p>If have those tables:</p>
<pre><code>create table prova_a (a number, b number);
alter table prova_a add primary key (a,b);
create table prova_b (a number, b number);
alter table prova_b add foreign key (a,b) references prova_a(a,b) ;
insert into... | [
{
"answer_id": 519466,
"author": "colithium",
"author_id": 61332,
"author_profile": "https://Stackoverflow.com/users/61332",
"pm_score": 2,
"selected": false,
"text": "<p>I know some DBMSs simply don't enforce referential integrity when it comes to foreign keys with foreign key constrain... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519456",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40441/"
] | Why does the SQL Standard accept this? Which are the benefits?
If have those tables:
```
create table prova_a (a number, b number);
alter table prova_a add primary key (a,b);
create table prova_b (a number, b number);
alter table prova_b add foreign key (a,b) references prova_a(a,b) ;
insert into prova_a values (1,2... | I know some DBMSs simply don't enforce referential integrity when it comes to foreign keys with foreign key constraints. SQLite comes to mind. It's talked about [here](http://www.sqlite.org/cvstrac/wiki?p=ForeignKeyTriggers).
Other DBMSs are different, I know that MS SQL Server will complain if you attempt something l... |
519,457 | <p>I used scaffold to create a model and controller. It worked well. Then I started editing/removing some of the controller actions. So I made participations/new > participations/signup.</p>
<p>This does not work, it says "Unkown action" but it does say it has the action signup. Funny thing is if I go to Participation... | [
{
"answer_id": 519480,
"author": "StevenMcD",
"author_id": 38595,
"author_profile": "https://Stackoverflow.com/users/38595",
"pm_score": 0,
"selected": false,
"text": "<p>If I remember correctly, RoR is case sensitive, so make sure your controller starts with a lowercase \"p\" and any ac... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519457",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I used scaffold to create a model and controller. It worked well. Then I started editing/removing some of the controller actions. So I made participations/new > participations/signup.
This does not work, it says "Unkown action" but it does say it has the action signup. Funny thing is if I go to Participations/signup u... | You need to edit the config/routes.rb file, too and tell Rails how should it handle the participations/signup route. In your routes.rb file you should have something like:
```
map.resources :participations
```
you will have to add a new rule for this:
```
map.signup '/participations/signup', :controller => 'partici... |
519,461 | <p>I thought that to clone a List you would just call:</p>
<pre><code>List<int> cloneList = new List<int>(originalList);
</code></pre>
<p>But I tried that in my code and I seem to be getting effects that imply the above is simply doing:</p>
<p>cloneList = originalList... because changes to cloneList se... | [
{
"answer_id": 519465,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": false,
"text": "<p>This would work...</p>\n\n<pre><code>List<Foo> cloneList = new List<Foo>(originalList);\n</code></pre>... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519461",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47630/"
] | I thought that to clone a List you would just call:
```
List<int> cloneList = new List<int>(originalList);
```
But I tried that in my code and I seem to be getting effects that imply the above is simply doing:
cloneList = originalList... because changes to cloneList seem to be affecting originalList.
So what is th... | You can use the below code to make a deep copy of the list or any other object supporting serialization:
Also you can use this for any version of .NET framework from v 2.0 and above, and the similar technique can be applied (removing the usage of generics) and used in 1.1 as well
```
public static class GenericCopier... |
519,467 | <p>First of all many thanks for clicking into my question.</p>
<p>I have a few UIImageView and a NSMutableArray</p>
<p>at .h</p>
<pre><code>{
IBOutlet UIImageView *img1;
IBOutlet UIImageView *img2;
IBOutlet UIImageView *img3;
NSMutable Array *aImg;
}
@property(nonatomic, retian) IBOutlet UIImageView ... | [
{
"answer_id": 519495,
"author": "Adam Ernst",
"author_id": 79,
"author_profile": "https://Stackoverflow.com/users/79",
"pm_score": 0,
"selected": false,
"text": "<p>You want to retain the array you're creating, otherwise it is released immediately afterwards.</p>\n\n<pre><code>-(void)vi... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63226/"
] | First of all many thanks for clicking into my question.
I have a few UIImageView and a NSMutableArray
at .h
```
{
IBOutlet UIImageView *img1;
IBOutlet UIImageView *img2;
IBOutlet UIImageView *img3;
NSMutable Array *aImg;
}
@property(nonatomic, retian) IBOutlet UIImageView *img1;
@property(nonatomic, ... | Was it an EXC BAD ACCESS error? I bet it was. This is caused when you try to access an object that has been deleted, or deallocated, from memory.
This line:
```
aImg = [NSMutableArray arrayWithObjects: img1, img2, img3, nil];
```
returns an array object set to autorelease. This means that after the event that caus... |
519,484 | <p>When trying to display a byte stream from HLDS (Half-Life Dedicated Server) in a textbox, it displays strange blocky question mark characters that look something like this:</p>
<pre><code>[?]
</code></pre>
<p>Here's a sample line from the byte stream (with [?] in place of the strange character):</p>
<pre><code>CP... | [
{
"answer_id": 519977,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know of a collection data type library for ActionScript 3/Flex but I would surely appreciate it.</p... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519484",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63229/"
] | When trying to display a byte stream from HLDS (Half-Life Dedicated Server) in a textbox, it displays strange blocky question mark characters that look something like this:
```
[?]
```
Here's a sample line from the byte stream (with [?] in place of the strange character):
```
CPU In Out Uptime Users FPS ... | The [as3ds](http://code.google.com/p/as3ds/) project has a bunch of [collections classes](http://code.google.com/p/as3ds/source/browse/#svn/trunk/src/de/polygonal/ds) for AS3. Haven't used them myself but they look very capable (and I might add, focused on performance). Uses the MIT license.
[Maashaack](http://code.go... |
519,496 | <p>I am trying to learn how to best use Cucumber + Selenium. For the most part it seems to be very straight forward but I would like to get some guidance on how to test dialogs. Basically I need to implement:</p>
<pre><code>assert !60.times{
break if ("Other Income" == @selenium.get_text("//form[@id='new_account']/... | [
{
"answer_id": 673253,
"author": "fidothe",
"author_id": 81402,
"author_profile": "https://Stackoverflow.com/users/81402",
"pm_score": 2,
"selected": false,
"text": "<p>Look at <a href=\"https://github.com/cucumber/cucumber/wiki/setting-up-selenium\" rel=\"nofollow noreferrer\">https://g... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519496",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63230/"
] | I am trying to learn how to best use Cucumber + Selenium. For the most part it seems to be very straight forward but I would like to get some guidance on how to test dialogs. Basically I need to implement:
```
assert !60.times{
break if ("Other Income" == @selenium.get_text("//form[@id='new_account']/h3") rescue f... | To update this answer a bit, I'd highly recommend using Capybara:
<http://github.com/jnicklas/capybara>
Being able to use javascript is just a `gem install` away! |
519,509 | <p>Does anybody know of a library or piece of software out there that will locate irregularities in text? For example, lets say I have...</p>
<pre>
1. Name 1, Comment
2. Name 2, Comment
3. Name 3 , Comment
5. Name 10, Comment
</pre>
<p>This software or library would first cut up portions of text that it would find si... | [
{
"answer_id": 519553,
"author": "yk4ever",
"author_id": 63227,
"author_profile": "https://Stackoverflow.com/users/63227",
"pm_score": 2,
"selected": false,
"text": "<p>If you are into Python, you might try <a href=\"http://docs.python.org/library/difflib.html\" rel=\"nofollow noreferrer... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56539/"
] | Does anybody know of a library or piece of software out there that will locate irregularities in text? For example, lets say I have...
```
1. Name 1, Comment
2. Name 2, Comment
3. Name 3 , Comment
5. Name 10, Comment
```
This software or library would first cut up portions of text that it would find similar (much a... | Depending on what sort of real life irregularities you want to find or correct this problem is radically different.
Here is your example updated with real text:
```
1. Lazarus Long, Get the first shot off fast.
2. Hiro Protagonist, Greatest swordfighter[sic] in the world.
3. Alice , Down the rabbit hole.
5. Orem, Sin... |
519,515 | <p>How can polymorphism replace an if-else statement or Switch inside of a loop? In particular can it always replace an if-else? Most of the if-thens I use inside of loops are arithmetic comparisons. This question is spawned from this <a href="https://stackoverflow.com/questions/519422/what-is-the-best-way-to-replace-o... | [
{
"answer_id": 519534,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 2,
"selected": false,
"text": "<p>Polymorphism is not really applicable in the example you provided.</p>\n\n<p>See this <a href=\"https://stackoverfl... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13491/"
] | How can polymorphism replace an if-else statement or Switch inside of a loop? In particular can it always replace an if-else? Most of the if-thens I use inside of loops are arithmetic comparisons. This question is spawned from this [question](https://stackoverflow.com/questions/519422/what-is-the-best-way-to-replace-or... | Polymorphism usually replaces switch statements when each case corresponds to a different type. So instead of having:
```
public class Operator
{
string operation;
public int Execute(int x, int y)
{
switch(operation)
{
case "Add":
return x + y;
... |
519,538 | <p>I'm subclassing the standard ListBox control. I get notified of changes to any of the elements added to the list. The task is to update the text shown by the ListBox for the changing element.</p>
<p>I'm aware that i could just remove the changed element and add it again, but this seems not preferable for obvious re... | [
{
"answer_id": 519547,
"author": "Anton Gogolev",
"author_id": 60188,
"author_profile": "https://Stackoverflow.com/users/60188",
"pm_score": 1,
"selected": false,
"text": "<p>Why don't you manually update Text of an item in question? You might also consider rolling out your own databindi... | 2009/02/06 | [
"https://Stackoverflow.com/questions/519538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39590/"
] | I'm subclassing the standard ListBox control. I get notified of changes to any of the elements added to the list. The task is to update the text shown by the ListBox for the changing element.
I'm aware that i could just remove the changed element and add it again, but this seems not preferable for obvious reasons. | Unfortunately, the data-binding in `ListView` doesn't support regular (item) change notification events (`FooChanged` / `INotifyPropertyChanged`). However, if you know about the change, you can get the list to re-bind itself. Since you are subclassing, you can call:
```
this.RefreshItems();
```
or for a single item:... |