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 |
|---|---|---|---|---|---|---|
379,900 | <p>I am trying to find a way to load a JSON page to display my content, which I currently have. But I am trying to fade in each element one after another? Is anyone familiar with a way to do that?</p>
<p>Fade in each element with a slight delay?</p>
<p>Here is an example of my code, I am using the jquery framework.</... | [
{
"answer_id": 379907,
"author": "Darryl Hein",
"author_id": 5441,
"author_profile": "https://Stackoverflow.com/users/5441",
"pm_score": 1,
"selected": false,
"text": "<p>Check out jQuery <a href=\"http://docs.jquery.com/Effects/fadeIn#speedcallback\" rel=\"nofollow noreferrer\">fadeIn()... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to find a way to load a JSON page to display my content, which I currently have. But I am trying to fade in each element one after another? Is anyone familiar with a way to do that?
Fade in each element with a slight delay?
Here is an example of my code, I am using the jquery framework.
CODE: <http://pas... | Well, you could setup your fade functions to trigger the "next" one.
```
$("div#foo").fadeIn("fast",function(){
$("div#bar").fadeIn("fast", function(){
// etc.
});
});
```
But a timer may be a better system, or a function that gets them all, puts them in an array, then pops them off one at... |
379,906 | <ul>
<li>How can I convert a <code>str</code> to <code>float</code>?
<pre><code>"545.2222" → 545.2222
</code></pre>
</li>
<li>How can I convert a <code>str</code> to <code>int</code>?
<pre><code>"31" → 31
</code></pre>
</li>
</ul>
<hr />
<p><sub>For the reverse, see <a href="https://stacko... | [
{
"answer_id": 379909,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 4,
"selected": false,
"text": "<p><code>float(\"545.2222\")</code> and <code>int(float(\"545.2222\"))</code></p>\n"
},
{
"answer_id": 379910,
... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379906",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30529/"
] | * How can I convert a `str` to `float`?
```
"545.2222" → 545.2222
```
* How can I convert a `str` to `int`?
```
"31" → 31
```
---
For the reverse, see [Convert integer to string in Python](https://stackoverflow.com/questions/961632) and [Converting a float to a string without rounding it](https://stacko... | ```
>>> a = "545.2222"
>>> float(a)
545.22220000000004
>>> int(float(a))
545
``` |
379,916 | <p><a href="https://stackoverflow.com/questions/48496/how-to-teach-a-crash-course-on-c">This post</a> reference to the One Definition Rule.</p>
<p><a href="http://en.wikipedia.org/wiki/One_Definition_Rule" rel="nofollow noreferrer">Wikipedia is pretty bad on explaining how to implement it</a></p>
<p>Where can I find ... | [
{
"answer_id": 379925,
"author": "Michael Burr",
"author_id": 12711,
"author_profile": "https://Stackoverflow.com/users/12711",
"pm_score": 1,
"selected": false,
"text": "<p>The easiest way to comply with the one definition rule is to put the definition in a .cpp file instead of the head... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379916",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6367/"
] | [This post](https://stackoverflow.com/questions/48496/how-to-teach-a-crash-course-on-c) reference to the One Definition Rule.
[Wikipedia is pretty bad on explaining how to implement it](http://en.wikipedia.org/wiki/One_Definition_Rule)
Where can I find good ressources about guidelines to follow in C++ .NET? | The one definition rule basically means that a variable/function can only be located at one place in address space of the compiled executable. One way to think of it is while you compile, there is an array of memory to be used in the compiled program (object code), and a lookup table to reference variable/function loca... |
379,917 | <p>I'm trying to recreate the iPhone flick / scroll event in a window using JavaScript.</p>
<p>Starting with JQuery, I'm measuring the mouse's acceleration and offset during click - drag - release events using a timer:</p>
<pre><code>var MouseY = {
init: function(context) {
var self = this;
self.... | [
{
"answer_id": 380006,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<p>Hit up this link for the full explanation of one approach that seems to be what you're looking for.</p>\n\n<p><a href=\"http... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37522/"
] | I'm trying to recreate the iPhone flick / scroll event in a window using JavaScript.
Starting with JQuery, I'm measuring the mouse's acceleration and offset during click - drag - release events using a timer:
```
var MouseY = {
init: function(context) {
var self = this;
self._context = context ||... | Hit up this link for the full explanation of one approach that seems to be what you're looking for.
<http://www.faqts.com/knowledge_base/view.phtml/aid/14742/fid/53>
Here's an excerpt:
>
> This handler then sets up event
> capture for mouse movement and stores
> mouse cursor positions in variables
> mouseX and ... |
379,920 | <p>I'm writing a component and would like to insert images from the template folder.</p>
<p>How do you get the correct path to the template folder?</p>
| [
{
"answer_id": 379934,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 2,
"selected": false,
"text": "<p>I've figured out one method. Use the global $mainframe object.</p>\n\n<pre><code>$templateDir = $mainframe->getBasePath(... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | I'm writing a component and would like to insert images from the template folder.
How do you get the correct path to the template folder? | IIRC, the $mainframe global object is eventually going away. Here is a way to do it through the framework:
```
$app = JFactory::getApplication();
$templateDir = JURI::base() . 'templates/' . $app->getTemplate();
``` |
379,930 | <p>i run Apache web server on windows in order to work on some Perl CGI scripts. in production these scripts run on a linux box, and in the source code repository they all have shebangs like: <code>#!/usr/bin/perl</code>, but on my windows machine the shebangs would be <code>#!c:\perl\bin\perl.exe</code>, so i have a c... | [
{
"answer_id": 386980,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 4,
"selected": true,
"text": "<p>It sounds like the ScriptInterpreterSource line is being ignored. If it's set to Registry or Registry-Strict, it shou... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46775/"
] | i run Apache web server on windows in order to work on some Perl CGI scripts. in production these scripts run on a linux box, and in the source code repository they all have shebangs like: `#!/usr/bin/perl`, but on my windows machine the shebangs would be `#!c:\perl\bin\perl.exe`, so i have a conflict with the source c... | It sounds like the ScriptInterpreterSource line is being ignored. If it's set to Registry or Registry-Strict, it should ignore the shebang lines and use the registry **only**.
Also, the [Apache 2.2 docs](http://httpd.apache.org/docs/2.2/mod/core.html#scriptinterpretersource) have a slightly different location for the ... |
379,938 | <p>I have a rather strange error with NHibernate. I am was having error with ISession been shared by across threads and got this resolved by supplying my own ADO.NET connection like:</p>
<pre><code> IDbConnection connection = new SqlConnection(ApplicationConfiguration.ConnectionString);
connecti... | [
{
"answer_id": 380029,
"author": "Sam",
"author_id": 47636,
"author_profile": "https://Stackoverflow.com/users/47636",
"pm_score": 2,
"selected": false,
"text": "<p>Check out the cascade attribute on your collection mapping - by default this is set to 'none', meaning child entities need ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a rather strange error with NHibernate. I am was having error with ISession been shared by across threads and got this resolved by supplying my own ADO.NET connection like:
```
IDbConnection connection = new SqlConnection(ApplicationConfiguration.ConnectionString);
connection.Open();
... | Check out the cascade attribute on your collection mapping - by default this is set to 'none', meaning child entities need to be explicitly saved. You probably want cascade="all" or cascade="all-delete-orphan". |
379,939 | <p>Basically I want to put "todays" year, month, day into two fields ... something like the following. Tried varients of but cant get it right</p>
<blockquote>
<p>"INSERT INTO film_out (start_year, start_month, start_day), (end_year, end_month, end_day) VALUES ('$year', '$month', '$day') "</p>
</blockquote>
| [
{
"answer_id": 379943,
"author": "cLFlaVA",
"author_id": 45109,
"author_profile": "https://Stackoverflow.com/users/45109",
"pm_score": 2,
"selected": false,
"text": "<p>?</p>\n\n<pre><code>\"INSERT INTO film_out (start_year, start_month, start_day, end_year, end_month, end_day)\n VA... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Basically I want to put "todays" year, month, day into two fields ... something like the following. Tried varients of but cant get it right
>
> "INSERT INTO film\_out (start\_year, start\_month, start\_day), (end\_year, end\_month, end\_day) VALUES ('$year', '$month', '$day') "
>
>
> | ?
```
"INSERT INTO film_out (start_year, start_month, start_day, end_year, end_month, end_day)
VALUES ('$year', '$month', '$day', '$year', '$month', '$day')"
``` |
379,962 | <p>I have the following data</p>
<p><a href="https://i.stack.imgur.com/KWyXz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KWyXz.png" alt="alt text"></a>
</p>
<p>How do I transform it (with SQL Server 2005) into the following format?</p>
<p><a href="https://i.stack.imgur.com/1FVoX.png" rel="nofo... | [
{
"answer_id": 379986,
"author": "Charles Bretana",
"author_id": 32632,
"author_profile": "https://Stackoverflow.com/users/32632",
"pm_score": 0,
"selected": false,
"text": "<p>Here's an idea... \nUse the Pivot Keyword... available in sql2005</p>\n\n<p><a href=\"http://msdn.microsoft.co... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19377/"
] | I have the following data
[](https://i.stack.imgur.com/KWyXz.png)
How do I transform it (with SQL Server 2005) into the following format?
[](https://i.stack.imgur.com/1FVoX.png)
I have a example solution that I came up w... | You can use the PIVOT() function
```
SELECT P.PRODUCT_ID,
P.Czech,
P.Other languages
FROM TABLE AS T
PIVOT (
AGGREGATE(LANGUAGE) FOR LANGUAGE IN ([Czech], ...)
) AS P
```
If you don't name the columns explicitly you are forced into doing tricks as far as I kno... |
379,975 | <p>What is the meaning of this attribute?</p>
<pre><code><System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
</code></pre>
| [
{
"answer_id": 379979,
"author": "Diadistis",
"author_id": 47401,
"author_profile": "https://Stackoverflow.com/users/47401",
"pm_score": 3,
"selected": true,
"text": "<p><a href=\"http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=390\" rel=\"nofollow noreferrer\">This explains it perfe... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23667/"
] | What is the meaning of this attribute?
```
<System.ComponentModel.DataObjectMethod(ComponentModel.DataObjectMethodType.Select, True)> _
``` | [This explains it perfectly](http://imar.spaanjaars.com/QuickDocId.aspx?quickdoc=390) |
379,988 | <p>I'm trying to make a database and so far, I've been using strings to store my entries from a text file into an array, but this just isn't working out. Thus, I began thinking of a new way of doing it.<br/> </p>
<p>What I want to do:</p>
<p>Lets say I have a text file with the following database...</p>
<p>John Smi... | [
{
"answer_id": 379999,
"author": "Tamara Wijsman",
"author_id": 47064,
"author_profile": "https://Stackoverflow.com/users/47064",
"pm_score": 0,
"selected": false,
"text": "<p>Read one line at a time with <a href=\"http://www.cplusplus.com/reference/iostream/ifstream/\" rel=\"nofollow no... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379988",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm trying to make a database and so far, I've been using strings to store my entries from a text file into an array, but this just isn't working out. Thus, I began thinking of a new way of doing it.
What I want to do:
Lets say I have a text file with the following database...
John Smith 00001 jsmith@email pw1
... | As TomWij says, you do ifstream then strtok, but I'd recommend you escape your strings with "", not just spaces, that way you can store "something like this, for example a note about the user", that's how its done with CSV (comma separated values).
```
#include <iostream>
#include <string>
#include <fstream>
#include ... |
379,995 | <p>I have one class that needs to grab an attribute that is set in another. It's not a standard data type though. Here's the code;</p>
<pre><code>class graphics:
def __init__(self, Fullscreen = False, Width = 640, Height = 480):
print "Graphics Init"
SCREEN_SIZE = (Width, Height)
pygame.init()
if Fulls... | [
{
"answer_id": 380001,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 0,
"selected": false,
"text": "<p>It's likely an <code>object</code> type so</p>\n\n<pre><code>self.screen = object()\n</code></pre>\n\n<p>might work (... | 2008/12/19 | [
"https://Stackoverflow.com/questions/379995",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46981/"
] | I have one class that needs to grab an attribute that is set in another. It's not a standard data type though. Here's the code;
```
class graphics:
def __init__(self, Fullscreen = False, Width = 640, Height = 480):
print "Graphics Init"
SCREEN_SIZE = (Width, Height)
pygame.init()
if Fullscreen:
... | You rarely, if ever, reference attributes of a class. You reference attributes of an object.
(Also, class names should be uppercase: `Graphics`).
```
class Graphics:
SCREEN_SIZE = (640, 480)
def __init__(self, Fullscreen = False, Width = 640, Height = 480):
print "Graphics Init"
self.SCREEN_SIZE = (Width, Hei... |
380,014 | <p>I have a 100% valid Ajax model written in Javascript with a few inputs I use being, Get or Post method, What page to communicate with, What String to send to that page and What element on my own page I might be fiddling with when I receive my response.
The problem is that, should I set the request to Asynchronous (H... | [
{
"answer_id": 380032,
"author": "Supernovah",
"author_id": 36076,
"author_profile": "https://Stackoverflow.com/users/36076",
"pm_score": 1,
"selected": false,
"text": "<p>Ho humm</p>\n\n<p>Outside of the onreadystatechange function I had a call for responsetext to check whether it exist... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36076/"
] | I have a 100% valid Ajax model written in Javascript with a few inputs I use being, Get or Post method, What page to communicate with, What String to send to that page and What element on my own page I might be fiddling with when I receive my response.
The problem is that, should I set the request to Asynchronous (Henc... | Ho humm
Outside of the onreadystatechange function I had a call for responsetext to check whether it existed yet, but aparently you can't do that if it doesn't exist yet so I just had to restructure some thigs. All is okay but this was the script that caused the problem
```
ajaxRequest(){
[...]
}
if(xmlhttp.respo... |
380,024 | <p>I have an Obj-C method similar to this:</p>
<pre><code>-(void)getUserDefaults:(BOOL *)refreshDefaults
{
PostAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
if (refreshDefaults) {
[appDelegate retrieveDefaults];
}
}
</code></pre>
<p>When I call it like this I get no war... | [
{
"answer_id": 380036,
"author": "aib",
"author_id": 1088,
"author_profile": "https://Stackoverflow.com/users/1088",
"pm_score": 3,
"selected": false,
"text": "<p>I have never seen Obj-C code before, but I'm pretty sure it's because the 'refreshDefaults' is a pointer to BOOL whereas it s... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380024",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46540/"
] | I have an Obj-C method similar to this:
```
-(void)getUserDefaults:(BOOL *)refreshDefaults
{
PostAppDelegate *appDelegate = [[UIApplication sharedApplication] delegate];
if (refreshDefaults) {
[appDelegate retrieveDefaults];
}
}
```
When I call it like this I get no warning:
```
[self getUserDe... | getUserDefaults takes a BOOL\*. You don't get a warning when you pass NO because NO is 0 and 0 is NULL, which is a legal BOOL\*. YES is 1 and the same conversion isn't automatically safe.
You should make getUserDefaults take a plain BOOL, instead of a pointer. |
380,031 | <p>I read a list of SIDs from the registry, <code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList</code>.</p>
<p>How would one resolve the display username (e.g. <code>DOMAIN\user</code>, <code>BUILT-IN\user</code>) given the SID string in C#?</p>
| [
{
"answer_id": 380048,
"author": "Mitch Wheat",
"author_id": 16076,
"author_profile": "https://Stackoverflow.com/users/16076",
"pm_score": 5,
"selected": true,
"text": "<p>The Win32 API function <a href=\"http://msdn.microsoft.com/en-us/library/windows/desktop/aa379166%28v=vs.85%29.aspx\... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40214/"
] | I read a list of SIDs from the registry, `HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\ProfileList`.
How would one resolve the display username (e.g. `DOMAIN\user`, `BUILT-IN\user`) given the SID string in C#? | The Win32 API function [`LookupAccountSid()`](http://msdn.microsoft.com/en-us/library/windows/desktop/aa379166%28v=vs.85%29.aspx) is used to find the name that corresponds to a SID.
`LookupAccountSid()` has the following signature:
```
BOOL LookupAccountSid(LPCTSTR lpSystemName, PSID Sid,LPTSTR Name, LPDWORD cbName,
... |
380,037 | <p>Does anyone have a solution for styling the borders of "select" elements in Internet Explorer using CSS?</p>
| [
{
"answer_id": 380068,
"author": "some",
"author_id": 36866,
"author_profile": "https://Stackoverflow.com/users/36866",
"pm_score": 6,
"selected": true,
"text": "<p>As far as I know, it's not possible in IE because it uses the OS component.</p>\n\n<p>Here is a <a href=\"http://v2.easy-de... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380037",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40538/"
] | Does anyone have a solution for styling the borders of "select" elements in Internet Explorer using CSS? | As far as I know, it's not possible in IE because it uses the OS component.
Here is a [link](http://v2.easy-designs.net/articles/replaceSelect/) where the control is replaced, but I don't know if thats what you want to do.
**Edit: The link is broken I'm dumping the content**
-----------------------------------------... |
380,050 | <p>So, I got ZF MVC site and want to force SSL connection on everything under my /checkout/
I tried using mod_rewrite for that, so my .htaccess would look like this:</p>
<pre><code>RewriteEngine on
RewriteRule (\/checkout.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|xml|avi|f... | [
{
"answer_id": 381624,
"author": "Tim Lytle",
"author_id": 45531,
"author_profile": "https://Stackoverflow.com/users/45531",
"pm_score": 1,
"selected": false,
"text": "<p>This may help you, add the RewriteCond to only apply when the connection is not SSL, then add the 'L' option to your ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380050",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35520/"
] | So, I got ZF MVC site and want to force SSL connection on everything under my /checkout/
I tried using mod\_rewrite for that, so my .htaccess would look like this:
```
RewriteEngine on
RewriteRule (\/checkout.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|xml|avi|flv|mov|mp3|wa... | Tim Lytle's answer is mostly there.
I'd change it be a little more strict in checking HTTPS and the flags need a delimiter.
```
RewriteCond %{HTTPS} !^on$
RewriteRule ^/checkout/? https://%{HTTP_HOST}%{REQUEST_URI} [R,L]
RewriteRule !\.(js|ico|gif|jpg|png|css|swf|xml|avi|flv|mov|mp3|wav)$ index.php [L]
``` |
380,057 | <p>I've created a table in MySQL:</p>
<pre><code>CREATE TABLE actions ( A_id int NOT NULL AUTO_INCREMENT,
type ENUM('rate','report','submit','edit','delete') NOT NULL,
Q_id int NOT NULL,
U_id int NOT NULL,
date DATE NOT NULL,
time TIME NOT NULL,
rate tinyint(1),
PRIMARY KEY (A_id),
CONSTRAINT fk_Question FOREIGN KEY (... | [
{
"answer_id": 380074,
"author": "Bill Karwin",
"author_id": 20860,
"author_profile": "https://Stackoverflow.com/users/20860",
"pm_score": 6,
"selected": false,
"text": "<p>I would guess that your default storage engine is MyISAM, which ignores foreign key constraints. It silently accep... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1615/"
] | I've created a table in MySQL:
```
CREATE TABLE actions ( A_id int NOT NULL AUTO_INCREMENT,
type ENUM('rate','report','submit','edit','delete') NOT NULL,
Q_id int NOT NULL,
U_id int NOT NULL,
date DATE NOT NULL,
time TIME NOT NULL,
rate tinyint(1),
PRIMARY KEY (A_id),
CONSTRAINT fk_Question FOREIGN KEY (Q_id) REFERENC... | I would guess that your default storage engine is MyISAM, which ignores foreign key constraints. It silently accepts the declaration of a foreign key, but does not store the constraint or enforce it subsequently.
However, it does implicitly create an index on the columns you declared for the foreign key. In MySQL, "`K... |
380,067 | <p>I'm trying to bring a legacy C# .NET 1.1 application into the modern era. We use DataTables for our collections of what could have been business objects.</p>
<p>Given that most of the code thinks it is talking to the interface of a DataRow, what generic collection would make for the least painful transition?</p>
| [
{
"answer_id": 380101,
"author": "Joseph Daigle",
"author_id": 507,
"author_profile": "https://Stackoverflow.com/users/507",
"pm_score": 2,
"selected": false,
"text": "<p>Instead of changing away from the DataSet/DataTable APIs, why not subclass DataTable and DataRow into types suitable ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380067",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33264/"
] | I'm trying to bring a legacy C# .NET 1.1 application into the modern era. We use DataTables for our collections of what could have been business objects.
Given that most of the code thinks it is talking to the interface of a DataRow, what generic collection would make for the least painful transition? | if im reading your question rightly, you are asking for which container will just store a list of your Business objects and then allow you to just enumerate through the collection, or select via an index.
well I would consider looking into the List<>
where you methods would accept either IList<> (to access the index)... |
380,069 | <p>I'm trying to include JQuery in my DotNetNuke skin by adding these two lines of code at the top of my DNN skin:</p>
<pre><code><%
Page.ClientScript.RegisterClientScriptInclude("jquery", "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js")
Page.ClientScript.RegisterStar... | [
{
"answer_id": 380168,
"author": "Glenn Slaven",
"author_id": 2975,
"author_profile": "https://Stackoverflow.com/users/2975",
"pm_score": 0,
"selected": false,
"text": "<p>What version of DNN are you using? DNN doesn't support including jQuery unless you're using DNN version 5. <a href... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24995/"
] | I'm trying to include JQuery in my DotNetNuke skin by adding these two lines of code at the top of my DNN skin:
```
<%
Page.ClientScript.RegisterClientScriptInclude("jquery", "http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js")
Page.ClientScript.RegisterStartupScript(Me.GetT... | Sigh. The solution is to make sure you put it in the Page\_Load() method, and not the page rendering code itself. I suppose I was too late in the page lifecycle to do what I'd wanted to do.
```
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.... |
380,076 | <p>The data model for my Core Data document-based app (10.5 only) is in a
framework, so automatic schema upgrades using a Core Data mapping
model don't appear to work. It appears that the Core Data machinery
doesn't find the appropriate data models or mapping model when they
are not in the app's main bundle. So, instea... | [
{
"answer_id": 381484,
"author": "Boaz Stuller",
"author_id": 1464654,
"author_profile": "https://Stackoverflow.com/users/1464654",
"pm_score": 2,
"selected": true,
"text": "<p>I haven't run across this particular situation, but I have a few guesses. First, instead of using -removeItemA... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2140/"
] | The data model for my Core Data document-based app (10.5 only) is in a
framework, so automatic schema upgrades using a Core Data mapping
model don't appear to work. It appears that the Core Data machinery
doesn't find the appropriate data models or mapping model when they
are not in the app's main bundle. So, instead o... | I haven't run across this particular situation, but I have a few guesses. First, instead of using -removeItemAtPath: and -moveItemAtPath: when you want to switch files, use the FSExchangeObjects() function instead. NSDocument uses FSRefs to track the file and unless you use FSExchangeObjects(), it'll realize that it's ... |
380,100 | <p>I'm trying to convert an HTML table to Excel in Javascript using new <code>ActiveXObject("Excel.application")</code>. Bascially I loop through table cells and insert the value to the corresponding cell in excel:</p>
<pre><code>//for each table cell
oSheet.Cells(x,y).value = cell.innerText;
</code></pre>
<p>The pro... | [
{
"answer_id": 380146,
"author": "lakshmanaraj",
"author_id": 44541,
"author_profile": "https://Stackoverflow.com/users/44541",
"pm_score": 0,
"selected": false,
"text": "<p>In Vbscript, we use to resolve this by</p>\n\n<pre><code> If IsDate ( Cell.Value ) Then\n Cell.Value = ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380100",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47646/"
] | I'm trying to convert an HTML table to Excel in Javascript using new `ActiveXObject("Excel.application")`. Bascially I loop through table cells and insert the value to the corresponding cell in excel:
```
//for each table cell
oSheet.Cells(x,y).value = cell.innerText;
```
The problem is that when the cell is in date... | In Vbscript, we use to resolve this by
```
If IsDate ( Cell.Value ) Then
Cell.Value = DateValue ( Cell.Value )
End If
```
Maybe, In java script also you need to play with same approach. |
380,103 | <p>This simple code is not producing any sound on a couple of machines that I've used to test it. I'm running the code from within Eclipse, but I've also tried using the command line to no avail. </p>
<pre><code>public static void main(String[] args)
{
try {
Synthesizer synthesizer = MidiSystem.getSynthes... | [
{
"answer_id": 380303,
"author": "Dmitry Khalatov",
"author_id": 18174,
"author_profile": "https://Stackoverflow.com/users/18174",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried to use different channel ?\nMay be <a href=\"http://forums.sun.com/thread.jspa?threadID=5237086\... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2197/"
] | This simple code is not producing any sound on a couple of machines that I've used to test it. I'm running the code from within Eclipse, but I've also tried using the command line to no avail.
```
public static void main(String[] args)
{
try {
Synthesizer synthesizer = MidiSystem.getSynthesizer();
... | Some installs of the JRE do not include the JavaSound soundbank.gm (in order to save space) so your code would not have a sound source to trigger on those machines.
Check for the existence of the soundbank on the machines that don't work. You can also put the soundbank in the same directory as your .class file and it... |
380,145 | <p>Well, maybe not with all 4 things, but here's my situation:</p>
<p>I have an ActiveMQ backend (running on my desktop Mac). It's a stock Apache ActiveMQ server I have which I am basically using as an echo server to tail the logs and debug my client. The client is an iPhone project with a hacked up Stomp.framework im... | [
{
"answer_id": 380785,
"author": "gtully",
"author_id": 47749,
"author_profile": "https://Stackoverflow.com/users/47749",
"pm_score": 3,
"selected": true,
"text": "<p>no idea on the specifics of the error code but I can tell you that the certs that ship with activemq are noddy, intended ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380145",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39932/"
] | Well, maybe not with all 4 things, but here's my situation:
I have an ActiveMQ backend (running on my desktop Mac). It's a stock Apache ActiveMQ server I have which I am basically using as an echo server to tail the logs and debug my client. The client is an iPhone project with a hacked up Stomp.framework implementati... | no idea on the specifics of the error code but I can tell you that the certs that ship with activemq are noddy, intended for testing only. They are self signed certs (essentially invalid) which can throw a client side ssl library that tries to validate their chain length. In the [ssl broker test](https://github.com/apa... |
380,153 | <p>Alright, so I just finished my last compiler error (so I thought) and these errors came up:</p>
<pre><code>1>GameEngine.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA)
1>Component.obj : error LNK2001: unresolved external symbol "public: static double ... | [
{
"answer_id": 380174,
"author": "Mr Fooz",
"author_id": 25050,
"author_profile": "https://Stackoverflow.com/users/25050",
"pm_score": 2,
"selected": false,
"text": "<p>This</p>\n\n<pre><code>WeaponsDB::PI = 4*atan(1.0);\n</code></pre>\n\n<p>assigns a value to PI. It does not create spa... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39189/"
] | Alright, so I just finished my last compiler error (so I thought) and these errors came up:
```
1>GameEngine.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@WeaponsDB@@2NA)
1>Component.obj : error LNK2001: unresolved external symbol "public: static double WeaponsDB::PI" (?PI@... | Most often, when the linker is failing to detect a static member it is because you to forgot to really define it somewhere, as it was pointed before:
```
// header
class X {
static const int y;
};
// cpp
const int X::y = 1;
```
But in your case, as you are not only missing static variables but also all the rest ... |
380,165 | <p>Can somebody show me how to calculate the inverse of a matrix? I'm using VC++ 6.0</p>
| [
{
"answer_id": 380207,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 1,
"selected": false,
"text": "<p>Another good source is <a href=\"http://www.nr.com/\" rel=\"nofollow noreferrer\">Numerical Recipes</a>, althoug... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Can somebody show me how to calculate the inverse of a matrix? I'm using VC++ 6.0 | MFC is not a tool for numerical methods.
---
Calculating the inverse of an nxn matrix is simple. I'll give you the algorithm:
```
/* I took this from my implementation of CMatrix
* It works, but I'm not sure if it's the most efficient algorithm.
*
* 1. Start with Q = Identity, whose inverse is R = Identity.
*... |
380,167 | <p>What is the best way to limit the number of (concurrent) users accessing a web application that any one can introduce for selling website/application to client and how to increase the number of users accessing it remotely?</p>
| [
{
"answer_id": 380183,
"author": "cdeszaq",
"author_id": 20770,
"author_profile": "https://Stackoverflow.com/users/20770",
"pm_score": 0,
"selected": false,
"text": "<p>One way would be to track active sessions in a database, and each time a user logs in, check the number of active sessi... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41524/"
] | What is the best way to limit the number of (concurrent) users accessing a web application that any one can introduce for selling website/application to client and how to increase the number of users accessing it remotely? | If you use the in-process session state management, you can use the [HttpApplicationState](http://msdn.microsoft.com/en-us/library/system.web.httpapplicationstate.aspx) class, by introducing the Global.asax file and putting something like this in the code behind:
```
void Application_Start(object sender, EventArgs e)
... |
380,171 | <p>I have two strings: the first's value is "catdog" and the second's is "got".</p>
<p>I'm trying to find a regex that tells me if the letters for "got" are in "catdog". I'm particularly looking to avoid the case where there are duplicate letters. For example, I know "got" is a match, however "gott" is not a match b... | [
{
"answer_id": 380197,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 0,
"selected": false,
"text": "<p>You want a string that matches exact those letters, exactly once. It depends what you're writing the regex in, ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42620/"
] | I have two strings: the first's value is "catdog" and the second's is "got".
I'm trying to find a regex that tells me if the letters for "got" are in "catdog". I'm particularly looking to avoid the case where there are duplicate letters. For example, I know "got" is a match, however "gott" is not a match because there... | You're using the wrong tool for the job. This is not something regular expressions are capable of handling easily. Fortunately, it's relatively easy to do this without regular expressions. You just count up the number of occurrences of each letter within both strings, and compare the counts between the two strings - if... |
380,172 | <p>I have a program that was written for linux and I am trying to build and run it on my MacOS 10.5 machine. The program builds and runs without problem, however it makes many calls to syslog. I know that syslogd is running on my mac, however I can't seem to find where my syslog calls are output to.</p>
<p>The syslog ... | [
{
"answer_id": 380190,
"author": "Charlie Martin",
"author_id": 35092,
"author_profile": "https://Stackoverflow.com/users/35092",
"pm_score": 4,
"selected": false,
"text": "<p>When in doubt, there's always <code>man syslog</code>.</p>\n\n<p>You can find your messages in <code>/var/log/sy... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380172",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a program that was written for linux and I am trying to build and run it on my MacOS 10.5 machine. The program builds and runs without problem, however it makes many calls to syslog. I know that syslogd is running on my mac, however I can't seem to find where my syslog calls are output to.
The syslog calls are ... | You should probably use the Console.app to view logfiles. It's purdy.
Select your device on the left and filter messages on the right:
[](https://i.stack.imgur.com/ui8BD.png) |
380,184 | <p>I am trying to get a text to wrap around a <code>div</code> in my XHTML. My XHTML looks like so....</p>
<pre><code><div id="cont-content">
<p>content</p>
<p>more content</p>
<div id="content-sidebar">
BLALALALALLAAL
</div>
</div>
</code></pre>
<p>And my CS... | [
{
"answer_id": 394727,
"author": "datasn.io",
"author_id": 49318,
"author_profile": "https://Stackoverflow.com/users/49318",
"pm_score": 6,
"selected": true,
"text": "<p>Yep you got it. The #content-sidebar should be before all the texts which are supposed to wrap it. Like this:</p>\n\n<... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31671/"
] | I am trying to get a text to wrap around a `div` in my XHTML. My XHTML looks like so....
```
<div id="cont-content">
<p>content</p>
<p>more content</p>
<div id="content-sidebar">
BLALALALALLAAL
</div>
</div>
```
And my CSS looks like...
```
#content-sidebar {
display: block;
float: right;
widt... | Yep you got it. The #content-sidebar should be before all the texts which are supposed to wrap it. Like this:
```
<div id="cont-content">
<div id="content-sidebar">
BLALALALALLAAL
</div>
<p>content</p>
<p>more content</p>
</div>
``` |
380,198 | <p>Is it possible to pass a function as a parameter in C#? I can do it using the Func or Action classes, but this forces me to declare the entire function signature at once. When I try to use Delegate, I get a compile error saying it can't convert a method group to a Delegate. </p>
<p>I'm working on <a href="http://ww... | [
{
"answer_id": 380225,
"author": "dbones",
"author_id": 47642,
"author_profile": "https://Stackoverflow.com/users/47642",
"pm_score": 2,
"selected": false,
"text": "<p>please have a look at using delegates here is a great example</p>\n\n<p><a href=\"http://www.c-sharpcorner.com/UploadFil... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380198",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23427/"
] | Is it possible to pass a function as a parameter in C#? I can do it using the Func or Action classes, but this forces me to declare the entire function signature at once. When I try to use Delegate, I get a compile error saying it can't convert a method group to a Delegate.
I'm working on [Axial](http://www.codeplex.... | I think what you want is:
```
static object InvokeMethod(Delegate method, params object[] args){
return method.DynamicInvoke(args);
}
static int Add(int a, int b){
return a + b;
}
static void Test(){
Console.WriteLine(InvokeMethod(new Func<int, int, int>(Add), 5, 4));
}
```
Prints "9". |
380,215 | <p>I am building a small wpf app in C#. When a button gets clicked a third
party dll function constructs a tree like object. This object is bound
to a treeview. This works fine but takes a bit of time to load. As the
dll function constructs the object it prints progress info to the
console. I want to redirect this ... | [
{
"answer_id": 380255,
"author": "Matt Hamilton",
"author_id": 615,
"author_profile": "https://Stackoverflow.com/users/615",
"pm_score": 0,
"selected": false,
"text": "<p>I believe the problem is in the constructor of your StringRedir class. You're passing in ProgessTextBlock, and you're... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47660/"
] | I am building a small wpf app in C#. When a button gets clicked a third
party dll function constructs a tree like object. This object is bound
to a treeview. This works fine but takes a bit of time to load. As the
dll function constructs the object it prints progress info to the
console. I want to redirect this int... | You haven't included the code that is loading the data for the `TreeView`, but I'm guessing it's being done on the UI thread. If so, this will block any UI updates (including changes to the `TextBlock`) until it has completed. |
380,217 | <p>I have a form without caption, using on double click to maximize : Code looks like this:</p>
<pre><code>procedure xxxxxx;
begin
if Form1.WindowState=wsNormal then
begin
Form1.WindowState:=wsMaximized;
Form1.SetBounds(0,0,screen.Width,screen.Height-getHeightOfTaskBar);
end
e... | [
{
"answer_id": 380266,
"author": "Drejc",
"author_id": 6482,
"author_profile": "https://Stackoverflow.com/users/6482",
"pm_score": 0,
"selected": false,
"text": "<p>One additional hint. The task bar can also be located on the right or the left of the screen (not only top and bottom). So ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380217",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27016/"
] | I have a form without caption, using on double click to maximize : Code looks like this:
```
procedure xxxxxx;
begin
if Form1.WindowState=wsNormal then
begin
Form1.WindowState:=wsMaximized;
Form1.SetBounds(0,0,screen.Width,screen.Height-getHeightOfTaskBar);
end
else
beg... | Sounds okay but like Drejc pointed out, the taskbar can appear anywhere, so too could additional docked sidebars like Google Desktop, Winamp, etc.
Instead perhaps use something like Screen.WorkAreaRect to get the client area of the screen. E.g.
```
with Screen.WorkAreaRect do
Form1.SetBounds(Left, Top, Right - Left... |
380,221 | <p>How to hide controller name in Url?</p>
<p>I use the ASP.NET MVC.</p>
<p>The original url is: <a href="http://www.sample.com/Users.mvc/UserDetail/9615" rel="nofollow noreferrer">http://www.sample.com/Users.mvc/UserDetail/9615</a></p>
<p>The "Users" is controller name, the "UserDetail" is action name, and the "96... | [
{
"answer_id": 380298,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 3,
"selected": true,
"text": "<p>The idea is the same. You do just the thing you did to the action. However, your problem arises from the fact that IIS is pr... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380221",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40919/"
] | How to hide controller name in Url?
I use the ASP.NET MVC.
The original url is: <http://www.sample.com/Users.mvc/UserDetail/9615>
The "Users" is controller name, the "UserDetail" is action name, and the "9615" is UserId.
How can I hide the controller name and action name in the url.
Just like this: <http://www.sa... | The idea is the same. You do just the thing you did to the action. However, your problem arises from the fact that IIS is probably not mapping www.xyz.com/1234 to ASP.NET runtime. To do so in IIS7, enable integrated mode and in IIS6, add a wildcard mapping in handler map that maps everything to ASP.NET.
To add a wildc... |
380,227 | <p>Suppose I am entering validation code into my model of multi-language publication database. The database needs either an English or a Japanese title for a particular journal. So I need to validate_presence_of at least one of the two. Right now I can easily check that both exists, but am stumped on the case of "at le... | [
{
"answer_id": 380250,
"author": "Chirantan",
"author_id": 45942,
"author_profile": "https://Stackoverflow.com/users/45942",
"pm_score": 4,
"selected": true,
"text": "<pre><code>class Article < ActiveRecord::Base \n belongs_to :publication \n validate_presence_of :journal_title, :... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39584/"
] | Suppose I am entering validation code into my model of multi-language publication database. The database needs either an English or a Japanese title for a particular journal. So I need to validate\_presence\_of at least one of the two. Right now I can easily check that both exists, but am stumped on the case of "at lea... | ```
class Article < ActiveRecord::Base
belongs_to :publication
validate_presence_of :journal_title, :if => :check_japanese
validate_presence_of :journal_title_ja, :if => :check_english
def check_japanese
journal_title_ja.nil?
end
def check_english
journal_title.nil?
end
end
```
This shou... |
380,244 | <p>I want to build a dynamic floating window with close button at corner. Is it possible, and also i want to add some content dynamically into that window. </p>
<p>Please help me.. It should be in javascript.. Better without AJAX..</p>
<p>Thanks in Advance</p>
| [
{
"answer_id": 380260,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 1,
"selected": false,
"text": "<p>My favourite has always been <a href=\"http://script.aculo.us/\" rel=\"nofollow noreferrer\">Scriptaculous</a>, whic... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38172/"
] | I want to build a dynamic floating window with close button at corner. Is it possible, and also i want to add some content dynamically into that window.
Please help me.. It should be in javascript.. Better without AJAX..
Thanks in Advance | jQuery UI has an awesome floating window. What's cool about the jQuery UI version is that you can also package it with the UI theme manager, which means less time styling.
Check it out here : [jQuery UI Dialog examples](https://jqueryui.com/resources/demos/dialog/modal-form.html "jQuery UI Modal")
All it takes is cre... |
380,257 | <p>when reading data through serial port </p>
<pre><code>VARIANT data;
BSTR k;
if(m_mscom.GetCommEvent() == 2)
{
data = m_mscom.GetInput();
k = data.bstrVal;
}
</code></pre>
<p>What is <code>BSTR k;</code> and
what do you mean <code>k=data.bstrVal</code>? What is <code>bstrVal</code>?</p>
| [
{
"answer_id": 380291,
"author": "yesraaj",
"author_id": 22076,
"author_profile": "https://Stackoverflow.com/users/22076",
"pm_score": 0,
"selected": false,
"text": "<p>BSTR is a pointer to unicode character(just character type that can hold unicode character).\ndata.bstrVal converts var... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | when reading data through serial port
```
VARIANT data;
BSTR k;
if(m_mscom.GetCommEvent() == 2)
{
data = m_mscom.GetInput();
k = data.bstrVal;
}
```
What is `BSTR k;` and
what do you mean `k=data.bstrVal`? What is `bstrVal`? | [BSTR](http://msdn.microsoft.com/en-us/library/ms221069.aspx) and [VARIANT](http://msdn.microsoft.com/en-us/library/ms221627.aspx) are data types used in COM. Actually, VARIANT is a container that may hold any COM data type.
In your case, GetInput() returns VARIANT containing a buffer as BSTR, so bstrVal has to be use... |
380,274 | <p><strong>What in C#.NET makes it more suitable</strong> for some projects than VB.NET?</p>
<p>Performance?, Capabilities?, Libraries/Components?, Reputation?, Reliability? Maintainability?, Ease?</p>
<hr>
<p>Basically anything <strong>C# can do, that is impossible using VB,</strong> or vice versa.
Things you just ... | [
{
"answer_id": 380280,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 3,
"selected": false,
"text": "<p>In early versions of VB.NET, the difference was more obvious, however with the current version, there are no significant di... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380274",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41021/"
] | **What in C#.NET makes it more suitable** for some projects than VB.NET?
Performance?, Capabilities?, Libraries/Components?, Reputation?, Reliability? Maintainability?, Ease?
---
Basically anything **C# can do, that is impossible using VB,** or vice versa.
Things you just **have to consider** when choosing C#/VB for... | C# and VB are basically the same however there are some minor differences. Aside from the obvious grammar differences you have the following differences:
1. C# can call unsafe code
2. VB has optional parameters (Coming in C#4.0)
3. VB is easier to use when making late bound calls (Coming in C# 4.0) This and number mak... |
380,287 | <p>I'd like to play mp3 files (b/c they compress smaller than .wav's) from a vb6 app but without needing any other player installed.</p>
<p>Any suggestions?</p>
| [
{
"answer_id": 380292,
"author": "jkchong",
"author_id": 32004,
"author_profile": "https://Stackoverflow.com/users/32004",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure whether you would consider it as \"being installed\" since it comes with the OS, but you can control windows m... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4906/"
] | I'd like to play mp3 files (b/c they compress smaller than .wav's) from a vb6 app but without needing any other player installed.
Any suggestions? | The easiest way to play an MP3 in VB6 is using the MCI in windowsmultimedia (winmm) functions. These are available in all versions of windows that can play MP3s in windows media player (by default in 2000, XP and I believe 98, needed to install Windows media player for NT4 and 95). Add the following to your header:
``... |
380,321 | <p>Is there a plain API to access Mercurial repositories from Java?</p>
<p>There are plugins for Netbeans and Eclipse, but unlike their Subversion counterparts, they do not use a common lower-level library but bring their own wrappers to call out to the Mercurial binary. Calling the binary would be okay (for now), but... | [
{
"answer_id": 380400,
"author": "Keltia",
"author_id": 16143,
"author_profile": "https://Stackoverflow.com/users/16143",
"pm_score": 3,
"selected": false,
"text": "<p>Have you looked at Jython? As far as I can see <a href=\"http://jython.org/\" rel=\"noreferrer\">here</a>, it should he... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14955/"
] | Is there a plain API to access Mercurial repositories from Java?
There are plugins for Netbeans and Eclipse, but unlike their Subversion counterparts, they do not use a common lower-level library but bring their own wrappers to call out to the Mercurial binary. Calling the binary would be okay (for now), but it seems ... | A new option is [**JavaHg**](http://javahg.aragost.com/), which gives you a high-level Java API. The [unit tests](https://bitbucket.org/aragost/javahg/src/tip/src/test/java/com/aragost/javahg/commands/) give a good example of how it is to program with it (as of JavaHg 0.1):
```
public void commitTest() throws IOExcept... |
380,338 | <p>I am divided between using a C# implementation and a pure SQL 2005/2008 implementation. I need to determine the length of usage based on timestamps of their last actions. My table contains "friendID" (uniqueIdentifier) and "lastAction" datetime. Here is an example:</p>
<pre>
Bob, 1:00 PM
Bob, 1:01 PM
Bob, 1:20... | [
{
"answer_id": 380583,
"author": "Charles Graham",
"author_id": 7705,
"author_profile": "https://Stackoverflow.com/users/7705",
"pm_score": 0,
"selected": false,
"text": "<p>Record the start time of the first action in the session. Record the last time in the session as well. Look at t... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380338",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am divided between using a C# implementation and a pure SQL 2005/2008 implementation. I need to determine the length of usage based on timestamps of their last actions. My table contains "friendID" (uniqueIdentifier) and "lastAction" datetime. Here is an example:
```
Bob, 1:00 PM
Bob, 1:01 PM
Bob, 1:20 PM
Bob, 1... | Here's a pure SQL example:
If you only need the start times of the session:
```
select u, t
from test a
where not exists (
select 1
from test b
where a.u = b.u
and b.t >= a.t - '60 minutes'::interval
and b.t
```
If you really need the duration of the session:... |
380,379 | <p>I'd like to yank a line in a register: <code>"{register}y</code> but without overwriting what was previously in the register. I often need to copy non-contiguous lines in a register, and I'd like to use sometimes the registers like a stack.</p>
<p>Example:</p>
<pre><code>line1
line2
line3
</code></pre>
<p>I want ... | [
{
"answer_id": 380864,
"author": "MarkB",
"author_id": 2996,
"author_profile": "https://Stackoverflow.com/users/2996",
"pm_score": 8,
"selected": true,
"text": "<p>If you want to append to a named register use it's corresponding upper case character.\ni.e. In your example:</p>\n\n<pre>\n... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28165/"
] | I'd like to yank a line in a register: `"{register}y` but without overwriting what was previously in the register. I often need to copy non-contiguous lines in a register, and I'd like to use sometimes the registers like a stack.
Example:
```
line1
line2
line3
```
I want to copy `line1`, by putting the cursor on it... | If you want to append to a named register use it's corresponding upper case character.
i.e. In your example:
```
"ayy
"Ayy
"ap
``` |
380,380 | <p>I have a Windows form application written in C#. I update the title of the form frequently, but there's a substantial lag between the title changing and the title dislayed in the taskbar being updated. </p>
<p>What's a clean way to force an update / redraw of the task bar's entry for my program? Failing that, ho... | [
{
"answer_id": 380407,
"author": "Jonas Elfström",
"author_id": 44620,
"author_profile": "https://Stackoverflow.com/users/44620",
"pm_score": 2,
"selected": false,
"text": "<p>Did you try to call Form.Refresh() after updating the title?</p>\n\n<p>Edit:</p>\n\n<p>If you are doing the titl... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388/"
] | I have a Windows form application written in C#. I update the title of the form frequently, but there's a substantial lag between the title changing and the title dislayed in the taskbar being updated.
What's a clean way to force an update / redraw of the task bar's entry for my program? Failing that, how can I force... | Did you try to call Form.Refresh() after updating the title?
Edit:
If you are doing the title updates in a loop you might have to do something along the line of:
```
this.Invalidate();
this.Update();
Application.DoEvents();
``` |
380,381 | <p>Details are as follows:</p>
<p>Environment:</p>
<p>SSRS 2008 Server, SQL Server 2008 for database, Report Developed in SQL Server Business Intelligence Devlopment Studio - Reporting Project</p>
<p>Error Messages: </p>
<p>"An error occurred during client rendering."
"An error has occurred during report processing... | [
{
"answer_id": 380407,
"author": "Jonas Elfström",
"author_id": 44620,
"author_profile": "https://Stackoverflow.com/users/44620",
"pm_score": 2,
"selected": false,
"text": "<p>Did you try to call Form.Refresh() after updating the title?</p>\n\n<p>Edit:</p>\n\n<p>If you are doing the titl... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3535708/"
] | Details are as follows:
Environment:
SSRS 2008 Server, SQL Server 2008 for database, Report Developed in SQL Server Business Intelligence Devlopment Studio - Reporting Project
Error Messages:
"An error occurred during client rendering."
"An error has occurred during report processing."
"Query execution failed for ... | Did you try to call Form.Refresh() after updating the title?
Edit:
If you are doing the title updates in a loop you might have to do something along the line of:
```
this.Invalidate();
this.Update();
Application.DoEvents();
``` |
380,403 | <p>I do not have problem as such but I am quite new to Ruby. I have the following 3 repeatable bits of code in one method and I would like to know how a true Rubyist would first of all remove the duplication and secondly make it more reusable.</p>
<p>Here is the code in question:</p>
<pre><code>file = File.new( dest... | [
{
"answer_id": 380412,
"author": "Keltia",
"author_id": 16143,
"author_profile": "https://Stackoverflow.com/users/16143",
"pm_score": 2,
"selected": false,
"text": "<p>You could try to add a method that tries to be as generic as possible to avoid this, but they are significantly differen... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11755/"
] | I do not have problem as such but I am quite new to Ruby. I have the following 3 repeatable bits of code in one method and I would like to know how a true Rubyist would first of all remove the duplication and secondly make it more reusable.
Here is the code in question:
```
file = File.new( destination)
doc = REXML::... | The last two blocks could be replaced with
```
["add", "connectionStrings/plans"].each do |elt_name|
doc.elements.each("configuration/#{elt_name}").do |elt|
elt.raw_attributes = elt.attributes.merge("connectionString" => "#{TEST_CONNECTION_STRING}")
end
end
```
I assume the case difference between "connectio... |
380,406 | <p>If I have an inner class, like this:</p>
<pre><code>public class Test
{
public class Inner
{
// code ...
}
public static void main(String[] args)
{
// code ...
}
}
</code></pre>
<p>When I compile it, I expect it should generate two files:</p>
<pre><code>Test.class
Test$Inn... | [
{
"answer_id": 380418,
"author": "hhafez",
"author_id": 42303,
"author_profile": "https://Stackoverflow.com/users/42303",
"pm_score": 6,
"selected": true,
"text": "<p>The SomeClass$1.class represent anonymous inner class</p>\n\n<p>hava a look at the anonymous inner class section <a href=... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380406",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11347/"
] | If I have an inner class, like this:
```
public class Test
{
public class Inner
{
// code ...
}
public static void main(String[] args)
{
// code ...
}
}
```
When I compile it, I expect it should generate two files:
```
Test.class
Test$Inner.class
```
So why do I sometimes ... | The SomeClass$1.class represent anonymous inner class
hava a look at the anonymous inner class section [here](http://java.sun.com/docs/books/tutorial/java/javaOO/innerclasses.html) |
380,414 | <p>If you have some directories from different version control systems (cvs, svn...), how do you find out what type of repository each came from?</p>
| [
{
"answer_id": 380433,
"author": "Kurt",
"author_id": 31056,
"author_profile": "https://Stackoverflow.com/users/31056",
"pm_score": 4,
"selected": true,
"text": "<p>\"svn info\" is the command you want.</p>\n\n<p>/some/random/directory/in/project/space/</p>\n\n<pre><code>$ svn info\n\nPa... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380414",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47090/"
] | If you have some directories from different version control systems (cvs, svn...), how do you find out what type of repository each came from? | "svn info" is the command you want.
/some/random/directory/in/project/space/
```
$ svn info
Path: .
URL: https://example.org/svn/project/space/
Repository Root: https://example.org/svn/project/
Repository UUID: aaaaaaaa-bbbb-cccc-dddd-333333333333
Revision: 295
Node Kind: directory
Schedule: normal
Last Changed Auth... |
380,424 | <p>Assume I allow the user to input a arbitrary numerical expression that allows usage of the explicit set of functions and predefined variables.</p>
<p>Interpreting this is pretty straight forward but what if performance is a critical factor?</p>
<p>I need a way to compile (in runtime) a string with a expression int... | [
{
"answer_id": 380432,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 1,
"selected": false,
"text": "<p>In C# 4.0, it'll become very easy and straightforward. However, before C# 4.0, I suggest you use <code>Microsoft.JScript</c... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] | Assume I allow the user to input a arbitrary numerical expression that allows usage of the explicit set of functions and predefined variables.
Interpreting this is pretty straight forward but what if performance is a critical factor?
I need a way to compile (in runtime) a string with a expression into something that ... | So really you want to parse the string into (eventually) a typed delegate.
One option, then it to parse the string into an `Expression`, which you can then compile to a lambda. This is quite complex, but I have some code that will do much of this - but there may be existing parsers that already do the job in full.
As... |
380,442 | <p>Let's say I have some pointers called:</p>
<pre><code>char * pChar;
int * pInt;
</code></pre>
<p>I know they both simply hold memory addresses that point to some other location, and that the types declare how big the memory location is pointed to by the particular pointer. So for example, a char might be the size ... | [
{
"answer_id": 380447,
"author": "avp",
"author_id": 20514,
"author_profile": "https://Stackoverflow.com/users/20514",
"pm_score": 4,
"selected": true,
"text": "<p>\"++\" is just another name for X = X + 1;</p>\n\n<p>For pointers it doesn't matter if you increment by 1 or by N.\nAnyway, ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380442",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29482/"
] | Let's say I have some pointers called:
```
char * pChar;
int * pInt;
```
I know they both simply hold memory addresses that point to some other location, and that the types declare how big the memory location is pointed to by the particular pointer. So for example, a char might be the size of a byte on a system, whi... | "++" is just another name for X = X + 1;
For pointers it doesn't matter if you increment by 1 or by N.
Anyway, sizeof(type)\*N is used. In the case of 1 it will be just sizeof(type).
So, when you increment by 2 (your second case):
for char is 2\*sizeof(char)=2\*1=2 bytes,
for int will be 2\*sizeof(int)=2\*4=8 b... |
380,451 | <p>I'm getting the error below when trying to loop through a listbox and then remove the item.</p>
<blockquote>
<p>List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change.</p>
</blockquote>
<pre><code>foreach (string s in listBox1.Items)
{
MessageBox.S... | [
{
"answer_id": 380461,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": false,
"text": "<p>Do you want to remove all items? If so, do the <code>foreach</code> first, then just use <code>Items.Clear()</cod... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380451",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm getting the error below when trying to loop through a listbox and then remove the item.
>
> List that this enumerator is bound to has been modified. An enumerator can only be used if the list does not change.
>
>
>
```
foreach (string s in listBox1.Items)
{
MessageBox.Show(s);
//do stuff with (s);
... | Do you want to remove all items? If so, do the `foreach` first, then just use `Items.Clear()` to remove all of them afterwards.
Otherwise, perhaps loop backwards by indexer:
```
listBox1.BeginUpdate();
try {
for(int i = listBox1.Items.Count - 1; i >= 0 ; i--) {
// do with listBox1.Items[i]
listBox1.Items.R... |
380,458 | <p>One of the most common dilemmas I have when commenting code is how to mark-up argument names. I'll explain what I mean:</p>
<pre><code>def foo(vector, widht, n=0):
""" Transmogrify vector to fit into width. No more than n
elements will be transmogrified at a time
"""
</code></pre>
<p>Now, my problem wit... | [
{
"answer_id": 380474,
"author": "reuben",
"author_id": 41646,
"author_profile": "https://Stackoverflow.com/users/41646",
"pm_score": 3,
"selected": true,
"text": "<p>I personally prefer single quotes--your first example. It seems closest to how certain titles / named entities can be re... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380458",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8206/"
] | One of the most common dilemmas I have when commenting code is how to mark-up argument names. I'll explain what I mean:
```
def foo(vector, widht, n=0):
""" Transmogrify vector to fit into width. No more than n
elements will be transmogrified at a time
"""
```
Now, my problem with this is that the argumen... | I personally prefer single quotes--your first example. It seems closest to how certain titles / named entities can be referenced in English text when neither underlining nor italics are available. |
380,482 | <p>I'm writing a search & replace function in a kind of spreadsheet program. What I want is that if you search for a string, the program shows a table with the element that has been found.</p>
<p>So far so good, but I cannot get the element to obtain the focus, with the cursor in it so you can immediately start ty... | [
{
"answer_id": 380577,
"author": "Peter",
"author_id": 26483,
"author_profile": "https://Stackoverflow.com/users/26483",
"pm_score": 0,
"selected": false,
"text": "<p>Did you try the editcellat without the requestfocus ?</p>\n\n<p>also make sure that you override/implemenet to return tru... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26387/"
] | I'm writing a search & replace function in a kind of spreadsheet program. What I want is that if you search for a string, the program shows a table with the element that has been found.
So far so good, but I cannot get the element to obtain the focus, with the cursor in it so you can immediately start typing.
I'm usi... | With some googling i found a forum thread : [programmatically start editing a cell in a JTable](http://coding.derkeiler.com/Archive/Java/comp.lang.java.gui/2006-06/msg00188.html) answered with following idea:
(in a subclass of JTable)
```
editCellAt(row,column);
requestFocus();
DefaultCellEditor ed = (DefaultCellEdi... |
380,507 | <p>I am adding a custom background for my UINavigationBar. It works fine as long as the phone is in portrait mode. As soon as I switch to landscape mode, half the bar appears blue (the default navbar color) and half of it has my image</p>
<p>How can I stretch the image for landscape mode and make it small again for po... | [
{
"answer_id": 381067,
"author": "Ben Gottlieb",
"author_id": 6694,
"author_profile": "https://Stackoverflow.com/users/6694",
"pm_score": 3,
"selected": true,
"text": "<p>You probably need to set the autoresizingMask of your background image view; try using <code>UIViewAutoresizingFlexib... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380507",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46297/"
] | I am adding a custom background for my UINavigationBar. It works fine as long as the phone is in portrait mode. As soon as I switch to landscape mode, half the bar appears blue (the default navbar color) and half of it has my image
How can I stretch the image for landscape mode and make it small again for portrait mod... | You probably need to set the autoresizingMask of your background image view; try using `UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight` |
380,509 | <p>I'm writing Add-inn Application A in VB.Net and DLL B in C language.
Application A pass callback method to dll B.
When certain event occur the dll invoke the callback from A.
Whole works fine on my PC but when I move it to Notebook I get an error:</p>
<p><em>Run-Time Check Failure #0 - The value of ESP was not pro... | [
{
"answer_id": 380526,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 0,
"selected": false,
"text": "<p>Do the two computers have different pointer sizes perhaps? Maybe one is a 64 bit machine and the other only 32?<... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380509",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm writing Add-inn Application A in VB.Net and DLL B in C language.
Application A pass callback method to dll B.
When certain event occur the dll invoke the callback from A.
Whole works fine on my PC but when I move it to Notebook I get an error:
*Run-Time Check Failure #0 - The value of ESP was not properly saved a... | If the calling convention is `cdecl`, then you need to declare your delegate like this:
```
<UnmanagedFunctionPointer(CallingConvention.Cdecl)>
Public Delegate Sub P_Fun()
```
You can only do this in .NET 2.0 and after, as the attribute was not introduced before then (and the interop layer was not changed to acknowl... |
380,529 | <pre><code>#include<iostream>
using namespace std;
class A
{
int a;
int b;
public:
void eat()
{
cout<<"A::eat()"<<endl;
}
};
class B: public A
{
public:
void eat()
{
cout<<"B::eat()"<<endl;
}
};
class C: public A
{
public:
void eat()
... | [
{
"answer_id": 380542,
"author": "1800 INFORMATION",
"author_id": 3146,
"author_profile": "https://Stackoverflow.com/users/3146",
"pm_score": 2,
"selected": false,
"text": "<p>Use a cast - <code>static_cast</code> is required here to cast up the heirarchy.</p>\n\n<pre><code>main()\n{\n ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39615/"
] | ```
#include<iostream>
using namespace std;
class A
{
int a;
int b;
public:
void eat()
{
cout<<"A::eat()"<<endl;
}
};
class B: public A
{
public:
void eat()
{
cout<<"B::eat()"<<endl;
}
};
class C: public A
{
public:
void eat()
{
cout<<"C::eat()"<<endl;
... | Inheriting twice
----------------
With double inheritance you have an ambiguity - the compiler cannot know which of the two A bases do you want to use. If you want to have two A bases (sometimes you may want to do this), you may select between them by casting to B or C. The most appropriate from default casts here is ... |
380,549 | <p>I have the following project solution:</p>
<ul>
<li><p>There is a ASP.NET MVC Web
Application where I have a SQL
database (mdf file) in the App_Data directory.</p></li>
<li><p>There is a class library where I
have some migrations from
<a href="http://code.google.com/p/migratordotnet/" rel="nofollow noreferrer">migr... | [
{
"answer_id": 380560,
"author": "Ken Yao",
"author_id": 42356,
"author_profile": "https://Stackoverflow.com/users/42356",
"pm_score": 2,
"selected": true,
"text": "<p>One icon for user account, another icon is for group account. </p>\n"
},
{
"answer_id": 4347442,
"author": "... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3713/"
] | I have the following project solution:
* There is a ASP.NET MVC Web
Application where I have a SQL
database (mdf file) in the App\_Data directory.
* There is a class library where I
have some migrations from
[migratordotnet](http://code.google.com/p/migratordotnet/). In my build file I
have to specify where the SQL
da... | One icon for user account, another icon is for group account. |
380,568 | <p>I'm working on a project that has a rich object model with various sets of aggregate roots. </p>
<p>We're using the <strong>Castle</strong> stack (Monorail through to nHibernate with ActiveRecord).</p>
<p>We have marked the aggregate roots as lazy <code>[ActiveRecord(Lazy = true)]</code> and have customized 'eager... | [
{
"answer_id": 382043,
"author": "user47393",
"author_id": 47393,
"author_profile": "https://Stackoverflow.com/users/47393",
"pm_score": 1,
"selected": false,
"text": "<p>Do an \"inner join fetch\" on the Account.Order.Product entity. So instead of something like this (which is what you... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380568",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32027/"
] | I'm working on a project that has a rich object model with various sets of aggregate roots.
We're using the **Castle** stack (Monorail through to nHibernate with ActiveRecord).
We have marked the aggregate roots as lazy `[ActiveRecord(Lazy = true)]` and have customized 'eager' routines on our Repository to eager fet... | Why do you want the eager behavior?
All of the Relationship attributes in ActiveRecord have a 'Lazy=' parameter to tell ActiveRecord to lazy load the related object. All except BelongsTo. BelongsTo checks if the dependent object has Lazy=true in its ActiveRecord attribute and then creates a proxy for the object instea... |
380,570 | <p>This is nice thing you have done. Could you please explain: How to use PhotoLibrary's CameraController without jailbreak. Actually I 've downloaded class-dump and tried dumping PhotoLibrary but did not work out well. It is giving: </p>
<pre><code>/*
* Generated by class-dump 3.1.2.
*
* class-dump is Copy... | [
{
"answer_id": 382043,
"author": "user47393",
"author_id": 47393,
"author_profile": "https://Stackoverflow.com/users/47393",
"pm_score": 1,
"selected": false,
"text": "<p>Do an \"inner join fetch\" on the Account.Order.Product entity. So instead of something like this (which is what you... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This is nice thing you have done. Could you please explain: How to use PhotoLibrary's CameraController without jailbreak. Actually I 've downloaded class-dump and tried dumping PhotoLibrary but did not work out well. It is giving:
```
/*
* Generated by class-dump 3.1.2.
*
* class-dump is Copyright (C) 1997... | Why do you want the eager behavior?
All of the Relationship attributes in ActiveRecord have a 'Lazy=' parameter to tell ActiveRecord to lazy load the related object. All except BelongsTo. BelongsTo checks if the dependent object has Lazy=true in its ActiveRecord attribute and then creates a proxy for the object instea... |
380,588 | <p>Suppose you store instances of a class in a relational table. How would you go about persisting a static attribute of that class? For example:</p>
<pre><code>class WebSiteUser {
private static $common_homepage_content;
private $username;
private $password_hash;
...
}
</code></pre>
<p>Corresponding ... | [
{
"answer_id": 380605,
"author": "Raminder",
"author_id": 25125,
"author_profile": "https://Stackoverflow.com/users/25125",
"pm_score": 2,
"selected": false,
"text": "<p>As static variables make sense for a class but not on the instance level it can't go inside the table that has instanc... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380588",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6430/"
] | Suppose you store instances of a class in a relational table. How would you go about persisting a static attribute of that class? For example:
```
class WebSiteUser {
private static $common_homepage_content;
private $username;
private $password_hash;
...
}
```
Corresponding to:
```
CREATE TABLE web_... | Well, if the variable you want to persist is just `static` I must assume that there are going to be many users (`WebSiteUser`) with the same `$common_homepage_content`. In this case, you should create a new table in the db just for this attribute because it's a 1->N relation. |
380,595 | <p>I need an equivalent to c++'s <code>std::multimap<K, V, Comp, Alloc></code> in C-sharp. Does it exist in the standard library?</p>
| [
{
"answer_id": 380601,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 7,
"selected": true,
"text": "<p>Because it's almost christmas :)</p>\n\n<pre><code>/////////////////////////////////////////////////////////////////... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380595",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/148909/"
] | I need an equivalent to c++'s `std::multimap<K, V, Comp, Alloc>` in C-sharp. Does it exist in the standard library? | Because it's almost christmas :)
```
//////////////////////////////////////////////////////////////////////
// Algorithmia is (c) 2008 Solutions Design. All rights reserved.
// http://www.sd.nl
//////////////////////////////////////////////////////////////////////
// COPYRIGHTS:
// Copyright (c) 2008 Solutions Design.... |
380,603 | <p>That is, all text and subtags, without the tag of an element itself?</p>
<p>Having</p>
<pre><code><p>blah <b>bleh</b> blih</p>
</code></pre>
<p>I want </p>
<pre><code>blah <b>bleh</b> blih
</code></pre>
<p>element.text returns "blah " and etree.tostring(element) returns:</p>
... | [
{
"answer_id": 380717,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 4,
"selected": false,
"text": "<p>ElementTree works perfectly, you have to assemble the answer yourself. Something like this...</p>\n\n<pre><code>\"\".jo... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6068/"
] | That is, all text and subtags, without the tag of an element itself?
Having
```
<p>blah <b>bleh</b> blih</p>
```
I want
```
blah <b>bleh</b> blih
```
element.text returns "blah " and etree.tostring(element) returns:
```
<p>blah <b>bleh</b> blih</p>
``` | This is the solution I ended up using:
```
def element_to_string(element):
s = element.text or ""
for sub_element in element:
s += etree.tostring(sub_element)
s += element.tail
return s
``` |
380,608 | <p>I have a repeater control with a check box, if I check the box then my delete functionality will delete an item in the underlying table.</p>
<p>When I test the delete functionality on an aspx page with a code behind page, everything works fine. Hooray!</p>
<p>However, when I take the repeater and put it into a Use... | [
{
"answer_id": 380648,
"author": "John_",
"author_id": 26081,
"author_profile": "https://Stackoverflow.com/users/26081",
"pm_score": 0,
"selected": false,
"text": "<p>So it binds to the repeater and displays all the items correctly but when repeating through the list of items on postback... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a repeater control with a check box, if I check the box then my delete functionality will delete an item in the underlying table.
When I test the delete functionality on an aspx page with a code behind page, everything works fine. Hooray!
However, when I take the repeater and put it into a User Control, the de... | I think the problem is that when the delete button is clicked the Page\_Load is fired again and since its a postback it does not execute the ItemsGet method and hence the repeater does not have the data.
Try putting the ItemsGet method call in the OnPreRender event instead of Page\_Load.
Jomit |
380,626 | <p>I am parsing XML file. In this file there is one tag containing date string <code>"2008-11-10T05:51:33Z"</code> and I want convert this string in to <code>java.util.Date object.</code></p>
<p>How can this be done?</p>
| [
{
"answer_id": 380633,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>Use <a href=\"http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html\" rel=\"nofollow noreferrer\">java.text... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380626",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25778/"
] | I am parsing XML file. In this file there is one tag containing date string `"2008-11-10T05:51:33Z"` and I want convert this string in to `java.util.Date object.`
How can this be done? | Use [java.text.DateFormat](http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html) - or more likely, [SimpleDateFormat](http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html).
Alternatively, go for [Joda Time](http://joda-time.sourceforge.net/) with its infinitely better API. Be careful with t... |
380,628 | <p>I’ve just found out that the execution plan performance between the following two select statements are massively different:</p>
<pre><code>select * from your_large_table
where LEFT(some_string_field, 4) = '2505'
select * from your_large_table
where some_string_field like '2505%'
</code></pre>
<p>The execution pl... | [
{
"answer_id": 380640,
"author": "Dan Sydner",
"author_id": 43988,
"author_profile": "https://Stackoverflow.com/users/43988",
"pm_score": 3,
"selected": false,
"text": "<p>There's a huge impact on using function calls in where clauses as SQL Server must calculate the result for each row.... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5884/"
] | I’ve just found out that the execution plan performance between the following two select statements are massively different:
```
select * from your_large_table
where LEFT(some_string_field, 4) = '2505'
select * from your_large_table
where some_string_field like '2505%'
```
The execution plans are 98% and 2% respect... | More generally speaking, you should never use a function on the LEFT side of a WHERE clause in a query. If you do, SQL won't use an index--it has to evaluate the function for every row of the table. The goal is to make sure that your where clause is "[Sargable](http://en.wikipedia.org/wiki/Sargable)"
Some other exampl... |
380,632 | <p>I am doing the following statements in Java,</p>
<pre><code>Obj t[] = new Obj[10];
Obj a = new Obj("a");
t[0] = a;
a = new Obj("b");
t[1] = a;
</code></pre>
<p>Why in java, when i access t[0] , it returns me "a", rather than "b"?
Is this because of the GC? and can i believe it is safe to do such an operation</p>... | [
{
"answer_id": 380644,
"author": "Vinze",
"author_id": 26859,
"author_profile": "https://Stackoverflow.com/users/26859",
"pm_score": 1,
"selected": false,
"text": "<p>When you do t[0] = a; you assign the address of object you created by new Object(\"a\") in the array, whatever you re-use... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am doing the following statements in Java,
```
Obj t[] = new Obj[10];
Obj a = new Obj("a");
t[0] = a;
a = new Obj("b");
t[1] = a;
```
Why in java, when i access t[0] , it returns me "a", rather than "b"?
Is this because of the GC? and can i believe it is safe to do such an operation | Here's exactly what's happening.
```
Obj t[] = new Obj[10]; // 1
Obj a = new Obj("a"); // 2
t[0] = a;
a = new Obj("b"); // 3
t[1] = a; // 4
```
1. You create an array that can hold 10 references to instances of `Obj`. Call this `obj01`. You assign it to `t`. Note that the variable `t` and th... |
380,639 | <p>I need your expertise once again. I have a java class that searches a directory for xml files (displays the files it finds in the eclipse console window), applies the specified xslt to these and sends the output to a directory.</p>
<p>What I want to do now is create an xml containing the file names and file format ... | [
{
"answer_id": 380652,
"author": "Vinze",
"author_id": 26859,
"author_profile": "https://Stackoverflow.com/users/26859",
"pm_score": 0,
"selected": false,
"text": "<p>Well just use a StringBuilder :</p>\n\n<pre><code>StringBuilder builder = new StringBuilder();\nfor(File f : files) {\n ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380639",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44649/"
] | I need your expertise once again. I have a java class that searches a directory for xml files (displays the files it finds in the eclipse console window), applies the specified xslt to these and sends the output to a directory.
What I want to do now is create an xml containing the file names and file format types. The... | Have a look at DOM and ECS. The following example was adapted to you requirements from [here](https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-1044810.html#):
```
XMLDocument document = new XMLDocument();
for (File f : files) {
document.addElement( new XML("file")
.addX... |
380,658 | <p>I have created an asp.net website that connects to a SQL server database. Currently on my development machine I have the connection set to a SQL server express database with the file residing in the App_Data file of the website.</p>
<p>I now need to upload the site to my host of which I have an SQL server database ... | [
{
"answer_id": 380661,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 2,
"selected": false,
"text": "<pre><code>Server=mssql.mydomain.com;uid=user_id_goes_here;pwd=password_goes_here\n</code></pre>\n"
},
{
"answer_id": ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380658",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have created an asp.net website that connects to a SQL server database. Currently on my development machine I have the connection set to a SQL server express database with the file residing in the App\_Data file of the website.
I now need to upload the site to my host of which I have an SQL server database set up. T... | ```
Server=mssql.mydomain.com;uid=user_id_goes_here;pwd=password_goes_here
``` |
380,660 | <p>Stuggling a little bit with the RegEx, I've got 4 codes in a string</p>
<p>CODE4:CODE3:CODE2:CODE1</p>
<p>each code is optional apart from CODE1</p>
<p>So I could have ab:bc:de:fg</p>
<p>or</p>
<p>bc::fg</p>
<p>of </p>
<p>ab:::fg</p>
<p>In each case of the above CODE1 = fg dnd for the dear life of me I can't... | [
{
"answer_id": 380682,
"author": "Gareth",
"author_id": 31582,
"author_profile": "https://Stackoverflow.com/users/31582",
"pm_score": 3,
"selected": true,
"text": "<p>There's no need to use a regular expression here.</p>\n\n<p>I don't know what language you're using, but split the string... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32336/"
] | Stuggling a little bit with the RegEx, I've got 4 codes in a string
CODE4:CODE3:CODE2:CODE1
each code is optional apart from CODE1
So I could have ab:bc:de:fg
or
bc::fg
of
ab:::fg
In each case of the above CODE1 = fg dnd for the dear life of me I can't work out the RegEX
Would be easy to do as a standard stri... | There's no need to use a regular expression here.
I don't know what language you're using, but split the string on ':' and you'll have an array of codes.
If you really just want to validate whether a string is valid for this then
```
/(\w*:){0,3}\w+/
```
matches your description and the few examples you've given. |
380,665 | <p>I am looking at nServiceBus and came over this interface</p>
<pre><code>namespace NServiceBus
{
public interface IMessage
{
}
}
</code></pre>
<p>What is the use of an empty interface?</p>
| [
{
"answer_id": 380677,
"author": "Filip Ekberg",
"author_id": 39106,
"author_profile": "https://Stackoverflow.com/users/39106",
"pm_score": 0,
"selected": false,
"text": "<p>I'd say its used for \"future\" reference or if you want to share some objects, meaning you could have 10 classes ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380665",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29519/"
] | I am looking at nServiceBus and came over this interface
```
namespace NServiceBus
{
public interface IMessage
{
}
}
```
What is the use of an empty interface? | Usually it's to signal usage of a class. You can implement IMessage to signal that your class is a message. Other code can then use reflection to see if your objects are meant to be used as messages and act accordingly.
This is something that was used in Java a lot before they had annotations. In .Net it's cleaner to ... |
380,694 | <p>anyone able to tell me how often a materialized view is set to refresh with the following setting plz?</p>
<p>REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT (round(sysdate) + 1/24) + 1</p>
<p>i think i read it as every hour but i'm not sure</p>
| [
{
"answer_id": 380711,
"author": "tuinstoel",
"author_id": 43901,
"author_profile": "https://Stackoverflow.com/users/43901",
"pm_score": 4,
"selected": true,
"text": "<pre><code>SQL> alter session set nls_date_format = 'yyyy-mm-dd :hh24:mi:ss';\n\nSession changed.\n\nSQL> select sy... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380694",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21180/"
] | anyone able to tell me how often a materialized view is set to refresh with the following setting plz?
REFRESH FORCE ON DEMAND START WITH sysdate+0 NEXT (round(sysdate) + 1/24) + 1
i think i read it as every hour but i'm not sure | ```
SQL> alter session set nls_date_format = 'yyyy-mm-dd :hh24:mi:ss';
Session changed.
SQL> select sysdate from dual;
SYSDATE
--------------------
2008-12-19 :12:18:28
SQL> select (round(sysdate) + 1/24) + 1 from dual;
(ROUND(SYSDATE)+1/24
--------------------
2008-12-21 :01:00:00
``` |
380,708 | <p>Closed as exact duplicate of <a href="https://stackoverflow.com/questions/145856">this question</a>.</p>
<p>I have an array/list of elements. I want to convert it to a string, separated by a custom delimitator. For example:</p>
<pre><code>[1,2,3,4,5] => "1,2,3,4,5"
</code></pre>
<p>What's the shortest/esiest w... | [
{
"answer_id": 380712,
"author": "mmx",
"author_id": 33708,
"author_profile": "https://Stackoverflow.com/users/33708",
"pm_score": 8,
"selected": true,
"text": "<pre><code>String.Join(\",\", arr.Select(p=>p.ToString()).ToArray())\n</code></pre>\n"
},
{
"answer_id": 380715,
... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380708",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23824/"
] | Closed as exact duplicate of [this question](https://stackoverflow.com/questions/145856).
I have an array/list of elements. I want to convert it to a string, separated by a custom delimitator. For example:
```
[1,2,3,4,5] => "1,2,3,4,5"
```
What's the shortest/esiest way to do this in c#?
I have always done this b... | ```
String.Join(",", arr.Select(p=>p.ToString()).ToArray())
``` |
380,709 | <p>I am working with a generic data structure, say <code>MyGeneric<Type></code>.
There is a case where I have to iterate over all the values it holds </p>
<p>The code I am trying to do.</p>
<pre><code>for ( all the keys in myGeneric ) {
// do lot of stuff here
}
</code></pre>
<p>Now the generic can hold b... | [
{
"answer_id": 380723,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": true,
"text": "<p>Well, you could use the Linq <code>OfType<T></code> method, and multiple loops?</p>\n\n<pre><code>foreach(Foo... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380709",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41968/"
] | I am working with a generic data structure, say `MyGeneric<Type>`.
There is a case where I have to iterate over all the values it holds
The code I am trying to do.
```
for ( all the keys in myGeneric ) {
// do lot of stuff here
}
```
Now the generic can hold base type as double and string and it can hold some... | Well, you could use the Linq `OfType<T>` method, and multiple loops?
```
foreach(Foo foo in list.OfType<Foo>()) {
//
}
foreach(Bar bar in list.OfType<Bar>()) {
//
}
```
Beyond that, you're into conditional statements. I did look at this [here](https://stackoverflow.com/questions/156467/switch-pattern-matching-id... |
380,720 | <p>In the following code doesn't work as </p>
<pre><code>public void Foo()
{
CompanyDataContext db = new CompanyDataContext();
Client client = (select c from db.Clients ....).Single();
Bar(client);
}
public void Bar(Client client)
{
CompanyDataContext db = new CompanyDataContext();
db.Client.Attach(cli... | [
{
"answer_id": 380753,
"author": "AndreasN",
"author_id": 24821,
"author_profile": "https://Stackoverflow.com/users/24821",
"pm_score": 0,
"selected": false,
"text": "<p>I've created data access classes that encapsulate all the communication with Linq2Sql.\nThese classes have their own d... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] | In the following code doesn't work as
```
public void Foo()
{
CompanyDataContext db = new CompanyDataContext();
Client client = (select c from db.Clients ....).Single();
Bar(client);
}
public void Bar(Client client)
{
CompanyDataContext db = new CompanyDataContext();
db.Client.Attach(client);
clien... | The [PLINQO](http://plinqo.com) framework generates detach for all entities making it easy to detach and reattach objects without receiving that error.
```
public void Foo()
{
CompanyDataContext db = new CompanyDataContext();
Client client = (select c from db.Clients ....).Single();
// makes it possible to ca... |
380,734 | <p>I have nested dictionaries:</p>
<pre><code>{'key0': {'attrs': {'entity': 'p', 'hash': '34nj3h43b4n3', 'id': '4130'},
u'key1': {'attrs': {'entity': 'r',
'hash': '34njasd3h43b4n3',
'id': '4130-1'},
u'key2': {'attrs': {'entity': '... | [
{
"answer_id": 380759,
"author": "e-satis",
"author_id": 9951,
"author_profile": "https://Stackoverflow.com/users/9951",
"pm_score": 0,
"selected": false,
"text": "<p>Well, if you have to do it only a few times, you can just use nested dict.iteritems() to find what you are looking for.</... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380734",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33612/"
] | I have nested dictionaries:
```
{'key0': {'attrs': {'entity': 'p', 'hash': '34nj3h43b4n3', 'id': '4130'},
u'key1': {'attrs': {'entity': 'r',
'hash': '34njasd3h43b4n3',
'id': '4130-1'},
u'key2': {'attrs': {'entity': 'c',
... | Your structure is unpleasantly irregular. Here's a version with a **Visitor** function that traverses the `attrs` sub-dictionaries.
```
def walkDict( aDict, visitor, path=() ):
for k in aDict:
if k == 'attrs':
visitor( path, aDict[k] )
elif type(aDict[k]) != dict:
pass
... |
380,755 | <p>What do you guys think about this for a generic singleton?</p>
<pre><code>using System;
using System.Reflection;
// Use like this
/*
public class Highlander : Singleton<Highlander>
{
private Highlander()
{
Console.WriteLine("There can be only one...");
}
}
*/
public class Singleton<T&... | [
{
"answer_id": 380761,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "<p>Well, it isn't really singleton - since you can't control <code>T</code>, there can be as many <code>T</code> inst... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380755",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5884/"
] | What do you guys think about this for a generic singleton?
```
using System;
using System.Reflection;
// Use like this
/*
public class Highlander : Singleton<Highlander>
{
private Highlander()
{
Console.WriteLine("There can be only one...");
}
}
*/
public class Singleton<T> where T : class
{
... | Creating a singleton class is just a few lines of code, and with the difficulty of making a generic singleton i always write those lines of code.
```
public class Singleton
{
private Singleton() {}
static Singleton() {}
private static Singleton _instance = new Singleton();
public static Singleton Insta... |
380,772 | <p>I have been trying for quite a while to figure out how to encrypt Application blocks that are stored in an external file called dev_entlib.config</p>
<p>I can see in entlib (4.1) that it's possible to use the default protection providers to encrypt the blocks but, I really need to deploy this Application on differe... | [
{
"answer_id": 491337,
"author": "nialljsmith",
"author_id": 5197,
"author_profile": "https://Stackoverflow.com/users/5197",
"pm_score": 0,
"selected": false,
"text": "<p>It doesn't seem to be possible yet. My solution is to just encrypt the blocks as part of the web.config and then cop... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380772",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5197/"
] | I have been trying for quite a while to figure out how to encrypt Application blocks that are stored in an external file called dev\_entlib.config
I can see in entlib (4.1) that it's possible to use the default protection providers to encrypt the blocks but, I really need to deploy this Application on different server... | Encrypt external Enterprise Library configuration files with your custom RSA key container using the Enterprise Library Configuration tool.
-------------------------------------------------------------------------------------------------------------------------------------------
* EntLib (4.1) uses the default protect... |
380,773 | <p>I have a situation in which I parse a body of text and replace certain phrases with links. I then need to re-parse the string to replace a second set of phrases with links. The problem arises at this point, where certain words or phrases in the second set can be substrings of phrases already replaced in the first pa... | [
{
"answer_id": 380844,
"author": "PEZ",
"author_id": 44639,
"author_profile": "https://Stackoverflow.com/users/44639",
"pm_score": 1,
"selected": false,
"text": "<p>This might work for all passes:</p>\n\n<pre><code>$string = preg_replace('/([^>]|^)grand canyon\\b/','$1<a href=#>... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a situation in which I parse a body of text and replace certain phrases with links. I then need to re-parse the string to replace a second set of phrases with links. The problem arises at this point, where certain words or phrases in the second set can be substrings of phrases already replaced in the first pass.... | This might work for all passes:
```
$string = preg_replace('/([^>]|^)grand canyon\b/','$1<a href=#>grand canyon</a>',$string);
```
EDIT: assuming you can afford missing when the text contains stuff like "amazonas>grand canyon" |
380,775 | <p>I have an NHibernate Dao..lets call it MyClassDao for want of a better name.</p>
<p>I am writing the following code.</p>
<pre><code>MyClassDao myDao = new MyClassDao();
var values = myDao.GetByCriteria(Restrictions.Eq("Status", someStatusValue));
</code></pre>
<p>I am using this in a Unit Test to pull back value... | [
{
"answer_id": 380786,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "<p>Use ICriteria.SetMaxResults()</p>\n"
},
{
"answer_id": 380788,
"author": "Darin Dimitrov",
"author_id"... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39532/"
] | I have an NHibernate Dao..lets call it MyClassDao for want of a better name.
I am writing the following code.
```
MyClassDao myDao = new MyClassDao();
var values = myDao.GetByCriteria(Restrictions.Eq("Status", someStatusValue));
```
I am using this in a Unit Test to pull back values from the database. However, it ... | Use ICriteria.SetMaxResults() |
380,792 | <p>I have multiple controller actions that takes an id</p>
<pre><code>public ActionResult Get(int? id) {
...
}
public ActionResult Delete(int id) {
...
}
public JsonResult GetJson(int? id) {
...
}
</code></pre>
<p>I'm thinking its best practice to use a ModelBinder (SomeObjectFromIDModelBinder) on each action, so t... | [
{
"answer_id": 380816,
"author": "tuinstoel",
"author_id": 43901,
"author_profile": "https://Stackoverflow.com/users/43901",
"pm_score": 1,
"selected": false,
"text": "<p>Two cons.</p>\n\n<ol>\n<li><p>Data manipulation with C# or VB.net becomes harder because you don't have classes with ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380792",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5556/"
] | I have multiple controller actions that takes an id
```
public ActionResult Get(int? id) {
...
}
public ActionResult Delete(int id) {
...
}
public JsonResult GetJson(int? id) {
...
}
```
I'm thinking its best practice to use a ModelBinder (SomeObjectFromIDModelBinder) on each action, so the obtaining of the object... | We have done something like this. And it works for very simple pages. But as soon as you would like to include some client side javascript and similar, you are doomed.
The generated output is hidden in the XSLT stylesheets and it is very hard to read, maintain and fix bugs.
Testing can be done, but also with much mo... |
380,804 | <p>We use Sharepoint as CMS for our webpages at work. I know how to create controls that can be only visible if you have logged in in SharePoint with:</p>
<p><Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server" PermissionsString="AddAndCustomizePages">&... | [
{
"answer_id": 381673,
"author": "strongopinions",
"author_id": 47517,
"author_profile": "https://Stackoverflow.com/users/47517",
"pm_score": 3,
"selected": true,
"text": "<p>How are the users authenticated? With forms authentication or Windows/active directory?</p>\n\n<p>If active direc... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380804",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31791/"
] | We use Sharepoint as CMS for our webpages at work. I know how to create controls that can be only visible if you have logged in in SharePoint with:
<Sharepoint:SPSecurityTrimmedControl ID="SPSecurityTrimmedControl1" runat="server" PermissionsString="AddAndCustomizePages"><br />
<Sharepoint:CssLink ID="CssLink1" run... | How are the users authenticated? With forms authentication or Windows/active directory?
If active directory, then I think in that case you might need to get a reference to the current SPWeb, and then do web.CurrentUser.ID. This might come out null when you are anonymous. If not, try web.SiteUsers.GetByID(web.CurrentUs... |
380,813 | <p>Upcasting is allowed in Java, however downcasting gives a compile error. </p>
<p>The compile error can be removed by adding a cast but would anyway break at the runtime. </p>
<p>In this case why Java allows downcasting if it cannot be executed at the runtime?<br>
Is there any practical use for this concept? </p>
... | [
{
"answer_id": 380828,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 9,
"selected": true,
"text": "<p>Downcasting is allowed when there is a possibility that it succeeds at run time:</p>\n\n<pre><code>Object o = getS... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40933/"
] | Upcasting is allowed in Java, however downcasting gives a compile error.
The compile error can be removed by adding a cast but would anyway break at the runtime.
In this case why Java allows downcasting if it cannot be executed at the runtime?
Is there any practical use for this concept?
```
public class demo ... | Downcasting is allowed when there is a possibility that it succeeds at run time:
```
Object o = getSomeObject(),
String s = (String) o; // this is allowed because o could reference a String
```
In some cases this will not succeed:
```
Object o = new Object();
String s = (String) o; // this will fail at runtime, bec... |
380,817 | <p>Suppose you have a file that contains IP addresses, one address in each line:</p>
<pre><code>10.0.10.1
10.0.10.1
10.0.10.3
10.0.10.2
10.0.10.1
</code></pre>
<p>You need a shell script that counts for each IP address how many times it appears in the file. For the previous input you need the following output:</p>
<... | [
{
"answer_id": 380824,
"author": "Francois Wolmarans",
"author_id": 47755,
"author_profile": "https://Stackoverflow.com/users/47755",
"pm_score": 6,
"selected": false,
"text": "<p>The quick and dirty method is as follows:</p>\n\n<p><code>cat ip_addresses | sort -n | uniq -c</code></p>\n\... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/686/"
] | Suppose you have a file that contains IP addresses, one address in each line:
```
10.0.10.1
10.0.10.1
10.0.10.3
10.0.10.2
10.0.10.1
```
You need a shell script that counts for each IP address how many times it appears in the file. For the previous input you need the following output:
```
10.0.10.1 3
10.0.10.2 1
10.... | ```
sort ip_addresses | uniq -c
```
This will print the count first, but other than that it should be exactly what you want. |
380,846 | <p>I am using Dojo 1.2 to implement some functionality on my customer's webpage. One of the widgets I use is the <code>dijit.layout.TabContainer</code>, which inherits <code>StackContainer</code>. The <code>StackContainer</code> subscribes on keyboard events and creates a few hotkeys, like arrow left to move one tab to... | [
{
"answer_id": 561439,
"author": "Heath Borders",
"author_id": 9636,
"author_profile": "https://Stackoverflow.com/users/9636",
"pm_score": 0,
"selected": false,
"text": "<p>I'm just coding off the cuff here, and I didn't test it out at all. I'm making this wikified, so post the correct ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380846",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3999/"
] | I am using Dojo 1.2 to implement some functionality on my customer's webpage. One of the widgets I use is the `dijit.layout.TabContainer`, which inherits `StackContainer`. The `StackContainer` subscribes on keyboard events and creates a few hotkeys, like arrow left to move one tab to the left and so on.
Now to the que... | Simply override \_onKeyPress with an empty body:
```
<div dojoType='dijit.layout.TabContainer'>
<script type='dojo/method' event='_onKeyPress'></script>
...
<div>
```
Works like a charm. |
380,850 | <p>I am trying to port a WebForms app to Silverlight, this application is using the GDI Graphics class to draw polygons to a in-memory bitmap, it will then do pixel by pixel comparisons so I need access to the pixel buffer.</p>
<p>Example:</p>
<pre>
Graphics g = Graphics.FromImage(bmp);
g.FillClosedCurve(brus... | [
{
"answer_id": 380877,
"author": "Bill Reiss",
"author_id": 18967,
"author_profile": "https://Stackoverflow.com/users/18967",
"pm_score": 2,
"selected": false,
"text": "<p>If you write a polygon rendering algorithm for Silverlight, it would have to be all managed code, I haven't seen any... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380850",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24425/"
] | I am trying to port a WebForms app to Silverlight, this application is using the GDI Graphics class to draw polygons to a in-memory bitmap, it will then do pixel by pixel comparisons so I need access to the pixel buffer.
Example:
```
Graphics g = Graphics.FromImage(bmp);
g.FillClosedCurve(brush, points, Fill... | If you write a polygon rendering algorithm for Silverlight, it would have to be all managed code, I haven't seen any examples of this, but if you write one let me know, I've been looking for something like the for XNA.
Silverlight 3 should be adding some of the things you need to make this a lot easier like rendering... |
380,855 | <p>What is the correct syntax to create objects in javascript that will work across the majority of web browsers (by that I mean : IE 6+, Firefox 2+, Opera 9+ )</p>
<p>Is this valid</p>
<pre><code>var a = {
"class": "Person",
"name": "William Shakespeare",
"birthday": -12802392000000,
"nickname": "Bill"
};
</... | [
{
"answer_id": 380860,
"author": "AndreasN",
"author_id": 24821,
"author_profile": "https://Stackoverflow.com/users/24821",
"pm_score": 3,
"selected": false,
"text": "<p>The <a href=\"http://www.json.org/\" rel=\"noreferrer\">spec</a> say to use \"\".</p>\n\n<p>Firefox accept without, bu... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380855",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32582/"
] | What is the correct syntax to create objects in javascript that will work across the majority of web browsers (by that I mean : IE 6+, Firefox 2+, Opera 9+ )
Is this valid
```
var a = {
"class": "Person",
"name": "William Shakespeare",
"birthday": -12802392000000,
"nickname": "Bill"
};
```
Or is this:
```
... | [@AndreasN is correct](https://stackoverflow.com/questions/380855/json-syntax-for-property-names#380860): the [JSON specification](http://www.json.org/) dictates the use of quotes in order for it to actually be JSON. If you don't use quotes, it may be a valid object literal in Javascript, but it is not JSON. Other serv... |
380,870 | <p>Is there a Pythonic way to have only one instance of a program running? </p>
<p>The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this? ... | [
{
"answer_id": 380876,
"author": "Joachim Sauer",
"author_id": 40342,
"author_profile": "https://Stackoverflow.com/users/40342",
"pm_score": 5,
"selected": false,
"text": "<p>I don't know if it's pythonic enough, but in the Java world listening on a defined port is a pretty widely used s... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37141/"
] | Is there a Pythonic way to have only one instance of a program running?
The only reasonable solution I've come up with is trying to run it as a server on some port, then second program trying to bind to same port - fails. But it's not really a great idea, maybe there's something more lightweight than this?
(Take in... | The following code should do the job, it is cross-platform and runs on Python 2.4-3.2. I tested it on Windows, OS X and Linux.
```
from tendo import singleton
me = singleton.SingleInstance() # will sys.exit(-1) if other instance is running
```
The latest code version is available [singleton.py](https://github.com/py... |
380,875 | <p>It seems like more and more OS X apps these days are doing all kinds of fancy drawing stuff for custom controls. Apps like Twitterific, Things, EventBox, Versions just to name a few....</p>
<p>So basically I'm looking for any information on how to get started doing this kind of thing. Not sure if it is just done by... | [
{
"answer_id": 380888,
"author": "Abizern",
"author_id": 41116,
"author_profile": "https://Stackoverflow.com/users/41116",
"pm_score": 2,
"selected": false,
"text": "<p>Have a look at some excellent example code: <a href=\"http://www.bitbucket.org/bwalkin/bwtoolkit/\" rel=\"nofollow nore... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47761/"
] | It seems like more and more OS X apps these days are doing all kinds of fancy drawing stuff for custom controls. Apps like Twitterific, Things, EventBox, Versions just to name a few....
So basically I'm looking for any information on how to get started doing this kind of thing. Not sure if it is just done by subclassi... | It depends entirely on what you want to do.
The "Show Raw Properties" button in Versions for instance is an NSButton subclass, because basically what we needed is standard button behavior with our own look. One way to subclass a button is to simply implement your own -drawRect:(NSRect)rect method in the NSButton subc... |
380,885 | <p>One for the mathematicians. This has gone around the office and we want to see who can come up with a better optimised version.</p>
<pre><code>(((a+p) <= b) && (a == 0 || a > 1) && (b >= p)) &&
((b - (a + p) == 0) || (b - (a + p) > 1))
</code></pre>
<p><strong>Edit</strong>: ... | [
{
"answer_id": 380896,
"author": "Filip Ekberg",
"author_id": 39106,
"author_profile": "https://Stackoverflow.com/users/39106",
"pm_score": 2,
"selected": false,
"text": "<p>I wouldnt do all math in that expression. Such as b - ( a + p ) is evaluated twice. If possible, split them into v... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380885",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17540/"
] | One for the mathematicians. This has gone around the office and we want to see who can come up with a better optimised version.
```
(((a+p) <= b) && (a == 0 || a > 1) && (b >= p)) &&
((b - (a + p) == 0) || (b - (a + p) > 1))
```
**Edit**: all data is positive int's
**Edit**: Better == simpler | ```
(a + p <= b) && (a != 1) && (b - a - p != 1);
``` |
380,889 | <p>Below is a stored procedure to check if there is a duplicate entry in the database based upon checking all the fields individually (don't ask why I should do this, it just has to be this way). </p>
<p>It sounds perfectly straightforward but the SP fails.
The problem is that some parameters passed into the SP may ha... | [
{
"answer_id": 380902,
"author": "n8wrl",
"author_id": 37710,
"author_profile": "https://Stackoverflow.com/users/37710",
"pm_score": 4,
"selected": true,
"text": "<p>I think you need something like this for each possibly-null parameter:</p>\n\n<pre><code>AND (aCode = @aCode OR (aCode IS ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Below is a stored procedure to check if there is a duplicate entry in the database based upon checking all the fields individually (don't ask why I should do this, it just has to be this way).
It sounds perfectly straightforward but the SP fails.
The problem is that some parameters passed into the SP may have a null ... | I think you need something like this for each possibly-null parameter:
```
AND (aCode = @aCode OR (aCode IS NULL AND @aCode IS NULL))
``` |
380,911 | <p>I'm parsing big XML file with XPathExpression selection for some nodes existing at various depth levels.</p>
<p>What is the easiest way to export selected nodes to separate XML file, preserving all direct-ancestors nodes (and their attributes)? C# is preferred.</p>
<p>Example source XML :</p>
<pre><code><a>... | [
{
"answer_id": 380955,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "<pre><code>string xml = @\"<xml>\n <a>\n <x/>\n <b>\n <c/>\n <z/>\n </... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7162/"
] | I'm parsing big XML file with XPathExpression selection for some nodes existing at various depth levels.
What is the easiest way to export selected nodes to separate XML file, preserving all direct-ancestors nodes (and their attributes)? C# is preferred.
Example source XML :
```
<a>
<x>
<b>
<c/>
<z/>
<... | ```
string xml = @"<xml>
<a>
<x/>
<b>
<c/>
<z/>
</b>
<c/>
</a>
<c/>
<d><e/></d></xml>";
XmlDocument doc = new XmlDocument();
doc.LoadXml(xml);
XmlDocument results = new XmlDocument();
XmlNode root = results.AppendChild(results.CreateElement("xml"));
foreach (XmlNode node in doc.Sele... |
380,917 | <p>Our Flex app automatically resizes with the browser window, we've addressed a whole bunch of scaling issues quite easily but one that remains is tooltips. They show in the wrong location on screen, not being scaled properly based on the window size. Since tooltips are positioned automatically, how can we address thi... | [
{
"answer_id": 382961,
"author": "cliff.meyers",
"author_id": 41754,
"author_profile": "https://Stackoverflow.com/users/41754",
"pm_score": 0,
"selected": false,
"text": "<p>I don't think there is a great solution to this problem since the <code>ToolTipManager</code> is not aware of when... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13220/"
] | Our Flex app automatically resizes with the browser window, we've addressed a whole bunch of scaling issues quite easily but one that remains is tooltips. They show in the wrong location on screen, not being scaled properly based on the window size. Since tooltips are positioned automatically, how can we address this?
... | Not sure if you found a solution to this one, but there's a simpler approach. This code hooks into the tooltip-show event, during the capture phase (before it displays), to scale and position it appropriately based on the scale of the containing element -- in "this" case, the `parentApplication` document. It also inclu... |
380,921 | <p>I've got a question about renaming a file after it's been uploaded in Zend. I don't know where to put the Rename Filter. Here's what I've got. I've tried moving things around, but I'm lost. Currently it does upload the file to my photos folder, but it doesn't rename it. Thanks for any help!</p>
<pre><code>if($this-... | [
{
"answer_id": 450025,
"author": "stunti",
"author_id": 54949,
"author_profile": "https://Stackoverflow.com/users/54949",
"pm_score": 1,
"selected": false,
"text": "<p>According to the documentation, you should not put the path in the destination</p>\n\n<p><a href=\"http://framework.zend... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38241/"
] | I've got a question about renaming a file after it's been uploaded in Zend. I don't know where to put the Rename Filter. Here's what I've got. I've tried moving things around, but I'm lost. Currently it does upload the file to my photos folder, but it doesn't rename it. Thanks for any help!
```
if($this->_request->isP... | Actually, there is an even easier way to do this. All you need to do is pass false as the second parameter for the getFileName method of the Zend\_File\_Transfer\_Adapter\_Http object. Then you can rename the file by appending a userID to it or parse the file name to get the extension out if you like as well.
```
// u... |
380,952 | <p>I have a method <code>fetchObjects(String)</code> that is expected to return an array of <code>Contract</code> business objects. The <code>className</code> parameter tells me what kind of business objects I should return (of course this doesn't make sense in this construed case because I already said I will return <... | [
{
"answer_id": 380972,
"author": "Dennis C",
"author_id": 40214,
"author_profile": "https://Stackoverflow.com/users/40214",
"pm_score": 4,
"selected": true,
"text": "<p>You may use the class as the parameter rather then the class name.</p>\n\n<pre><code> static <T extends Contract&g... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45018/"
] | I have a method `fetchObjects(String)` that is expected to return an array of `Contract` business objects. The `className` parameter tells me what kind of business objects I should return (of course this doesn't make sense in this construed case because I already said I will return `Contract`s, but it's basically the s... | You may use the class as the parameter rather then the class name.
```
static <T extends Contract> T[] buildArray(Class<T> clazz){
ArrayList<T> l=new ArrayList<T>();
return l.toArray((T[]) java.lang.reflect.Array.newInstance(clazz, l.size()));
}
```
EDIT: (after read Yang comment)
No, You cannot use... |
380,962 | <p>I am new to unittesting and currently have a problem with finding a decent way to test methods that contain branches. </p>
<p>I created a small demo method I hope could be used to explain the problem.</p>
<pre><code>public void ExportAccounts()
{
int emptyAccounts = 0;
int nonEmptyAccounts = 0;
int ... | [
{
"answer_id": 380972,
"author": "Dennis C",
"author_id": 40214,
"author_profile": "https://Stackoverflow.com/users/40214",
"pm_score": 4,
"selected": true,
"text": "<p>You may use the class as the parameter rather then the class name.</p>\n\n<pre><code> static <T extends Contract&g... | 2008/12/19 | [
"https://Stackoverflow.com/questions/380962",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] | I am new to unittesting and currently have a problem with finding a decent way to test methods that contain branches.
I created a small demo method I hope could be used to explain the problem.
```
public void ExportAccounts()
{
int emptyAccounts = 0;
int nonEmptyAccounts = 0;
int errorous = 0;
st... | You may use the class as the parameter rather then the class name.
```
static <T extends Contract> T[] buildArray(Class<T> clazz){
ArrayList<T> l=new ArrayList<T>();
return l.toArray((T[]) java.lang.reflect.Array.newInstance(clazz, l.size()));
}
```
EDIT: (after read Yang comment)
No, You cannot use... |
381,007 | <p>I am trying to loop on a recordset returned from db2 using a .wsf file and vbscript .</p>
<p>the vbscript libfile(lib.vbs) is as follows</p>
<pre><code>'***************
Const ADOCon="Provider=IBMDADB2.1;Password=*****;User ID=*****;Data Source=yourdatasourc;"
'************************
'ADO environment is Initi... | [
{
"answer_id": 381028,
"author": "user25623",
"author_id": 25623,
"author_profile": "https://Stackoverflow.com/users/25623",
"pm_score": 2,
"selected": false,
"text": "<p>Check out the <a href=\"http://www.asp.net/ajax/ajaxcontroltoolkit/samples/CascadingDropDown/CascadingDropDown.aspx\"... | 2008/12/19 | [
"https://Stackoverflow.com/questions/381007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43180/"
] | I am trying to loop on a recordset returned from db2 using a .wsf file and vbscript .
the vbscript libfile(lib.vbs) is as follows
```
'***************
Const ADOCon="Provider=IBMDADB2.1;Password=*****;User ID=*****;Data Source=yourdatasourc;"
'************************
'ADO environment is Initialised here
'******... | Check out the [CascadingDropDown Control](http://www.asp.net/ajax/ajaxcontroltoolkit/samples/CascadingDropDown/CascadingDropDown.aspx). It's part of the ASP.NET Ajax Control Toolkit. |
381,008 | <p>I have a new ASP.NET MVC project (my first), and I had been running fine with 1 controller, view, and model. After I added a new controller and view, my first view started throwing this error message when I try to run the project:</p>
<p>Description: An error occurred during the parsing of a resource required to se... | [
{
"answer_id": 381048,
"author": "Trevor de Koekkoek",
"author_id": 41783,
"author_profile": "https://Stackoverflow.com/users/41783",
"pm_score": 4,
"selected": true,
"text": "<p>I've had this happen before. Can't explain it. I ended up rebuilding the first view by creating it again an... | 2008/12/19 | [
"https://Stackoverflow.com/questions/381008",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1284/"
] | I have a new ASP.NET MVC project (my first), and I had been running fine with 1 controller, view, and model. After I added a new controller and view, my first view started throwing this error message when I try to run the project:
Description: An error occurred during the parsing of a resource required to service this... | I've had this happen before. Can't explain it. I ended up rebuilding the first view by creating it again and copying and pasting the markup. Also try shutting down VS and restarting. |
381,016 | <p>am having trouble with visible attribute of an asp.net panel. Basically I have a page that calls a database table and returns the results in a detailsview. However, some of the values that are returned are null and if so I need to hide the image thats next to it. </p>
<p>I am using a panel to determine whether to h... | [
{
"answer_id": 381035,
"author": "Greg Dean",
"author_id": 1200558,
"author_profile": "https://Stackoverflow.com/users/1200558",
"pm_score": 2,
"selected": false,
"text": "<p>I hate Databinding (for many reason, including this), Whenever I have an overly complex expression to bind to. ... | 2008/12/19 | [
"https://Stackoverflow.com/questions/381016",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | am having trouble with visible attribute of an asp.net panel. Basically I have a page that calls a database table and returns the results in a detailsview. However, some of the values that are returned are null and if so I need to hide the image thats next to it.
I am using a panel to determine whether to hide or sho... | Your syntax says VB.NET, but you're compiler says C# (the CS\* compiler error). Since I trust your compiler more:
```
Visible='<%# Eval("addr1") != DBNull.Value %>'
``` |
381,017 | <p>This one has been stumping me for a while. But I'm no expert. This is a bit long...</p>
<p>I have a WinForms app with an Outlook style UI. That it to say there is a bar on the left hand pane that allows you to select a 'screen' which is a WinForms control, say the customer screen, and on the right hand pane ther... | [
{
"answer_id": 570513,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>I'm currently attempting to implement an identical scenario in our WinForms SmartClient app.</p>\n\n<p>Did you come to a go... | 2008/12/19 | [
"https://Stackoverflow.com/questions/381017",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29411/"
] | This one has been stumping me for a while. But I'm no expert. This is a bit long...
I have a WinForms app with an Outlook style UI. That it to say there is a bar on the left hand pane that allows you to select a 'screen' which is a WinForms control, say the customer screen, and on the right hand pane there will appear... | I'm going to restate your problem to make sure I've understood it.
You have a widget which presents a list of entities (the LIST). When you click an item in the LIST, another widget appears which allows the user to edit the entity. When the user has finished editing the entity, their changes are committed to the DB, a... |
381,020 | <p>I have been working on standardizing the source control structure for our Team Foundation Server rollout for the new year. I have started by using the <a href="http://www.codeplex.com/BranchingGuidance" rel="noreferrer">Microsoft Team Foundation Server Branching Guidance</a> documentation available on CodePlex.</p>... | [
{
"answer_id": 381058,
"author": "Micah",
"author_id": 17744,
"author_profile": "https://Stackoverflow.com/users/17744",
"pm_score": 2,
"selected": false,
"text": "<p>Great layout and explanation. I've struggled with the exact same issues. I've wound up with a very similar structure. Min... | 2008/12/19 | [
"https://Stackoverflow.com/questions/381020",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15906/"
] | I have been working on standardizing the source control structure for our Team Foundation Server rollout for the new year. I have started by using the [Microsoft Team Foundation Server Branching Guidance](http://www.codeplex.com/BranchingGuidance) documentation available on CodePlex.
I was hoping to get some feedback ... | I like your idea of putting the Sandcastle files as a peer to Source and Tests, I would add a documentation folder, that would then contain the sandcastle files, and optionally the actual documentation.
There are definetly differences of opinions and I'm sure I will be downvoted for this (since I have been before). I ... |
381,049 | <p>From a <a href="https://stackoverflow.com/questions/29040/linq-to-sql-can-i-eager-load-only-one-field-in-a-joined-table">previous question</a>, I learn that Linq to SQL is not able to eager load only certain files of foreingKey tables.</p>
<p>So I'm asking what .net ORM can support including this type of statement ... | [
{
"answer_id": 381084,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": true,
"text": "<p>As part of a projection, LINQ-to-SQL should handle that - have you tried</p>\n\n<pre><code>select new {Order = orde... | 2008/12/19 | [
"https://Stackoverflow.com/questions/381049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2385/"
] | From a [previous question](https://stackoverflow.com/questions/29040/linq-to-sql-can-i-eager-load-only-one-field-in-a-joined-table), I learn that Linq to SQL is not able to eager load only certain files of foreingKey tables.
So I'm asking what .net ORM can support including this type of statement inside a entity class... | As part of a projection, LINQ-to-SQL should handle that - have you tried
```
select new {Order = order, ProductName = order.Product.Name,
CustomerName = order.Customer.Name,
OrderType = order.OrderType.Name } // etc
```
If you want those properties to become part of the object model itself.... |