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 |
|---|---|---|---|---|---|---|
524,498 | <p>In this example the .Stub returns a new memory stream. The same memory stream is returned both times. What I want is a new memory stream every time. My question is, how do I change the .Stub in order to make this test pass?</p>
<pre><code>[TestMethod]
public void Meh()
{
var mockFileSystem = MockRepository.G... | [
{
"answer_id": 526081,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Depending on what version you are using there is an implicity Repeat.Once or Repeat.Any - From your test i think it is a Re... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61311/"
] | In this example the .Stub returns a new memory stream. The same memory stream is returned both times. What I want is a new memory stream every time. My question is, how do I change the .Stub in order to make this test pass?
```
[TestMethod]
public void Meh()
{
var mockFileSystem = MockRepository.GenerateMock<IFile... | The trick is to use WhenCalled to replace the previous Return operation:
```
[TestMethod]
public void Meh()
{
var mockFileSystem = MockRepository.GenerateMock<IFileSystemService>();
mockFileSystem.Stub(fs => fs.CreateFileStream(null, FileMode.Append, FileAccess.Write, FileShare.None))
.IgnoreArguments(... |
524,524 | <p>I am trying to create a c++ ostream for educational reasons. My test will be creating an ostream that acts like a ofstream would except instead of writing to a file it would write to a deque or vector container.</p>
| [
{
"answer_id": 524542,
"author": "Martin York",
"author_id": 14065,
"author_profile": "https://Stackoverflow.com/users/14065",
"pm_score": 2,
"selected": false,
"text": "<p>Use std::stringstream</p>\n\n<pre><code>#include <iostream>\n#include <sstream>\nint main()\n{\n std... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524524",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to create a c++ ostream for educational reasons. My test will be creating an ostream that acts like a ofstream would except instead of writing to a file it would write to a deque or vector container. | As it is for education, as you say, i will show you how i would do such a thingy. Otherwise, `stringstream` is really the way to go.
Sounds like you want to create a streambuf implementation that then writes to a vector / deque. Something like this (copying from another answer of me that [targeted a /dev/null stream]... |
524,525 | <p>For example, there is this website: www.azet.sk</p>
<p>On the right, there is login and password, I'd like my application to login to this web application and retrieve the data from my own account to C# (.NET) application and work with it. The aim is to keep the "logged in" connection alive and send vars using POST... | [
{
"answer_id": 524565,
"author": "Brannon",
"author_id": 5745,
"author_profile": "https://Stackoverflow.com/users/5745",
"pm_score": 2,
"selected": false,
"text": "<p>The login part should be relatively easy.</p>\n\n<p>Use <code>System.Net.WebClient</code> and the <code>UploadValues()</c... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21209/"
] | For example, there is this website: www.azet.sk
On the right, there is login and password, I'd like my application to login to this web application and retrieve the data from my own account to C# (.NET) application and work with it. The aim is to keep the "logged in" connection alive and send vars using POST method. I... | ```
string username = "your";
string password = "password";
HttpWebRequest request = (HttpWebRequest)WebRequest.Create("https://moje.azet.sk/prihlasenie.phtml?KDE=www.azet.sk%2Findex.phtml%3F");
using (StreamWriter writer = new StreamWriter(request.GetRequestStream(), Encoding.ASCII))
{
writer.Write("nick=" + usern... |
524,528 | <p><code>Html.Encode</code> seems to simply call <code>HttpUtility.HtmlEncode</code> to replace a few html specific characters with their escape sequences.</p>
<p>However this doesn't provide any consideration for how new lines and multiple spaces will be interpretted (markup whitespace). So I provide a text area for ... | [
{
"answer_id": 524554,
"author": "Brannon",
"author_id": 5745,
"author_profile": "https://Stackoverflow.com/users/5745",
"pm_score": 6,
"selected": true,
"text": "<p><code>HtmlEncode</code> is only meant to encode characters for display in HTML. It specifically does not encode whitespac... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `Html.Encode` seems to simply call `HttpUtility.HtmlEncode` to replace a few html specific characters with their escape sequences.
However this doesn't provide any consideration for how new lines and multiple spaces will be interpretted (markup whitespace). So I provide a text area for the a user to enter a plain text... | `HtmlEncode` is only meant to encode characters for display in HTML. It specifically does not encode whitespace characters.
I would go with your first option, and make it an extension method for HtmlHelper. Something like:
```
public static string HtmlEncode(this HtmlHelper htmlHelper,
... |
524,541 | <p>Exact duplicate: <a href="https://stackoverflow.com/questions/79968/split-a-string-by-spaces-in-python">Split a string by spaces -- preserving quoted substrings -- in Python</a></p>
<hr>
<p>I want to take in a string and return a list, dictionary or tuple of values as separated by spaces. However, I want to not ma... | [
{
"answer_id": 524564,
"author": "Jonas",
"author_id": 24946,
"author_profile": "https://Stackoverflow.com/users/24946",
"pm_score": 1,
"selected": false,
"text": "<p>This problem sounds a lot like parsing tag input, you could take a look at django-tagging <a href=\"http://code.google.co... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | Exact duplicate: [Split a string by spaces -- preserving quoted substrings -- in Python](https://stackoverflow.com/questions/79968/split-a-string-by-spaces-in-python)
---
I want to take in a string and return a list, dictionary or tuple of values as separated by spaces. However, I want to not match spaces that are so... | ```
def splitstring(string):
"""
>>> string = 'apple orange "banana tree" green'
>>> splitstring(string)
['apple', 'orange', 'green', '"banana tree"']
"""
import re
p = re.compile(r'"[\w ]+"')
quoted_item = p.search(string).group()
newstring = p.sub('', string)
return newstring.s... |
524,548 | <p>In my Python application, I need to write a regular expression that matches a C++ <code>for</code> or <code>while</code> loop that has been terminated with a semi-colon (<code>;</code>). For example, it should match this:</p>
<pre><code>for (int i = 0; i < 10; i++);
</code></pre>
<p>... but not this:</p>
<pre>... | [
{
"answer_id": 524562,
"author": "Jesse Beder",
"author_id": 112,
"author_profile": "https://Stackoverflow.com/users/112",
"pm_score": 5,
"selected": false,
"text": "<p>This is the kind of thing you really shouldn't do with a regular expression. Just parse the string one character at a t... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1304/"
] | In my Python application, I need to write a regular expression that matches a C++ `for` or `while` loop that has been terminated with a semi-colon (`;`). For example, it should match this:
```
for (int i = 0; i < 10; i++);
```
... but not this:
```
for (int i = 0; i < 10; i++)
```
This looks trivial at first glan... | You could write a little, very simple routine that does it, without using a regular expression:
* Set a position counter `pos` so that is points to just before the opening bracket after your `for` or `while`.
* Set an open brackets counter `openBr` to `0`.
* Now keep incrementing `pos`, reading the characters at the r... |
524,559 | <p>In .NET 2.0 (in this case VB), is there a standard API that'll serialize a DataSet object into a stream that can be saved as a tab-delimited file and opened directly in Excel? Or does one have to create the delimited file manually by iterating through the members of the table collection? </p>
<p>In this case, the... | [
{
"answer_id": 524561,
"author": "Malfist",
"author_id": 12243,
"author_profile": "https://Stackoverflow.com/users/12243",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/system.data.dataset.writexml.aspx\" rel=\"nofollow noreferrer\">DataS... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32129/"
] | In .NET 2.0 (in this case VB), is there a standard API that'll serialize a DataSet object into a stream that can be saved as a tab-delimited file and opened directly in Excel? Or does one have to create the delimited file manually by iterating through the members of the table collection?
In this case, the DataSet's s... | There is an ADO.NET provider for Excel.
This means, if you have a dataset, you can employ two DataAdapters to move data from one place to another: from Oracle to Excel, from SQL to Excel, from Excel to Oracle, etc.
Fill a DataSet from the source with the first DA, then Update the destination with the second DA. The Da... |
524,567 | <p>If I have something like:</p>
<pre><code>var query = from children in _data.Children
where children.ChildId == childId
select new CustomModel.MyChild
{
ChildId = children.ChildId,
Name = children.ChildName
};
return query.FirstOrDefault();
</code></pre>
<p>Where I want the resultan... | [
{
"answer_id": 524576,
"author": "flq",
"author_id": 51428,
"author_profile": "https://Stackoverflow.com/users/51428",
"pm_score": 0,
"selected": false,
"text": "<p>If you wanted you could write \"select 1\" or in your case \"CreateMyCustomChild(children)\" since \"children\" is containi... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31412/"
] | If I have something like:
```
var query = from children in _data.Children
where children.ChildId == childId
select new CustomModel.MyChild
{
ChildId = children.ChildId,
Name = children.ChildName
};
return query.FirstOrDefault();
```
Where I want the resultant object to be my custom m... | It really depends on what version of LINQ you're using. If you're using LINQ to SQL, I don't believe you can call arbitrary methods in the query. The query translator wouldn't know what to do with the method call
If you're using LINQ to Objects, you're absolutely fine to do it, like this:
```
var query = from childre... |
524,582 | <p>I have two forms. </p>
<p>Form A has three text input; A1, A2, A3. Form B has one text input, B1.</p>
<p>Whenever you type in any of the inputs on Form A, Form B should get updated, right away, with all three inputs from Form A. If one of the Form A inputs is empty, a 0 should replace it in B1.</p>
<p>For exam... | [
{
"answer_id": 524613,
"author": "gnud",
"author_id": 27204,
"author_profile": "https://Stackoverflow.com/users/27204",
"pm_score": 1,
"selected": false,
"text": "<p>A start, using <a href=\"http://prototypejs.org\" rel=\"nofollow noreferrer\">prototype.js</a></p>\n\n<pre><code>function ... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524582",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have two forms.
Form A has three text input; A1, A2, A3. Form B has one text input, B1.
Whenever you type in any of the inputs on Form A, Form B should get updated, right away, with all three inputs from Form A. If one of the Form A inputs is empty, a 0 should replace it in B1.
For example, if I'm typing "test" i... | Add a method to the onChange event of each input on the A form such as: onChange=populateBField();
```
Function populateBField(){
document.formB.B1.value = getFieldContents("A1") + "+" + getFieldContents("A2")
+ "+" + getFieldContents("A3");
}
function getFieldContents(fieldName){
var fieldValue = document.form... |
524,591 | <p>I'm doing something really simple: slurping an entire text file from disk into a <code>std::string</code>. My current code basically does this:</p>
<pre><code>std::ifstream f(filename);
return std::string(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());
</code></pre>
<p>It's very u... | [
{
"answer_id": 524607,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 2,
"selected": false,
"text": "<p>What happens to the performance if you try doing that? Instead of asking \"which way is faster?\" you can think \"hey,... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524591",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30579/"
] | I'm doing something really simple: slurping an entire text file from disk into a `std::string`. My current code basically does this:
```
std::ifstream f(filename);
return std::string(std::istreambuf_iterator<char>(f), std::istreambuf_iterator<char>());
```
It's very unlikely that this will ever have any kind of perf... | I benchmarked your implementation(1), mine(2), and two others(3 and 4) that I found on stackoverflow.
Results (Average of 100 runs; timed using gettimeofday, file was 40 paragraphs of lorem ipsum):
* readFile1: 764
* readFile2: 104
* readFile3: 129
* readFile4: 402
The implementations:
```
string readFile1(const st... |
524,603 | <p>I have some e-commerce code that I use often that uses Linq To SQL for saving orders to the database. I want to remove the tightly coupled Linq to SQL bit and pass in an IRepository instead but I am still a little confused on things.</p>
<p>Say I have a GetCustomer() method on my ICustomerRepository that returns a... | [
{
"answer_id": 524610,
"author": "ssmith",
"author_id": 13729,
"author_profile": "https://Stackoverflow.com/users/13729",
"pm_score": 1,
"selected": false,
"text": "<p>You can have it return a Customer as long as Customer is a plain old .NET object, and not some db-generated entity. You... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34548/"
] | I have some e-commerce code that I use often that uses Linq To SQL for saving orders to the database. I want to remove the tightly coupled Linq to SQL bit and pass in an IRepository instead but I am still a little confused on things.
Say I have a GetCustomer() method on my ICustomerRepository that returns a Customer o... | If you want your Customer class to be a plain object with no attachment to LINQ, then you will most likely need to write a mapper method to convert your LINQ-based Customer object to your plain Customer domain object. LINQ to SQL does not have such functionality built-in.
I have begun to wrap my mapping methods in an ... |
524,616 | <p>I'm trying to learn Ocaml by working on <a href="https://projecteuler.net/problem=18" rel="nofollow noreferrer">Problem 18</a> from Project Euler. I know what I want to do, I just can't figure out <em>how</em> to do it.</p>
<p>I've got three lists:</p>
<pre><code>let list1 = [1;2;3;4;5];;
let list2 = [ 6;7;8;9];;... | [
{
"answer_id": 524748,
"author": "Norman Ramsey",
"author_id": 41661,
"author_profile": "https://Stackoverflow.com/users/41661",
"pm_score": 3,
"selected": false,
"text": "<p>Well, I think you haven't grasped the essence of functional programming: instead of calling <code>List.append</co... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63741/"
] | I'm trying to learn Ocaml by working on [Problem 18](https://projecteuler.net/problem=18) from Project Euler. I know what I want to do, I just can't figure out *how* to do it.
I've got three lists:
```
let list1 = [1;2;3;4;5];;
let list2 = [ 6;7;8;9];;
let line = [9999];;
```
I want to add the numbers list2 to the ... | Well, I think you haven't grasped the essence of functional programming: instead of calling `List.append` and throwing the value away, you need to pass that value as the parameter `accum` to the recursive call.
I would tackle this problem by decoupling the triangle geometry from the arithmetic. The first function take... |
524,625 | <p>I have moved an sql database from one server to a new one (detached/attached)</p>
<p>Now i experience some strange behavior as it does not work but NO error is displayed.</p>
<p>This is the code</p>
<pre><code><%
const database_dsn="PROVIDER=SQLNCLI10; SERVER=FR-2626\SQLLOP;DATABASE=Lop;Uid=admin-sql;Pwd=xxxx;... | [
{
"answer_id": 524662,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>Oh i partially found the answer for the error display.</p>\n\n<p>In the Debug pane of the IIS directory configuration, Enab... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524625",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have moved an sql database from one server to a new one (detached/attached)
Now i experience some strange behavior as it does not work but NO error is displayed.
This is the code
```
<%
const database_dsn="PROVIDER=SQLNCLI10; SERVER=FR-2626\SQLLOP;DATABASE=Lop;Uid=admin-sql;Pwd=xxxx;"
response.write "Step 0//"
... | Oh i partially found the answer for the error display.
In the Debug pane of the IIS directory configuration, Enable ASP debugging should NOT be checked...althought i thougth it should... |
524,633 | <p>How can I avoid name mangling in C++?</p>
| [
{
"answer_id": 524635,
"author": "Crashworks",
"author_id": 53543,
"author_profile": "https://Stackoverflow.com/users/53543",
"pm_score": 3,
"selected": false,
"text": "<p>You mean so you can export your function from a library?\n<a href=\"http://www.devx.com/tips/Tip/12527\" rel=\"nofol... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63679/"
] | How can I avoid name mangling in C++? | You can't. It's built into compilers to allow you overloading functions and to have functions with the same name in different classes and such stuff. But you can write functions that are mangled like C functions. Those can be called from C code. But those can't be overloaded and can't be called by "normal" C++ function... |
524,641 | <p>For educational purposes I want to create a ostream and stream buffer to do: </p>
<ol>
<li>fix endians when doing << myVar; </li>
<li>store in a deque container instead of using std:cout or writing to a file </li>
<li>log extra data, such as how many times I did <<, how many times I did .write, the amou... | [
{
"answer_id": 528460,
"author": "Sol",
"author_id": 27029,
"author_profile": "https://Stackoverflow.com/users/27029",
"pm_score": 1,
"selected": false,
"text": "<p>I'm not sure that what you want to do is possible. The <code><<</code> operators are not virtual. So you could defi... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524641",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | For educational purposes I want to create a ostream and stream buffer to do:
1. fix endians when doing << myVar;
2. store in a deque container instead of using std:cout or writing to a file
3. log extra data, such as how many times I did <<, how many times I did .write, the amount of bytes I written and how many time... | The canonical approach consists in defining your own streambuf.
You should have a look at:
* [Angelika LAnger's articles](http://www.angelikalanger.com/Articles/Topics.html#CPP) on IOStreams derivation
* [James Kanze's articles](http://gabisoft.free.fr/articles-en.html) on filtering streambufs
* [boost.iostream](http:... |
524,647 | <p>I started off by drafting a question: "What is the best way to perform unit testing on a constructor (e.g., __construct() in PHP5)", but when reading through the related questions, I saw several comments that seemed to suggest that setting member variables or performing any complicated operations in the constructor ... | [
{
"answer_id": 524668,
"author": "Ólafur Waage",
"author_id": 22459,
"author_profile": "https://Stackoverflow.com/users/22459",
"pm_score": -1,
"selected": false,
"text": "<p>You should not put things in a constructor that is only supposed to run once when the class is created.</p>\n\n<p... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49529/"
] | I started off by drafting a question: "What is the best way to perform unit testing on a constructor (e.g., \_\_construct() in PHP5)", but when reading through the related questions, I saw several comments that seemed to suggest that setting member variables or performing any complicated operations in the constructor a... | This comes up quite a lot in C++ discussions, and the general conclusion I've come to there has been this:
If an object does not acquire any external resources, members *must* be initialized *in* the constructor. This involves doing all work in the constructor.
* (x, y) coordinate (or really any other structure that'... |
524,658 | <p>Just wondering what <code>!!</code> is in Ruby.</p>
| [
{
"answer_id": 524687,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 8,
"selected": true,
"text": "<p>Not not.</p>\n<p>It's used to convert a value to a boolean:</p>\n<pre><code>!!nil #=> false\n!!"abc" #... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63748/"
] | Just wondering what `!!` is in Ruby. | Not not.
It's used to convert a value to a boolean:
```
!!nil #=> false
!!"abc" #=> true
!!false #=> false
```
It's usually not necessary to use though since the only false values to Ruby are `nil` and `false`, so it's usually best to let that convention stand.
Think of it as
```
!(!some_val)
```
One thing th... |
524,666 | <p>I want to code an auto bot for an online game (tribalwars.net). I'm learning C# in school, but haven't covered networking yet. </p>
<p>Is it possible to make HTTP POSTs though C#? Can anyone provide an example?</p>
| [
{
"answer_id": 524684,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.csharpfriends.com/Forums/ShowPost.aspx?PostID=32254\" rel=\"nofollow noreferrer\">Here's</a> a... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524666",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to code an auto bot for an online game (tribalwars.net). I'm learning C# in school, but haven't covered networking yet.
Is it possible to make HTTP POSTs though C#? Can anyone provide an example? | Trivial with [System.Net.WebClient](http://msdn.microsoft.com/en-us/library/system.net.webclient.aspx):
```
using(WebClient client = new WebClient()) {
string responseString = client.UploadString(address, requestString);
}
```
There is also:
* UploadData - binary (`byte[]`)
* UploadFile - from a file
* UploadVa... |
524,696 | <p>I'm looking for a way to insert a <code><style></code> tag into an HTML page with JavaScript.</p>
<p>The best way I found so far:</p>
<pre><code>var divNode = document.createElement("div");
divNode.innerHTML = "<br><style>h1 { background: red; }</style>";
document.body.appendChild(divNode);... | [
{
"answer_id": 524715,
"author": "Tom",
"author_id": 20,
"author_profile": "https://Stackoverflow.com/users/20",
"pm_score": 5,
"selected": false,
"text": "<p>I'm assuming that you're wanting to insert a <code>style</code> tag versus a <code>link</code> tag (referencing an external CSS),... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524696",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking for a way to insert a `<style>` tag into an HTML page with JavaScript.
The best way I found so far:
```
var divNode = document.createElement("div");
divNode.innerHTML = "<br><style>h1 { background: red; }</style>";
document.body.appendChild(divNode);
```
This works in Firefox, Opera and Internet Explore... | Try adding the `style` element to the `head` rather than the `body`.
This was tested in IE (7-9), Firefox, Opera and Chrome:
```
var css = 'h1 { background: red; }',
head = document.head || document.getElementsByTagName('head')[0],
style = document.createElement('style');
head.appendChild(style);
style.type... |
524,698 | <p>I'm reading the second edition of K&R book and one of the exercises requires printing all maximum integer values defined in limits.h header. However, this...</p>
<pre><code>printf("unsigned int: 0 to %d\n", UINT_MAX);
</code></pre>
<p>... outputs the following:</p>
<pre><code>unsigned int: 0 to -1
</code></pr... | [
{
"answer_id": 524705,
"author": "Jarin Udom",
"author_id": 574,
"author_profile": "https://Stackoverflow.com/users/574",
"pm_score": 3,
"selected": false,
"text": "<p>In the printf, I believe %d is a signed decimal integer, try %u instead.</p>\n\n<p>The max value of an unsigned int has ... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56463/"
] | I'm reading the second edition of K&R book and one of the exercises requires printing all maximum integer values defined in limits.h header. However, this...
```
printf("unsigned int: 0 to %d\n", UINT_MAX);
```
... outputs the following:
```
unsigned int: 0 to -1
```
How come I get -1? Anyone could explain this b... | This is because UINT\_MAX resolves to -1 if treated as a signed integer. The reason for this is, that integers are represented in [two's-complement](http://en.wikipedia.org/wiki/Two%27s_complement). As a consequence, -1 and 4294967296 (i.e. UINT\_MAX) have the same bit representation (0xFFFFFFFF, i.e. all bits set) and... |
524,714 | <p>I have a series of Python classes in a file. Some classes reference others.</p>
<p>My code is something like this:</p>
<pre><code>class A():
pass
class B():
c = C()
class C():
pass
</code></pre>
<p>Trying to run that, I get <code>NameError: name 'C' is not defined</code>. Fair enough, but is there a... | [
{
"answer_id": 524722,
"author": "Joe Holloway",
"author_id": 48837,
"author_profile": "https://Stackoverflow.com/users/48837",
"pm_score": 6,
"selected": true,
"text": "<p>In Python you don't create a prototype per se, but you do need to understand the difference between \"class attribu... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524714",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42974/"
] | I have a series of Python classes in a file. Some classes reference others.
My code is something like this:
```
class A():
pass
class B():
c = C()
class C():
pass
```
Trying to run that, I get `NameError: name 'C' is not defined`. Fair enough, but is there any way to make it work, or do I have to manu... | In Python you don't create a prototype per se, but you do need to understand the difference between "class attributes" and instance-level attributes. In the example you've shown above, you are declaring a class attribute on class B, not an instance-level attribute.
This is what you are looking for:
```
class B():
... |
524,725 | <p>I have a data grid that has a checkbox item renderer in a cloumn to allow row selections:</p>
<p><strong>Main application:</strong></p>
<pre>
<code>
<mx:DataGrid id="dg">
<mx:columns>
<mx:DataGridColumn id="ir" itemRenderer="renderers.RowCheckbox" />
<mx:DataGridColumn dataField="N... | [
{
"answer_id": 524763,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 0,
"selected": false,
"text": "<p>You can use the <code>indexToItemRenderer()</code> method exposed by all subclasses of ListBase. </p>\n\n<p... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1638/"
] | I have a data grid that has a checkbox item renderer in a cloumn to allow row selections:
**Main application:**
```
<mx:DataGrid id="dg">
<mx:columns>
<mx:DataGridColumn id="ir" itemRenderer="renderers.RowCheckbox" />
<mx:DataGridColumn dataField="Name" headerText="Name" />
</mx:columns>
</... | Just a word of advice: We had a similar problem in our application and we solved it by adding a "selected" property to the entities in the dataprovider of the datagrid. The selected property of the checkBox was then bound to the selected property of our entity. To know which ones were selected, we just looped over the ... |
524,732 | <p>I have a <code><table/></code> in a ViewUserControl that I have given the tag a <em>class="tblRaised"</em> attribute/value. Visual Studio keeps underlying <em>tblRaised</em> and telling me - The class or CssClass is not defined.</p>
<p>Why is the intellisense engine trying to validate my CSS class names here?... | [
{
"answer_id": 524735,
"author": "rball",
"author_id": 50711,
"author_profile": "https://Stackoverflow.com/users/50711",
"pm_score": 1,
"selected": false,
"text": "<p>Typically in the ASP.NET world (not MVC) you'd specify your styles in the master page or your current page. VS then read... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524732",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | I have a `<table/>` in a ViewUserControl that I have given the tag a *class="tblRaised"* attribute/value. Visual Studio keeps underlying *tblRaised* and telling me - The class or CssClass is not defined.
Why is the intellisense engine trying to validate my CSS class names here? Anyone else run into this? Is this a bug... | Because the styles are usually included in your view or master page, VS can't find them in your ViewUserControl. If you add something like the following to your ViewUserControl you can get around the issue (and get intellisense) without including the CSS twice.
```
<% if (false) { %>
<link rel="stylesheet" type="te... |
524,734 | <p>How can i find out if the obj returned by a func is a int or something else (like a sqlite cursor)</p>
| [
{
"answer_id": 524736,
"author": "Charles Duffy",
"author_id": 14122,
"author_profile": "https://Stackoverflow.com/users/14122",
"pm_score": 5,
"selected": true,
"text": "<p>Use <code>isinstance(item, type)</code> -- for instance:</p>\n\n<pre><code>if isinstance(foo, int):\n pass # ha... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can i find out if the obj returned by a func is a int or something else (like a sqlite cursor) | Use `isinstance(item, type)` -- for instance:
```
if isinstance(foo, int):
pass # handle this case
```
However, explicit type checking is not considered a good practice in the Python world -- it means that much of the power of duck typing is lost: Something which walks and quacks like a duck should be allowed to... |
524,741 | <p>I saw a couple of similar questions on the same topic, but none of them addressed my issue. </p>
<p>I've got a asp.net website, and want to show a status message (asp:label that will disappear in 5 seconds) to the user after the database was updated.</p>
<p>I want to assign the text to the label, and then hide it ... | [
{
"answer_id": 524757,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": "<p>Are you posting back via Ajax or a normal postback? If it's a normal postback, just register some javascript on the... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3661/"
] | I saw a couple of similar questions on the same topic, but none of them addressed my issue.
I've got a asp.net website, and want to show a status message (asp:label that will disappear in 5 seconds) to the user after the database was updated.
I want to assign the text to the label, and then hide it with Javascript.
... | To answer your question "How do i call js function after i assigned the text to the control?". You can just add a call to 'RegisterClientScriptBlock' inside of your button click event to output the JavaScript provided by Luke.
```
protected void buttonSubmit_Click(object sender, EventArgs e)
{
try
{
//... |
524,755 | <p>I've been given a struct for a 2D triangle with x and y coordinates, a rotation variable, and so on. From the point created by those x and y coordinates, I am supposed to draw a triangle around the point and rotate it appropriately using the rotation variable.</p>
<p>I'm familiar with drawing triangles in OpenGl w... | [
{
"answer_id": 524770,
"author": "strager",
"author_id": 39992,
"author_profile": "https://Stackoverflow.com/users/39992",
"pm_score": 7,
"selected": true,
"text": "<p>There are different \"types\" of centers of a triangle. Details on: <a href=\"https://web.archive.org/web/2013110401595... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3879/"
] | I've been given a struct for a 2D triangle with x and y coordinates, a rotation variable, and so on. From the point created by those x and y coordinates, I am supposed to draw a triangle around the point and rotate it appropriately using the rotation variable.
I'm familiar with drawing triangles in OpenGl with GL\_TRI... | There are different "types" of centers of a triangle. Details on: [The Centers of a Triangle](https://web.archive.org/web/20131104015950/http://www.jimloy.com/geometry/centers.htm). A quick method for finding a center of a triangle is to average all your point's coordinates. For example:
```
GLfloat centerX = (tri[0].... |
524,756 | <p>I am in a project with 3 people. We need to have the same folds in Vim for each member. How can I share my folds?</p>
<p><strong>[Feedback]</strong> </p>
<p>I understood one important thing: Google ignores signs, such as {{{, so please google "VIM three braces" to find help about the marker-method. It becomes much... | [
{
"answer_id": 524764,
"author": "chuckg",
"author_id": 63193,
"author_profile": "https://Stackoverflow.com/users/63193",
"pm_score": 2,
"selected": false,
"text": "<p>I haven't shared VIM folds with someone before, but if you're working on the same machine perhaps you can use VIM sessio... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54964/"
] | I am in a project with 3 people. We need to have the same folds in Vim for each member. How can I share my folds?
**[Feedback]**
I understood one important thing: Google ignores signs, such as {{{, so please google "VIM three braces" to find help about the marker-method. It becomes much easier to practise, as you ca... | Probably the easiest way is to just use fold markers (e.g. `{{{1`), making sure to include the `vim:fdm=marker` setting in the file itself. For example, here's a shell script which contains both the setting to use fold markers and two levels of fold:
```
#/bin/sh
# vim:fdm=marker
echo This file contains fold markers.
... |
524,758 | <p>I wish to download a web page, which may be in any possible text encoding, and save it as UTF16LE. Assuming I can determine the text's encoding (by examining the HTTP header, HTML header, and/or BOM), how do I convert the text?</p>
<p>I am using Delphi 2009. Unfortunately, the help files do not explain how to get... | [
{
"answer_id": 524764,
"author": "chuckg",
"author_id": 63193,
"author_profile": "https://Stackoverflow.com/users/63193",
"pm_score": 2,
"selected": false,
"text": "<p>I haven't shared VIM folds with someone before, but if you're working on the same machine perhaps you can use VIM sessio... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524758",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I wish to download a web page, which may be in any possible text encoding, and save it as UTF16LE. Assuming I can determine the text's encoding (by examining the HTTP header, HTML header, and/or BOM), how do I convert the text?
I am using Delphi 2009. Unfortunately, the help files do not explain how to get from *any* ... | Probably the easiest way is to just use fold markers (e.g. `{{{1`), making sure to include the `vim:fdm=marker` setting in the file itself. For example, here's a shell script which contains both the setting to use fold markers and two levels of fold:
```
#/bin/sh
# vim:fdm=marker
echo This file contains fold markers.
... |
524,761 | <p>Whats wrong with the following c# code? Compiler reports this error:</p>
<p>Inconsistent accessibility: parameter type 'ClassLibrary1.Interface1' is less accessible than method 'ClassLibrary1.Class1.Class1(ClassLibrary1.Interface1)'</p>
<p>with the following code:</p>
<pre><code>interface Interface1<T>
{
... | [
{
"answer_id": 524766,
"author": "Sciolist",
"author_id": 16045,
"author_profile": "https://Stackoverflow.com/users/16045",
"pm_score": 7,
"selected": true,
"text": "<p>your \"Interface1\" isn't public..</p>\n\n<pre><code>public interface Interface1<T>\n{\n bool IsDataValid();\n... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524761",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6204/"
] | Whats wrong with the following c# code? Compiler reports this error:
Inconsistent accessibility: parameter type 'ClassLibrary1.Interface1' is less accessible than method 'ClassLibrary1.Class1.Class1(ClassLibrary1.Interface1)'
with the following code:
```
interface Interface1<T>
{
bool IsDataValid();
/* Other... | your "Interface1" isn't public..
```
public interface Interface1<T>
{
bool IsDataValid();
/* Other interfaces */
}
``` |
524,762 | <p>I trying to code a login script for phpmyadmin </p>
<pre><code><?php
$user = "Domain";
$passwords = file("passwords.txt");
foreach ( $passwords as $pass){
$source = file_get_contents("http://dbadmin.one.com/index.php?lang=en&server=1&pma_username=$user&pma_password=$pass");
if(preg_match("/Datab... | [
{
"answer_id": 524794,
"author": "Asciant",
"author_id": 50147,
"author_profile": "https://Stackoverflow.com/users/50147",
"pm_score": 1,
"selected": false,
"text": "<p>Not necessarily the solution to your problem, but some basic error checking might point you in the right direction. You... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524762",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I trying to code a login script for phpmyadmin
```
<?php
$user = "Domain";
$passwords = file("passwords.txt");
foreach ( $passwords as $pass){
$source = file_get_contents("http://dbadmin.one.com/index.php?lang=en&server=1&pma_username=$user&pma_password=$pass");
if(preg_match("/Database/", $source)):
echo "Login... | Not necessarily the solution to your problem, but some basic error checking might point you in the right direction. Your problem may even begin at the initial call to file.
```
$passwords = file("passwords.txt");
if (!$passwords) {
echo 'Unable to read password file';
} //etc
$source = file_get_contents("http://dba... |
524,765 | <p>I have decided to take up f# as my functional language. </p>
<p>My problem: Give a bunch of 50digits in a file, get the first 10 digits of the sum of each line. (euler problem for those who know)</p>
<p>for example (simplified):
1234567890</p>
<p>The sum is 45<br>
The first "ten" digits or in our case the "first"... | [
{
"answer_id": 524864,
"author": "masfenix",
"author_id": 50312,
"author_profile": "https://Stackoverflow.com/users/50312",
"pm_score": 4,
"selected": true,
"text": "<p>My final answer:</p>\n\n<pre><code>let total =\n lines.Split([|'\\n'|])\n |> Seq.map (fun line -> line.ToCh... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524765",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50312/"
] | I have decided to take up f# as my functional language.
My problem: Give a bunch of 50digits in a file, get the first 10 digits of the sum of each line. (euler problem for those who know)
for example (simplified):
1234567890
The sum is 45
The first "ten" digits or in our case the "first" digit is 4.
Heres my p... | My final answer:
```
let total =
lines.Split([|'\n'|])
|> Seq.map (fun line -> line.ToCharArray() |> Array.to_seq)
|> Seq.map (fun eachSeq -> eachSeq
|> Seq.take 50 //get rid of the \r
|> Seq.map (fun c -> Double.Parse(c.ToString()))
... |
524,778 | <p>Does anyone know of examples which show how to encrypt a dataset at the client side and send it over to a web service and have it decrypted there?</p>
<p>Another question:
What i need to do is a send hundreds of rows of data from a client to a web service and have the web service update the database with these re... | [
{
"answer_id": 524800,
"author": "BobbyShaftoe",
"author_id": 38426,
"author_profile": "https://Stackoverflow.com/users/38426",
"pm_score": 0,
"selected": false,
"text": "<p>Well, there are a lot of approaches to this. Since you are sending this over the wire, you could: 1) Write the dat... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56509/"
] | Does anyone know of examples which show how to encrypt a dataset at the client side and send it over to a web service and have it decrypted there?
Another question:
What i need to do is a send hundreds of rows of data from a client to a web service and have the web service update the database with these records. I ca... | As far as the encryption is concerned, why try to reinvent the wheel? Just connect to the webservice over SSL - it'll most likely be much safer than a homegrown alternative.
I would probably create a custom struct/object and send an array of those to the webservice rather than a DataSet. It will mean (slightly) less n... |
524,780 | <p>I want to use a ComboBox with the DropDownList style (the one that makes it look like a button so you can't enter a value) to insert a value into a text box. I want the combobox to have a text label called 'Wildcards' and as I select a wildcard from the list the selected value is inserted in to a text box and the co... | [
{
"answer_id": 524868,
"author": "BlackWasp",
"author_id": 21862,
"author_profile": "https://Stackoverflow.com/users/21862",
"pm_score": 6,
"selected": true,
"text": "<p>The code you specify:</p>\n\n<pre><code>comboBox.Text = \"Wildcards\";\n</code></pre>\n\n<p>...should work. The only r... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524780",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to use a ComboBox with the DropDownList style (the one that makes it look like a button so you can't enter a value) to insert a value into a text box. I want the combobox to have a text label called 'Wildcards' and as I select a wildcard from the list the selected value is inserted in to a text box and the combo... | The code you specify:
```
comboBox.Text = "Wildcards";
```
...should work. The only reason it would not is that the text you specify is not an item within the comboBox's item list. When using the DropDownList style, you can only set Text to values that actually appear in the list.
If it is the case that you are try... |
524,786 | <p>I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when the application starts. MonthlyPlan is hidden behind InfoEditor (on load).</p>
<p>So my question is when I exchange InfoEditor for MonthlyPlan (MonthlyPlan gets brought to the top) how can I have data on the MonthlyP... | [
{
"answer_id": 524815,
"author": "Andrew Grant",
"author_id": 1043,
"author_profile": "https://Stackoverflow.com/users/1043",
"pm_score": 4,
"selected": true,
"text": "<p>There's a lack of details here. How are you \"exchanging\" the two views?</p>\n\n<p>If you were using a UINavigationC... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22292/"
] | I have a viewController (Planner) that loads two view controllers (InfoEditor and MonthlyPlan) when the application starts. MonthlyPlan is hidden behind InfoEditor (on load).
So my question is when I exchange InfoEditor for MonthlyPlan (MonthlyPlan gets brought to the top) how can I have data on the MonthlyPlan view b... | There's a lack of details here. How are you "exchanging" the two views?
If you were using a UINavigationController as the container then viewWillAppear/viewDidAppear would be called whenever you push/pop a new viewController. These calls are made by the UINavigationController itself. If you ARE using a UINavigationCon... |
524,804 | <p>To put it simple: a swing app that uses sqlitejdbc as backend. Currently, there's no problem launching multiple instances that work with the same database file. And there should be.
The file is locked (can't delete it while the app is running) so the check should be trivial. Turns out not.</p>
<pre><code> File f... | [
{
"answer_id": 524850,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 3,
"selected": true,
"text": "<p>FileLocks are exclusive to the JVM, not an individual thread. So if you ran that code inside the same process as your Swi... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15187/"
] | To put it simple: a swing app that uses sqlitejdbc as backend. Currently, there's no problem launching multiple instances that work with the same database file. And there should be.
The file is locked (can't delete it while the app is running) so the check should be trivial. Turns out not.
```
File f = new File("/... | FileLocks are exclusive to the JVM, not an individual thread. So if you ran that code inside the same process as your Swing app, you would get the lock because it is shared by the JVM.
If your Swing app is not running, no other process is contending for the lock so you will obtain it there is well. |
524,818 | <p>Note: Let me appologize for the length of this question, i had to put a lot of information into it. I hope that doesn't cause too many people to simply skim it and make assumptions. Please read in its entirety. Thanks.</p>
<p>I have a stream of data coming in over a socket. This data is line oriented. </p>
<p... | [
{
"answer_id": 524924,
"author": "Kevin Nisbet",
"author_id": 51330,
"author_profile": "https://Stackoverflow.com/users/51330",
"pm_score": 0,
"selected": false,
"text": "<p>What you're explaining in you're question, reminds me very much of ASCIZ strings. (<a href=\"http://www.joelonsoft... | 2009/02/07 | [
"https://Stackoverflow.com/questions/524818",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61164/"
] | Note: Let me appologize for the length of this question, i had to put a lot of information into it. I hope that doesn't cause too many people to simply skim it and make assumptions. Please read in its entirety. Thanks.
I have a stream of data coming in over a socket. This data is line oriented.
I am using the APM (A... | That's quite an interesting question. The solution for me in the past has been to use a separate thread with synchronous operations, as you propose. (I managed to get around most of the problems with blocking sockets using locks and lots of exception handlers.) Still, using the in-built asynchronous operations is typic... |
524,825 | <p>I have a file with about 100 #defines in it, from 1-100, and each with a unique string value.</p>
<p>Now I'm trying to print this value, but instead of the value, I want to print what the #define is. For example:</p>
<pre><code>#define FIRST_VALUE 1
var = FIRST_VALUE;
printf("%s", var);
</code></pre>
<p>and I wan... | [
{
"answer_id": 524873,
"author": "David Segonds",
"author_id": 13673,
"author_profile": "https://Stackoverflow.com/users/13673",
"pm_score": 4,
"selected": false,
"text": "<p>You can use <a href=\"http://gcc.gnu.org/onlinedocs/cpp/Stringification.html#Stringification\" rel=\"nofollow nor... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524825",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39036/"
] | I have a file with about 100 #defines in it, from 1-100, and each with a unique string value.
Now I'm trying to print this value, but instead of the value, I want to print what the #define is. For example:
```
#define FIRST_VALUE 1
var = FIRST_VALUE;
printf("%s", var);
```
and I want the printf to print FIRST\_VALU... | After talking to one of my TA's at school, we've decided that the best way to do this would be to write an AWK script to process the header file and automatically generate all the case statements needed.
Thanks guys! |
524,826 | <p>I wonder if I could write a program in the <code>C</code>-programming language that is executable, albeit not using a single library call, e.g. not even exit()?</p>
<p>If so, it obviously wouldn't depend on libraries (libc, ld-linux) at all.</p>
| [
{
"answer_id": 524828,
"author": "samoz",
"author_id": 39036,
"author_profile": "https://Stackoverflow.com/users/39036",
"pm_score": 0,
"selected": false,
"text": "<p>Well, you would need to use some system calls to load all it's information into memory, so I doubt it.</p>\n\n<p>And you ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49628/"
] | I wonder if I could write a program in the `C`-programming language that is executable, albeit not using a single library call, e.g. not even exit()?
If so, it obviously wouldn't depend on libraries (libc, ld-linux) at all. | I suspect you could write such a thing, but it would need to have an endless loop at the end, because you can't ask the operation system to exit your process. And you couldn't do anything useful.
Well start with compiling an ELF program, look into the ELF spec and craft together the header, the program segments and t... |
524,827 | <p>I'm using the following piece of Objective-C code to format a NSNumber, and it works fine most of the time, but it doesn't quite do what I want when the NSNumber object holds an integer (no fractional part).</p>
<pre><code>UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(80.0f, 90.0f, 225.0f, 40.0f)];
lab... | [
{
"answer_id": 524856,
"author": "Garrett",
"author_id": 59220,
"author_profile": "https://Stackoverflow.com/users/59220",
"pm_score": 3,
"selected": false,
"text": "<p>I believe what you are looking for is: \"%.2f\"</p>\n\n<p>Worst case scenario, you can split the value, check if there ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524827",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35478/"
] | I'm using the following piece of Objective-C code to format a NSNumber, and it works fine most of the time, but it doesn't quite do what I want when the NSNumber object holds an integer (no fractional part).
```
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(80.0f, 90.0f, 225.0f, 40.0f)];
label.backgroundC... | Your format string should have a "`0`" for each decimal place you want to always exist.
```
[formatter setFormat:@"###.00"];
```
for "55.23" and ".23" and ".20"
```
[formatter setFormat:@"##0.00"];
```
for "55.23" and "0.23" and "0.20"
See [Number Format String Syntax (Mac OS X Versions 10.0 to 10.3)](http://dev... |
524,829 | <p>I want to extract links from google.com; My HTML code looks like this:</p>
<pre><code><a href="http://www.test.com/" class="l"
</code></pre>
<p>I took me around five minutes to find a regex that works using www.rubular.com.
It is:</p>
<pre><code>"(.*?)" class="l"
</code></pre>
<p>The code is:</p>
<pre><code>... | [
{
"answer_id": 524863,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 0,
"selected": false,
"text": "<blockquote>\n <p>What im going wrong?</p>\n</blockquote>\n\n<p>You're trying to parse HTML with regex. Don't do that. Re... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to extract links from google.com; My HTML code looks like this:
```
<a href="http://www.test.com/" class="l"
```
I took me around five minutes to find a regex that works using www.rubular.com.
It is:
```
"(.*?)" class="l"
```
The code is:
```
require "open-uri"
url = "http://www.google.com/search?q=ruby"
... | Those links actually have `class=l` not `class="l"`. By the way, to figure this put I added some logging to the method so that you can see the output at various stages and debug it. I searched for the string you were expecting to find and didn't find it, which is why your regex failed. So I looked for the right string ... |
524,831 | <p>In PHP I can do the following:</p>
<pre><code>$myVar = 'name';
print $myClass->$myVar;
// Identical to $myClass->name
</code></pre>
<p>I wish to do this in Python but can't find out how</p>
| [
{
"answer_id": 524842,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 5,
"selected": true,
"text": "<p>In python, it's the getattr built-in function.</p>\n\n<pre><code>class Something( object ):\n def __init__( self ):\n ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524831",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] | In PHP I can do the following:
```
$myVar = 'name';
print $myClass->$myVar;
// Identical to $myClass->name
```
I wish to do this in Python but can't find out how | In python, it's the getattr built-in function.
```
class Something( object ):
def __init__( self ):
self.a= 2
self.b= 3
x= Something()
getattr( x, 'a' )
getattr( x, 'b' )
``` |
524,844 | <p>I am new to VBA and am trying to figure out how to reverse the order of a selected range of columns without hard coding. Every example I look out either hard codes the columns to reverse the order of, or assumes you want to reverse all the columns in the worksheet. I'm not trying to ask someone to write this for me,... | [
{
"answer_id": 524860,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 0,
"selected": false,
"text": "<p><strong>From here</strong>: <a href=\"http://www.cpearson.com/excel/excelM.htm\" rel=\"nofollow noreferrer\">Flippi... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am new to VBA and am trying to figure out how to reverse the order of a selected range of columns without hard coding. Every example I look out either hard codes the columns to reverse the order of, or assumes you want to reverse all the columns in the worksheet. I'm not trying to ask someone to write this for me, bu... | You can use **sort** to do this.
Using this method, you can arrange the columns any way you want.
If you have data that looks like this:
```
A B C
1 header1 header2 header3
2 dataA dataE dataI
3 dataB dataF dataJ
4 dataC dataG dataK
5 dataD dataH dataL
```
Add some numbers... |
524,870 | <p>I'm working on a web application. A user will create an email message that will be sent to another person.</p>
<p>I would like the e-mail that gets sent to appear from the user's name and e-mail address of the user on my system. And if they reply to the e-mail then it should go directly to the sender's email addres... | [
{
"answer_id": 524909,
"author": "David Z",
"author_id": 56541,
"author_profile": "https://Stackoverflow.com/users/56541",
"pm_score": 2,
"selected": false,
"text": "<p>Basically all you need to do is set the <code>From</code> header to the email address of the user sending the email. Th... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58413/"
] | I'm working on a web application. A user will create an email message that will be sent to another person.
I would like the e-mail that gets sent to appear from the user's name and e-mail address of the user on my system. And if they reply to the e-mail then it should go directly to the sender's email address.
Howeve... | Setting email fields is generally trivial, but the exact method of doing so depends on the language and framework you are using, which you don't mention. Usually it is a matter of creating a new email object, and just doing something along the lines of:
```
email.from = "From Name <fromemailaddress@example.com>";
```
... |
524,871 | <p>I am encountering an issue where Oracle is very slow when I attempt to delete rows from a table which contains two CLOB fields. The table has millions of rows, no constraints, and the deletes are based on the Primary Key. I have rebuilt indexes and recomputed statistics, to no avail.</p>
<p>What can I do to impr... | [
{
"answer_id": 524925,
"author": "Nick",
"author_id": 62985,
"author_profile": "https://Stackoverflow.com/users/62985",
"pm_score": 1,
"selected": false,
"text": "<p>With Oracle you have to consider the amount of redo you are generating when deleting a row. If the CLOB fields are very b... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63777/"
] | I am encountering an issue where Oracle is very slow when I attempt to delete rows from a table which contains two CLOB fields. The table has millions of rows, no constraints, and the deletes are based on the Primary Key. I have rebuilt indexes and recomputed statistics, to no avail.
What can I do to improve the perfo... | Trace it, with waits enabled
```
http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_monitor.htm#i1003679
```
Find the trace file in the UDUMP directory. TKPROF it.
Look at the end and it will tell you what the database spent its time doing during that SQL. The following link is a good overview of how ... |
524,881 | <p>I am using Ruby's Test::unit to compare the result of generated html with the expected result. (not using rails). I am not concerned with whitespace differences but these nearly always crop up during tests. Is there any testing mechanism to compare html while ignoring meaningless whitespace. I can see there's simila... | [
{
"answer_id": 524886,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 1,
"selected": false,
"text": "<p><code>assert_select</code> is what you want. It lets you use CSS selectors to parse the HTML and see if it has the ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56279/"
] | I am using Ruby's Test::unit to compare the result of generated html with the expected result. (not using rails). I am not concerned with whitespace differences but these nearly always crop up during tests. Is there any testing mechanism to compare html while ignoring meaningless whitespace. I can see there's similar q... | Or just strip whitespace yourself
```
assert_equal html_string.gsub(/\s+/, ' '), '<a href="foo">'
``` |
524,888 | <p>I'd like to embed 2 gems into my RubyCocoa app, so the user doesn't have to install them on the console on him-/herself. But I can't find any information on about how to do that.</p>
| [
{
"answer_id": 524886,
"author": "Alex Wayne",
"author_id": 62076,
"author_profile": "https://Stackoverflow.com/users/62076",
"pm_score": 1,
"selected": false,
"text": "<p><code>assert_select</code> is what you want. It lets you use CSS selectors to parse the HTML and see if it has the ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63779/"
] | I'd like to embed 2 gems into my RubyCocoa app, so the user doesn't have to install them on the console on him-/herself. But I can't find any information on about how to do that. | Or just strip whitespace yourself
```
assert_equal html_string.gsub(/\s+/, ' '), '<a href="foo">'
``` |
524,891 | <p>I have this htaccess code:</p>
<pre><code>RewriteEngine on
RewriteBase /xm/
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteRule ^([a-z0-9]*)\.php$ index.php?page=$1
</code></pre>
<p>And I want that when the user goes to, for example, main.php, that this htaccess redirects to index.php?page=main, but every time, a... | [
{
"answer_id": 524897,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 1,
"selected": false,
"text": "<p>It's rewriting again on the subrequest. Put [NS] to the right of it so it'll only get rewritten once.</p>\n"
},
{
... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2216175/"
] | I have this htaccess code:
```
RewriteEngine on
RewriteBase /xm/
RewriteCond %{REQUEST_URI} !^/index.php$
RewriteRule ^([a-z0-9]*)\.php$ index.php?page=$1
```
And I want that when the user goes to, for example, main.php, that this htaccess redirects to index.php?page=main, but every time, and with every page, it red... | Try this:
```
RewriteCond $1 !^index$
RewriteRule ^([a-z0-9]+)\.php$ index.php?page=$1
``` |
524,893 | <p>Today's my first day with Flex and FlashDevelop. In my ActionScript file, I have this line.</p>
<pre><code>import flash.display.SimpleButton;
</code></pre>
<p>FlashDevelop is aware about this and Code-completion works fine.</p>
<p>But, when I have this line.</p>
<pre><code>import mx.controls.Button;
</code></pre... | [
{
"answer_id": 525234,
"author": "Scott Evernden",
"author_id": 11397,
"author_profile": "https://Stackoverflow.com/users/11397",
"pm_score": 4,
"selected": true,
"text": "<p>Works perfectly well for me w/o doing anything special. But maybe your project's properties got borked. Do this:<... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9328/"
] | Today's my first day with Flex and FlashDevelop. In my ActionScript file, I have this line.
```
import flash.display.SimpleButton;
```
FlashDevelop is aware about this and Code-completion works fine.
But, when I have this line.
```
import mx.controls.Button;
```
Then code-completion doesn't work. | Works perfectly well for me w/o doing anything special. But maybe your project's properties got borked. Do this:
Open Project Properties
Go to Compiler Options tab
In Advanced -> Intrinsic Libraries add the following
Library\AS3\frameworks\Flex3 |
524,905 | <p>I am having problems using the [HandleError] attribute on my Controller Actions - it doesn't seem to work at all (i.e. it doesn't matter if the filter is there or not - I get the same results...). When an Exception is thrown, I get the standard red-toned Server Error in '/' Application error page instead of my custo... | [
{
"answer_id": 525019,
"author": "mhenrixon",
"author_id": 61249,
"author_profile": "https://Stackoverflow.com/users/61249",
"pm_score": 2,
"selected": false,
"text": "<p>You need to specify what page to redirect to as well.</p>\n\n<pre><code><customErrors mode=\"On\" defaultRedirect=... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524905",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38055/"
] | I am having problems using the [HandleError] attribute on my Controller Actions - it doesn't seem to work at all (i.e. it doesn't matter if the filter is there or not - I get the same results...). When an Exception is thrown, I get the standard red-toned Server Error in '/' Application error page instead of my custom v... | Two useful things to know:
By default, `HandleError` does nothing when running under the development server. The intention is to show developers more useful information:
```
public virtual void OnException(ExceptionContext filterContext) {
if (filterContext == null) {
throw new ArgumentNullException("filt... |
524,907 | <p>hey, what do i have to write, if i want date&time which updates itself?
Label3.Caption := TimeToStr(Time)
this just shows me the time, when i opened the program, but i want a time, that updates to the form every second (--> like a normal clock does).</p>
| [
{
"answer_id": 524916,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "<p>1) Drop a TTimer object on your form</p>\n\n<p>2) Set its 'Interval' propert to 1000 and its 'Enabled' property to true.</p>... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61910/"
] | hey, what do i have to write, if i want date&time which updates itself?
Label3.Caption := TimeToStr(Time)
this just shows me the time, when i opened the program, but i want a time, that updates to the form every second (--> like a normal clock does). | 1) Drop a TTimer object on your form
2) Set its 'Interval' propert to 1000 and its 'Enabled' property to true.
3) Double click on it to create an OnTimer event handler. Modify it som it looks something like this:
```
procedure TForm1.Timer1Timer(Sender: TObject);
begin
Label3.Caption := TimeToStr(Time)
end;
```... |
524,908 | <p>Is there any way to safely include pages without putting them all in an array?</p>
<pre>
if (preg_match('/^[a-z0-9]+/', $_GET['page'])) {
$page = $_GET['page'].".php";
$tpl = $_GET['page'].".html";
if (file_exists($page)) include($page);
if (file_exists($tpl)) include($tpl);
}
</pre>
<p>What should I add to make... | [
{
"answer_id": 524959,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 3,
"selected": false,
"text": "<p>The weakness in your current implementation is that …</p>\n\n<ol>\n<li>the regular expression just tests the beginning of... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there any way to safely include pages without putting them all in an array?
```
if (preg_match('/^[a-z0-9]+/', $_GET['page'])) {
$page = $_GET['page'].".php";
$tpl = $_GET['page'].".html";
if (file_exists($page)) include($page);
if (file_exists($tpl)) include($tpl);
}
```
What should I add to make this pretty ... | The weakness in your current implementation is that …
1. the regular expression just tests the beginning of the string, so “`images/../../secret`” would pass, and
2. without further validation, “`index`” would also be a valid value and would cause a recursion.
---
To make your implementation safe, it’s a good practi... |
524,930 | <p>I'm trying to add two images together using NumPy and PIL. The way I would do this in <a href="http://en.wikipedia.org/wiki/MATLAB" rel="noreferrer">MATLAB</a> would be something like:</p>
<pre><code>>> M1 = imread('_1.jpg');
>> M2 = imread('_2.jpg');
>> resM = M1 + M2;
>> imwrite(resM, 'res... | [
{
"answer_id": 524943,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 2,
"selected": false,
"text": "<p>It seems the code you posted just sums up the values and values bigger than 256 are overflowing. You want something l... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55985/"
] | I'm trying to add two images together using NumPy and PIL. The way I would do this in [MATLAB](http://en.wikipedia.org/wiki/MATLAB) would be something like:
```
>> M1 = imread('_1.jpg');
>> M2 = imread('_2.jpg');
>> resM = M1 + M2;
>> imwrite(resM, 'res.jpg');
```
I get something like this:
[alt text http://www.dea... | As everyone suggested already, the weird colors you're observing are overflow. And as you point out in the [comment of schnaader's answer](https://stackoverflow.com/questions/524930/numpy-pil-adding-an-image/524943#524943) you **still get overflow** if you add your images like this:
```
addition=(im1arr+im2arr)/2
```... |
524,936 | <p>I have two checkboxes in my MVC app which are both boolean / bit fields. "NotifyEmail" & "NotifySMS". </p>
<p>Whenever I post back to the server and an error occurs, the state of the checkbox is gone event though I set attempted values.</p>
| [
{
"answer_id": 524961,
"author": "Andrew Hare",
"author_id": 34211,
"author_profile": "https://Stackoverflow.com/users/34211",
"pm_score": 2,
"selected": false,
"text": "<p>MVC does not have ViewState like WebForms does - this means that you now have the responsibility of maintaining tho... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524936",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have two checkboxes in my MVC app which are both boolean / bit fields. "NotifyEmail" & "NotifySMS".
Whenever I post back to the server and an error occurs, the state of the checkbox is gone event though I set attempted values. | Why not something as simple as this?
```
<%=Html.CheckBox("AgreeToRules", (Request.Form["AgreeToRules"] ?? string.Empty).Contains("true"))%>
``` |
524,965 | <p>I'm specifying a color hex code as the <code>background-color</code> of a really long div. However, i'd like this color to be only repeated horizontally, from left to right, in the first part of the and not go down any further.</p>
<p>Can that be done using <code>background-repeat:repeat-y</code> or is there anoth... | [
{
"answer_id": 524966,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 4,
"selected": true,
"text": "<p>Colors have no height...they just exist, without dimensions. If you want a visual distinction between your background co... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524965",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49153/"
] | I'm specifying a color hex code as the `background-color` of a really long div. However, i'd like this color to be only repeated horizontally, from left to right, in the first part of the and not go down any further.
Can that be done using `background-repeat:repeat-y` or is there another method? | Colors have no height...they just exist, without dimensions. If you want a visual distinction between your background color and the rest of the document, you'll need to use a solid image as your background-image:
```
div.className {
background-image:url("images/background.jpg");
background-position:left top;
bac... |
524,974 | <p>In my system, I have two entities - ShoppingCart and ShoppingCartItem. Fairly generic use-case. However, when I save my ShoppingCart, none of the items are being saved to the DB. </p>
<p>Within my object, I create a new ShoppingCart object.</p>
<pre><code>ShoppingCart cart = CreateOrGetCart();
</code></pre>
<p>I ... | [
{
"answer_id": 524986,
"author": "Qerim Shahini",
"author_id": 63786,
"author_profile": "https://Stackoverflow.com/users/63786",
"pm_score": 1,
"selected": false,
"text": "<p>Try wrapping Session.SaveOrUpdate in a transaction, or force a flush directly after.</p>\n"
},
{
"answer_... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524974",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61712/"
] | In my system, I have two entities - ShoppingCart and ShoppingCartItem. Fairly generic use-case. However, when I save my ShoppingCart, none of the items are being saved to the DB.
Within my object, I create a new ShoppingCart object.
```
ShoppingCart cart = CreateOrGetCart();
```
I then add an existing Product whic... | Why did you include `.Cascade.SaveUpdate()` in the line
```
References(x => x.Cart, "ShoppingCartId").Cascade.SaveUpdate()
```
?
Perhaps it confuses NHibernate (or Fluent NHibernate) that there seems to be cascading saves/updates from both ends of your relation?
Configuring your HasMany to cascade ought to be suff... |
524,992 | <p>I'm tooling around with <a href="http://www.djangoproject.com/" rel="noreferrer">Django</a> and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.</p>
<p>I figure that in the worst case I can get this information from the request object in the view functio... | [
{
"answer_id": 525000,
"author": "Oli",
"author_id": 12870,
"author_profile": "https://Stackoverflow.com/users/12870",
"pm_score": 5,
"selected": true,
"text": "<p>Well you can enable:</p>\n\n<pre><code>'django.core.context_processors.request',\n</code></pre>\n\n<p>in your <code>settings... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12983/"
] | I'm tooling around with [Django](http://www.djangoproject.com/) and I'm wondering if there is a simple way to create a "back" link to the previous page using the template system.
I figure that in the worst case I can get this information from the request object in the view function, and pass it along to the template r... | Well you can enable:
```
'django.core.context_processors.request',
```
in your `settings.TEMPLATE_CONTEXT_PROCESSORS` block and hook out the referrer but that's a bit nauseating and could break all over the place.
Most places where you'd want this (eg the edit post page on SO) you have a real object to hook on to ... |
524,993 | <p>I've got a json encoded dataset that I retrieve via ajax. Some of the data points I'm trying to retrieve will come back us null or empty. </p>
<p>However, I don't want those null or empty to be displayed to the end user, or passed on to other functions. </p>
<p>What I'm doing now is checking for</p>
<pre>
if(... | [
{
"answer_id": 525179,
"author": "Kevin Babcock",
"author_id": 56864,
"author_profile": "https://Stackoverflow.com/users/56864",
"pm_score": 5,
"selected": true,
"text": "<p>Since JSON is simply a data format, there really is no way to know which of your data members will be null unless ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48067/"
] | I've got a json encoded dataset that I retrieve via ajax. Some of the data points I'm trying to retrieve will come back us null or empty.
However, I don't want those null or empty to be displayed to the end user, or passed on to other functions.
What I'm doing now is checking for
```
if(this.cityState!='null'... | Since JSON is simply a data format, there really is no way to know which of your data members will be null unless you explicitly check them. You can always refactor your code to make it more compact and easier to read, but you will have to check each item explicitly if you do not know beforehand which will be null and ... |
524,999 | <p>I have c++ code that attempts to dynamically allocate a 2d array of bytes that measures approx 151MB in size. When I attempt to go back and index through the array, my program crashes in exactly the same place every time with an "Access violation reading location 0x0110f000" error, but the indicies appear to be in ... | [
{
"answer_id": 525003,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 2,
"selected": false,
"text": "<p>How are you accessing the allocated memory? Does it always die on the same statement? It looks very much like you'... | 2009/02/08 | [
"https://Stackoverflow.com/questions/524999",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/191808/"
] | I have c++ code that attempts to dynamically allocate a 2d array of bytes that measures approx 151MB in size. When I attempt to go back and index through the array, my program crashes in exactly the same place every time with an "Access violation reading location 0x0110f000" error, but the indicies appear to be in rang... | Some possibilities to look at or things to try:
* It may be that the pHDVideo->VideoData[iFrame] or pHDVideo->VideoData is being freed somewhere. I doubt this is the case but I'd check all the places this can happen anyway. Output a debug statement each time you free on of those AND just before your crash statement.
*... |
525,001 | <p>I am trying to parse a URL with an <code>&amp;</code> in the URL:</p>
<pre><code>ViewArticle.dbml?DB_OEM_ID=1800&amp;ATCLID=3664162
</code></pre>
<p>..but using NSXMLParser, all i get is <code>1800ATCL</code>. It completely ignores the <code>&amp;</code>.</p>
<pre><code>- (void)parser:(NSXMLParser *)p... | [
{
"answer_id": 525453,
"author": "dbr",
"author_id": 745,
"author_profile": "https://Stackoverflow.com/users/745",
"pm_score": 0,
"selected": false,
"text": "<p>Perhaps you could override the encoding using <a href=\"http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/Foundation/Cla... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525001",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63789/"
] | I am trying to parse a URL with an `&` in the URL:
```
ViewArticle.dbml?DB_OEM_ID=1800&ATCLID=3664162
```
..but using NSXMLParser, all i get is `1800ATCL`. It completely ignores the `&`.
```
- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceUR... | thanks with the y'all's help i was able to get it going using
```
NSData *myData = [NSData dataWithContentsOfURL:URL];
NSString *myStr = [[NSString alloc] initWithData:myData encoding:NSWindowsCP1252StringEncoding];
myStr = [myStr stringByReplacingOccurrencesOfString:@"encoding=\"windows-1252\"" withStrin... |
525,004 | <p>In the Stack Overflow podcast #36 (<a href="https://blog.stackoverflow.com/2009/01/podcast-36/">https://blog.stackoverflow.com/2009/01/podcast-36/</a>), this opinion was expressed:
Once you understand how easy it is to set up a state machine, you’ll never try to use a regular expression inappropriately ever again.</... | [
{
"answer_id": 525009,
"author": "Sciolist",
"author_id": 16045,
"author_profile": "https://Stackoverflow.com/users/16045",
"pm_score": 2,
"selected": false,
"text": "<p>I'm sure someone has better examples, but you could <a href=\"http://haacked.com/archive/2009/01/14/named-formats-redu... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525004",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2464/"
] | In the Stack Overflow podcast #36 (<https://blog.stackoverflow.com/2009/01/podcast-36/>), this opinion was expressed:
Once you understand how easy it is to set up a state machine, you’ll never try to use a regular expression inappropriately ever again.
I've done a bunch of searching. I've found some academic papers an... | Sure, although you'll need more complicated examples to truly understand how REs work. Consider the following RE:
```
^[A-Za-z][A-Za-z0-9_]*$
```
which is a typical identifier (must start with alpha and can have any number of alphanumeric and undescore characters following, including none). The following pseudo-code... |
525,021 | <p>I'm using the following code to get the members of a group on my domain:</p>
<pre><code> Dim de As New DirectoryEntry("LDAP://" & GroupDN)
For Each user As String In CType(de.Properties("member"), IEnumerable)
GroupCollection.Add(Username, Username)
Next
</code></pre>
<p>My problem is that wh... | [
{
"answer_id": 525131,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 5,
"selected": true,
"text": "<p>Unless you change the primary group id of a user, the user is not stored in the member attribute of the Domain Users ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525021",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8114/"
] | I'm using the following code to get the members of a group on my domain:
```
Dim de As New DirectoryEntry("LDAP://" & GroupDN)
For Each user As String In CType(de.Properties("member"), IEnumerable)
GroupCollection.Add(Username, Username)
Next
```
My problem is that when GroupDN (the distinguishedn... | Unless you change the primary group id of a user, the user is not stored in the member attribute of the Domain Users group, rather it uses the fact that the primary group id is set to the Domain Users RID to determine membership in Domain Users. The normal case is that the Domain Users member attribute is empty; it wou... |
525,027 | <p>What's the best way (if any) to make the inside box transparent so the image can be seen with no opacity (clear image) and the rest of the outer box opaque. So far this is what I'm doing:</p>
<pre><code><style>
#a {
background-color: black;
float: left;
} #b {
opacity : 0.4;
filter: alpha(opacity=... | [
{
"answer_id": 525041,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 4,
"selected": true,
"text": "<p>The maximum opacity of an element is the opacity of its parent element. So if div#b has an opacity of 40%, if his children have ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What's the best way (if any) to make the inside box transparent so the image can be seen with no opacity (clear image) and the rest of the outer box opaque. So far this is what I'm doing:
```
<style>
#a {
background-color: black;
float: left;
} #b {
opacity : 0.4;
filter: alpha(opacity=40);
} #div {
p... | The maximum opacity of an element is the opacity of its parent element. So if div#b has an opacity of 40%, if his children have 100% opacity in style they will also be 40% absolute opacity.
To accomplish what you're describing (at least what I think you're describing), one way could be to have both the transparent wra... |
525,057 | <p>I'm trying to use Apache's <code>CustomLog</code> directive to create some custom log files, but can't get it working. Here is the configuration I'm using for the custom logs:</p>
<pre><code>LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
Cu... | [
{
"answer_id": 2036248,
"author": "Mike Spross",
"author_id": 17862,
"author_profile": "https://Stackoverflow.com/users/17862",
"pm_score": 4,
"selected": false,
"text": "<p>I have the same problem with Ubuntu 9.10 Server and Apache 2.2.12. I'm setting up a Subversion server with <code>m... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to use Apache's `CustomLog` directive to create some custom log files, but can't get it working. Here is the configuration I'm using for the custom logs:
```
LogFormat "%h %l %u %t \"%r\" %>s %b" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /var/log/apache2/jb_com... | I have the same problem with Ubuntu 9.10 Server and Apache 2.2.12. I'm setting up a Subversion server with `mod_dav_svn` and added a `CustomLog` directive to `/etc/apache2/mods-available/dav_svn.conf` to log Subversion requests, but had the same problem (the log file was created when Apache started, but was never writt... |
525,063 | <p>I want my intent to be launched when the user goes to a certain url: for example, the android market does this with <a href="http://market.android.com/" rel="noreferrer">http://market.android.com/</a> urls. so does youtube. I want mine to do that too.</p>
| [
{
"answer_id": 525086,
"author": "Isaac Waller",
"author_id": 764272,
"author_profile": "https://Stackoverflow.com/users/764272",
"pm_score": 9,
"selected": true,
"text": "<p>I did it! Using <a href=\"https://developer.android.com/guide/topics/manifest/intent-filter-element.html\" rel=\"... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764272/"
] | I want my intent to be launched when the user goes to a certain url: for example, the android market does this with <http://market.android.com/> urls. so does youtube. I want mine to do that too. | I did it! Using [`<intent-filter>`](https://developer.android.com/guide/topics/manifest/intent-filter-element.html). Put the following into your manifest file:
```
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:na... |
525,064 | <p>I am learning how to use NUnit. I have my main project in it's solution, and created a separate project in that same solution which will hold my unit tests, with it's own namespace. From that project I add a reference to the main project and add a </p>
<pre><code>using MainProjectNamespace;
</code></pre>
<p>to t... | [
{
"answer_id": 525075,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>The compiler removes all unused references, and doesn't deploy the dll unnecessarily. A <code>using</code> (by itse... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525064",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47630/"
] | I am learning how to use NUnit. I have my main project in it's solution, and created a separate project in that same solution which will hold my unit tests, with it's own namespace. From that project I add a reference to the main project and add a
```
using MainProjectNamespace;
```
to the top of it.
When I go to ... | The compiler removes all unused references, and doesn't deploy the dll unnecessarily. A `using` (by itself) does not count as a use. Either mark the dll for deployment via the "Copy to output directory" setting, or add some code that *really* uses types declared in the dll. |
525,097 | <p>I'm mapping a legacy database with nhibernate and having some problems with mapping a relation.</p>
<p>The two classes look like this</p>
<pre><code>public class Questionnaire
{
public int Id {get; set;}
public string FormCode {get; set;}
public IList<Question> Questions {get; set;}
}
public cla... | [
{
"answer_id": 525116,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 2,
"selected": false,
"text": "<p>Well this is the \"problem\" with ORMs. I say \"problem\" because Hibernate is technically correct: foreign keys should... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1213936/"
] | I'm mapping a legacy database with nhibernate and having some problems with mapping a relation.
The two classes look like this
```
public class Questionnaire
{
public int Id {get; set;}
public string FormCode {get; set;}
public IList<Question> Questions {get; set;}
}
public class Question
{
public in... | Your relationship is an m:n relationship without an intermediate entity. It's a classic mistake to define m:n relationships this way, because it cuts out a pk side, which leads to the situation where there are two tables with the same attribute/field and they happen to semantically represent the same thing. However, be... |
525,134 | <p>In my python script i am parsing a user created file and typically there will be some errors and there are cases were i warn the user to be more clear. In c i would have an enum like eAssignBad, eAssignMismatch, eAssignmentSignMix (sign mixed with unsigned). Then i would look the value up to print an error or warnin... | [
{
"answer_id": 525151,
"author": "Arkady",
"author_id": 1626,
"author_profile": "https://Stackoverflow.com/users/1626",
"pm_score": 2,
"selected": false,
"text": "<p>You could try making a bunch of exception classes (all subclasses of Exception, perhaps through some common parent class o... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In my python script i am parsing a user created file and typically there will be some errors and there are cases were i warn the user to be more clear. In c i would have an enum like eAssignBad, eAssignMismatch, eAssignmentSignMix (sign mixed with unsigned). Then i would look the value up to print an error or warning m... | Here is one of the best enum implementations I've found so far:
<http://code.activestate.com/recipes/413486/>
But, dare I ask, do you need an enum?
You could have a simple dict with your error messages and some integer constants with your error numbers.
```
eAssignBad = 0
eAssignMismatch = 1
eAssignmentSignMix = 2
... |
525,139 | <pre><code>$('div.box').html("hello")
</code></pre>
<p>puts the word hello inside all my div's of class 'box'. They all have an assigned id.</p>
<p>I'm trying to figure out how to put each div's id instead of 'hello' inside the div. Maybe this is really easy, but I can't figure it out. I'm also new to jQuery. Any... | [
{
"answer_id": 525142,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 4,
"selected": true,
"text": "<p>Try this:</p>\n\n<pre><code>$(\"div.box\").each(function() {\n $(this).html(\"Id: \" + this.id);\n});\n</code></pre>\n\n... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63803/"
] | ```
$('div.box').html("hello")
```
puts the word hello inside all my div's of class 'box'. They all have an assigned id.
I'm trying to figure out how to put each div's id instead of 'hello' inside the div. Maybe this is really easy, but I can't figure it out. I'm also new to jQuery. Any ideas? I've tried:
```
$("di... | Try this:
```
$("div.box").each(function() {
$(this).html("Id: " + this.id);
});
```
Full example:
```
<html>
<head>
<title>Layout</title>
</head>
<body>
<div id="id1" class="box">Box One</div>
<div id="id2" class="box">Box Two</div>
<div id="id3">Box Three</div>
<div id="id4" class="box">Box Four</div>... |
525,144 | <p>I have the following code and basically what i am not able to figure out is how to clone the whole grid and make a blank copy of them side by side.... for a clear understanding this is something to do with hospital application and the grid is related to a pregnancy so when said 'ADD CHILD' button a whole new grid sh... | [
{
"answer_id": 525153,
"author": "davogones",
"author_id": 59631,
"author_profile": "https://Stackoverflow.com/users/59631",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure that you're using the correct approach here. I would approach the problem by creating a \"ChildGridContr... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have the following code and basically what i am not able to figure out is how to clone the whole grid and make a blank copy of them side by side.... for a clear understanding this is something to do with hospital application and the grid is related to a pregnancy so when said 'ADD CHILD' button a whole new grid shoul... | You should put the object you are want to "clone" in a `DataTemplate` and reference this template from an `ItemsControl`, then when you need another grid add another item to the items control (or even better to the list the control is bound to) and the `ItemsControl` will create a new grid and bind it the new object.
... |
525,158 | <p>I have a generic class, but I want my type to be forced to inherit from either one or the other interface. For example:</p>
<pre><code>public class MyGeneric<T> where T : IInterface1, IInterface2 {}
</code></pre>
<p>The above will force T to inherti from both IInterface1 and IInterface2 but can I force T to... | [
{
"answer_id": 525164,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 0,
"selected": false,
"text": "<p>No, you can't do this. It simply doesn't make sense.</p>\n\n<p>The best you could do would be to create 2 empty subcl... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525158",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9266/"
] | I have a generic class, but I want my type to be forced to inherit from either one or the other interface. For example:
```
public class MyGeneric<T> where T : IInterface1, IInterface2 {}
```
The above will force T to inherti from both IInterface1 and IInterface2 but can I force T to inhert from IInterface1 OR IInte... | Define a base interface -- it doesn't even have to have any members and let both Interface1 and Interface2 extend it. Then scope T to be of the base interface type. This only works if you want to have the generic derive from your interfaces, not any of the existing ones in the framework.
```
public interface BaseInter... |
525,161 | <p>With reference to the <a href="https://stackoverflow.com/questions/505040/developing-a-robocode-type-game-with-net-for-a-school-assignment">Software Project I am currently working on</a>.</p>
<p>I have the below methods that basically move a canvas with a Timer:</p>
<pre><code>DispatcherTimer dt = new DispatcherTi... | [
{
"answer_id": 525164,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 0,
"selected": false,
"text": "<p>No, you can't do this. It simply doesn't make sense.</p>\n\n<p>The best you could do would be to create 2 empty subcl... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44084/"
] | With reference to the [Software Project I am currently working on](https://stackoverflow.com/questions/505040/developing-a-robocode-type-game-with-net-for-a-school-assignment).
I have the below methods that basically move a canvas with a Timer:
```
DispatcherTimer dt = new DispatcherTimer(); //global
public void Ahea... | Define a base interface -- it doesn't even have to have any members and let both Interface1 and Interface2 extend it. Then scope T to be of the base interface type. This only works if you want to have the generic derive from your interfaces, not any of the existing ones in the framework.
```
public interface BaseInter... |
525,162 | <p>I have a div on an ASP.NET MVC page that I would like to populate dynamically (at user request) using jQuery. I currently have jQuery placing a JSON call to my controller, which returns a JSON object, and then I use Javascript to build the HTML manually, which is then placed in the div.</p>
<p>Hang on a minute. W... | [
{
"answer_id": 525297,
"author": "Canton",
"author_id": 63824,
"author_profile": "https://Stackoverflow.com/users/63824",
"pm_score": 1,
"selected": false,
"text": "<p>It works here.\nAre you sure the jquery load() is called?</p>\n"
},
{
"answer_id": 525358,
"author": "Chad M... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/691/"
] | I have a div on an ASP.NET MVC page that I would like to populate dynamically (at user request) using jQuery. I currently have jQuery placing a JSON call to my controller, which returns a JSON object, and then I use Javascript to build the HTML manually, which is then placed in the div.
Hang on a minute. Wouldn't it b... | In one of the most bizarre fixes I've found yet, it would seem that (in my case), adding a
```
<html><head><title></title></head><body>
```
before the user control code, and a
```
</body></html>
```
after the user control code, gets around the problem. Without these, the control returns nothing.
Now, it is perfe... |
525,194 | <p>Using extension syntax I'm trying to create a left-join using LINQ on two lists that I have. The following is from the Microsoft help but I've modified it to show that the pets list has no elements. What I'm ending up with is a list of 0 elements. I assume that this is because an inner-join is taking place. What I w... | [
{
"answer_id": 525207,
"author": "Jason Punyon",
"author_id": 6212,
"author_profile": "https://Stackoverflow.com/users/6212",
"pm_score": 2,
"selected": false,
"text": "<p>Left joins in LINQ are possible with the DefaultIfEmpty() method. I don't have the exact syntax for your case thoug... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] | Using extension syntax I'm trying to create a left-join using LINQ on two lists that I have. The following is from the Microsoft help but I've modified it to show that the pets list has no elements. What I'm ending up with is a list of 0 elements. I assume that this is because an inner-join is taking place. What I want... | I think if you want to use extension methods you need to use the [GroupJoin](http://msdn.microsoft.com/en-us/library/bb534805.aspx)
```
var query =
people.GroupJoin(pets,
person => person,
pet => pet.Owner,
(person, petCollection) =>
... |
525,204 | <p>I was wondering what is the intent for downloading URLs? In the browser, it will download stuff with a little notification icon. I was wondering if I can use that intent (and what it is).</p>
| [
{
"answer_id": 525232,
"author": "GregD",
"author_id": 38317,
"author_profile": "https://Stackoverflow.com/users/38317",
"pm_score": -1,
"selected": false,
"text": "<p>Have a look <a href=\"http://developer.android.com/reference/android/content/Intent.html\" rel=\"nofollow noreferrer\">h... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525204",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/764272/"
] | I was wondering what is the intent for downloading URLs? In the browser, it will download stuff with a little notification icon. I was wondering if I can use that intent (and what it is). | Applications can download files with the download manager just like the browser and gmail. This is available starting with Gingerbread.
Your app needs the *INTERNET* permission to initiate a download. To save the file in the default Download directory it also needs the *WRITE\_EXTERNAL\_STORAGE* permission.
Here's ho... |
525,212 | <p>It is quite simple to run a Unix command from Java. </p>
<pre><code>Runtime.getRuntime().exec(myCommand);
</code></pre>
<p>But is it possible to run a Unix shell script from Java code? If yes, would it be a good practice to run a shell script from within Java code?</p>
| [
{
"answer_id": 525218,
"author": "Chris Ballance",
"author_id": 1551,
"author_profile": "https://Stackoverflow.com/users/1551",
"pm_score": 5,
"selected": false,
"text": "<p>I think you have answered your own question with</p>\n\n<pre><code>Runtime.getRuntime().exec(myShellScript);\n</co... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525212",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | It is quite simple to run a Unix command from Java.
```
Runtime.getRuntime().exec(myCommand);
```
But is it possible to run a Unix shell script from Java code? If yes, would it be a good practice to run a shell script from within Java code? | You should really look at [Process Builder](http://docs.oracle.com/javase/6/docs/api/java/lang/ProcessBuilder.html). It is really built for this kind of thing.
```
ProcessBuilder pb = new ProcessBuilder("myshellScript.sh", "myArg1", "myArg2");
Map<String, String> env = pb.environment();
env.put("VAR1", "myValue");
... |
525,215 | <p>I'm still on D2007 and have need to create a unicode enabled virtual keyboard. So I'm using TMS's unicode buttons to simulate the keys, but what I want to avoid is having to assign</p>
<pre><code>mmo.Lines.Text := mmo.Lines.Text + Button1.Caption;
</code></pre>
<p>~50 times. There just has to be a better way to se... | [
{
"answer_id": 525245,
"author": "Rob Kennedy",
"author_id": 33732,
"author_profile": "https://Stackoverflow.com/users/33732",
"pm_score": 3,
"selected": false,
"text": "<p>Assign the same <code>OnClick</code> event handler to all your buttons. Instead of referring to each button by name... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm still on D2007 and have need to create a unicode enabled virtual keyboard. So I'm using TMS's unicode buttons to simulate the keys, but what I want to avoid is having to assign
```
mmo.Lines.Text := mmo.Lines.Text + Button1.Caption;
```
~50 times. There just has to be a better way to send one character at a time... | Assign the same `OnClick` event handler to all your buttons. Instead of referring to each button by name, as you did above with `Button1`, use the `Sender` parameter. That's what it's there for. It tells you which control's event was triggered to cause the handler to run.
`Sender` has the static type `TObject`. When o... |
525,227 | <p>I am making an application that does some custom image processing. The program will be driven by a simple menu in the console. The user will input the filename of an image, and that image will be displayed using openGL in a window. When the user selects some processing to be done to the image, the processing is done... | [
{
"answer_id": 525270,
"author": "Jesse Beder",
"author_id": 112,
"author_profile": "https://Stackoverflow.com/users/112",
"pm_score": 3,
"selected": true,
"text": "<p>I've had this problem before - it's pretty annoying. The problem is that all of your OpenGL calls must be done in the th... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63814/"
] | I am making an application that does some custom image processing. The program will be driven by a simple menu in the console. The user will input the filename of an image, and that image will be displayed using openGL in a window. When the user selects some processing to be done to the image, the processing is done, a... | I've had this problem before - it's pretty annoying. The problem is that all of your OpenGL calls must be done in the thread where you started the OpenGL context. So when you want your main (input) thread to change something in the OpenGL thread, you need to somehow signal to the thread that it needs to do stuff (set a... |
525,229 | <p>I have two tables with date fields. Each table displays the date in Short Date format (MM/DD/YYYY). </p>
<p>I wrote a Union Query to combine these tables, but the Union query displays the date in General Date (long) format (MM/DD/YYYY HH:MM:SS). I would be grateful for a solution to getting dates out of the Union... | [
{
"answer_id": 525231,
"author": "dkretz",
"author_id": 31641,
"author_profile": "https://Stackoverflow.com/users/31641",
"pm_score": 1,
"selected": false,
"text": "<p>If you are using a querydef, you can right-click on the column in Design Mode and you will find a Format property.</p>\n... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525229",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51350/"
] | I have two tables with date fields. Each table displays the date in Short Date format (MM/DD/YYYY).
I wrote a Union Query to combine these tables, but the Union query displays the date in General Date (long) format (MM/DD/YYYY HH:MM:SS). I would be grateful for a solution to getting dates out of the Union Query in Sh... | do a select on the union and format the date column at the end:
```
select format(foo, "short date")
from (
blah
union
blah
)
``` |
525,243 | <p>I have this code here:</p>
<pre><code>var infiltrationResult;
while(thisOption) {
var trNode = document.createElement('tr');
var tdNode = document.createElement('td');
var hrefNode = document.createElement('a');
infPlanetID = thisOption.getAttribute('value');
var myURL = "http://www.hyperiums.c... | [
{
"answer_id": 525257,
"author": "Rob Kennedy",
"author_id": 33732,
"author_profile": "https://Stackoverflow.com/users/33732",
"pm_score": 4,
"selected": true,
"text": "<p>The request runs asynchronously. That's <em>why</em> the function takes an <code>onload</code> callback function in ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525243",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46782/"
] | I have this code here:
```
var infiltrationResult;
while(thisOption) {
var trNode = document.createElement('tr');
var tdNode = document.createElement('td');
var hrefNode = document.createElement('a');
infPlanetID = thisOption.getAttribute('value');
var myURL = "http://www.hyperiums.com/servlet/Pla... | The request runs asynchronously. That's *why* the function takes an `onload` callback function in the first place. If it were synchronous, then `GM_xmlhttpRequest` would simply return the response details like an ordinary function.
While waiting for the request to return, the code after the call to `GM_xmlhttpRequest`... |
525,244 | <p>curl_unescape doesnt seem to be in pycurl, what do i use instead?</p>
| [
{
"answer_id": 525271,
"author": "kender",
"author_id": 4172,
"author_profile": "https://Stackoverflow.com/users/4172",
"pm_score": 4,
"selected": true,
"text": "<p>Have you tried <code>urllib.quote</code>?</p>\n\n<pre><code>import urllib\nprint urllib.quote(\"some url\")\n\nsome%20url\n... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | curl\_unescape doesnt seem to be in pycurl, what do i use instead? | Have you tried `urllib.quote`?
```
import urllib
print urllib.quote("some url")
some%20url
```
[here's](http://docs.python.org/library/urllib.html) the documentation |
525,247 | <p>I'd like a daemonizer that can turn an arbitrary, generic script or command into a <a href="http://en.wikipedia.org/wiki/Daemon_(computer_software)" rel="noreferrer">daemon</a>.</p>
<p>There are two common cases I'd like to deal with:</p>
<ol>
<li><p>I have a script that should run forever. If it ever dies (or on... | [
{
"answer_id": 525406,
"author": "Kamil Kisiel",
"author_id": 15061,
"author_profile": "https://Stackoverflow.com/users/15061",
"pm_score": 3,
"selected": false,
"text": "<p>If you're using OS X specifically, I suggest you take a look at how launchd works. It will automatically check to ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525247",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4234/"
] | I'd like a daemonizer that can turn an arbitrary, generic script or command into a [daemon](http://en.wikipedia.org/wiki/Daemon_(computer_software)).
There are two common cases I'd like to deal with:
1. I have a script that should run forever. If it ever dies (or on reboot), restart it. Don't let there ever be two co... | You can daemonize any executable in Unix by using nohup and the & operator:
```
nohup yourScript.sh script args&
```
The nohup command allows you to shut down your shell session without it killing your script, while the & places your script in the background so you get a shell prompt to continue your session. The on... |
525,256 | <p>How does one embedd an image in HTML so that the image is delivered with the html file content and does not need a separate trip to the server to retrieve the image? We need this to embed company logo's into signatures before they leave the mail server. We don't want to use a client side solution like thunderbird's ... | [
{
"answer_id": 525260,
"author": "Two Bit Gangster",
"author_id": 63694,
"author_profile": "https://Stackoverflow.com/users/63694",
"pm_score": 0,
"selected": false,
"text": "<p>It can't be done, but that's OK because modern browsers use a KeepAlive feature so that the connection to the ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525256",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61636/"
] | How does one embedd an image in HTML so that the image is delivered with the html file content and does not need a separate trip to the server to retrieve the image? We need this to embed company logo's into signatures before they leave the mail server. We don't want to use a client side solution like thunderbird's or ... | What you need to do is encode the file to Base64, and include it like this:
```
<img src="data:image/gif;base64,R0lGODlhUAA..(the rest of your base64 encoded file)..">
```
<http://www.sweeting.org/mark/blog/2005/07/12/base64-encoded-images-embedded-in-html>
<http://dean.edwards.name/weblog/2005/06/base64-ie/> |
525,272 | <p>I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like</p>
<pre><code>file = open('myfile.txt'... | [
{
"answer_id": 525287,
"author": "Imran",
"author_id": 58866,
"author_profile": "https://Stackoverflow.com/users/58866",
"pm_score": 2,
"selected": false,
"text": "<p>Truncating the file as you read it seems a bit extreme. What if your script has a bug that doesn't cause an error? In tha... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525272",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20794/"
] | I have an application that reads lines from a file and runs its magic on each line as it is read. Once the line is read and properly processed, I would like to delete the line from the file. A backup of the removed line is already being kept. I would like to do something like
```
file = open('myfile.txt', 'rw+')
for l... | ### Remove all lines after you've done with them:
```py
with open('myfile.txt', 'r+') as file:
for line in file:
processLine(line)
file.truncate(0)
```
### Remove each line independently:
```py
lines = open('myfile.txt').readlines()
for line in lines[::-1]: # process lines in reverse order
proc... |
525,283 | <h3>Original Question</h3>
<p>What I'd like is not a standard C pre-processor, but a variation on it which would accept from somewhere - probably the command line via -DNAME1 and -UNAME2 options - a specification of which macros are defined, and would then eliminate dead code.</p>
<p>It may be easier to understand wh... | [
{
"answer_id": 525313,
"author": "Jörg W Mittag",
"author_id": 2988,
"author_profile": "https://Stackoverflow.com/users/2988",
"pm_score": 6,
"selected": true,
"text": "<p>I know absolutely nothing about C, but it sounds like you are looking for something like <a href=\"https://github.co... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525283",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15168/"
] | ### Original Question
What I'd like is not a standard C pre-processor, but a variation on it which would accept from somewhere - probably the command line via -DNAME1 and -UNAME2 options - a specification of which macros are defined, and would then eliminate dead code.
It may be easier to understand what I'm after wi... | I know absolutely nothing about C, but it sounds like you are looking for something like [`unifdef`](https://github.com/fanf2/unifdef). Note that it hasn't been updated since 2000, but there is a successor called ["Son of unifdef" (sunifdef)](https://sourceforge.net/projects/sunifdef/). |
525,319 | <p>In our C# code, we have a class called Project. Our base BusinessObject class (that all business objects inherit from) defines a property:</p>
<pre><code>public Project Project { get; set; }
</code></pre>
<p>This is normally not a problem as long as we stay within the C# codebase. However, these business object cl... | [
{
"answer_id": 525330,
"author": "shahkalpesh",
"author_id": 23574,
"author_profile": "https://Stackoverflow.com/users/23574",
"pm_score": 0,
"selected": false,
"text": "<p>How about good old methods? (GetProject/SetProject OR the way .net does it - Thread.CurrentThread)</p>\n"
},
{
... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525319",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59631/"
] | In our C# code, we have a class called Project. Our base BusinessObject class (that all business objects inherit from) defines a property:
```
public Project Project { get; set; }
```
This is normally not a problem as long as we stay within the C# codebase. However, these business object classes are exposed in web s... | It sounds like you've got an intractable problem if you've already got the web service out there with the problematic name. If you can't change anything without breaking existing customers, and you can't leave it as it is without breaking Flex, *someone's* going to be broken.
You *could* potentially expose a parallel ... |
525,324 | <p>Is it possible to execute a proc within the context of another object?</p>
<p>I know that normally you'd do proc.call(foo), and then the block should define a parameter. I was wondering though whether I could get "self" to bind to foo so that it's not necessary to have a block parameter.</p>
<pre><code>proc = Proc... | [
{
"answer_id": 525387,
"author": "Chuck",
"author_id": 50742,
"author_profile": "https://Stackoverflow.com/users/50742",
"pm_score": 7,
"selected": true,
"text": "<pre><code>foo.instance_eval &proc\n</code></pre>\n\n<p><code>instance_eval</code> can take a block instead of a string, ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63828/"
] | Is it possible to execute a proc within the context of another object?
I know that normally you'd do proc.call(foo), and then the block should define a parameter. I was wondering though whether I could get "self" to bind to foo so that it's not necessary to have a block parameter.
```
proc = Proc.new { self.hello }
... | ```
foo.instance_eval &proc
```
`instance_eval` can take a block instead of a string, and the `&` operator turns the proc into a block for use with the method call. |
525,329 | <p>I've been trying to embed an icon (.ico) into my "compyled" .exe with py2exe.</p>
<p>Py2Exe does have a way to embed an icon:</p>
<pre><code>windows=[{
'script':'MyScript.py',
'icon_resources':[(1,'MyIcon.ico')]
}]
</code></pre>
<p>And that's what I am using. The icon shows up fine on Windows XP or lower,... | [
{
"answer_id": 525486,
"author": "simplyharsh",
"author_id": 63841,
"author_profile": "https://Stackoverflow.com/users/63841",
"pm_score": 5,
"selected": true,
"text": "<p>Vista uses icons of high resolution <em>256x256</em> pixels images, they are stored using <em>PNG-based</em> compres... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525329",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/109696/"
] | I've been trying to embed an icon (.ico) into my "compyled" .exe with py2exe.
Py2Exe does have a way to embed an icon:
```
windows=[{
'script':'MyScript.py',
'icon_resources':[(1,'MyIcon.ico')]
}]
```
And that's what I am using. The icon shows up fine on Windows XP or lower, but doesn't show at all on Vista... | Vista uses icons of high resolution *256x256* pixels images, they are stored using *PNG-based* compression. The problem is if you simply make the icon and save it in standard XP `ICO` format, the resulting file will be `400Kb` on disk. The solution is to compress the images. The compression scheme used is `PNG` (Portab... |
525,333 | <p>I'm reading <strong>The C Programming Language</strong> and learned how to make a reverse Polish calculator using a stack. Here is one of the exercises that follow it:</p>
<blockquote>
<p><strong>Exercise 4-4.</strong> Add the commands to print the top elements of the stack without popping, to duplicate it, and t... | [
{
"answer_id": 525342,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 4,
"selected": true,
"text": "<p>No, it makes more sense to duplicate an <em>individual</em> element on the top of the stack. I suspect "print the... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525333",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/813/"
] | I'm reading **The C Programming Language** and learned how to make a reverse Polish calculator using a stack. Here is one of the exercises that follow it:
>
> **Exercise 4-4.** Add the commands to print the top elements of the stack without popping, to duplicate it, and to swap the top
> two elements. Add a command ... | No, it makes more sense to duplicate an *individual* element on the top of the stack. I suspect "print the top elements" was a typo that should have been the singular "print the top element".
The *reason* this is a far more likely case is because printing the "top elements" makes no sense on its own. If it was some su... |
525,364 | <p>Is it possible to download a file from a website in Windows Application form and put it into a certain directory?</p>
| [
{
"answer_id": 525368,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": false,
"text": "<p>Use <a href=\"http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadfile.aspx\" rel=\"noreferrer\"><co... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63830/"
] | Is it possible to download a file from a website in Windows Application form and put it into a certain directory? | With the [WebClient class](http://msdn.microsoft.com/en-us/library/ez801hhe.aspx):
```
using System.Net;
//...
WebClient Client = new WebClient ();
Client.DownloadFile("http://i.stackoverflow.com/Content/Img/stackoverflow-logo-250.png", @"C:\folder\stackoverflowlogo.png");
``` |
525,370 | <p>I have a database table with a list of products (clothing). The products belong to categories and are from different stores.</p>
<p>Sample categories: tops, bottoms, shoes</p>
<p>Sample stores: gap.com, macys.com, target.com</p>
<p>My customers can request to filter products in the following ways:</p>
<ul>
<li>a... | [
{
"answer_id": 525381,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>The strategy pattern doesn't necessarily knit well with the common interface-based repository approach. Personally... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a database table with a list of products (clothing). The products belong to categories and are from different stores.
Sample categories: tops, bottoms, shoes
Sample stores: gap.com, macys.com, target.com
My customers can request to filter products in the following ways:
* all products (no filter)
* by catego... | According to Eric Evan's "Domain Drive Design" you need the specification pattern. Something like this
```
public interface ISpecification<T>
{
bool Matches(T instance);
string GetSql();
}
public class ProductCategoryNameSpecification : ISpecification<Product>
{
readonly string CategoryName;
public ProductCat... |
525,376 | <p>The title says it. I'm looking for a way to determine exactly which file/registry key this executable is attempting to access. I have attempted to use Windows <a href="http://support.microsoft.com/kb/315416" rel="nofollow noreferrer">auditing capabilities</a> and <a href="http://technet.microsoft.com/en-us/sysintern... | [
{
"answer_id": 525381,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>The strategy pattern doesn't necessarily knit well with the common interface-based repository approach. Personally... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525376",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The title says it. I'm looking for a way to determine exactly which file/registry key this executable is attempting to access. I have attempted to use Windows [auditing capabilities](http://support.microsoft.com/kb/315416) and [Process Monitor](http://technet.microsoft.com/en-us/sysinternals/bb896645.aspx) to determine... | According to Eric Evan's "Domain Drive Design" you need the specification pattern. Something like this
```
public interface ISpecification<T>
{
bool Matches(T instance);
string GetSql();
}
public class ProductCategoryNameSpecification : ISpecification<Product>
{
readonly string CategoryName;
public ProductCat... |
525,405 | <p>in C do return -1 when i want to cancel the download in either the header or the write function. In pycurl i get this error</p>
<pre><code>pycurl.error: invalid return value for write callback -1 17
</code></pre>
<p>I dont know what the 17 means but what am i not doing correctly?</p>
| [
{
"answer_id": 525481,
"author": "RSabet",
"author_id": 49219,
"author_profile": "https://Stackoverflow.com/users/49219",
"pm_score": 3,
"selected": true,
"text": "<p>from pycurl.c: </p>\n\n<pre><code>else if (PyInt_Check(result)) {\n long obj_size = PyInt_AsLong(result);\n if (obj... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | in C do return -1 when i want to cancel the download in either the header or the write function. In pycurl i get this error
```
pycurl.error: invalid return value for write callback -1 17
```
I dont know what the 17 means but what am i not doing correctly? | from pycurl.c:
```
else if (PyInt_Check(result)) {
long obj_size = PyInt_AsLong(result);
if (obj_size < 0 || obj_size > total_size) {
PyErr_Format(ErrorObject, "invalid return value for write callback %ld %ld", (long)obj_size, (long)total_size);
goto verbose_error;
}
```
this would mean ... |
525,408 | <p>I have a spring web application which has been working fine on tomcat 5.5. I've attempted to deploy the same web app to a tomcat 6 container and come up against some issues.</p>
<p>The main two problems I've had are relating to configuring the container for jstl and getting the spring security login to work properl... | [
{
"answer_id": 525423,
"author": "Michael Pralow",
"author_id": 62201,
"author_profile": "https://Stackoverflow.com/users/62201",
"pm_score": 1,
"selected": false,
"text": "<p>if you use maven, you need for jstl :</p>\n\n<pre><code> <dependency>\n <groupId>javax.ser... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525408",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/63837/"
] | I have a spring web application which has been working fine on tomcat 5.5. I've attempted to deploy the same web app to a tomcat 6 container and come up against some issues.
The main two problems I've had are relating to configuring the container for jstl and getting the spring security login to work properly.
I beli... | if you use maven, you need for jstl :
```
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
``` |
525,413 | <p>I would like to know how threads are handled on the server side using MarshalByRef objects.</p>
<p>Given my remoted MarshalByRef class:</p>
<pre><code>public class MyRemotedClass : MarshalByRef
{
public int MyInt;
public string MyString;
}
</code></pre>
<p>Client code (single threaded):</p>
<pre><code>MyRemo... | [
{
"answer_id": 525423,
"author": "Michael Pralow",
"author_id": 62201,
"author_profile": "https://Stackoverflow.com/users/62201",
"pm_score": 1,
"selected": false,
"text": "<p>if you use maven, you need for jstl :</p>\n\n<pre><code> <dependency>\n <groupId>javax.ser... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24451/"
] | I would like to know how threads are handled on the server side using MarshalByRef objects.
Given my remoted MarshalByRef class:
```
public class MyRemotedClass : MarshalByRef
{
public int MyInt;
public string MyString;
}
```
Client code (single threaded):
```
MyRemotedClass m = GetSomehowMyRemotedClass();
m.... | if you use maven, you need for jstl :
```
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
<scope>runtime</scope>
</dependency>
``` |
525,416 | <p>Consider the following code</p>
<pre><code>Timer1 .Enabled := False;
Timer1.Interval : = 300;
For I := 1 to NumberOfTimesNeed do
Begin
Timer1 .Enabled := False; //
Timer1 .Enabled := True; // reset the timer to 0.30 seconds
TakesToLong := False;
DoSomethingThatTakesTime; // Application... | [
{
"answer_id": 525428,
"author": "mghie",
"author_id": 30568,
"author_profile": "https://Stackoverflow.com/users/30568",
"pm_score": 5,
"selected": true,
"text": "<p>Yes, it will. Setting Enabled to False will call the Windows API function KillTimer() if the timer was enabled before. Se... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525416",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17560/"
] | Consider the following code
```
Timer1 .Enabled := False;
Timer1.Interval : = 300;
For I := 1 to NumberOfTimesNeed do
Begin
Timer1 .Enabled := False; //
Timer1 .Enabled := True; // reset the timer to 0.30 seconds
TakesToLong := False;
DoSomethingThatTakesTime; // Application.ProcessMessag... | Yes, it will. Setting Enabled to False will call the Windows API function KillTimer() if the timer was enabled before. Setting Enabled to True will call the Windows API function SetTimer() if the timer was not enabled before.
It's a standard idiom, which has been working since the times of Delphi 1.
I would however i... |
525,425 | <p>What would your own (I assume perfect) programming language look like? Give a small example and explain your <strong>novel</strong> ideas! </p>
<p>I'm really interested in the syntax.</p>
| [
{
"answer_id": 525426,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>I have no concept of a \"perfect\" programming language because there isn't just one task to be performed.</p>\n\n<p>... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525425",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17500/"
] | What would your own (I assume perfect) programming language look like? Give a small example and explain your **novel** ideas!
I'm really interested in the syntax. | Jon is right in saying that “[d]ifferent tasks suit different languages and paradigms.” However, there are a few considerations that are largely independent of the domain. These mostly concern syntax but since code is read more often than written, I actually think that syntax matters.
For one thing, and something that... |
525,430 | <p>When my program starts, the main window places itself where it was when it was last closed. I want to modify this behavior some so if the window is off-screen (or partially off-screen) it moves itself to fully on screen. </p>
<p>I've got this working perfectly. Here's the code:<br><br></p>
<pre><code> int x ... | [
{
"answer_id": 525434,
"author": "Lawrence Dol",
"author_id": 8946,
"author_profile": "https://Stackoverflow.com/users/8946",
"pm_score": 3,
"selected": true,
"text": "<p>Use getScreenInsets (Java 4+):</p>\n\n<pre><code>static public Insets getScreenInsets(Window wnd) {\n Insets ... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525430",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61248/"
] | When my program starts, the main window places itself where it was when it was last closed. I want to modify this behavior some so if the window is off-screen (or partially off-screen) it moves itself to fully on screen.
I've got this working perfectly. Here's the code:
```
int x = gameConfig.windowX;
int ... | Use getScreenInsets (Java 4+):
```
static public Insets getScreenInsets(Window wnd) {
Insets si;
try {
if(wnd==null) { si=Toolkit.getDefaultToolkit().getScreenInsets(new Frame().getGraphicsConfiguration()); }
else { si=wnd.getToolkit() .getScreen... |
525,492 | <p>Grrr so close yet still failing...</p>
<p>I display this tree, in Flex, which contains two nodes types:</p>
<ol>
<li>Regular nodes, which are rendered normally like text (because they are!)</li>
<li>Rich (HTML) nodes - that's where things get twisted</li>
</ol>
<p>Note that my issue is when I <strong>dynamically ... | [
{
"answer_id": 538659,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": 0,
"selected": false,
"text": "<p>It would certainly help if you could post some code.</p>\n\n<p>I was wondering though why you are using a c... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525492",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6253/"
] | Grrr so close yet still failing...
I display this tree, in Flex, which contains two nodes types:
1. Regular nodes, which are rendered normally like text (because they are!)
2. Rich (HTML) nodes - that's where things get twisted
Note that my issue is when I **dynamically add** a new (HTML) node to my tree.
---
So..... | You made false assumption about label component in default renderer - it is capable of displaying html content. This renderer works for me:
```
public class HtmlTreeItemRenderer extends TreeItemRenderer {
override protected function commitProperties():void {
super.commitProperties();
label.htmlText... |
525,498 | <p>I have created usercontrol GridEx:UserControl.
On that control I putted GridControl (DevExpress datagrid control).
I have created Property DataGrid which return inner datagrid control (previously added)
How to enable design support for DataGrid ?
I try to put </p>
<pre><code>[Designer("DevExpress.XtraGrid.Design.Gr... | [
{
"answer_id": 538659,
"author": "Christophe Herreman",
"author_id": 17255,
"author_profile": "https://Stackoverflow.com/users/17255",
"pm_score": 0,
"selected": false,
"text": "<p>It would certainly help if you could post some code.</p>\n\n<p>I was wondering though why you are using a c... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29421/"
] | I have created usercontrol GridEx:UserControl.
On that control I putted GridControl (DevExpress datagrid control).
I have created Property DataGrid which return inner datagrid control (previously added)
How to enable design support for DataGrid ?
I try to put
```
[Designer("DevExpress.XtraGrid.Design.GridControlDesig... | You made false assumption about label component in default renderer - it is capable of displaying html content. This renderer works for me:
```
public class HtmlTreeItemRenderer extends TreeItemRenderer {
override protected function commitProperties():void {
super.commitProperties();
label.htmlText... |
525,512 | <p>What is the command to drop all tables in SQLite? </p>
<p>Similarly I'd like to drop all indexes.</p>
| [
{
"answer_id": 525523,
"author": "paxdiablo",
"author_id": 14860,
"author_profile": "https://Stackoverflow.com/users/14860",
"pm_score": 7,
"selected": false,
"text": "<p>I don't think you can drop all tables in one hit but you can do the following to get the commands:</p>\n\n<pre><code>... | 2009/02/08 | [
"https://Stackoverflow.com/questions/525512",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/58521/"
] | What is the command to drop all tables in SQLite?
Similarly I'd like to drop all indexes. | ```
rm db/development.sqlite3
``` |