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 |
|---|---|---|---|---|---|---|
393,633 | <p>I want to flip an imageView (left/right), but I can not find a UIView (or UIImageView) method to do that? any idea?</p>
<p>thanks!</p>
| [
{
"answer_id": 393645,
"author": "diclophis",
"author_id": 32678,
"author_profile": "https://Stackoverflow.com/users/32678",
"pm_score": 0,
"selected": false,
"text": "<p>Put your UIIMageView into a UIView and use this code (from the utility app project sample)</p>\n\n<pre><code>- (void)... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393633",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47936/"
] | I want to flip an imageView (left/right), but I can not find a UIView (or UIImageView) method to do that? any idea?
thanks! | I think the only thing you're looking for is:
UIView's
```
+ (void)setAnimationTransition:(UIViewAnimationTransition)transition forView:(UIView *)view cache:(BOOL)cache;
```
and
```
UIViewAnimationTransitionFlipFromLeft,
UIViewAnimationTransitionFlipFromRight,
```
These animation transitions can only be used wit... |
393,635 | <p>I wish to pass many small PNG files as base64 encoded URIs within an XML response, but there seems to be no way to make flex present these images. I was thinking of the data uri scheme, but it appears not to be supported.</p>
<h2>Proposed solutions</h2>
<ol>
<li>Use Loader.LoadBytes</li>
</ol>
<p>Tried it and it ... | [
{
"answer_id": 393903,
"author": "cliff.meyers",
"author_id": 41754,
"author_profile": "https://Stackoverflow.com/users/41754",
"pm_score": 3,
"selected": true,
"text": "<p>If you decode the image data into a ByteArray then you can use Loader.loadBytes(byteArray) to load it as an image.<... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393635",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11208/"
] | I wish to pass many small PNG files as base64 encoded URIs within an XML response, but there seems to be no way to make flex present these images. I was thinking of the data uri scheme, but it appears not to be supported.
Proposed solutions
------------------
1. Use Loader.LoadBytes
Tried it and it doesn't seem to w... | If you decode the image data into a ByteArray then you can use Loader.loadBytes(byteArray) to load it as an image. |
393,637 | <p>I'm running a Django application. Had it under Apache + mod_python before, and it was all OK. Switched to Lighttpd + FastCGI. Now I randomly get the following exception (neither the place nor the time where it appears seem to be predictable). Since it's random, and it appears only after switching to FastCGI, I assum... | [
{
"answer_id": 393656,
"author": "diclophis",
"author_id": 32678,
"author_profile": "https://Stackoverflow.com/users/32678",
"pm_score": 0,
"selected": false,
"text": "<p>In the switch, did you change PostgreSQL client/server versions?</p>\n\n<p>I have seen similar problems with php+mysq... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5475/"
] | I'm running a Django application. Had it under Apache + mod\_python before, and it was all OK. Switched to Lighttpd + FastCGI. Now I randomly get the following exception (neither the place nor the time where it appears seem to be predictable). Since it's random, and it appears only after switching to FastCGI, I assume ... | In the end I switched back to Apache + mod\_python (I was having other random errors with fcgi, besides this one) and everything is good and stable now.
The question still remains open. In case anybody has this problem in the future and solves it they can record the solution here for future reference. :) |
393,639 | <p>MySQL column > sdate, edate ( its 2 column).</p>
<p>sdate is start date for project starting and edate is end date for project ending.</p>
<p>so i need to make search between them..</p>
<pre><code><strong>Search</strong><br />
<form method="post" action="search.php">
Start Report Date : ... | [
{
"answer_id": 393650,
"author": "Assaf Lavie",
"author_id": 11208,
"author_profile": "https://Stackoverflow.com/users/11208",
"pm_score": 0,
"selected": false,
"text": "<p>It seems like a simple select query with a \"where\" clause can do the trick.</p>\n\n<p>Peuso-code:</p>\n\n<pre><co... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | MySQL column > sdate, edate ( its 2 column).
sdate is start date for project starting and edate is end date for project ending.
so i need to make search between them..
```
<strong>Search</strong><br />
<form method="post" action="search.php">
Start Report Date : <input type="text" name="sdate" />
End Report Date... | assuming that your `sdate` and `edate` are of MySQL columns type `DATE` you could do the following:
```
SELECT
Project_Name
, sdate
, edate
FROM your_table
WHERE
sdate <= '2008-12-26'
AND
edate >= '2008-12-26'
```
or you could use DATEDIFF
```
SELECT
Project_Name
, sdate
, edate
FROM your_table
WHE... |
393,644 | <p>I've got a table of student information in MySQL that looks like this (simplified):</p>
<pre><code>| age : int | city : text | name : text |
-----------------------------------------------------
| | | |
</code></pre>
<p>I wish to select all student names an... | [
{
"answer_id": 393648,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 4,
"selected": true,
"text": "<pre><code>select \n t1.name, \n t1.age as a, \n count(t2.age) NumberSameAge\nfrom \n tbl_students t1 inner ... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11208/"
] | I've got a table of student information in MySQL that looks like this (simplified):
```
| age : int | city : text | name : text |
-----------------------------------------------------
| | | |
```
I wish to select all student names and ages within a given city... | ```
select
t1.name,
t1.age as a,
count(t2.age) NumberSameAge
from
tbl_students t1 inner join tbl_students t2
on t1.age=t2.age
where
city = 'ny'
group by t1.name, t1.age
```
not tested, but something like that. I.o.w. a groupby on a join. This sometimes can be faster as the query you're runn... |
393,647 | <p>I need to send a CSV file in HTTP response. How can I set the output response as CSV format?</p>
<p>This is not working:</p>
<pre><code>Response.ContentType = "application/CSV";
</code></pre>
| [
{
"answer_id": 393651,
"author": "ibz",
"author_id": 5475,
"author_profile": "https://Stackoverflow.com/users/5475",
"pm_score": 6,
"selected": false,
"text": "<p>Use <code>text/csv</code> as the content type.</p>\n"
},
{
"answer_id": 393652,
"author": "diclophis",
"autho... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22162/"
] | I need to send a CSV file in HTTP response. How can I set the output response as CSV format?
This is not working:
```
Response.ContentType = "application/CSV";
``` | Using `text/csv` is the most appropriate type.
You should also consider adding a `Content-Disposition` header to the response. Often a text/csv will be loaded by a Internet Explorer directly into a hosted instance of Excel. This may or may not be a desirable result.
```
Response.AddHeader("Content-Disposition", "atta... |
393,661 | <p>.NET XSLT engine allows passing objects to the XSLT processing engine through the AddExtensionObject method.</p>
<p>Can someone comment on the performance of using this to retrieve localized strings to be used in the XSLT?</p>
| [
{
"answer_id": 393702,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "<p>To be honest, I wouldn't worry about it - it should be <em>more</em> than sufficient. I use an extension object to... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40498/"
] | .NET XSLT engine allows passing objects to the XSLT processing engine through the AddExtensionObject method.
Can someone comment on the performance of using this to retrieve localized strings to be used in the XSLT? | **[Extension objects](http://msdn.microsoft.com/en-us/library/tf741884.aspx)** can be used to improve performance if a part of an XSLT transformation is deemed inefficient.
While the use of methods of an extension method would not decrease performance (excluding buggy and inefficient code), **they will not improve pe... |
393,675 | <p>When I am making methods with return values, I usually try and set things up so that there is never a case when the method is called in such a way that it would have to return some default value. When I started I would often write methods that did something, and would either return what they did or, if they failed t... | [
{
"answer_id": 393691,
"author": "Matthew Flaschen",
"author_id": 47773,
"author_profile": "https://Stackoverflow.com/users/47773",
"pm_score": 1,
"selected": false,
"text": "<p>I don't agree that methods should never return null. The most obvious examples are from systems programming. ... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29182/"
] | When I am making methods with return values, I usually try and set things up so that there is never a case when the method is called in such a way that it would have to return some default value. When I started I would often write methods that did something, and would either return what they did or, if they failed to d... | In my humble opinion, there are three kinds of return-cases that you should take into consideration:
Object property manipulation
----------------------------
The first is the manipulation of object properties. The pattern you describe here is very often used when manipulating objects. A very typical scenario is usin... |
393,678 | <p>I'm storing a simple java.util.date in an Oracle XE database via hibernate.</p>
<p>When testing with JUnit if I can retrieve the correct value, I get an error like this:</p>
<pre><code>junit.framework.AssertionFailedError:
expected:<Sun Dec 28 11:20:27 CET 2008>
but was:<2008-12-28 11:20:27.0>
</... | [
{
"answer_id": 394089,
"author": "davetron5000",
"author_id": 3029,
"author_profile": "https://Stackoverflow.com/users/3029",
"pm_score": 0,
"selected": false,
"text": "<p>If you compare a <code>java.util.Date</code> to a <code>java.sql.Date</code> that both represent the same instant in... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393678",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25320/"
] | I'm storing a simple java.util.date in an Oracle XE database via hibernate.
When testing with JUnit if I can retrieve the correct value, I get an error like this:
```
junit.framework.AssertionFailedError:
expected:<Sun Dec 28 11:20:27 CET 2008>
but was:<2008-12-28 11:20:27.0>
```
The value is stored in an Ora... | Okay, worked some more on it ...
1. Oracle Date columns only store values with an accuracy of a second.
2. Java Dates do contain milliseconds, but they are typically not printed. So
expected:
was actually created by a date like 11:20:27,345, which is of course not equal to 11:20:27.0
Solution:
* either only use f... |
393,679 | <pre><code> MERGE INTO PAGEEDITCONTROL A
USING (SELECT
'1585' AS PAGEID
,'admin' AS EDITUSER
,sysdate AS EDITDATE
FROM DUAL) B
ON (A.PAGEID = B.PAGEID)
WHEN MATCHED THEN
UPDATE SET
A.EDITUSER = B.EDITUSER
,A.EDITDATE = B.EDITDATE
WHEN NOT... | [
{
"answer_id": 394992,
"author": "Henning",
"author_id": 7034,
"author_profile": "https://Stackoverflow.com/users/7034",
"pm_score": 1,
"selected": false,
"text": "<p>MySQL has a similar construct which looks less like an upsert, but more like an insate: <code>INSERT ... ON DUPLICATE KEY... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | ```
MERGE INTO PAGEEDITCONTROL A
USING (SELECT
'1585' AS PAGEID
,'admin' AS EDITUSER
,sysdate AS EDITDATE
FROM DUAL) B
ON (A.PAGEID = B.PAGEID)
WHEN MATCHED THEN
UPDATE SET
A.EDITUSER = B.EDITUSER
,A.EDITDATE = B.EDITDATE
WHEN NOT MATCHE... | ```
INSERT INTO
pageeditcontrol (pageid, edituser, editdate)
VALUES ('1585', 'admin', sysdate())
ON DUPLICATE KEY UPDATE
edituser = values(edituser),
editdate = values(editdate);
``` |
393,681 | <p>I have a situation where i need to debug a Windows CE application in both Vs.NET 2008 as well as VS.NET 2005.</p>
<p>After I switch between the emulators in these 2 environments a few times, i get the error:</p>
<blockquote>
<p>A fatal error has occurred and debugging needs to be terminated. HRESULT=0x8013110e. ... | [
{
"answer_id": 394992,
"author": "Henning",
"author_id": 7034,
"author_profile": "https://Stackoverflow.com/users/7034",
"pm_score": 1,
"selected": false,
"text": "<p>MySQL has a similar construct which looks less like an upsert, but more like an insate: <code>INSERT ... ON DUPLICATE KEY... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49189/"
] | I have a situation where i need to debug a Windows CE application in both Vs.NET 2008 as well as VS.NET 2005.
After I switch between the emulators in these 2 environments a few times, i get the error:
>
> A fatal error has occurred and debugging needs to be terminated. HRESULT=0x8013110e. Error code=0x0.
>
>
>
W... | ```
INSERT INTO
pageeditcontrol (pageid, edituser, editdate)
VALUES ('1585', 'admin', sysdate())
ON DUPLICATE KEY UPDATE
edituser = values(edituser),
editdate = values(editdate);
``` |
393,687 | <p>I would like to add attributes to Linq 2 Sql classes properties. Such as this Column is browsable in the UI or ReadOnly in the UI and so far.</p>
<p>I've thought about using templates, anybody knows how to use it? or something different?</p>
<p>Generally speaking, would do you do to address this issue with classes... | [
{
"answer_id": 393690,
"author": "Brad Leach",
"author_id": 708,
"author_profile": "https://Stackoverflow.com/users/708",
"pm_score": 1,
"selected": false,
"text": "<p>You may want to consider using <a href=\"http://damieng.com/blog/2008/09/14/linq-to-sql-template-for-visual-studio-2008\... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393687",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11659/"
] | I would like to add attributes to Linq 2 Sql classes properties. Such as this Column is browsable in the UI or ReadOnly in the UI and so far.
I've thought about using templates, anybody knows how to use it? or something different?
Generally speaking, would do you do to address this issue with classes being code-gener... | As requested, here's an approach using a `CustomTypeDescriptor` to edit the attributes at run-time; the example here is win-forms, but it should be pretty simple to swap it into WPF to see if it works...
```
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
// exa... |
393,701 | <p>Suppose we have following type:</p>
<pre><code>struct MyNullable<T> where T : struct
{
T Value;
public bool HasValue;
public MyNullable(T value)
{
this.Value = value;
this.HasValue = true;
}
public static implicit operator T(MyNullable<T> value)
{
r... | [
{
"answer_id": 393714,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "<p>That is an interesting question... it works with <code>Decimal</code>, for example, but not <code>TimeSpan</code>,... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393701",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31090/"
] | Suppose we have following type:
```
struct MyNullable<T> where T : struct
{
T Value;
public bool HasValue;
public MyNullable(T value)
{
this.Value = value;
this.HasValue = true;
}
public static implicit operator T(MyNullable<T> value)
{
return value.HasValue ? val... | Marc is on the right lines - it's section 7.2.4 in the C# 3.0 spec - Binary Operator Overload Resolution.
Basically the steps are:
* We need to resolve the implementation for "X + Y" where X and Y are both `MyNullable<Money>`.
* Looking at section 7.2.5 (candidate user-defined operators) we end up with an empty set, ... |
393,707 | <p>In XML documentaiton comments for C#, is there a way to mark two or more functions to be overloads of each other, so that they reference each other automatically? Ideally, they'd also be grouped in the sandcastle-generated documentation somehow.</p>
<p>Purpose: Often, I want to link to this group of functions, e.g.... | [
{
"answer_id": 393718,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 2,
"selected": false,
"text": "<p>The relationship between multiple overloads are already identified and grouped by XMl documentation and Sandcastl... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31317/"
] | In XML documentaiton comments for C#, is there a way to mark two or more functions to be overloads of each other, so that they reference each other automatically? Ideally, they'd also be grouped in the sandcastle-generated documentation somehow.
Purpose: Often, I want to link to this group of functions, e.g. in a list... | The relationship between multiple overloads are already identified and grouped by XMl documentation and Sandcastle.
Creating links to other members using the `see` or `seealso` tags.
Eg.
```
///See <see cref="M:AnotherMethod(System.String)">
```
I've found though that Sandcastle member resolution can be a bit fla... |
393,708 | <p>I have a legacy VB6 program which installs an Access file in a sub-directory of the common data folder (CSIDL_COMMON_APPDATA). I have now installed this program on a 64-bit Vista system, and the program works fine and accesses the file at C:\ProgramData\Wow\WowCat.mdb, but this file does not show in Windows Explorer... | [
{
"answer_id": 393719,
"author": "Vegard Larsen",
"author_id": 1606,
"author_profile": "https://Stackoverflow.com/users/1606",
"pm_score": 3,
"selected": true,
"text": "<p>This is because of folder redirection in Windows Vista. If you do not normally have the rights to write something in... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27863/"
] | I have a legacy VB6 program which installs an Access file in a sub-directory of the common data folder (CSIDL\_COMMON\_APPDATA). I have now installed this program on a 64-bit Vista system, and the program works fine and accesses the file at C:\ProgramData\Wow\WowCat.mdb, but this file does not show in Windows Explorer.... | This is because of folder redirection in Windows Vista. If you do not normally have the rights to write something into the C:\Program Files-folder, Vista will silently redirect those writes into a "secret" folder inside your user directory. The file will still be visible for the user who created the file (and any progr... |
393,738 | <p>I want to scrape the contents of a webpage. The contents are produced after a form on that site has been filled in and submitted. </p>
<p>I've read on how to scrape the end result content/webpage - but how to I programmatically submit the form? </p>
<p>I'm using python and have read that I might need to get the or... | [
{
"answer_id": 393749,
"author": "Joao da Silva",
"author_id": 46329,
"author_profile": "https://Stackoverflow.com/users/46329",
"pm_score": -1,
"selected": false,
"text": "<p>You can do it with javascript. If the form is something like:</p>\n\n<pre><code><form name='myform' ...\n</co... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393738",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to scrape the contents of a webpage. The contents are produced after a form on that site has been filled in and submitted.
I've read on how to scrape the end result content/webpage - but how to I programmatically submit the form?
I'm using python and have read that I might need to get the original webpage wi... | you'll need to generate a HTTP request containing the data for the form.
The form will look something like:
```
<form action="submit.php" method="POST"> ... </form>
```
This tells you the url to request is www.example.com/submit.php and your request should be a POST.
In the form will be several input items, eg:
... |
393,742 | <p>I have a Deplhi based Windows Service that, on installation, parses some command line arguments. I want those arguments to be added to the services command line (ImagePath value on the registry) so that the service is always started with them.</p>
<p>How can I accomplish this?</p>
<p>I want the regedit look like t... | [
{
"answer_id": 393919,
"author": "Zartog",
"author_id": 9467,
"author_profile": "https://Stackoverflow.com/users/9467",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think you can make the service start with them, but if you store those parameters in the registry you can modify t... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16732/"
] | I have a Deplhi based Windows Service that, on installation, parses some command line arguments. I want those arguments to be added to the services command line (ImagePath value on the registry) so that the service is always started with them.
How can I accomplish this?
I want the regedit look like this:
at regist... | Ok, after some research, I gave up on an elegant approach, and took the straight-forward path of writing directly to the registry.
To make things simple, I did this: I store the arguments I wanted to pass in variables on my TService. Then, I set the AfterInstall event to write directly into the registry (using a TRegi... |
393,785 | <p>Is it possible in opengl to setup blending to achieve additive color overlays?</p>
<p>Red + green = yellow, cyan + magenta = white, etc.. (see <a href="http://en.wikipedia.org/wiki/File:AdditiveColor.svg" rel="noreferrer">diagram</a>)</p>
| [
{
"answer_id": 393825,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 5,
"selected": true,
"text": "<pre><code>glEnable(GL_BLEND);\nglBlendFunc(GL_SRC_ALPHA, GL_ONE);\n</code></pre>\n\n<p>should do it.</p>\n\n<p>Have a lo... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393785",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36182/"
] | Is it possible in opengl to setup blending to achieve additive color overlays?
Red + green = yellow, cyan + magenta = white, etc.. (see [diagram](http://en.wikipedia.org/wiki/File:AdditiveColor.svg)) | ```
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE);
```
should do it.
Have a look at the full description of [glBlendFunc](http://pyopengl.sourceforge.net/documentation/manual-3.0/glBlendFunc.xhtml)
EDIT: [Old tutorial link](http://www.processingblogs.org/2007/03/31/mini-tutorial-additive-blending/) seems to... |
393,786 | <p>I have a piece of code here that i really could use some help with refactoring. I need the different methods for adding relational data in a form in rails. The code is taken from <a href="http://railscasts.com/episodes/75-complex-forms-part-3" rel="nofollow noreferrer">http://railscasts.com/episodes/75-complex-forms... | [
{
"answer_id": 393846,
"author": "srboisvert",
"author_id": 6805,
"author_profile": "https://Stackoverflow.com/users/6805",
"pm_score": 4,
"selected": true,
"text": "<p>You might also want to take a look at this site:</p>\n\n<p><a href=\"http://refactormycode.com/\" rel=\"nofollow norefe... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393786",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9191/"
] | I have a piece of code here that i really could use some help with refactoring. I need the different methods for adding relational data in a form in rails. The code is taken from <http://railscasts.com/episodes/75-complex-forms-part-3>, my problem is that i need to have the methods fro both the Material model and the A... | You might also want to take a look at this site:
<http://refactormycode.com/> |
393,813 | <p>I am making a popup window using jqModal, and I have one main popup window. After clicking OK, I have to close that window and open another popup window. How do I achieve this?</p>
<p>Here my problem is that the click event is not working. While I am pressing a button {#b}, more than this onclick of the button I hav... | [
{
"answer_id": 394246,
"author": "Mauricio Scheffer",
"author_id": 21239,
"author_profile": "https://Stackoverflow.com/users/21239",
"pm_score": 1,
"selected": false,
"text": "<p>Try setting <code>$(\"#b\").click</code> in the onShow callback of jqModal.</p>\n"
},
{
"answer_id": ... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I am making a popup window using jqModal, and I have one main popup window. After clicking OK, I have to close that window and open another popup window. How do I achieve this?
Here my problem is that the click event is not working. While I am pressing a button {#b}, more than this onclick of the button I have to open... | Try setting `$("#b").click` in the onShow callback of jqModal. |
393,824 | <p>I need to use git over SSH (it's a self-imposed limitation, but one I am loathe to break). If my laptop is sitting on my home network, it all works great. When I'm at work or logged in via VPN, however, I would need to use corkscrew to access my remote repository, which I can set up without problems. </p>
<p>I w... | [
{
"answer_id": 393834,
"author": "Paul Beckingham",
"author_id": 14356,
"author_profile": "https://Stackoverflow.com/users/14356",
"pm_score": 2,
"selected": false,
"text": "<p>I solved this problem for myself by setting up a free DynDNS account that points to my server. Then, I clone v... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393824",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45978/"
] | I need to use git over SSH (it's a self-imposed limitation, but one I am loathe to break). If my laptop is sitting on my home network, it all works great. When I'm at work or logged in via VPN, however, I would need to use corkscrew to access my remote repository, which I can set up without problems.
I would like to ... | Looking through my old questions, I realized I resolved this years ago (via questions on [ServerFault](https://serverfault.com/users/214507/kasperd%20%22kasperd) / [SuperUser](https://serverfault.com/a/889410/21814 "ServerFault")) and never posted an answer.
The answer is compliments of [kasperd](https://serverfault.c... |
393,840 | <p>I need to locate the node within an xml file by its value using XPath.
The problem araises when the node to find contains value with whitespaces inside.
F.e.:</p>
<pre><code><Root>
<Child>value</Child>
<Child>value with spaces</Child>
</Root>
</code></pre>
<p>I can not const... | [
{
"answer_id": 393865,
"author": "Scott Evernden",
"author_id": 11397,
"author_profile": "https://Stackoverflow.com/users/11397",
"pm_score": 0,
"selected": false,
"text": "<p>did you try #x20 ?</p>\n"
},
{
"answer_id": 393867,
"author": "kdgregory",
"author_id": 42126,
... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393840",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1596171/"
] | I need to locate the node within an xml file by its value using XPath.
The problem araises when the node to find contains value with whitespaces inside.
F.e.:
```
<Root>
<Child>value</Child>
<Child>value with spaces</Child>
</Root>
```
I can not construct the XPath locating the second Child node.
Simple XPath /... | **Depending on your exact situation, there are different XPath expressions that will select the node**, whose value contains some whitespace.
First, let us recall that any one of these characters is "whitespace":
**`	`** -- the Tab
**`
`** -- newline
**`
`** -- carriage return
**`' '`*... |
393,843 | <p>I need to delete some Unicode symbols from the string 'بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ'</p>
<p>I know they exist here for sure. I tried:</p>
<pre><code>re.sub('([\u064B-\u0652\u06D4\u0670\u0674\u06D5-\u06ED]+)', '', 'بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ')
</code></pre>
<p>but it doesn't work. String stay... | [
{
"answer_id": 393856,
"author": "ʞɔıu",
"author_id": 41613,
"author_profile": "https://Stackoverflow.com/users/41613",
"pm_score": 8,
"selected": true,
"text": "<p>Are you using python 2.x or 3.0?</p>\n\n<p>If you're using 2.x, try making the regex string a unicode-escape string, with '... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393843",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49206/"
] | I need to delete some Unicode symbols from the string 'بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ'
I know they exist here for sure. I tried:
```
re.sub('([\u064B-\u0652\u06D4\u0670\u0674\u06D5-\u06ED]+)', '', 'بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ')
```
but it doesn't work. String stays the same. What am I doing wrong... | Are you using python 2.x or 3.0?
If you're using 2.x, try making the regex string a unicode-escape string, with 'u'. Since it's regex it's good practice to make your regex string a raw string, with 'r'. Also, putting your entire pattern in parentheses is superfluous.
```
re.sub(ur'[\u064B-\u0652\u06D4\u0670\u0674\u06... |
393,852 | <p>I wonder if you anyone can construct a regular expression that can detect if a person searches for something like "site:cnn.com" or "site:www.globe.com.ph/". I've been having the most difficult time figuring it out. Thanks a lot in advance!</p>
<p>Edit: Sorry forgot to mention my script is in PHP.</p>
| [
{
"answer_id": 393875,
"author": "ʞɔıu",
"author_id": 41613,
"author_profile": "https://Stackoverflow.com/users/41613",
"pm_score": 0,
"selected": false,
"text": "<p>What are you matching against? A referer url?</p>\n\n<p>Assuming you're matching against a referer url that looks like thi... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47947/"
] | I wonder if you anyone can construct a regular expression that can detect if a person searches for something like "site:cnn.com" or "site:www.globe.com.ph/". I've been having the most difficult time figuring it out. Thanks a lot in advance!
Edit: Sorry forgot to mention my script is in PHP. | Ok, for input into an arbitary text field, something as simple as the following will work:
```
\bsite:(\S+)
```
where the parentheses will capture whatever site/domain they're trying to search. It won't verify it as valid, but validating urls/domains is complex and there are many easily googlable regexes for doing t... |
393,853 | <p>I have a class called DataSet with various constructors, each specifying a different type of variable. It might look a bit like this:</p>
<pre><code>public class DataSet
{
private HashSet Data;
public DataSet( DataObject obj )
{
Data = new <DataObject>HashSet();
Data.add( obj );... | [
{
"answer_id": 393855,
"author": "Loki",
"author_id": 39057,
"author_profile": "https://Stackoverflow.com/users/39057",
"pm_score": 1,
"selected": false,
"text": "<p>You could fetch an object from the set and verify its type.</p>\n\n<p>Or you could have multiple sets to contain different... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19825/"
] | I have a class called DataSet with various constructors, each specifying a different type of variable. It might look a bit like this:
```
public class DataSet
{
private HashSet Data;
public DataSet( DataObject obj )
{
Data = new <DataObject>HashSet();
Data.add( obj );
}
public Dat... | Sounds like you want to make the entire class generic- add a template parameter to the declaration for the class and define your HashSet and retrieval functions using that template parameter for the types.
I'm a .Net guy at the moment, though, so I couldn't give you the Java syntax, but using C# *syntax* it would look... |
393,871 | <p><br/>
I'd like to include <strong>Python scripting</strong> in one of my applications, that is written in Python itself. </p>
<p>My application must be able to call external Python functions (written by the user) as <strong>callbacks</strong>. There must be some control on code execution; for example, if the user p... | [
{
"answer_id": 393893,
"author": "gimel",
"author_id": 6491,
"author_profile": "https://Stackoverflow.com/users/6491",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://pypi.python.org/pypi/RestrictedPython\" rel=\"nofollow noreferrer\">RestrictedPython</a> provides a restri... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393871",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23034/"
] | I'd like to include **Python scripting** in one of my applications, that is written in Python itself.
My application must be able to call external Python functions (written by the user) as **callbacks**. There must be some control on code execution; for example, if the user provided code with syntax errors, the appli... | Use `__import__` to import the files provided by the user. This function will return a module. Use that to call the functions from the imported file.
Use `try..except` both on `__import__` and on the actual call to catch errors.
Example:
```
m = None
try:
m = __import__("external_module")
except:
# invalid m... |
393,873 | <p>My objective here is really simple -- I'm trying to set an <code>NSString</code> to some test data, then return the class, which should be <code>NSString</code>. Here's my code:</p>
<pre><code>NSString* stringer = [NSString stringWithFormat: @"Test"];
NSLog(@"%@", [stringer class]);
</code></pre>
<p>The log says t... | [
{
"answer_id": 393880,
"author": "mipadi",
"author_id": 28804,
"author_profile": "https://Stackoverflow.com/users/28804",
"pm_score": 6,
"selected": true,
"text": "<p>NSString is really a container class for different types of string objects. Generally an NSString constructor <em>does</e... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393873",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29297/"
] | My objective here is really simple -- I'm trying to set an `NSString` to some test data, then return the class, which should be `NSString`. Here's my code:
```
NSString* stringer = [NSString stringWithFormat: @"Test"];
NSLog(@"%@", [stringer class]);
```
The log says that the class is `NSCFString`, not `NSString`. W... | NSString is really a container class for different types of string objects. Generally an NSString constructor *does* return an object that is actually of type NSCFString, which is a thin wrapper around the Core Foundation CFString struct. |
393,881 | <p>Hey, im doing a little app for my smart phone, using Windows Mobile 6. I'm trying to get all currently running processec, but method CreateToolhelp32Snapshot always returns -1. So now im stuck. I tried to get error with invoking GetLastError() method, but that method returns 0 value.
Here is a snippet of my code.</p... | [
{
"answer_id": 393926,
"author": "reuben",
"author_id": 41646,
"author_profile": "https://Stackoverflow.com/users/41646",
"pm_score": 0,
"selected": false,
"text": "<p>If you're not seeing valid \"last error\" information, perhaps you might need to add the \"SetLastError\" attribute on t... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393881",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19600/"
] | Hey, im doing a little app for my smart phone, using Windows Mobile 6. I'm trying to get all currently running processec, but method CreateToolhelp32Snapshot always returns -1. So now im stuck. I tried to get error with invoking GetLastError() method, but that method returns 0 value.
Here is a snippet of my code.
```
... | * First, your handle check is wrong. It's common for the high bit to be on in a handle, causing it to look like a negative number when cast to a signed int. You should be checking that is isn't NULL (0) or INVALID\_HANDLE\_VALUE (-1 / 0xffffffff).
* You shouldn't be "invoking GetLastError" but calling Marshal.GetLastWi... |
393,885 | <p>Simple question - In c++, what's the neatest way of getting which of two numbers (u0 and u1) is the smallest positive number? (that's still efficient)</p>
<p>Every way I try it involves big if statements or complicated conditional statements.</p>
<p>Thanks,
Dan</p>
<p>Here's a simple example:</p>
<pre><code>bool... | [
{
"answer_id": 393906,
"author": "antik",
"author_id": 1625,
"author_profile": "https://Stackoverflow.com/users/1625",
"pm_score": 2,
"selected": false,
"text": "<p>I suggest you refactor the function into simpler functions. Furthermore, this allows your compiler to better enforce expec... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18909/"
] | Simple question - In c++, what's the neatest way of getting which of two numbers (u0 and u1) is the smallest positive number? (that's still efficient)
Every way I try it involves big if statements or complicated conditional statements.
Thanks,
Dan
Here's a simple example:
```
bool lowestPositive(int a, int b, int& ... | I prefer clarity over compactness:
```
bool lowestPositive( int a, int b, int& result )
{
if (a > 0 && a <= b) // a is positive and smaller than or equal to b
result = a;
else if (b > 0) // b is positive and either smaller than a or a is negative
result = b;
else
result = a; // at least b is... |
393,886 | <h2>Exact Duplicate of: <a href="https://stackoverflow.com/questions/390800/is-there-a-way-to-do-object-with-its-attributes-serializing-to-xml">Is there a way to do object (with its attributes) serializing to xml?</a></h2>
<p>Quite Ironically, it's a duplicate of the poster's previous question.</p>
<hr />
<p>I want ... | [
{
"answer_id": 393916,
"author": "StingyJack",
"author_id": 16391,
"author_profile": "https://Stackoverflow.com/users/16391",
"pm_score": 0,
"selected": false,
"text": "<p>You want to serialize your Class to XML. Its not going to serialize an individual attribute or element. </p>\n\n<p>U... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393886",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48824/"
] | Exact Duplicate of: [Is there a way to do object (with its attributes) serializing to xml?](https://stackoverflow.com/questions/390800/is-there-a-way-to-do-object-with-its-attributes-serializing-to-xml)
---------------------------------------------------------------------------------------------------------------------... | Use the XmlSerializer class:
```
//Create serializer instance, passing in the type of the class
XmlSerializer serializer =
new XmlSerializer(typeof(FormElement));
// Create a FileStream to write with (could be any other stream)
Stream writer = new FileStream(filename, FileMode.Create);
// Serialize the object, an... |
393,888 | <p>I have a class declared in the App_Code folder. The class contains a public shared method that returns a type Portfolio.
<br /><br />
When I try to call this method to initialize an object of type Portfolio in one of the ASCX controls, i get a "Value of type Jaguar.Portfolio cannot be converted to Jaguar.Portfolio" ... | [
{
"answer_id": 393896,
"author": "JamesEggers",
"author_id": 28540,
"author_profile": "https://Stackoverflow.com/users/28540",
"pm_score": 2,
"selected": false,
"text": "<p>Do you have a webpage or a user control also called Portfolio? You may have a name space collision where it's conf... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1443363/"
] | I have a class declared in the App\_Code folder. The class contains a public shared method that returns a type Portfolio.
When I try to call this method to initialize an object of type Portfolio in one of the ASCX controls, i get a "Value of type Jaguar.Portfolio cannot be converted to Jaguar.Portfolio" message.
This... | Do you have a webpage or a user control also called Portfolio? You may have a name space collision where it's confused between which Portfolio object to use. If this is the case, you'll need to change the name of the Class/Module or the control's or page's code behind class and you should be all set. |
393,895 | <p>I am using jQuery and Ajax, and my <code>Ajax.php</code> file returns the following field into the main file. While I am clicking in Mozilla and Chrome, it is working fine and gives an alert, but when I use Internet Explorer 7 (version 7.0.5730.13), it wasn't supported. Do I need to do anything on browser ... | [
{
"answer_id": 393904,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": true,
"text": "<p>You might want to get rid of the extra space after the closing parenthesis (this may just be a typo in your post, tho... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393895",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I am using jQuery and Ajax, and my `Ajax.php` file returns the following field into the main file. While I am clicking in Mozilla and Chrome, it is working fine and gives an alert, but when I use Internet Explorer 7 (version 7.0.5730.13), it wasn't supported. Do I need to do anything on browser side or do I have to mod... | You might want to get rid of the extra space after the closing parenthesis (this may just be a typo in your post, though), put in a semi-colon, and return false so that it doesn't attempt to follow the link.
```
echo " <a href='#' onclick=\"javascript:alert('hello'); return false;\"> link</a>";
``` |
393,943 | <p>I'm fiddling with calling DLLs from C#, and came across the need to define my own structs. Lots of articles force a sequential layout for the struct with</p>
<pre><code>[StructLayout(LayoutKind.Sequential)]
struct Foo ...
</code></pre>
<p>So, I followed suite, and my programme worked. Now, when I took the line out... | [
{
"answer_id": 393964,
"author": "Hans Passant",
"author_id": 17034,
"author_profile": "https://Stackoverflow.com/users/17034",
"pm_score": 4,
"selected": true,
"text": "<p>The internal layout of a managed struct is undocumented and undiscoverable. Implementation details like member ord... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393943",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30698/"
] | I'm fiddling with calling DLLs from C#, and came across the need to define my own structs. Lots of articles force a sequential layout for the struct with
```
[StructLayout(LayoutKind.Sequential)]
struct Foo ...
```
So, I followed suite, and my programme worked. Now, when I took the line out, it still works. Why do I... | The internal layout of a managed struct is undocumented and undiscoverable. Implementation details like member order and packing are intentionally hidden. With the [StructLayout] attribute, you force the P/Invoke marshaller to impose a specific layout and packing.
That the default just happens to match what you need t... |
393,950 | <p>Can someone please give me a simple example on how to add three rows to a ListField so that the list shows something like this?</p>
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
<p>I just want to show a list in which the user can select one of the items and the program would do something depending on the item select... | [
{
"answer_id": 401557,
"author": "roryf",
"author_id": 270,
"author_profile": "https://Stackoverflow.com/users/270",
"pm_score": 5,
"selected": true,
"text": "<p>You probably want to look at using an ObjectListField. Handling the select action is done throught the containing Screen objec... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393950",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49229/"
] | Can someone please give me a simple example on how to add three rows to a ListField so that the list shows something like this?
Item 1
Item 2
Item 3
I just want to show a list in which the user can select one of the items and the program would do something depending on the item selected.
I've search all over the i... | You probably want to look at using an ObjectListField. Handling the select action is done throught the containing Screen object, I've done this below using a MenuItem, I'm not really sure how to set a default select listener, you may have to detect key and trackwheel events.
Some example code for you: (not tested!)
`... |
393,954 | <p>I'm trying to write a program which takes an <code>SDL_Surface</code>, converts it to an <code>IplImage</code>, uses the cvBlobsLib to find blobs, paints the blobs as spots back over the image, then converts the output <code>IplImage</code> back to an <code>SDL_Surface</code>.</p>
<p>I'm almost done: only convertin... | [
{
"answer_id": 395408,
"author": "sgielen",
"author_id": 13104,
"author_profile": "https://Stackoverflow.com/users/13104",
"pm_score": 5,
"selected": true,
"text": "<p>Ok, I got it working!</p>\n\n<p>I think I was confused by the fact that an OpenCV depth of 8 means <em>a pixel has 8 bit... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13104/"
] | I'm trying to write a program which takes an `SDL_Surface`, converts it to an `IplImage`, uses the cvBlobsLib to find blobs, paints the blobs as spots back over the image, then converts the output `IplImage` back to an `SDL_Surface`.
I'm almost done: only converting the `IplImage` back to an `SDL_Surface` hasn't been ... | Ok, I got it working!
I think I was confused by the fact that an OpenCV depth of 8 means *a pixel has 8 bits per channel, so in a 3-channel image, a pixel has 24 bits*. So when converting that to the SDL meaning of depth, we get `8 * 3 = 24` bits.
The image was 24 bits after all, which SDL supports. So converting the... |
393,968 | <p>That is, if I had two or more sets, and I wanted to return a new set containing either:</p>
<ol>
<li>All of the elements each set has in common (AND).</li>
<li>All of the elements total of each set (OR).</li>
<li>All of the elements unique to each set. (XOR).</li>
</ol>
<p>Is there an easy, pre-existing way to do ... | [
{
"answer_id": 393979,
"author": "Milhous",
"author_id": 17712,
"author_profile": "https://Stackoverflow.com/users/17712",
"pm_score": 1,
"selected": false,
"text": "<p>check out the sets <a href=\"http://java.sun.com/j2se/1.4.2/docs/api/java/util/Set.html\" rel=\"nofollow noreferrer\">a... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393968",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19825/"
] | That is, if I had two or more sets, and I wanted to return a new set containing either:
1. All of the elements each set has in common (AND).
2. All of the elements total of each set (OR).
3. All of the elements unique to each set. (XOR).
Is there an easy, pre-existing way to do that?
**Edit:** That's the wrong termi... | Assuming 2 Set objects a and b
AND(intersection of two sets)
```
a.retainAll(b);
```
OR(union of two sets)
```
a.addAll(b);
```
XOR
either roll your own loop:
```
foreach item
if(a.contains(item) and !b.contains(item) || (!a.contains(item) and b.contains(item)))
c.add(item)
```
or do this:
```
c.addAll(a... |
393,980 | <p>I'm looking for ways to restrict the number of C symbols exported to a Linux static library (archive). I'd like to limit these to only those symbols that are part of the official API for the library. I already use 'static' to declare most functions as static, but this restricts them to file scope. I'm looking for... | [
{
"answer_id": 394000,
"author": "Joshua",
"author_id": 14768,
"author_profile": "https://Stackoverflow.com/users/14768",
"pm_score": 0,
"selected": false,
"text": "<p>My way of doing it is to mark everything that is not to be exported with INTERNAL,\ninclude guard all .h files, compile ... | 2008/12/26 | [
"https://Stackoverflow.com/questions/393980",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm looking for ways to restrict the number of C symbols exported to a Linux static library (archive). I'd like to limit these to only those symbols that are part of the official API for the library. I already use 'static' to declare most functions as static, but this restricts them to file scope. I'm looking for a way... | Static libraries can not do what you want for code compiled with either GCC 3.x or 4.x.
If you can use shared objects (libraries), the GNU linker does what you need with a feature called a version script. This is usually used to provide version-specific entry points, but the degenerate case just distinguishes between... |
394,036 | <p>What I need to do is have a C# 2005 GUI app call a .bat and several VBScript files at user's request. This is just a stop-gap solution until the end of the holidays and I can write it all in C#. I can get the VBScript files to execute with no problem but I am unable to execute the .bat file. When I "click" in the C#... | [
{
"answer_id": 394038,
"author": "kemiller2002",
"author_id": 1942,
"author_profile": "https://Stackoverflow.com/users/1942",
"pm_score": 5,
"selected": true,
"text": "<p>Here is what you are looking for:</p>\n\n<p><a href=\"https://stackoverflow.com/questions/361097/c-service-cannot-exe... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394036",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33727/"
] | What I need to do is have a C# 2005 GUI app call a .bat and several VBScript files at user's request. This is just a stop-gap solution until the end of the holidays and I can write it all in C#. I can get the VBScript files to execute with no problem but I am unable to execute the .bat file. When I "click" in the C# ap... | Here is what you are looking for:
[Service hangs up at WaitForExit after calling batch file](https://stackoverflow.com/questions/361097/c-service-cannot-execute-batch-file)
It's about a question as to why a service can't execute a file, but it shows all the code necessary to do so. |
394,053 | <p>I am doing windows appliction in vb.net. i have customer object contains save method. how do i generate insert query?</p>
<p>I need to save the object in relational database (SQL server). I need to know which is the correct way of doing the insertion ie,. Inside the save method i have written the SQL statement to s... | [
{
"answer_id": 394076,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 1,
"selected": false,
"text": "<p>There's a few issues here. First, exactly where are you saving this? You say SQL, but is it a SQL Server, an ins... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am doing windows appliction in vb.net. i have customer object contains save method. how do i generate insert query?
I need to save the object in relational database (SQL server). I need to know which is the correct way of doing the insertion ie,. Inside the save method i have written the SQL statement to save the ob... | A simple INSERT statement for SQL takes this basic form:
```
INSERT INTO [tablename] ( [column1], [column2], ... ) VALUES ( [value1], [value2], ...)
```
So, we obviously need to know about the database table you are using: what columns it has. We also need to know about the class: what properties it has. Finally, we... |
394,061 | <p>I`m writing a chat using WinSock2 and WinAPI functions. And I have a little trouble.<br>
I store the std::vector of client connections on server. When new client connects, new thread starts and all work with the client is done in this new thread. I do not use classes (I know it is not very good) so this list of conn... | [
{
"answer_id": 394075,
"author": "Nemanja Trifunovic",
"author_id": 8899,
"author_profile": "https://Stackoverflow.com/users/8899",
"pm_score": 1,
"selected": false,
"text": "<p>Yes, if you expose a global vector like this, you definitelly need to lock it on any read/write. And yes, that... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394061",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28298/"
] | I`m writing a chat using WinSock2 and WinAPI functions. And I have a little trouble.
I store the std::vector of client connections on server. When new client connects, new thread starts and all work with the client is done in this new thread. I do not use classes (I know it is not very good) so this list of connecti... | Yes, you are just lucky never to experience any problems. This is the problem with synchronization issues and race conditions, that the code will work in 99.9% of all cases, and when disaster strikes you won't know why.
I would take away the constructor taking a CRITICAL\_SECTION as a parameter since it is not clear w... |
394,063 | <p>I want to take two variables (in and in2) and put them together, for example:</p>
<pre><code>in = 1;
in2 = 3;
pin = in.in2; // I want this to set pin to 13
</code></pre>
<p>The arduino IDE tells me that in is not a class, so what syntax would I use to accomplish this?</p>
<p>EDIT: I figured out a different way t... | [
{
"answer_id": 394073,
"author": "Russ Bradberry",
"author_id": 48450,
"author_profile": "https://Stackoverflow.com/users/48450",
"pm_score": 0,
"selected": false,
"text": "<p>Try this, I wrote it in <strong>C</strong> but you get the gist. turn the two items into strings then concatena... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394063",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29291/"
] | I want to take two variables (in and in2) and put them together, for example:
```
in = 1;
in2 = 3;
pin = in.in2; // I want this to set pin to 13
```
The arduino IDE tells me that in is not a class, so what syntax would I use to accomplish this?
EDIT: I figured out a different way to do it, you can just take `in`. ... | If your two variables are definitely integers then
```
pin = (in*10)+in2;
```
would work.
If not, read them into strings (maybe with in.toString(), language dependent) and just do
```
pin = int.parse(in.toString()+in2.toString());
```
(Although, again dependent on language, you may have to do something other tha... |
394,081 | <p>I need function in c++ that allows me to retrieve and store the system date. I have a class for storing dates.</p>
| [
{
"answer_id": 394091,
"author": "jason",
"author_id": 45914,
"author_profile": "https://Stackoverflow.com/users/45914",
"pm_score": 3,
"selected": false,
"text": "<p>From <code>time.h</code>:</p>\n\n<pre><code>struct tm {\n int tm_sec; /* seconds after the minute - [0,59] */\n ... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394081",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need function in c++ that allows me to retrieve and store the system date. I have a class for storing dates. | From `time.h`:
```
struct tm {
int tm_sec; /* seconds after the minute - [0,59] */
int tm_min; /* minutes after the hour - [0,59] */
int tm_hour; /* hours since midnight - [0,23] */
int tm_mday; /* day of the month - [1,31] */
int tm_mon; /* months since January - [0,11] */
in... |
394,122 | <p>I've got a bunch of data loaded into a TClientDataset, representing an array of complex objects. But when I try to run </p>
<pre><code>Dataset.SaveToFile('c:\test.xml', dfXMLUTF8);
</code></pre>
<p>it doesn't like it:</p>
<p>Project testing.exe raised exception class EDBClient with message 'Fieldtype not supporte... | [
{
"answer_id": 394283,
"author": "Riho",
"author_id": 44715,
"author_profile": "https://Stackoverflow.com/users/44715",
"pm_score": 1,
"selected": false,
"text": "<p>Is everything saved or just some fields? Maybe for example TArrayFields are throwing an exception? Try removing different ... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32914/"
] | I've got a bunch of data loaded into a TClientDataset, representing an array of complex objects. But when I try to run
```
Dataset.SaveToFile('c:\test.xml', dfXMLUTF8);
```
it doesn't like it:
Project testing.exe raised exception class EDBClient with message 'Fieldtype not supported for XML.'.
This is a lot less ... | Is everything saved or just some fields? Maybe for example TArrayFields are throwing an exception? Try removing different fieldtypes one-by-one and see when things start working. |
394,127 | <pre><code>private HashMap<DataObject, HashSet> AllDataObjects;
...
/** Returns all DataObject elements that are NOT in the specified set. */
private DataObject[] invert( HashSet<DataObject> set )
{
HashSet<DataObject> keys = (HashSet) AllDataObjects.keySet();
keys = (HashSet) keys.clone();
... | [
{
"answer_id": 394129,
"author": "iny",
"author_id": 27067,
"author_profile": "https://Stackoverflow.com/users/27067",
"pm_score": 5,
"selected": true,
"text": "<p>Create a new set and give the one to be cloned as an argument. This avoids casting and so you don't lose generics.</p>\n\n<p... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394127",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19825/"
] | ```
private HashMap<DataObject, HashSet> AllDataObjects;
...
/** Returns all DataObject elements that are NOT in the specified set. */
private DataObject[] invert( HashSet<DataObject> set )
{
HashSet<DataObject> keys = (HashSet) AllDataObjects.keySet();
keys = (HashSet) keys.clone();
keys.removeAll( set ... | Create a new set and give the one to be cloned as an argument. This avoids casting and so you don't lose generics.
```
private DataObject[] invert( Set<DataObject> set ){
Set<DataObject> keys = new HashSet<DataObject>(AllDataObjects.keySet());
keys.removeAll( set );
return keys.toArray(new DataObject[]{});... |
394,133 | <p>I'm a beginner programmer and I'm learning my first language, C. </p>
<p>I'm learning mostly from Deitel and Deitel's C How to Program book, but also using example tasks and things from the university, however I am stuck on one.</p>
<p>I have a very very basic understanding of pointers - adding & in front of a... | [
{
"answer_id": 394139,
"author": "erikkallen",
"author_id": 47161,
"author_profile": "https://Stackoverflow.com/users/47161",
"pm_score": 2,
"selected": false,
"text": "<p>You don't return anything from your function, so the value 2293524 is just random junk. Doesn't your compiler give y... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49262/"
] | I'm a beginner programmer and I'm learning my first language, C.
I'm learning mostly from Deitel and Deitel's C How to Program book, but also using example tasks and things from the university, however I am stuck on one.
I have a very very basic understanding of pointers - adding & in front of a variable makes it pr... | You are missing a 'return' statement in the last line of the function greatestCD()
```
greatestCD(num2,(num1%num2));
```
Make it
```
return greatestCD(num2,(num1%num2));
```
(you may still have further debugging to do, but this is why it's returning junk...you're not telling it what else to return)
edit: I'd al... |
394,144 | <p>According to Wikipedia, a <a href="http://en.wikipedia.org/wiki/Monkey_patch" rel="noreferrer">monkey patch</a> is:</p>
<blockquote>
<p>a way to extend or modify the runtime
code of dynamic languages [...]
without altering the original source
code.</p>
</blockquote>
<p>The following statement from the same... | [
{
"answer_id": 394168,
"author": "Robert K",
"author_id": 24950,
"author_profile": "https://Stackoverflow.com/users/24950",
"pm_score": 2,
"selected": false,
"text": "<p>This is monkey patching:</p>\n<pre><code>class Float\n def self.times(&block)\n self.to_i.times { |i| yield(i)... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1173/"
] | According to Wikipedia, a [monkey patch](http://en.wikipedia.org/wiki/Monkey_patch) is:
>
> a way to extend or modify the runtime
> code of dynamic languages [...]
> without altering the original source
> code.
>
>
>
The following statement from the same entry confused me:
>
> In Ruby, the term monkey patch ... | The short answer is that there is no "exact" meaning, because it's a novel term, and different folks use it differently. That much at least can be discerned from the Wikipedia article. There are some who insist that it only applies to "runtime" code (built-in classes, I suppose) while some would use it to refer to the ... |
394,153 | <p>I wrote the following function that works about 95% of the time, but I need it to work 100% (obviously):</p>
<pre><code>Public Shared Function getPassedVars() As String
Const keyCount As Integer = 54 ' 54 seems to be the number of parameter keys passed by default (for this web_app).
' ... | [
{
"answer_id": 394159,
"author": "Mitchel Sellers",
"author_id": 13279,
"author_profile": "https://Stackoverflow.com/users/13279",
"pm_score": 1,
"selected": false,
"text": "<p>If you know the name you can use the following to get it by key value</p>\n\n<pre><code>Dim myParamValue as Str... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I wrote the following function that works about 95% of the time, but I need it to work 100% (obviously):
```
Public Shared Function getPassedVars() As String
Const keyCount As Integer = 54 ' 54 seems to be the number of parameter keys passed by default (for this web_app).
' th... | It looks like you are trying to get values from the query string.
For example, for this URL:-
```
http://www.tempuri.org/mypage.aspx?param1=x¶m2=y
```
I assume you want retreive the values of the query string parameters param1 and param2?
If so, just use:-
```
Dim param1 as String = Request.QueryString("param... |
394,162 | <p>I'm trying to write a function that is able to determine whether a string contains a real or an integer value.</p>
<p>This is the simplest solution I could think of:</p>
<pre><code>int containsStringAnInt(char* strg){
for (int i =0; i < strlen(strg); i++) {if (strg[i]=='.') return 0;}
return 1;
}
</code></p... | [
{
"answer_id": 394171,
"author": "erikkallen",
"author_id": 47161,
"author_profile": "https://Stackoverflow.com/users/47161",
"pm_score": 2,
"selected": false,
"text": "<p>Is your string hundreds of characters long? Otherwise, don't care about any possible performance issues.\nThe only i... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43960/"
] | I'm trying to write a function that is able to determine whether a string contains a real or an integer value.
This is the simplest solution I could think of:
```
int containsStringAnInt(char* strg){
for (int i =0; i < strlen(strg); i++) {if (strg[i]=='.') return 0;}
return 1;
}
```
But this solution is really ... | You are using strlen, which means you are not worried about unicode. In that case why to use strlen or strchr, just check for '\0' (Null char)
```
int containsStringAnInt(char* strg){
for (int i =0;strg[i]!='\0'; i++) {
if (strg[i]=='.') return 0;}
return 1; }
```
Only one parsing through the string, ... |
394,174 | <p>Imagine you have a large array of floating point numbers, of all kinds of sizes. What is the most correct way to calculate the sum, with the least error? For example, when the array looks like this:</p>
<pre><code>[1.0, 1e-10, 1e-10, ... 1e-10.0]
</code></pre>
<p>and you add up from left to right with a simple loo... | [
{
"answer_id": 394183,
"author": "dF.",
"author_id": 3002,
"author_profile": "https://Stackoverflow.com/users/3002",
"pm_score": 6,
"selected": true,
"text": "<p>For \"more precise\": <a href=\"http://code.activestate.com/recipes/393090/\" rel=\"noreferrer\">this recipe in the Python Coo... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48181/"
] | Imagine you have a large array of floating point numbers, of all kinds of sizes. What is the most correct way to calculate the sum, with the least error? For example, when the array looks like this:
```
[1.0, 1e-10, 1e-10, ... 1e-10.0]
```
and you add up from left to right with a simple loop, like
```
sum = 0
numbe... | For "more precise": [this recipe in the Python Cookbook](http://code.activestate.com/recipes/393090/) has summation algorithms which keep the full precision (by keeping track of the subtotals). Code is in Python but even if you don't know Python it's clear enough to adapt to any other language.
All the details are giv... |
394,184 | <p>I have a table in SQL Server 2005 which has three columns: </p>
<pre><code>id (int),
message (text),
timestamp (datetime)
</code></pre>
<p>There is an index on timestamp and id.</p>
<p>I am interested in doing a query which retrieves all messages for a given date, say '12/20/2008'. However I know that simply do... | [
{
"answer_id": 394190,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": true,
"text": "<pre><code>-- avoid re-calculating @MyDate +1 for every row\nDECLARE @NextDay DateTime\nSet @NextDay = @MyDate + 1\n\nS... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/324/"
] | I have a table in SQL Server 2005 which has three columns:
```
id (int),
message (text),
timestamp (datetime)
```
There is an index on timestamp and id.
I am interested in doing a query which retrieves all messages for a given date, say '12/20/2008'. However I know that simply doing where timestamp='12/20/2008' ... | ```
-- avoid re-calculating @MyDate +1 for every row
DECLARE @NextDay DateTime
Set @NextDay = @MyDate + 1
SELECT
-- ...
WHERE [timestamp] >= @MyDate AND [timestamp] < @NextDay
``` |
394,192 | <p>What is the source (url) for Rails Engines that works with rails 2.2.2?</p>
| [
{
"answer_id": 394190,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": true,
"text": "<pre><code>-- avoid re-calculating @MyDate +1 for every row\nDECLARE @NextDay DateTime\nSet @NextDay = @MyDate + 1\n\nS... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394192",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19224/"
] | What is the source (url) for Rails Engines that works with rails 2.2.2? | ```
-- avoid re-calculating @MyDate +1 for every row
DECLARE @NextDay DateTime
Set @NextDay = @MyDate + 1
SELECT
-- ...
WHERE [timestamp] >= @MyDate AND [timestamp] < @NextDay
``` |
394,214 | <p>I am hoping that there is a standard class/php script that we can use for the "forgot password" functionality. It seems almost every website has one, and I'd like to reduce the development time on it.</p>
<p>It appears that a common approach is:</p>
<ol>
<li>click on Forgot password</li>
<li>User receives via ema... | [
{
"answer_id": 394228,
"author": "Zak",
"author_id": 2112692,
"author_profile": "https://Stackoverflow.com/users/2112692",
"pm_score": 0,
"selected": false,
"text": "<p>You can steal it from a wide variety of frameworks/CMSs. Drupal, Kohana, etc...</p>\n"
},
{
"answer_id": 394292... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43980/"
] | I am hoping that there is a standard class/php script that we can use for the "forgot password" functionality. It seems almost every website has one, and I'd like to reduce the development time on it.
It appears that a common approach is:
1. click on Forgot password
2. User receives via email a "reset password" link
... | I use my own scripts for password resetting.
I create a table to store a user\_id, a random key and a time that the password reset initiated:
```
// query is my own SQLite3 wrapper function which ensures I have a valid database connection then executes the SQL.
// I would imagine small changes will be needed to the S... |
394,230 | <p>I would like to keep my <code>.bashrc</code> and <code>.bash_login</code> files in version control so that I can use them between all the computers I use. The problem is I have some OS specific aliases so I was looking for a way to determine if the script is running on Mac OS X, Linux or <a href="http://en... | [
{
"answer_id": 394235,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 8,
"selected": false,
"text": "<p>The <a href=\"https://www.gnu.org/software/bash/manual/html_node/Bash-Variables.html\" rel=\"noreferrer\... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19839/"
] | I would like to keep my `.bashrc` and `.bash_login` files in version control so that I can use them between all the computers I use. The problem is I have some OS specific aliases so I was looking for a way to determine if the script is running on Mac OS X, Linux or [Cygwin](http://en.wikipedia.org/wiki/Cygwin).
What ... | I think the following should work. I'm not sure about `win32` though.
```
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
# ...
elif [[ "$OSTYPE" == "darwin"* ]]; then
# Mac OSX
elif [[ "$OSTYPE" == "cygwin" ]]; then
# POSIX compatibility layer and Linux environment emulation for Windows
elif [[ "$OST... |
394,285 | <p>I've been doing some research on how to globally handle errors in my ASP.NET application. I have settled on using the web.config file with the following code:</p>
<pre><code><customErrors mode="On" defaultRedirect="errorpage.aspx">
</customErrors>
</code></pre>
<p>Here is my errorpage.aspx.vb code:</p... | [
{
"answer_id": 394288,
"author": "Chris Van Opstal",
"author_id": 7264,
"author_profile": "https://Stackoverflow.com/users/7264",
"pm_score": 3,
"selected": true,
"text": "<p>You can capture global errors <a href=\"http://www.developer.com/net/asp/article.php/961301\" rel=\"nofollow nore... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25515/"
] | I've been doing some research on how to globally handle errors in my ASP.NET application. I have settled on using the web.config file with the following code:
```
<customErrors mode="On" defaultRedirect="errorpage.aspx">
</customErrors>
```
Here is my errorpage.aspx.vb code:
```
Protected Sub Page_Load(ByVal sender... | You can capture global errors [using the global.asax](http://www.developer.com/net/asp/article.php/961301).
The error page is loaded via a simple http redirect and unfortunately doesn't know what the last error for a particular user was. |
394,298 | <p>In an HTML file on My Computer, I'm trying to use the Scripting.FileSystemObject in a script. How can I disable the popup saying "Any ActiveX control on this page may be unsafe for scripting"?</p>
<p>The "Internet Options" Security pane allows one to set "Initialize and script ActiveX controls not marked as safe fo... | [
{
"answer_id": 394353,
"author": "Scott Evernden",
"author_id": 11397,
"author_profile": "https://Stackoverflow.com/users/11397",
"pm_score": 3,
"selected": false,
"text": "<p>Tools |Internet Options | Advanced tab .. way down under Security .. \"Allow active content to run in files on M... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394298",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In an HTML file on My Computer, I'm trying to use the Scripting.FileSystemObject in a script. How can I disable the popup saying "Any ActiveX control on this page may be unsafe for scripting"?
The "Internet Options" Security pane allows one to set "Initialize and script ActiveX controls not marked as safe for scriptin... | By pure hackery, I discovered that setting the following registry value does it:
```
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Zones\0]
"1201"=dword:00000000
```
But I'm still wondering whether there's any *supported* way of doing this. |
394,299 | <p>I have an object tree that looks something like</p>
<pre><code> Ball
/ \
LegalBall IllegalBall
</code></pre>
<p>And I have 2 methods:</p>
<pre><code>class o {
AddBall(LegalBall l)
AddBall(IllegalBall i)
}
</code></pre>
<p>in another class I'd like to do the following:</p>
<pre><code>... | [
{
"answer_id": 394306,
"author": "Federico A. Ramponi",
"author_id": 18770,
"author_profile": "https://Stackoverflow.com/users/18770",
"pm_score": 2,
"selected": false,
"text": "<p>You should try to implement only <em>one</em> method:</p>\n\n<pre><code>class o {\nAddBall(Ball b)\n}\n</co... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47026/"
] | I have an object tree that looks something like
```
Ball
/ \
LegalBall IllegalBall
```
And I have 2 methods:
```
class o {
AddBall(LegalBall l)
AddBall(IllegalBall i)
}
```
in another class I'd like to do the following:
```
o.AddBall(myBall);
```
where myBall is of type Ball.
And g... | You could use the [Visitor pattern](http://en.wikipedia.org/wiki/Visitor_pattern).
```
class Basket {
void AddBall(LegalBall l) {
System.out.println("LegalBall added to basket");
}
void AddBall(IllegalBall i) {
System.out.println("IllegalBall added to basket");
}
}
interface Ball {
... |
394,316 | <p>I want to write a script in Ruby to clean up some messed up keys in several copies of the same MySQL schema. I'd like to do something like SHOW CREATE TABLE, then look at what comes back and delete keys if they exist.</p>
<p>I know in the Rails environment you can do this...</p>
<pre><code>ActiveRecord::Base.conne... | [
{
"answer_id": 394326,
"author": "frankodwyer",
"author_id": 42404,
"author_profile": "https://Stackoverflow.com/users/42404",
"pm_score": 1,
"selected": false,
"text": "<p>There is probably a better way to do that programmatically, however if you really want to drive the interactive com... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42595/"
] | I want to write a script in Ruby to clean up some messed up keys in several copies of the same MySQL schema. I'd like to do something like SHOW CREATE TABLE, then look at what comes back and delete keys if they exist.
I know in the Rails environment you can do this...
```
ActiveRecord::Base.connection.execute( some s... | You could check the [mysql-ruby](http://rubyforge.org/projects/mysql-ruby/) gem.
Here is a write-up on how to use it: [Using the Ruby MySQL Module](http://www.kitebird.com/articles/ruby-mysql.html)
More can be found via google |
394,321 | <p>I'm looking for examples of specifying files in a tree structure, for example, for specifying the set of files to search in a grep tool. I'd like to be able to include and exclude files and directories by name matches. I'm sure there are examples out there, but I'm having a hard time finding them. </p>
<p>Here's ... | [
{
"answer_id": 394347,
"author": "dmckee --- ex-moderator kitten",
"author_id": 2509,
"author_profile": "https://Stackoverflow.com/users/2509",
"pm_score": 1,
"selected": false,
"text": "<p>How about <strong><code>find</code></strong> in unixish environments?</p>\n\n<p>Find can, of cours... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14343/"
] | I'm looking for examples of specifying files in a tree structure, for example, for specifying the set of files to search in a grep tool. I'd like to be able to include and exclude files and directories by name matches. I'm sure there are examples out there, but I'm having a hard time finding them.
Here's an example o... | There is no single standard format for this kind of thing, but if you want to copy something that is widely recognized, have a look at the [`rsync` documentation](http://samba.anu.edu.au/ftp/rsync/rsync.html). Look at the chapter on "INCLUDE/EXCLUDE PATTERN RULES." |
394,330 | <p><em>[I'm just starting with Ruby, but "no question is ever too newbie," so I trudge onwards...]</em></p>
<p>Every tutorial and book I see goes from Ruby with the interactive shell to Ruby on Rails. I'm not doing Rails (yet), but I don't want to use the interactive shell. I have a class file (first_class.rb) and a M... | [
{
"answer_id": 394338,
"author": "frankodwyer",
"author_id": 42404,
"author_profile": "https://Stackoverflow.com/users/42404",
"pm_score": 4,
"selected": true,
"text": "<p>The easiest way is to put them both in the same file. </p>\n\n<p>However you can also use require, e.g.:</p>\n\n<pre... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394330",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] | *[I'm just starting with Ruby, but "no question is ever too newbie," so I trudge onwards...]*
Every tutorial and book I see goes from Ruby with the interactive shell to Ruby on Rails. I'm not doing Rails (yet), but I don't want to use the interactive shell. I have a class file (first\_class.rb) and a Main (main.rb). I... | The easiest way is to put them both in the same file.
However you can also use require, e.g.:
```
require 'first_class'
``` |
394,349 | <pre><code>Array 1 | Array 2
=================
1 | 2
2 | 3
3 | 4
5 | 5
| 6
</code></pre>
<p>What is a good algorithm to 'sync' or combine Array 2 into Array 1? The following needs to happen:</p>
<ol>
<li>Integers in Array 2 but not in Array 1 should be added to Array 1.</li>
... | [
{
"answer_id": 394366,
"author": "Yuliy",
"author_id": 47527,
"author_profile": "https://Stackoverflow.com/users/47527",
"pm_score": 3,
"selected": false,
"text": "<p><code>Array1 = Array2.Clone()</code> or some equivalent might be the simplest solution, unless the order of elements is i... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394349",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46540/"
] | ```
Array 1 | Array 2
=================
1 | 2
2 | 3
3 | 4
5 | 5
| 6
```
What is a good algorithm to 'sync' or combine Array 2 into Array 1? The following needs to happen:
1. Integers in Array 2 but not in Array 1 should be added to Array 1.
2. Integers in both Arrays can be ... | I'm kind of guessing since your example leaves some things up in the air, but typically in situations like this I would use a set. Here's some example code in Obj-C.
```
NSMutableSet *set = [NSMutableSet set];
[set addObjectsFromArray:array1];
[set addObjectsFromArray:array2];
NSArray *finalArray = [[set allObjects] s... |
394,375 | <p>How do I get the row count of an internal table? I guess that I can loop on it. But there must be a saner way.</p>
<p>I don't know if it makes a difference but the code should run on 4.6c version.</p>
| [
{
"answer_id": 394386,
"author": "Thorsten",
"author_id": 25320,
"author_profile": "https://Stackoverflow.com/users/25320",
"pm_score": 7,
"selected": true,
"text": "<p>You can use the following function:</p>\n\n<pre><code> DESCRIBE TABLE <itab-Name> LINES <variable>\n</code>... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25737/"
] | How do I get the row count of an internal table? I guess that I can loop on it. But there must be a saner way.
I don't know if it makes a difference but the code should run on 4.6c version. | You can use the following function:
```
DESCRIBE TABLE <itab-Name> LINES <variable>
```
After the call, variable contains the number of rows of the internal table . |
394,379 | <p>Here is what my svn repository look like: </p>
<pre>
/
/libraries
/libA
/libB
/libC
/tools
/projects
/proj1
/proj2
/website
</pre>
<p>I am making changes in libA and proj1. I want to set it up so that I can submit my changes in libA and proj1 together. The challenge in not to check out the entire repos... | [
{
"answer_id": 394385,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>I've heard a few different ways to do this, but my preferred method is via <a href=\"http://claudio.cicali.org/arti... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45890/"
] | Here is what my svn repository look like:
```
/
/libraries
/libA
/libB
/libC
/tools
/projects
/proj1
/proj2
/website
```
I am making changes in libA and proj1. I want to set it up so that I can submit my changes in libA and proj1 together. The challenge in not to check out the entire repository. I would ... | You can use sparse checkouts in Subversion 1.5.
Read more about it here: [Sparse Directories](http://svnbook.red-bean.com/en/1.5/svn.advanced.sparsedirs.html).
This will allow you to checkout the root repository directory to a local directory, but not everything beneath it. |
394,382 | <p>I am trying to program an Excel module where it dynamically inserts code in new objects in a form that is created at design time.</p>
<p>I am using this code where "Code" contains a string with the actual code that should go into the DstrFiles object.</p>
<pre><code>Dim DstrFiles As Object
Set DstrFiles = ThisWor... | [
{
"answer_id": 397791,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 1,
"selected": false,
"text": "<p>If possible I would recommend against dynamic generation of code (smells like a self-modifying program?). </p>\n\n... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49280/"
] | I am trying to program an Excel module where it dynamically inserts code in new objects in a form that is created at design time.
I am using this code where "Code" contains a string with the actual code that should go into the DstrFiles object.
```
Dim DstrFiles As Object
Set DstrFiles = ThisWorkbook.VBProject.VBCom... | You should not be generating new labels by writing code that creates the controls.
You should be using the .Add method on the Controls collection to create new labels.
For example:
```
UserForm1.Controls.Add("Forms.Label.1", "foo", True)
```
You can use `WithEvents` to get the events.
For example, in UserForm1,
... |
394,402 | <p>If I'm looking to use Core Animation to fade a view in and out of display -- is it good practice to have the UIView in the same NIB as the view that it is being drawn into? Should I build the view in another NIB file and load it in from there? I'm looking to animate three small views into display simultaneously upon... | [
{
"answer_id": 394455,
"author": "diclophis",
"author_id": 32678,
"author_profile": "https://Stackoverflow.com/users/32678",
"pm_score": 0,
"selected": false,
"text": "<p>I think interface builder should be used as much as possible... so I recommend that each view be its own xib file... ... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394402",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40882/"
] | If I'm looking to use Core Animation to fade a view in and out of display -- is it good practice to have the UIView in the same NIB as the view that it is being drawn into? Should I build the view in another NIB file and load it in from there? I'm looking to animate three small views into display simultaneously upon a ... | You can have the three views as separate UIViews inside a single XIB, or lay out the three views within one single view (otherwise, you'll have to position them in code). Set their initial alpha values to 0.0, then fading them in is as easy as:
```
[UIView beginAnimations:@"fade" context:nil];
[UIView setAnimationDura... |
394,439 | <p>I'd like to be able to lock directory access under windows.
The following code work greatly with file or directory under POSIX system:</p>
<pre><code>def flock(fd, blocking=False, exclusive=False):
if exclusive:
flags = fcntl.LOCK_EX
else:
flags = fcntl.LOCK_SH
if not blocking:
... | [
{
"answer_id": 394464,
"author": "kylebrooks",
"author_id": 49284,
"author_profile": "https://Stackoverflow.com/users/49284",
"pm_score": 0,
"selected": false,
"text": "<p>You probably can do something like this to indirectly lock a directory with the latter flock function.</p>\n\n<pre><... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394439",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11563/"
] | I'd like to be able to lock directory access under windows.
The following code work greatly with file or directory under POSIX system:
```
def flock(fd, blocking=False, exclusive=False):
if exclusive:
flags = fcntl.LOCK_EX
else:
flags = fcntl.LOCK_SH
if not blocking:
flags |= fcntl... | I don't believe it's possible to use flock() on directories in windows. [PHPs docs](http://us2.php.net/flock) on flock() indicate that it won't even work on FAT32 filesystems.
On the other hand, Windows already tends to not allow you to delete files/directories if any files are still open. This, plus maybe using ACLs ... |
394,440 | <p>So I have this code that takes care of command acknowledgment from remote computers, sometimes (like once in 14 days or something) the following line throws a null reference exception:</p>
<pre><code>computer.ProcessCommandAcknowledgment( commandType );
</code></pre>
<p>What really bugs me is that I check for a nu... | [
{
"answer_id": 394449,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "<p>Is it possible that <code>ReadString()</code> is returning null? This would cause GetType to fail. Perhaps you've r... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15409/"
] | So I have this code that takes care of command acknowledgment from remote computers, sometimes (like once in 14 days or something) the following line throws a null reference exception:
```
computer.ProcessCommandAcknowledgment( commandType );
```
What really bugs me is that I check for a null reference before it, so... | What are the other thread(s) doing?
Edit: You mention that the server is single threaded, but another comment suggests that *this portion* is single threaded. If that's the case, you could still have concurrency issues.
Bottom line here, I think, is that you either have a multi-thread issue or a CLR bug. You can gues... |
394,450 | <p>Is it possible to animate a change in css using jquery? </p>
<p>If someone would be so kind as to provide me with an example i would be much obliged.</p>
<p>Essentially, i am trying to animate the sprites technique by manipulating the background-image in the css using jQuery. The goal is to animate the hover so th... | [
{
"answer_id": 394462,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://jqueryfordesigners.com/image-cross-fade-transition/\" rel=\"nofollow noreferrer\">This article</... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44443/"
] | Is it possible to animate a change in css using jquery?
If someone would be so kind as to provide me with an example i would be much obliged.
Essentially, i am trying to animate the sprites technique by manipulating the background-image in the css using jQuery. The goal is to animate the hover so that I get a nice f... | [This article](http://jqueryfordesigners.com/image-cross-fade-transition/) will get you started on the `Two Image Technique`
**[UPDATE]**
Found a better tutorial for you:
[This article](http://swedishfika.com/2008/03/04/creating-a-fading-header/) will show you how to create a fading image (like a logo, for example) |
394,465 | <p>This must be a very simple question, but I don't seem to be able to figure out.</p>
<p>I'm using apache + mod_wsgi to host my python application, and I'd like to get the post content submitted in one of the forms -however, neither the environment values, nor sys.stdin contains any of this data. Mind giving me a qui... | [
{
"answer_id": 394543,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 6,
"selected": true,
"text": "<p><a href=\"http://www.python.org/dev/peps/pep-0333/\" rel=\"noreferrer\">PEP 333</a> says <a href=\"http://www.python.org/... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9440/"
] | This must be a very simple question, but I don't seem to be able to figure out.
I'm using apache + mod\_wsgi to host my python application, and I'd like to get the post content submitted in one of the forms -however, neither the environment values, nor sys.stdin contains any of this data. Mind giving me a quick hand?
... | [PEP 333](http://www.python.org/dev/peps/pep-0333/) says [you must read environ['wsgi.input']](http://www.python.org/dev/peps/pep-0333/#input-and-error-streams).
I just saved the following code and made apache's mod\_wsgi run it. It works.
You must be doing something wrong.
```
from pprint import pformat
def applic... |
394,470 | <p>I'm trying to change the alt of the image, I'm clicking by
selecting the image's class (<strong><em><code>add_answer</code></em></strong>)</p>
<p><strong>Note:</strong> <strong><em><code>.add_answer</code></strong> shows up multiple times inside different containing <code>div</code>'s</em></p>
<pre><code>jQuery(f... | [
{
"answer_id": 394474,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 4,
"selected": false,
"text": "<p>This should work:</p>\n\n<pre><code>$(this).parent(\"div\").find(\".add_answer\").attr(\"alt\", count);\n</code><... | 2008/12/26 | [
"https://Stackoverflow.com/questions/394470",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48973/"
] | I'm trying to change the alt of the image, I'm clicking by
selecting the image's class (***`add_answer`***)
**Note:** ***`.add_answer`*** shows up multiple times inside different containing `div`'s
```
jQuery(function(){ // Add Answer
jQuery(".add_answer").click(function(){
var count = $(this).attr("a... | you can use the parent div as the scope:
```
$('.add_answer',$(this).parent('div:first')).attr('alt',count);
``` |
394,488 | <p>I need to convert an 8-bit IplImage to a 32-bits IplImage. Using documentation from all over the web I've tried the following things:</p>
<pre><code>// general code
img2 = cvCreateImage(cvSize(img->width, img->height), 32, 3);
int height = img->height;
int width = img->width;
int channels = img-... | [
{
"answer_id": 395049,
"author": "Stefan Schmidt",
"author_id": 1958045,
"author_profile": "https://Stackoverflow.com/users/1958045",
"pm_score": 4,
"selected": true,
"text": "<p>Perhaps this <a href=\"http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html#SECTION000... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394488",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13104/"
] | I need to convert an 8-bit IplImage to a 32-bits IplImage. Using documentation from all over the web I've tried the following things:
```
// general code
img2 = cvCreateImage(cvSize(img->width, img->height), 32, 3);
int height = img->height;
int width = img->width;
int channels = img->nChannels;
int step1 ... | Perhaps this [link](http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/opencv-intro.html#SECTION00054000000000000000) can help you?
**Edit** In response to the second edit of the OP and the comment
Have you tried
`float value = 0.5`
instead of
`float value = 0x0000001;`
I thought the range for a float co... |
394,491 | <p>I'm developing an <code>ASP.Net MVC</code> site and on it I list some bookings from a database query in a table with an <code>ActionLink</code> to cancel the booking on a specific row with a certain <code>BookingId</code> like this: </p>
<p><strong>My bookings</strong></p>
<pre><code><table cellspacing="3">... | [
{
"answer_id": 394580,
"author": "Mauricio Scheffer",
"author_id": 21239,
"author_profile": "https://Stackoverflow.com/users/21239",
"pm_score": 7,
"selected": true,
"text": "<p>You could do it like this:</p>\n\n<ul>\n<li>mark the <code><a></code> with a class, say \"cancel\"</li>\... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/459417/"
] | I'm developing an `ASP.Net MVC` site and on it I list some bookings from a database query in a table with an `ActionLink` to cancel the booking on a specific row with a certain `BookingId` like this:
**My bookings**
```
<table cellspacing="3">
<thead>
<tr style="font-weight: bold;">
<td>Date<... | You could do it like this:
* mark the `<a>` with a class, say "cancel"
* set up the dialog by acting on all elements with class="cancel":
```
$('a.cancel').click(function() {
var a = this;
$('#myDialog').dialog({
buttons: {
"Yes": function() {
window.location = a.href;
}
}
});
... |
394,500 | <p>In the python program I'm writing, I've got a thread which iterates over a large structure in memory and writes it incrementally into a file-like object. I've got another thread which takes a file-like object and writes it to disk. Is there an easy way to connect the two, such that any data input from the first th... | [
{
"answer_id": 394503,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 3,
"selected": false,
"text": "<p>You should use the <a href=\"http://docs.python.org/library/queue.html\" rel=\"noreferrer\">Queue</a> module fo... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394500",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9161/"
] | In the python program I'm writing, I've got a thread which iterates over a large structure in memory and writes it incrementally into a file-like object. I've got another thread which takes a file-like object and writes it to disk. Is there an easy way to connect the two, such that any data input from the first thread ... | Use [`shutil`'s `copyfileobj()`](http://docs.python.org/library/shutil.html#shutil.copyfileobj) function:
```
import shutil
import subprocess
proc = subprocess.Popen([...], stdin=subprocess.PIPE)
my_input = get_filelike_object('from a place not given in the question')
shutil.copyfileobj(my_input, proc.stdin)
```
... |
394,504 | <p>So I'm trying to load some returned html from an .aspx page but a click event needs to fire before it doing some stuff that the AJAX request depends upon. More specifically, I'm doing this. When a user types in a text field this function is run...</p>
<pre><code>function KeyPress() {
$("#" + HiddenButtonId).cli... | [
{
"answer_id": 394563,
"author": "cfbarbero",
"author_id": 2218,
"author_profile": "https://Stackoverflow.com/users/2218",
"pm_score": 3,
"selected": true,
"text": "<p>You are mixing technologies here. The hiddenButtonID click event is trying to do a full postback for the page, whereas ... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49294/"
] | So I'm trying to load some returned html from an .aspx page but a click event needs to fire before it doing some stuff that the AJAX request depends upon. More specifically, I'm doing this. When a user types in a text field this function is run...
```
function KeyPress() {
$("#" + HiddenButtonId).click();
$("#test... | You are mixing technologies here. The hiddenButtonID click event is trying to do a full postback for the page, whereas the AJAX call will not do a postback. There is no reason to do a post back and then follow it up with an AJAX call. The point of AJAX is to eliminate the need to postback the page and instead just relo... |
394,552 | <p>I'm trying to write some code to work with an htdigest password file. The documentation I can find seems to claim that the format of that file is:</p>
<pre><code>user:realm:MD5(user:realm:pass)
</code></pre>
<p>If that is the case, then why doesn't this work for me? I created a file with the command line htdigest ... | [
{
"answer_id": 394556,
"author": "wxs",
"author_id": 12981,
"author_profile": "https://Stackoverflow.com/users/12981",
"pm_score": 2,
"selected": false,
"text": "<p>Hm, I seem to have answered my own question. My test case was flawed, 'echo' is adding extra characters (not sure which). F... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394552",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12981/"
] | I'm trying to write some code to work with an htdigest password file. The documentation I can find seems to claim that the format of that file is:
```
user:realm:MD5(user:realm:pass)
```
If that is the case, then why doesn't this work for me? I created a file with the command line htdigest thus:
```
htdigest -c tes... | `echo` by default adds a trailing new line:
```
echo -n a:b:c | md5
```
Should work as you expect. |
394,566 | <p>Working with the following code, I need to return only records where the `point' attribute is unique. I can't seem to get there by myself.</p>
<pre><code>uniques = Item.find_all_by_item_id(item_id)
uniques.sort! {|a, b| b.point <=> a.point } # how do I reject the equal points?
</code></pre>
<p>In other word... | [
{
"answer_id": 394723,
"author": "Robert",
"author_id": 17864,
"author_profile": "https://Stackoverflow.com/users/17864",
"pm_score": 3,
"selected": true,
"text": "<p>You need to upgrade to the latest version of F# 1.9.6.2 (also known as the September CTP): \n<a href=\"http://www.microso... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33287/"
] | Working with the following code, I need to return only records where the `point' attribute is unique. I can't seem to get there by myself.
```
uniques = Item.find_all_by_item_id(item_id)
uniques.sort! {|a, b| b.point <=> a.point } # how do I reject the equal points?
```
In other words.. I guess, how do you make **[0... | You need to upgrade to the latest version of F# 1.9.6.2 (also known as the September CTP):
<http://www.microsoft.com/downloads/details.aspx?FamilyID=61ad6924-93ad-48dc-8c67-60f7e7803d3c&displaylang=en>
Cheers,
Rob |
394,567 | <p>I have a generic list say and I want to serialize it.
I want to use a interface for the generic list which can't be serialized
so you have to use the instance. Like this
MyClass implements IMyClass.</p>
<pre><code>List<IMyClass> list = DeserializeMyClass(path); //Can't do this right
</code></pre>
<p>So ha... | [
{
"answer_id": 394578,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Ok this is what it should have been:</p>\n\n<pre><code>Listl<IMyclass> list = DeserializeMyClass(path); //Can't do th... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a generic list say and I want to serialize it.
I want to use a interface for the generic list which can't be serialized
so you have to use the instance. Like this
MyClass implements IMyClass.
```
List<IMyClass> list = DeserializeMyClass(path); //Can't do this right
```
So have to do this
```
List<MyClass>... | This will work, but I'm not sure it's the best way:
```
List<Test> list = new List<Test>();
List<ITest> ilist = list.ConvertAll<ITest>(x => (ITest)x);
``` |
394,574 | <p>Write a program that take a single command line argument N and prints out the corresponding <a href="http://en.wikipedia.org/wiki/Roman_numerals" rel="nofollow noreferrer">Roman Numeral</a>.</p>
<p>Eg N = 2009 should print MMIX.</p>
<p>Let's say this should work for 0 < N < 3000.</p>
<p>(Had fun playing my ... | [
{
"answer_id": 394585,
"author": "AnonJr",
"author_id": 25163,
"author_profile": "https://Stackoverflow.com/users/25163",
"pm_score": 0,
"selected": false,
"text": "<p>Real simple: pass the query to Google and screenscrape the answer. Next. :p</p>\n\n<p>BTW, shouldn't this be a community... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394574",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4812/"
] | Write a program that take a single command line argument N and prints out the corresponding [Roman Numeral](http://en.wikipedia.org/wiki/Roman_numerals).
Eg N = 2009 should print MMIX.
Let's say this should work for 0 < N < 3000.
(Had fun playing my first ever round of code golf with the [Christmas edition](https://... | In C#, as an extension method to `Int32`:
```
public static class Int32Extension {
public static string ToRomanNumeral(this int number) {
Dictionary<int, string> lookup = new Dictionary<int, string>() {
{ 1000000, "M_" },
{ 900000, "C_D_" },
{ 500000, "D_" },
... |
394,588 | <p>in terms of both parsing (serializing, deserializing) and sending packets over the network is there any good estimation of performance differences between binary and xml serialization?</p>
| [
{
"answer_id": 394597,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 5,
"selected": true,
"text": "<p>Nope. </p>\n\n<p>It depends highly on what sort of data is inside the XML document itself. If you have a lot of str... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | in terms of both parsing (serializing, deserializing) and sending packets over the network is there any good estimation of performance differences between binary and xml serialization? | Nope.
It depends highly on what sort of data is inside the XML document itself. If you have a lot of structured data, the overhead for XML will be large. For example, if your data looks like:
```
<person>
<name>Dave</dave>
<ssn>000-00-0000</ssn>
<email1>xxxxxx/email1>
</person>
...
```
You'll have a lot more... |
394,616 | <p>I have a JAR file named <em>helloworld.jar</em>.
In order to run it, I'm executing the following command in a command-line window:</p>
<pre class="lang-none prettyprint-override"><code>java -jar helloworld.jar
</code></pre>
<p>This works fine, but how do I execute it with double-click instead?
Do I need to install... | [
{
"answer_id": 394620,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 2,
"selected": false,
"text": "<p>You want to check a couple of things; if this is your own jar file, make sure you have defined a Main-class in t... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394616",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40945/"
] | I have a JAR file named *helloworld.jar*.
In order to run it, I'm executing the following command in a command-line window:
```none
java -jar helloworld.jar
```
This works fine, but how do I execute it with double-click instead?
Do I need to install any software? | Easiest route is probably upgrading or re-installing the Java Runtime Environment (JRE).
Or this:
* Open the Windows Explorer, from the Tools select 'Folder Options...'
* Click the File Types tab, scroll down and select JAR File type.
* Press the Advanced button.
* In the Edit File Type dialog box, select open in Act... |
394,647 | <p>Say I have two repositories that were created from the same initial content. For example, if I were using git to manage my apache config files in /etc/apache2 and I ran <code>git init</code> on machine-a and machine-b separately.</p>
<p>I've since made some configuration changes to machine-b that I would like to a... | [
{
"answer_id": 394661,
"author": "Brian Kelly",
"author_id": 8252,
"author_profile": "https://Stackoverflow.com/users/8252",
"pm_score": 0,
"selected": false,
"text": "<p>How can Git tell between what is a \"configuration change\" and what is an \"uncommon thing\"? Are there only certai... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9594/"
] | Say I have two repositories that were created from the same initial content. For example, if I were using git to manage my apache config files in /etc/apache2 and I ran `git init` on machine-a and machine-b separately.
I've since made some configuration changes to machine-b that I would like to apply to the configurat... | You might want to look at git grafts. Some information is available here: <http://git-scm.com/docs/git-filter-branch>
basically, what you want to do is to fake an ancestry.
You did an initial commit on both machines -- let's call them 'baseA' and 'baseB'. Then, you created a second commit on top of that on both sides... |
394,650 | <p>Is there a tool that I can use to see the multiple inheritance memory layout of compiled C++ code?</p>
| [
{
"answer_id": 394658,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 0,
"selected": false,
"text": "<p>Yes, but you're not going to like it much. What you need to do is use the -S flag (on gcc, check your documenta... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a tool that I can use to see the multiple inheritance memory layout of compiled C++ code? | I don't know what exactly you want to know. For this simple example
```
class classA { };
class classB { };
class classC : public classA, public classB {
};
$ g++ -fdump-class-hierarchy test.cpp
```
Outputs the following into a file `test.cpp.002t.class`
```
Class classA
size=1 align=1
base size=0 base al... |
394,692 | <p>I have a DATETIME field. I would like to select all the records that have been updated in the last week. Right now I'm using this query:</p>
<pre><code>SELECT SUM(mins_spent) as time_sum FROM todos WHERE
lastUpdate >= '2008-12-22' AND lastUpdate <='2008-12-28'
</code></pre>
<p>But the results i get seem to... | [
{
"answer_id": 394705,
"author": "Jonathan Lonowski",
"author_id": 15031,
"author_profile": "https://Stackoverflow.com/users/15031",
"pm_score": 4,
"selected": true,
"text": "<p><code>'2008-12-22'</code> should equal <code>'2008-12-22 00:00:00'</code>.</p>\n\n<p>Are you wanting \"till en... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394692",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49153/"
] | I have a DATETIME field. I would like to select all the records that have been updated in the last week. Right now I'm using this query:
```
SELECT SUM(mins_spent) as time_sum FROM todos WHERE
lastUpdate >= '2008-12-22' AND lastUpdate <='2008-12-28'
```
But the results i get seem to be different depending on time ... | `'2008-12-22'` should equal `'2008-12-22 00:00:00'`.
Are you wanting "till end-of-day 28th?" If so, add `23:59:59` to the 2nd date.
Alternatively, you can use `lastUpdate < "2008-12-29"`.
How are you tracking changes to an existing ToDo? `INSERT` and/or `DELETE`? Or `UPDATE`?
If you're `DELETE`'ing records upon "... |
394,698 | <p>Can you have cellpadding or spacing just on the top/ bottom as opposed to all (T, B, L, R) ?</p>
| [
{
"answer_id": 394703,
"author": "TRF",
"author_id": 48230,
"author_profile": "https://Stackoverflow.com/users/48230",
"pm_score": 6,
"selected": true,
"text": "<p>CSS?</p>\n\n<pre><code>td {\n padding-top: 2px;\n padding-bottom: 2px;\n}\n</code></pre>\n"
},
{
"answer_id": 3947... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394698",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | Can you have cellpadding or spacing just on the top/ bottom as opposed to all (T, B, L, R) ? | CSS?
```
td {
padding-top: 2px;
padding-bottom: 2px;
}
``` |
394,709 | <p>I am learning functional programming style. In <a href="http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads/" rel="noreferrer">Don't Fear the Monads</a>, Brian Beckman gave a brilliant introduction about Monad. He mentioned that Monad is about composition of functions so as to address comple... | [
{
"answer_id": 394720,
"author": "chaos",
"author_id": 47529,
"author_profile": "https://Stackoverflow.com/users/47529",
"pm_score": 0,
"selected": false,
"text": "<p>It's certainly not the case that a language implementing monads <i>must</i> be statically typed, as your question title a... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26349/"
] | I am learning functional programming style. In [Don't Fear the Monads](http://channel9.msdn.com/shows/Going+Deep/Brian-Beckman-Dont-fear-the-Monads/), Brian Beckman gave a brilliant introduction about Monad. He mentioned that Monad is about composition of functions so as to address complexity.
>
> A Monad includes a... | There are lots of implementations of monads in dynamically typed languages:
* [The Maybe Monad in Ruby](http://Blog.PreTheory.Com/arch/2008/02/the_maybe_monad_in_ruby.php)
* [OO Monads and Ruby](http://CWilliams.TextDriven.Com/pages/monads) (site is down, but the article [is available in the Internet Archive's Wayback... |
394,715 | <p>I am implementing Javascript Validation on an ASP.Net page that is inside a Master Page. The control IDs are changing, so I can't use the original control IDs for validation. I looked on the Net and got the suggestion to build the script dynamically, and add it to the page using RegisterStartupScript. I don't like t... | [
{
"answer_id": 394728,
"author": "Brant Bobby",
"author_id": 4160,
"author_profile": "https://Stackoverflow.com/users/4160",
"pm_score": 2,
"selected": false,
"text": "<p>IMO, copying the final ClientID values that appear in the browser is trouble waiting to happen. If you change a contr... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33052/"
] | I am implementing Javascript Validation on an ASP.Net page that is inside a Master Page. The control IDs are changing, so I can't use the original control IDs for validation. I looked on the Net and got the suggestion to build the script dynamically, and add it to the page using RegisterStartupScript. I don't like that... | It's perfectly acceptable to refer the ClientID via inline code (e.g. <% %> tags). The example given won't really work, though; you need to access the DOM...
```
<script language="javascript" type="text/javascript">
var control = document.getElementById('<%= control.ClientID %>');
</script>
``` |
394,763 | <p>In using Dev C++, I a m trying to insert a smaller 2D array object into a larger 2D array object. While attempting to achieve that, I came into compilers errors which I do not know how to solve.</p>
<p>I attempt to insert the smaller Object by making it returning the array's name. Then I attempt to change the value... | [
{
"answer_id": 394759,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://dsource.org/projects/poseidon\" rel=\"nofollow noreferrer\">Poseidon</a>.</p>\n"
},
{
"ans... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | In using Dev C++, I a m trying to insert a smaller 2D array object into a larger 2D array object. While attempting to achieve that, I came into compilers errors which I do not know how to solve.
I attempt to insert the smaller Object by making it returning the array's name. Then I attempt to change the values inside t... | [Descent](http://www.dsource.org/projects/descent) has the ability to use a debugger. Not exactly what you asked but... |
394,767 | <p>Does anyone have any good articles or explanations (blogs, examples) for pointer arithmetic? Figure the audience is a bunch of Java programmers learning C and C++.</p>
| [
{
"answer_id": 394774,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 7,
"selected": true,
"text": "<p>First, the <a href=\"http://cslibrary.stanford.edu/104/\" rel=\"noreferrer\">binky</a> video may help. It... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4653/"
] | Does anyone have any good articles or explanations (blogs, examples) for pointer arithmetic? Figure the audience is a bunch of Java programmers learning C and C++. | First, the [binky](http://cslibrary.stanford.edu/104/) video may help. It's a nice video about pointers. For arithmetic, here is an example:
```
int * pa = NULL;
int * pb = NULL;
pa += 1; // pa++. behind the scenes, add sizeof(int) bytes
assert((pa - pb) == 1);
print_out(pa); // possibly outputs 0x4
print_out(pb); //... |
394,770 | <p>Is there a way in Python to override a class method at instance level?
For example:</p>
<pre><code>class Dog:
def bark(self):
print "WOOF"
boby = Dog()
boby.bark() # WOOF
# METHOD OVERRIDE
boby.bark() # WoOoOoF!!
</code></pre>
| [
{
"answer_id": 394779,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 8,
"selected": false,
"text": "<p>Yes, it's possible:</p>\n\n<pre><code>class Dog:\n def bark(self):\n print \"Woof\"\n\ndef new_bark(self):\... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42636/"
] | Is there a way in Python to override a class method at instance level?
For example:
```
class Dog:
def bark(self):
print "WOOF"
boby = Dog()
boby.bark() # WOOF
# METHOD OVERRIDE
boby.bark() # WoOoOoF!!
``` | Please do not do this as shown. You code becomes unreadable when you monkeypatch an instance to be different from the class.
You cannot debug monkeypatched code.
When you find a bug in `boby` and `print type(boby)`, you'll see that (a) it's a Dog, but (b) for some obscure reason it doesn't bark correctly. This is a n... |
394,771 | <p>I have a table where each row has a few fields that have ID's that relate to some other data from some other tables.</p>
<p>Let's say it's called <code>people</code>, and each person has the ID of a <code>city</code>, <code>state</code> and <code>country</code>.</p>
<p>So there will be three more tables, <code>cit... | [
{
"answer_id": 394773,
"author": "Toby Hede",
"author_id": 14971,
"author_profile": "https://Stackoverflow.com/users/14971",
"pm_score": 2,
"selected": false,
"text": "<p>JOINS are the only way to really do this.</p>\n\n<p>You might be able to change your schema, but the problem will be ... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394771",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25910/"
] | I have a table where each row has a few fields that have ID's that relate to some other data from some other tables.
Let's say it's called `people`, and each person has the ID of a `city`, `state` and `country`.
So there will be three more tables, `cities`, `states` and `countries` where each has an ID and a name.
W... | Assuming the following tables:
```
create table People
(
ID int not null primary key auto_increment
,FullName varchar(255) not null
,StateID int
,CountryID int
,CityID int
)
;
create table States
(
ID int not null primary key auto_increment
,Name varcha... |
394,809 | <p>Is there a <a href="https://en.wikipedia.org/wiki/%3F:#Python" rel="noreferrer">ternary conditional operator</a> in Python?</p>
| [
{
"answer_id": 394814,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 14,
"selected": true,
"text": "<p>Yes, it was <a href=\"https://mail.python.org/pipermail/python-dev/2005-September/056846.html\" rel=\"noreferrer\... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394809",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51518/"
] | Is there a [ternary conditional operator](https://en.wikipedia.org/wiki/%3F:#Python) in Python? | Yes, it was [added](https://mail.python.org/pipermail/python-dev/2005-September/056846.html "[Python-Dev] Conditional Expression Resolution") in version 2.5. The expression syntax is:
```py
a if condition else b
```
First `condition` is evaluated, then exactly one of either `a` or `b` is evaluated and returned based... |
394,816 | <p>I was looking a lot for method to get parent process in .NET, but found only P/Invoke way.</p>
| [
{
"answer_id": 2336322,
"author": "Michael Hale",
"author_id": 166325,
"author_profile": "https://Stackoverflow.com/users/166325",
"pm_score": 7,
"selected": true,
"text": "<p>This code provides a nice interface for finding the Parent process object and takes into account the possibility... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41956/"
] | I was looking a lot for method to get parent process in .NET, but found only P/Invoke way. | This code provides a nice interface for finding the Parent process object and takes into account the possibility of multiple processes with the same name:
Usage:
```
Console.WriteLine("ParentPid: " + Process.GetProcessById(6972).Parent().Id);
```
Code:
```
public static class ProcessExtensions {
private stati... |
394,829 | <p>I have written a very simple WCF Service that sends and receives messages. I have tested the app through the VS 2008 default web server host and everything works fine. But when I deploy the WCF service to another computer's IIS I receive the following error:</p>
<p><strong>"The request for security token could not ... | [
{
"answer_id": 799654,
"author": "Mark",
"author_id": 2760,
"author_profile": "https://Stackoverflow.com/users/2760",
"pm_score": 5,
"selected": false,
"text": "<p>You need to turn off security for the binding. Otherwise, I believe that, by default, the wsHttpBinding will try to negotia... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34623/"
] | I have written a very simple WCF Service that sends and receives messages. I have tested the app through the VS 2008 default web server host and everything works fine. But when I deploy the WCF service to another computer's IIS I receive the following error:
**"The request for security token could not be satisfied bec... | You need to turn off security for the binding. Otherwise, I believe that, by default, the wsHttpBinding will try to negotiate a Security Context Token (SCT).
So, modify the endpoint definition to point to a binding configuration section. Here's an example:
```
<endpoint address=""
binding="wsHttpBinding"
... |
394,841 | <p>I'm creating a runtime dataset in page load. In this dataset I'm adding columns like that:</p>
<pre><code>CrystalDecisions.CrystalReports.Engine.ReportDocument orpt =
new CrystalDecisions.CrystalReports.Engine.ReportDocument();
DataTable table = new DataTable("DataSet1");
table.Columns.Add("Fname", typeof(Sys... | [
{
"answer_id": 394846,
"author": "Stefan",
"author_id": 48003,
"author_profile": "https://Stackoverflow.com/users/48003",
"pm_score": 2,
"selected": false,
"text": "<p>Can't be done. If you nee a detailed explanation why, see this blog post:\n<a href=\"http://blogs.msdn.com/oldnewthing/a... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394841",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm creating a runtime dataset in page load. In this dataset I'm adding columns like that:
```
CrystalDecisions.CrystalReports.Engine.ReportDocument orpt =
new CrystalDecisions.CrystalReports.Engine.ReportDocument();
DataTable table = new DataTable("DataSet1");
table.Columns.Add("Fname", typeof(System.String));
... | Can't be done. If you nee a detailed explanation why, see this blog post:
<http://blogs.msdn.com/oldnewthing/archive/2005/04/19/409620.aspx> |
394,844 | <p>This problem is from a solved problem in my old question, which is from:
<a href="https://stackoverflow.com/questions/394763/c-inserting-2d-array-object-into-another-2d-array-object">C++ Inserting 2D array Object into another 2D array Object</a></p>
<p>But also created a new problem for me. Please read the question... | [
{
"answer_id": 394893,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>Right now, your problem seems a bit underspecified. How large of a 'piece' do you expect from the smaller array, and where ... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394844",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This problem is from a solved problem in my old question, which is from:
[C++ Inserting 2D array Object into another 2D array Object](https://stackoverflow.com/questions/394763/c-inserting-2d-array-object-into-another-2d-array-object)
But also created a new problem for me. Please read the question and the solution in ... | ```
void Grid::extractArray( int** arr )
{
for(int i = 0; i < xGrid ; ++i) {
for (int j = 0; j < yGrid ; ++j) {
squares[i][j] = arr[i][j];
}
}
}
```
The smaller array `int**arr` does not have as many elements as the `Grid`.
`xGrid` and `yGrid` are too large to use as indices for `arr[][]`.
You must... |
394,850 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/171970/how-can-i-find-the-method-that-called-the-current-method">How can I find the method that called the current method?</a></p>
</blockquote>
<p>I need a way to know the name of calling methods in C#.</p>
<p>F... | [
{
"answer_id": 394852,
"author": "Andrew Robertson",
"author_id": 40167,
"author_profile": "https://Stackoverflow.com/users/40167",
"pm_score": 7,
"selected": true,
"text": "<p>from <a href=\"http://www.csharp-examples.net/reflection-calling-method-name/\" rel=\"noreferrer\">http://www.c... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36446/"
] | >
> **Possible Duplicate:**
>
> [How can I find the method that called the current method?](https://stackoverflow.com/questions/171970/how-can-i-find-the-method-that-called-the-current-method)
>
>
>
I need a way to know the name of calling methods in C#.
For instance:
```
private void doSomething()
{
// I ne... | from <http://www.csharp-examples.net/reflection-calling-method-name/>
```
using System.Diagnostics;
// get call stack
StackTrace stackTrace = new StackTrace();
// get calling method name
Console.WriteLine(stackTrace.GetFrame(1).GetMethod().Name);
``` |
394,853 | <p>the two bits of SQL below get the same result</p>
<pre><code>SELECT c.name, o.product
FROM customer c, order o
WHERE c.id = o.cust_id
AND o.value = 150
SELECT c.name, o.product
FROM customer c
INNER JOIN order o on c.id = o.cust_id
WHERE o.value = 150
</code></pre>
<p>I've seen both styles used as s... | [
{
"answer_id": 394857,
"author": "Jim Anderson",
"author_id": 42439,
"author_profile": "https://Stackoverflow.com/users/42439",
"pm_score": 2,
"selected": false,
"text": "<p>Both queries are performing an inner join, just different syntax.</p>\n"
},
{
"answer_id": 394858,
"au... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49171/"
] | the two bits of SQL below get the same result
```
SELECT c.name, o.product
FROM customer c, order o
WHERE c.id = o.cust_id
AND o.value = 150
SELECT c.name, o.product
FROM customer c
INNER JOIN order o on c.id = o.cust_id
WHERE o.value = 150
```
I've seen both styles used as standard at different compa... | Both queries are an inner joins and equivalent. The first is the older method of doing things, whereas the use of the JOIN syntax only became common after the introduction of the SQL-92 standard (I believe it's in the older definitions, just wasn't particularly widely used before then).
The use of the JOIN syntax is s... |
394,882 | <p>There are some nice free "image to ASCII art" conversion sites like this one: <a href="http://www.ascii-art.org/" rel="noreferrer">ASCII-art.org</a></p>
<p>How does such an image conversion algorithm work?</p>
<pre>
,
. W ,
... | [
{
"answer_id": 394899,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 4,
"selected": false,
"text": "<p><a href=\"http://aa-project.sourceforge.net/aalib/\" rel=\"noreferrer\">aalib</a> (last release in 2001) is an open s... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394882",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6461/"
] | There are some nice free "image to ASCII art" conversion sites like this one: [ASCII-art.org](http://www.ascii-art.org/)
How does such an image conversion algorithm work?
```
,
. W ,
W W @ ... | The big-picture-level concept is simple:
1. Each printable character can be assigned an approximate gray-scale value; the "at" sign `@` obviously is visually darker than the "plus" sign `+`, for example. The effect will vary, depending on the font and spacing actually used.
2. Based on the proportions of the chosen fo... |
394,889 | <p>I have the following scenario
I have a main form as MDI parent and MDI child form, the child form shows a new form (I called it mydialog).
I want to access specific function in the MDI child form from mydialog so I tried to set the Owner property in the mydialog object but exception occured (circular reference exce... | [
{
"answer_id": 394890,
"author": "SecretDeveloper",
"author_id": 2720,
"author_profile": "https://Stackoverflow.com/users/2720",
"pm_score": 0,
"selected": false,
"text": "<p>Can you show us the code you were using to show the dialog, One of the ShowDialog methods takes a parent object ... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42749/"
] | I have the following scenario
I have a main form as MDI parent and MDI child form, the child form shows a new form (I called it mydialog).
I want to access specific function in the MDI child form from mydialog so I tried to set the Owner property in the mydialog object but exception occured (circular reference excepti... | >
>
> >
> > so I tried to set the Owner property in the mydialog object but exception occured (circular reference exception)
> >
> >
> >
>
>
>
There should be no exception when setting the Owner property. Can you paste the exception ? Also could you paste your code that sets this value ? Have you set other pr... |
394,900 | <p>I have a class which is not thread safe:</p>
<pre><code>class Foo {
/* Abstract base class, code which is not thread safe */
};
</code></pre>
<p>Moreover, if you have foo1 and foo2 objects, you cannot call foo1->someFunc() until foo2->anotherFunc() has returned (this can happen with two threads). This is the... | [
{
"answer_id": 394903,
"author": "kshahar",
"author_id": 33982,
"author_profile": "https://Stackoverflow.com/users/33982",
"pm_score": 0,
"selected": false,
"text": "<p>So far I've written the following code. Sometimes it works and sometimes the test fails, since the Sleep is not enough ... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33982/"
] | I have a class which is not thread safe:
```
class Foo {
/* Abstract base class, code which is not thread safe */
};
```
Moreover, if you have foo1 and foo2 objects, you cannot call foo1->someFunc() until foo2->anotherFunc() has returned (this can happen with two threads). This is the situation and it can't be... | Instead of just checking that a particular thread is finished or not, why not create a fake `Foo` to be invoked by your wrapper in which the functions record the time at which they were actually started/completed. Then your yield thread need only wait long enough to be able to distinguish the difference between the rec... |
394,908 | <p>I'm designing a game server and I have never done anything like this before. I was just wondering what a good structure for a packet would be data-wise? I am using TCP if it matters. Here's an example, and what I was considering using as of now:</p>
<p>(each value in brackets is a byte)</p>
<pre><code>[Packet leng... | [
{
"answer_id": 394915,
"author": "Michael Borgwardt",
"author_id": 16883,
"author_profile": "https://Stackoverflow.com/users/16883",
"pm_score": 0,
"selected": false,
"text": "<p>Do you want the server to support multiple clients written in different languages? If not, it's probably not ... | 2008/12/27 | [
"https://Stackoverflow.com/questions/394908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49018/"
] | I'm designing a game server and I have never done anything like this before. I was just wondering what a good structure for a packet would be data-wise? I am using TCP if it matters. Here's an example, and what I was considering using as of now:
(each value in brackets is a byte)
```
[Packet length][Action ID][Number... | Passing the total packet length is a good idea. It might cost two more bytes, but you can peek and wait for the socket to have a full packet ready to sip before receiving. That makes code easier.
Overall, I agree with brazzy, a language supplied serialization mechanism is preferrable over any self-made.
Other than th... |