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 |
|---|---|---|---|---|---|---|
438,260 | <p>I'm writing an app that supposed to copy a bunch of files from one place to another.
When I'm using TFileStream for the copy it is 3-4 times slower than copying the files with the OS.</p>
<p>I also tried to copy with a buffer, but that was too slow aswell.</p>
<p>I'm working under Win32, anyone got some insights o... | [
{
"answer_id": 438278,
"author": "Tony Lee",
"author_id": 5819,
"author_profile": "https://Stackoverflow.com/users/5819",
"pm_score": 2,
"selected": false,
"text": "<p>You can have Explorer do it for you via SHFileOperation() <a href=\"http://msdn.microsoft.com/en-us/library/bb762164(VS.... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25316/"
] | I'm writing an app that supposed to copy a bunch of files from one place to another.
When I'm using TFileStream for the copy it is 3-4 times slower than copying the files with the OS.
I also tried to copy with a buffer, but that was too slow aswell.
I'm working under Win32, anyone got some insights on this matter? | There are a few options.
1. You could call CopyFile which uses
the [CopyFileA](http://msdn.microsoft.com/en-us/library/aa363851(VS.85).aspx) windows API
* You could call the api which explorer uses (the windows api
[SHFileOperation](http://msdn.microsoft.com/en-us/library/bb762164(VS.85).aspx)). An example of
calli... |
438,312 | <p>I need to run a callable at a specific time of day. One way to do it is to calculate the timediff between now and the desired time , and to use the executor.scheduleAtFixedRate . </p>
<p>Have a better idea?</p>
<p><code>executor.scheduleAtFixedRate(command, TIMEDIFF(now,run_time), period, TimeUnit.SECONDS))</code>... | [
{
"answer_id": 438318,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 5,
"selected": true,
"text": "<p>For this kind of thing, just go ahead and install <a href=\"http://www.quartz-scheduler.org/\" rel=\"noreferrer\">Quartz<... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438312",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4038/"
] | I need to run a callable at a specific time of day. One way to do it is to calculate the timediff between now and the desired time , and to use the executor.scheduleAtFixedRate .
Have a better idea?
`executor.scheduleAtFixedRate(command, TIMEDIFF(now,run_time), period, TimeUnit.SECONDS))` | For this kind of thing, just go ahead and install [Quartz](http://www.quartz-scheduler.org/). EJB has some support for this kind of thing but really you just want Quartz for scheduled tasks.
That being said, if you insist on doing it yourself (and I'd recommend not), use the [`ScheduledThreadPoolExecutor`](http://java... |
438,321 | <p>I need a simple function which will take a FileInfo and a destination_directory_name as input, get the file path from the fileinfo and replicate it in the destination_directory_name passed as the second parameter.</p>
<p>for ex. filepath is "d:\recordings\location1\client1\job1\file1.ext
the function should create ... | [
{
"answer_id": 438328,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 6,
"selected": true,
"text": "<p>I'm using the following method for that purpose:</p>\n\n<pre><code>public static void CreateDirectory(DirectoryInfo director... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53270/"
] | I need a simple function which will take a FileInfo and a destination\_directory\_name as input, get the file path from the fileinfo and replicate it in the destination\_directory\_name passed as the second parameter.
for ex. filepath is "d:\recordings\location1\client1\job1\file1.ext
the function should create the di... | I'm using the following method for that purpose:
```
public static void CreateDirectory(DirectoryInfo directory)
{
if (!directory.Parent.Exists)
CreateDirectory(directory.Parent);
directory.Create();
}
```
Use it in this way:
```
// path is your file path
string directory = Path.GetDirectoryName(pat... |
438,325 | <p>We have taken over some .NET 1.1 Windows Service code that spawns threads to read messages off a queue (SeeBeyond eGate JMS queue, but that is not important) and in turn spawns threads to process the message in the target application service. We are continually encountering logic and design decisions that is puzzlin... | [
{
"answer_id": 438334,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": false,
"text": "<p>Edit: for clarification there is an <em>insane edge case</em> where you can get <code>null</code> from a class con... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2663/"
] | We have taken over some .NET 1.1 Windows Service code that spawns threads to read messages off a queue (SeeBeyond eGate JMS queue, but that is not important) and in turn spawns threads to process the message in the target application service. We are continually encountering logic and design decisions that is puzzling u... | In my opinion, what the `else` statement suggests is that the previous developers didn't know their C#. A constructor always returns a constructed object or throws an exception.
In the very old times, C++ constructors could return `null`, so maybe the problem comes from that. This is no longer true in C++ either, at l... |
438,332 | <p>Hallo,</p>
<p>i need to write some javascript that gets the contents of a userfield in a sharepoint-website. I can get most fields with the javascript-function 'getTagFromIdentifierAndTitle' of <a href="http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-manipulate-a-list-form-field.aspx... | [
{
"answer_id": 444500,
"author": "EG.",
"author_id": 36486,
"author_profile": "https://Stackoverflow.com/users/36486",
"pm_score": 2,
"selected": true,
"text": "<p>I traced how address book interacts with user field. To get values it uses function getUplevel(ctx) and to set values can be... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438332",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4531/"
] | Hallo,
i need to write some javascript that gets the contents of a userfield in a sharepoint-website. I can get most fields with the javascript-function 'getTagFromIdentifierAndTitle' of [Using Javascript to Manipulate a List Form Field](http://blogs.msdn.com/sharepointdesigner/archive/2007/06/13/using-javascript-to-m... | I traced how address book interacts with user field. To get values it uses function getUplevel(ctx) and to set values can be used function EntityEditorCallback(xml, ctx). First function will return html/xml mixed string with user information. Second function input must be special formatted xml string.
```
// Get value... |
438,335 | <p>Given I have a canvas that contains many shapes, lets say rectangles for now.</p>
<p>Each shape has a location (inches), size(inches) and rotation angle(degrees).</p>
<p>When a mouse click event happen inside the canvas for a location (x,y) in pixels.</p>
<p>I want to check if the clicked mouse position is inside... | [
{
"answer_id": 438445,
"author": "Hans Passant",
"author_id": 17034,
"author_profile": "https://Stackoverflow.com/users/17034",
"pm_score": 2,
"selected": false,
"text": "<p>Your question is awfully short on details, I can only provide a generic answer. Do it mathematically is the faste... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438335",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/225022/"
] | Given I have a canvas that contains many shapes, lets say rectangles for now.
Each shape has a location (inches), size(inches) and rotation angle(degrees).
When a mouse click event happen inside the canvas for a location (x,y) in pixels.
I want to check if the clicked mouse position is inside/within a specific shape... | I found the answer (I have to convert al measurements to pixels to make sure it will calculate correctly):
```
public static bool HitTest(Rectangle bounds, float angle, Point location)
{
if (angle == 0) return bounds.Contains(location);
using (Matrix matrix = new Matrix())
... |
438,336 | <p>I got an error today while trying to do some formatting to existing code. Originally, the code had the <code>using</code> directives declared outside the namespace:</p>
<pre><code>using System.Collections.Generic;
namespace MyNamespace
{
using IntPair = KeyValuePair<int, int>;
}
</code></pre>
<p>When I t... | [
{
"answer_id": 438344,
"author": "DavGarcia",
"author_id": 40161,
"author_profile": "https://Stackoverflow.com/users/40161",
"pm_score": 4,
"selected": true,
"text": "<p>I used to think that it did not matter, but I always fully qualify using commands.</p>\n\n<p>Edit: Checked the <a href... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41283/"
] | I got an error today while trying to do some formatting to existing code. Originally, the code had the `using` directives declared outside the namespace:
```
using System.Collections.Generic;
namespace MyNamespace
{
using IntPair = KeyValuePair<int, int>;
}
```
When I tried to insert the `using` directive inside... | I used to think that it did not matter, but I always fully qualify using commands.
Edit: Checked the [C# spec](http://msdn.microsoft.com/en-us/vcsharp/aa336809.aspx), section 9.4 says that:
>
> The scope of a using-directive specifically does not include its peer using-directives. Thus, peer using-directives do not ... |
438,360 | <p>My forms are losing session variables on shared hosting very quickly (webhost4life), and I think I want to replace them with cookies. Does the following look reasonable for tracking an ID from form to form:</p>
<pre><code>if(Request.Cookies["currentForm"] == null)
return;
projectID = new Guid(Request.Cookies["cu... | [
{
"answer_id": 438457,
"author": "DomBat",
"author_id": 54170,
"author_profile": "https://Stackoverflow.com/users/54170",
"pm_score": 2,
"selected": false,
"text": "<p>Before changing any code, I would investigate why session variables are disappearing.</p>\n\n<p>Perhaps it is as simple ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28343/"
] | My forms are losing session variables on shared hosting very quickly (webhost4life), and I think I want to replace them with cookies. Does the following look reasonable for tracking an ID from form to form:
```
if(Request.Cookies["currentForm"] == null)
return;
projectID = new Guid(Request.Cookies["currentForm"]["s... | Before changing any code, I would investigate why session variables are disappearing.
Perhaps it is as simple as changing the timeout setting in the web.config?
Here's a list of the session state settings in the config file: [Session Element on MSDN](http://msdn.microsoft.com/en-us/library/h6bb9cz9.aspx)
===========... |
438,381 | <p>I am using a tab bar (UITabBarController) on my app and I wish to customize the appearance of the table that appears when you click the more button.
I have worked out how to change the appearance of the Navigation bar that is on the more screen by setting </p>
<pre><code>self.moreNavigationController.navigationBar.... | [
{
"answer_id": 438514,
"author": "Stephan Burlot",
"author_id": 53071,
"author_profile": "https://Stackoverflow.com/users/53071",
"pm_score": 5,
"selected": true,
"text": "<p>visibleCells is populated only after the moreNavigationController is displayed.</p>\n\n<p>And the cells are creat... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53970/"
] | I am using a tab bar (UITabBarController) on my app and I wish to customize the appearance of the table that appears when you click the more button.
I have worked out how to change the appearance of the Navigation bar that is on the more screen by setting
```
self.moreNavigationController.navigationBar.barStyle
```
... | visibleCells is populated only after the moreNavigationController is displayed.
And the cells are created at runtime, so even if you change the content of the cells, they are replaced when they are displayed.
One thing to try would be to replace the datasource of the moreNavigationController tableView, call the cellF... |
438,386 | <p>I have a C# Web application built in Visual Studio 2008 where we rely heavily on user controls for 'pre-built' blocks of ASP.NET.</p>
<p>Instead of registering a big stack of user controls on each page, we register all the controls in a local (to a specific folder) web.config file. The advantage is that we can use ... | [
{
"answer_id": 441201,
"author": "Al W",
"author_id": 50011,
"author_profile": "https://Stackoverflow.com/users/50011",
"pm_score": 1,
"selected": false,
"text": "<p>It probably has to do with the fact that it isn't registered in the main web.config file. Test it out by putting one or t... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52891/"
] | I have a C# Web application built in Visual Studio 2008 where we rely heavily on user controls for 'pre-built' blocks of ASP.NET.
Instead of registering a big stack of user controls on each page, we register all the controls in a local (to a specific folder) web.config file. The advantage is that we can use the contro... | Whilst this doesn't work in a local Web.Config file you can use the Location tag in your root web.config file to achieve the same result.
For example:
```
<?xml version="1.0"?>
<configuration>
<location path="MyPath">
<system.web>
<pages>
<controls>
<add src... |
438,388 | <p>I've set up a one-to-many association in NHibernate:</p>
<pre><code>Parent (1 -> ∞) Child
</code></pre>
<p>The problem I now face is that when I set Child.Parent, the Parent.Children collection doesn't automatically contain the new Child. Similarly, when I add a Child to the Parent.Children collection, the Chi... | [
{
"answer_id": 438449,
"author": "sirrocco",
"author_id": 5246,
"author_profile": "https://Stackoverflow.com/users/5246",
"pm_score": 0,
"selected": false,
"text": "<p>When you set Child.Parent, you also have to add the Child to the Parent.Children, NHibernate (.net for that matter) can'... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438388",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2700/"
] | I've set up a one-to-many association in NHibernate:
```
Parent (1 -> ∞) Child
```
The problem I now face is that when I set Child.Parent, the Parent.Children collection doesn't automatically contain the new Child. Similarly, when I add a Child to the Parent.Children collection, the Child.Parent property is still nu... | Do you really want to have this behavior ? Is it really necessary ?
I always make my 'Parent' reference readonly with an internal setter, and I also do not expose the Children collection of the parent as a regular collection.
My Parent has a AddChild method, which adds the child to the collection, and sets the Parent ... |
438,397 | <p>Can a Java Applet able to print out text/html easily to standard printer driver(s) (with all common platforms Win/Mac/Linux)?</p>
<p>Does it need to be signed?</p>
| [
{
"answer_id": 438511,
"author": "grom",
"author_id": 486,
"author_profile": "https://Stackoverflow.com/users/486",
"pm_score": 5,
"selected": true,
"text": "<p>To print you will either need to use <a href=\"http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html\" r... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20979/"
] | Can a Java Applet able to print out text/html easily to standard printer driver(s) (with all common platforms Win/Mac/Linux)?
Does it need to be signed? | To print you will either need to use [Signed Applets](http://java.sun.com/developer/onlineTraining/Programming/JDCBook/signed.html) or if an unsigned applet tries to print, the user will be prompted to ask whether to allow permission.
Here is some sample code for printing HTML using JEditorPane:
```
public class HTML... |
438,401 | <p>Suppose I have a function definiton:</p>
<pre><code>def test():
print 'hi'
</code></pre>
<p>I get a TypeError whenever I gives an argument.</p>
<p>Now, I want to put the def statement in try. How do I do this?</p>
| [
{
"answer_id": 438409,
"author": "hasen",
"author_id": 35364,
"author_profile": "https://Stackoverflow.com/users/35364",
"pm_score": 3,
"selected": false,
"text": "<pre><code>try: \n test()\nexcept TypeError:\n print \"error\"\n</code></pre>\n"
},
{
"answer_id": 438421,
... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438401",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46646/"
] | Suppose I have a function definiton:
```
def test():
print 'hi'
```
I get a TypeError whenever I gives an argument.
Now, I want to put the def statement in try. How do I do this? | ```
try:
test()
except TypeError:
print "error"
``` |
438,413 | <p>I was wondering whether search engines respect the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14" rel="nofollow noreferrer">HTTP header field <code>Content-Location</code></a>.</p>
<p>This could be useful, for example, when you want to remove the session ID argument out of the URL:</p>
<... | [
{
"answer_id": 438451,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 1,
"selected": false,
"text": "<p>Most decent crawlers do follow Content-Location. So, yes, search engines respect the Content-Location header, alt... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53114/"
] | I was wondering whether search engines respect the [HTTP header field `Content-Location`](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.14).
This could be useful, for example, when you want to remove the session ID argument out of the URL:
```
GET /foo/bar?sid=0123456789 HTTP/1.1
Host: example.com
…
H... | I think Google just announced the answer to my question: [the `canonical` link relation for declaring the canonical URL](http://googlewebmastercentral.blogspot.com/2009/02/specify-your-canonical.html).
[Maile Ohye](http://www.google.com/s2/profiles/112810134285899618775) from Google wrote:
>
>
> >
> > MickeyC said... |
438,431 | <p>e.g. in Winforms I'd write...</p>
<pre><code>// on UI Thread
BackgroundWorker workerThread = new BackgroundWorker();
workerThread.DoWork += new DoWorkEventHandler(LoadChildren);
workerThread.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnLoadChildrenCompleted);
while (workerThread.IsBusy... | [
{
"answer_id": 438440,
"author": "Sam Meldrum",
"author_id": 16005,
"author_profile": "https://Stackoverflow.com/users/16005",
"pm_score": 1,
"selected": false,
"text": "<p>Calling DoEvents on the UI thread in a loop like this is not recommended practice in WinForms or WPF.</p>\n\n<p>If ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438431",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695/"
] | e.g. in Winforms I'd write...
```
// on UI Thread
BackgroundWorker workerThread = new BackgroundWorker();
workerThread.DoWork += new DoWorkEventHandler(LoadChildren);
workerThread.RunWorkerCompleted += new RunWorkerCompletedEventHandler(OnLoadChildrenCompleted);
while (workerThread.IsBusy)
{
... | As I understand it, you've got this sort of flow:
* Do some prep work (UI thread)
* Do some background work (other thread)
* Do some finishing work (UI thread)
You want to wait for the second bullet to finish before running the code in the third.
The easiest way to do that is make the second bullet's code call back ... |
438,463 | <p>I have problem currently for my swing reminder application, which able to minimize to tray on close. My problem here is, I need JOptionPane dialog to pop up on time according to what I set, but problem here is, when I minimize it, the dialog will pop up, but not in the top of windows when other application like expl... | [
{
"answer_id": 438815,
"author": "Markus Lausberg",
"author_id": 39062,
"author_profile": "https://Stackoverflow.com/users/39062",
"pm_score": 2,
"selected": false,
"text": "<p>Windows is blocking this operation since XP.</p>\n\n<p>The scenario before was like:\nYour a tiping in some tex... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54519/"
] | I have problem currently for my swing reminder application, which able to minimize to tray on close. My problem here is, I need JOptionPane dialog to pop up on time according to what I set, but problem here is, when I minimize it, the dialog will pop up, but not in the top of windows when other application like explore... | Create an empty respectively dummy JFrame, set it always on top and use it as the component for the JOptionPane instead of null. So the JOptionPane remains always on top over all other windows of an application. You can also determine where the JOptionPane appears on screen with the location of the dummy JFrame.
```
J... |
438,477 | <p>I am running Sql Server Compact Edition 3.5.1.0 SP1 in a multi-thread application. The application randomly runs insert queries in transactions. With short transactions, it works fine. But when the transactions get longer and delay between executions get shorter or when I run the application in debug mode, SqlCE beg... | [
{
"answer_id": 447423,
"author": "Serhat Ozgel",
"author_id": 31505,
"author_profile": "https://Stackoverflow.com/users/31505",
"pm_score": 4,
"selected": true,
"text": "<p>Just because you set a connection to command.Connection does not mean it is set.</p>\n\n<pre><code>command.Connecti... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438477",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31505/"
] | I am running Sql Server Compact Edition 3.5.1.0 SP1 in a multi-thread application. The application randomly runs insert queries in transactions. With short transactions, it works fine. But when the transactions get longer and delay between executions get shorter or when I run the application in debug mode, SqlCE begins... | Just because you set a connection to command.Connection does not mean it is set.
```
command.Connection = connection;
command.Connection.GetHashCode() == connection.GetHashCode(); // may return false.
```
This is the cause of the problem. Can be corrected by using connection.CreateCommand(); |
438,486 | <pre><code><td valign="top">
<input type="hidden" name="MAX_FILE_SIZE" value="12485760" />
Image?</td>
<td><input type="file" name="image">
$path = "uploads/";
$path .= basename($_FILES['image']['name']);
$path = addslashes($path);
$name = $_FILES['image']['name'];
echo $path;
move_upl... | [
{
"answer_id": 438494,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 4,
"selected": true,
"text": "<p>Make sure you have the attribute <code>enctype=\"multipart/form-data\"</code> on your <code><form></code> tag.</p>\n"... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31677/"
] | ```
<td valign="top">
<input type="hidden" name="MAX_FILE_SIZE" value="12485760" />
Image?</td>
<td><input type="file" name="image">
$path = "uploads/";
$path .= basename($_FILES['image']['name']);
$path = addslashes($path);
$name = $_FILES['image']['name'];
echo $path;
move_uploaded_file($_FILES['image']['tmp_name... | Make sure you have the attribute `enctype="multipart/form-data"` on your `<form>` tag. |
438,515 | <p>How can I track the memory allocations in C++, especially those done by <code>new</code>/<code>delete</code>. For an object, I can easily override the <code>operator new</code>, but I'm not sure how to globally override all allocations so they go through my custom <code>new</code>/<code>delete</code>. This should be... | [
{
"answer_id": 438531,
"author": "gimpf",
"author_id": 15529,
"author_profile": "https://Stackoverflow.com/users/15529",
"pm_score": 1,
"selected": false,
"text": "<p>Not directly answering your question, but if you really just want to get a list of leaked heap-objects at the end of the ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39912/"
] | How can I track the memory allocations in C++, especially those done by `new`/`delete`. For an object, I can easily override the `operator new`, but I'm not sure how to globally override all allocations so they go through my custom `new`/`delete`. This should be not a big problem, but I'm not sure how this is supposed ... | I would recommend you to use `valgrind` for linux. It will catch not freed memory, among other bugs like writing to unallocated memory. Another option is mudflap, which tells you about not freed memory too. Use `-fmudflap -lmudflap` options with gcc, then start your program with `MUDFLAP_OPTIONS=-print-leaks ./my_progr... |
438,538 | <p>This isn't quite as straight forward as one may think. I'm using a plugin called <a href="http://abeautifulsite.net/notebook.php?article=62" rel="nofollow noreferrer" title="jQuery MultiSelect">jQuery MultiSelect</a> and multiple <select> options using XSLT as follows:</p>
<pre><code><xsl:for-each select=&... | [
{
"answer_id": 438562,
"author": "Robert MacLean",
"author_id": 53236,
"author_profile": "https://Stackoverflow.com/users/53236",
"pm_score": 2,
"selected": false,
"text": "<p>Sounds like a Halloween problem (<a href=\"http://blogs.msdn.com/mikechampion/archive/2006/07/20/672208.aspx\" r... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438538",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39693/"
] | This isn't quite as straight forward as one may think. I'm using a plugin called [jQuery MultiSelect](http://abeautifulsite.net/notebook.php?article=62 "jQuery MultiSelect") and multiple <select> options using XSLT as follows:
```
<xsl:for-each select="RootField">
<select id="{RootField}" multiple="multiple" size="3... | I'd not heard the 'Halloween problem' tag before, but Robert may be correct.
The nodelist returned from getElementsByTagName is dynamic i.e. adding or removing, in this case selects, will change the nodelist after it has been created.
try
```
//hoping for magic here
$('select').multiSelect();
```
or
```
$('sele... |
438,540 | <p>From <a href="http://projecteuler.net/" rel="nofollow noreferrer">ProjectEuler.net</a>:</p>
<p><strong>Prob 76: How many different ways can one hundred be written as a sum of at least two positive integers?</strong></p>
<p>I have no idea how to start this...any points in the right direction or help? I'm not lookin... | [
{
"answer_id": 438569,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>A good way to approach these is not get fixated on the '100' but try to consider what the difference between totalling... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438540",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51518/"
] | From [ProjectEuler.net](http://projecteuler.net/):
**Prob 76: How many different ways can one hundred be written as a sum of at least two positive integers?**
I have no idea how to start this...any points in the right direction or help? I'm not looking for how to do it but some **hints** on how to do it.
For example... | [Partition Numbers](http://mathworld.wolfram.com/PartitionFunctionP.html) (or Partition Functions) are the key to this one.
Problems like these are usually easier if you start at the bottom and work your way up to see if you can detect any patterns.
* P(1) = 1 = {[1](http://mathworld.wolfram.com/PartitionFunctionP.ht... |
438,547 | <p>I'm using oracle(10).</p>
<p>I've got two tables as follows:</p>
<pre><code>Table1 (uniq rows):
ID AMOUNT DATE
Table2:
ID AMOUNT1 AMOUNT2 ...AMOUNTN DATE
</code></pre>
<p>Table2 is connected many to one to Table1 connected via ID.</p>
<p>What I need is update-ing Table1.DATE with: the last (earliest)... | [
{
"answer_id": 438595,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 3,
"selected": true,
"text": "<p>Based on your revised question, this is a case for using analytic functions.</p>\n\n<p>Assuming you meant >=100 rat... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438547",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11621/"
] | I'm using oracle(10).
I've got two tables as follows:
```
Table1 (uniq rows):
ID AMOUNT DATE
Table2:
ID AMOUNT1 AMOUNT2 ...AMOUNTN DATE
```
Table2 is connected many to one to Table1 connected via ID.
What I need is update-ing Table1.DATE with: the last (earliest) date from Table2 where Table1.AMOUNT - ... | Based on your revised question, this is a case for using analytic functions.
Assuming you meant >=100 rather than <= 100 as your example implies, and renaming columns DATE to THEDATE since DATE is a reserved word in Oracle:
```
update table1 set thedate=
( select max(thedate) from
( select id, thedate,
s... |
438,556 | <p><strong>Hi All,</strong></p>
<p>I'm designing a user control, briefly it contains an asp:hiddenfield control, i'm going to access it via JavaScript function like this</p>
<pre><code>function doAnyThing
{
var myVar = document.getElementById("myHiddenFiled");
}
</code></pre>
<p>but when I trace my code I found ... | [
{
"answer_id": 438568,
"author": "tanathos",
"author_id": 51295,
"author_profile": "https://Stackoverflow.com/users/51295",
"pm_score": 4,
"selected": true,
"text": "<p>You had to set by ClientID the final id of your control, that will depend by the structure of your page.\nTry this:</p>... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32718/"
] | **Hi All,**
I'm designing a user control, briefly it contains an asp:hiddenfield control, i'm going to access it via JavaScript function like this
```
function doAnyThing
{
var myVar = document.getElementById("myHiddenFiled");
}
```
but when I trace my code I found myVar assigned to null, does it matter
```
d... | You had to set by ClientID the final id of your control, that will depend by the structure of your page.
Try this:
```
function doAnyThing
{
var myVar = document.getElementById("<%= yourControlServerID.ClientID %>");
}
```
Obviously this function need to be placed in the .aspx file. I suggest you to switch to us... |
438,558 | <p>I have tried using the obvious method as outlined in the following example but my passed variable (<em>rootcategory</em>) is still <strong>nil</strong> on viewDidLoad in the loaded view.</p>
<p>This is my code:</p>
<pre><code>CategoryViewController *viewController = [[CategoryViewController alloc] initWithNibName:... | [
{
"answer_id": 438604,
"author": "Andy Bourassa",
"author_id": 44858,
"author_profile": "https://Stackoverflow.com/users/44858",
"pm_score": 0,
"selected": false,
"text": "<p>What does your header file for CategoryViewController look like? Did you define rootCategory as a property? Is ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/258/"
] | I have tried using the obvious method as outlined in the following example but my passed variable (*rootcategory*) is still **nil** on viewDidLoad in the loaded view.
This is my code:
```
CategoryViewController *viewController = [[CategoryViewController alloc] initWithNibName:@"CategoryViewController" bundle:[NSBundl... | You are allocating viewController, and try to change self.categoryViewController before it is assigned to viewController.
```
CategoryViewController *viewController = [[CategoryViewController alloc] initWithNibName:@"CategoryViewController" bundle:[NSBundle mainBundle]];
viewController.rootCategory = @"433";
self.cate... |
438,559 | <p>The beauty of ORM lulled me into a soporific sleep. I've got an existing Django app with a lack of database indexes. Is there a way to automatically generate a list of columns that need indexing?</p>
<p>I was thinking maybe some middleware that logs which columns are involved in WHERE clauses? but is there anything... | [
{
"answer_id": 438604,
"author": "Andy Bourassa",
"author_id": 44858,
"author_profile": "https://Stackoverflow.com/users/44858",
"pm_score": 0,
"selected": false,
"text": "<p>What does your header file for CategoryViewController look like? Did you define rootCategory as a property? Is ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438559",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45955/"
] | The beauty of ORM lulled me into a soporific sleep. I've got an existing Django app with a lack of database indexes. Is there a way to automatically generate a list of columns that need indexing?
I was thinking maybe some middleware that logs which columns are involved in WHERE clauses? but is there anything built int... | You are allocating viewController, and try to change self.categoryViewController before it is assigned to viewController.
```
CategoryViewController *viewController = [[CategoryViewController alloc] initWithNibName:@"CategoryViewController" bundle:[NSBundle mainBundle]];
viewController.rootCategory = @"433";
self.cate... |
438,565 | <p>I would like to add a path "images/" to all img tags in my html file. Is that possible and if how can I achive that?</p>
| [
{
"answer_id": 438604,
"author": "Andy Bourassa",
"author_id": 44858,
"author_profile": "https://Stackoverflow.com/users/44858",
"pm_score": 0,
"selected": false,
"text": "<p>What does your header file for CategoryViewController look like? Did you define rootCategory as a property? Is ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438565",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I would like to add a path "images/" to all img tags in my html file. Is that possible and if how can I achive that? | You are allocating viewController, and try to change self.categoryViewController before it is assigned to viewController.
```
CategoryViewController *viewController = [[CategoryViewController alloc] initWithNibName:@"CategoryViewController" bundle:[NSBundle mainBundle]];
viewController.rootCategory = @"433";
self.cate... |
438,566 | <p>I am working on Windows Server 2003 (IIS6), which has two asp.net sites running in seperate app pools. One of the sites has an ssl certificate installed and was running fine on https. The other site has no certificate and does not require https</p>
<p>The problem I have is that when I publish my app from vs2005 to ... | [
{
"answer_id": 438604,
"author": "Andy Bourassa",
"author_id": 44858,
"author_profile": "https://Stackoverflow.com/users/44858",
"pm_score": 0,
"selected": false,
"text": "<p>What does your header file for CategoryViewController look like? Did you define rootCategory as a property? Is ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438566",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12918/"
] | I am working on Windows Server 2003 (IIS6), which has two asp.net sites running in seperate app pools. One of the sites has an ssl certificate installed and was running fine on https. The other site has no certificate and does not require https
The problem I have is that when I publish my app from vs2005 to the site w... | You are allocating viewController, and try to change self.categoryViewController before it is assigned to viewController.
```
CategoryViewController *viewController = [[CategoryViewController alloc] initWithNibName:@"CategoryViewController" bundle:[NSBundle mainBundle]];
viewController.rootCategory = @"433";
self.cate... |
438,587 | <p>I have a <code>DataSet</code> populated from Excel Sheet. I wanted to use SQLBulk Copy to Insert Records in <code>Lead_Hdr</code> table where <code>LeadId</code> is PK. </p>
<p>I am having following error while executing the code below:</p>
<blockquote>
<p>The given ColumnMapping does not match up with any colum... | [
{
"answer_id": 438606,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 6,
"selected": true,
"text": "<p>Well, is it right? Do the column names exist on both sides?</p>\n\n<p>To be honest, I've never bothered with mappin... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438587",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a `DataSet` populated from Excel Sheet. I wanted to use SQLBulk Copy to Insert Records in `Lead_Hdr` table where `LeadId` is PK.
I am having following error while executing the code below:
>
> The given ColumnMapping does not match up with any column in the
> source or destination
>
>
>
```
string ConSt... | Well, is it right? Do the column names exist on both sides?
To be honest, I've never bothered with mappings. I like to keep things simple - I tend to have a staging table that looks like the input on the server, then I `SqlBulkCopy` into the staging table, and finally run a stored procedure to move the table from the ... |
438,594 | <p>I have a python program, which runs on the CPython implementation, and inside it I must call a function defined in a java program. How can I do this?</p>
<p>It would be nice to be able to use some java objects too.</p>
<p>Jython is not an option. I must run the python part in CPython.</p>
| [
{
"answer_id": 438643,
"author": "Marko",
"author_id": 31141,
"author_profile": "https://Stackoverflow.com/users/31141",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know for Python, but last time I had to call java from C application (NT service) I had to load <code>jvm.dll</co... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438594",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17160/"
] | I have a python program, which runs on the CPython implementation, and inside it I must call a function defined in a java program. How can I do this?
It would be nice to be able to use some java objects too.
Jython is not an option. I must run the python part in CPython. | The easiest thing to do is
1. Write a trivial CLI for your java "function". (There's no such thing, so I'll assume you actually mean a method function of a Java class.)
```
public class ExposeAMethod {
public static void main( String args[] ) {
TheClassToExpose x = new TheClassToExpose();
x.th... |
438,603 | <p>I encountered a strange problem today. Whenever i put a breakpoint in one of my js files, the breakpoint is not hit.</p>
<p>I use Visual Studio 2005 in combination with TFS.
In ie the disable script options are both disabled.</p>
<p>The only thing that changed is that I installed Visual Basic 6 for an old project... | [
{
"answer_id": 438643,
"author": "Marko",
"author_id": 31141,
"author_profile": "https://Stackoverflow.com/users/31141",
"pm_score": 1,
"selected": false,
"text": "<p>I don't know for Python, but last time I had to call java from C application (NT service) I had to load <code>jvm.dll</co... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54533/"
] | I encountered a strange problem today. Whenever i put a breakpoint in one of my js files, the breakpoint is not hit.
I use Visual Studio 2005 in combination with TFS.
In ie the disable script options are both disabled.
The only thing that changed is that I installed Visual Basic 6 for an old project, but I don't see... | The easiest thing to do is
1. Write a trivial CLI for your java "function". (There's no such thing, so I'll assume you actually mean a method function of a Java class.)
```
public class ExposeAMethod {
public static void main( String args[] ) {
TheClassToExpose x = new TheClassToExpose();
x.th... |
438,607 | <p>Suppose I have the following code:</p>
<pre><code>class siteMS
{
...
function __CONSTRUCT()
{
require 'config.php';
$this->config = new siteMSConfig;
...
}
...
}
</code></pre>
<p>From inside the siteMSConfig class can I determine weather or not it is being called ... | [
{
"answer_id": 438633,
"author": "Deniss Kozlovs",
"author_id": 53948,
"author_profile": "https://Stackoverflow.com/users/53948",
"pm_score": 0,
"selected": false,
"text": "<p>I guess you have to pass it with variable, from what place you called it</p>\n\n<pre><code>$this->config = ne... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438607",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/115/"
] | Suppose I have the following code:
```
class siteMS
{
...
function __CONSTRUCT()
{
require 'config.php';
$this->config = new siteMSConfig;
...
}
...
}
```
From inside the siteMSConfig class can I determine weather or not it is being called from inside the siteMS class? | Yes, but there's no "pretty" way to do it - you'll end up looking through a [backtrace](http://www.php.net/debug_backtrace) or something similar.
It would be better to pass an (optional?) parameter to the `siteMSConfig` constructor like this:
```
class siteMSConfig
{
public function __construct($inSiteMS = false)... |
438,610 | <p>How do I write a query that outputs the row number as a column? This is DB2 SQL on an iSeries.</p>
<p>eg if I have</p>
<p>table Beatles:</p>
<pre><code>John
Paul
George
Ringo
</code></pre>
<p>and I want to write a statement, without writing a procedure or view if possible, that gives me</p>
<pre><code>1 John
2 ... | [
{
"answer_id": 438619,
"author": "Andrzej Doyle",
"author_id": 45664,
"author_profile": "https://Stackoverflow.com/users/45664",
"pm_score": 2,
"selected": false,
"text": "<p>Check out the row_number() function; you should be able to do this in DB2 via:</p>\n\n<pre><code>SELECT row_numbe... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438610",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23447/"
] | How do I write a query that outputs the row number as a column? This is DB2 SQL on an iSeries.
eg if I have
table Beatles:
```
John
Paul
George
Ringo
```
and I want to write a statement, without writing a procedure or view if possible, that gives me
```
1 John
2 Paul
3 George
4 Ringo
``` | ```
SELECT ROW_NUMBER() OVER (ORDER BY beatle_name ASC) AS ROWID, * FROM beatles
``` |
438,618 | <p>I am using this php code:</p>
<pre><code>exec("unrar e file.rar",$ret,$code);
</code></pre>
<p>and getting an error code of illegal command ie 127 ... but when I am using this command through ssh its working ... because unrar is installed on the server ... so can anyone guess why exec is not doing the right stuff?... | [
{
"answer_id": 438625,
"author": "AAA",
"author_id": 1977,
"author_profile": "https://Stackoverflow.com/users/1977",
"pm_score": 6,
"selected": true,
"text": "<p>Try using the direct path of the application (/usr/bin/unrar of whatever), it sounds like php can't find the application.</p>\... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438618",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54534/"
] | I am using this php code:
```
exec("unrar e file.rar",$ret,$code);
```
and getting an error code of illegal command ie 127 ... but when I am using this command through ssh its working ... because unrar is installed on the server ... so can anyone guess why exec is not doing the right stuff? | Try using the direct path of the application (/usr/bin/unrar of whatever), it sounds like php can't find the application. |
438,624 | <p>When I use the Visual Studio menu Tool -> Generate Local Resource, it changed aspx file by adding meta attributes to controls. But it doesnt do so for user controls that I have created.</p>
<p>For example, If I have used a control in the page</p>
<pre><code><myControl:SpecialLabelControl ID="myLabel" runat="ser... | [
{
"answer_id": 438636,
"author": "Steven Robbins",
"author_id": 26507,
"author_profile": "https://Stackoverflow.com/users/26507",
"pm_score": 0,
"selected": false,
"text": "<p>Add it manually into the resource file as:</p>\n\n<pre><code>myLabel.Text\n</code></pre>\n\n<p>Then change the c... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438624",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54541/"
] | When I use the Visual Studio menu Tool -> Generate Local Resource, it changed aspx file by adding meta attributes to controls. But it doesnt do so for user controls that I have created.
For example, If I have used a control in the page
```
<myControl:SpecialLabelControl ID="myLabel" runat="server" Text="Localize Me!"... | Firstly, make sure 'Text' is a publicly accessible property on your control.
Add [Localizable(true)] above the declaration, as shown in the example on [this page](http://msdn.microsoft.com/en-us/library/system.componentmodel.localizableattribute.aspx)
This will tell the IDE that this property is supposed to be picked... |
438,628 | <p>Suppose I have a class</p>
<pre><code>public class MyClass {
private Set<String> set = new HashSet<String>();
//and many methods here
}
</code></pre>
<p>is there a possibility to make an eclipse debugger stop at every line where set member is used?</p>
| [
{
"answer_id": 438630,
"author": "Andrzej Doyle",
"author_id": 45664,
"author_profile": "https://Stackoverflow.com/users/45664",
"pm_score": 5,
"selected": true,
"text": "<p>I haven't used Eclipse for a while, but from what I remember this was possible in the Callisto release at least. ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438628",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24028/"
] | Suppose I have a class
```
public class MyClass {
private Set<String> set = new HashSet<String>();
//and many methods here
}
```
is there a possibility to make an eclipse debugger stop at every line where set member is used? | I haven't used Eclipse for a while, but from what I remember this was possible in the Callisto release at least. If you set a breakpoint on the line containing the declaration, and then go into the advanced properties for that breakpoint, I believe you can set options for *modification* and *access* of that variable.
... |
438,649 | <p>I have a dynamically created table and in some of the cells i have an image button associated with the redBall_Click() handler</p>
<p>(here is the code behind)</p>
<pre><code> TableCell cellOK = new TableCell();
cellOK.Style.Add(HtmlTextWriterStyle.TextAlign, "Center");
cellOK.Width = new Unit("3%");
... | [
{
"answer_id": 592134,
"author": "Simes",
"author_id": 47878,
"author_profile": "https://Stackoverflow.com/users/47878",
"pm_score": 0,
"selected": false,
"text": "<p>Have you tried putting a breakpoint in the page load method before clicking the image? I suspect this might show that the... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47432/"
] | I have a dynamically created table and in some of the cells i have an image button associated with the redBall\_Click() handler
(here is the code behind)
```
TableCell cellOK = new TableCell();
cellOK.Style.Add(HtmlTextWriterStyle.TextAlign, "Center");
cellOK.Width = new Unit("3%");
ImageButton redBal... | I finally resolved (just yesterday).
I guess I was building my buttons too late: in the Page\_PreRender (after the event was to be fired) maybe if i put the creation in Page\_Load (yes, I create everything also on PostBack) it would handle the click, but I think I won't try since I found a workaround.
I'll explain fo... |
438,659 | <p>So I've got basic example of jqgrid working in ASP.NET MVC, the javascript looks like this:</p>
<pre><code> $(document).ready(function() {
$("#list").jqGrid({
url: '../../Home/Example',
datatype: 'json',
myType: 'GET',
colNames: ['Id', 'Action', 'Parameter... | [
{
"answer_id": 653446,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": -1,
"selected": false,
"text": "<p>Just follow <a href=\"http://trirand.com/jqgrid/jqgrid.html\" rel=\"nofollow noreferrer\">this link</a>. It has all implem... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4639/"
] | So I've got basic example of jqgrid working in ASP.NET MVC, the javascript looks like this:
```
$(document).ready(function() {
$("#list").jqGrid({
url: '../../Home/Example',
datatype: 'json',
myType: 'GET',
colNames: ['Id', 'Action', 'Parameters'],
... | I recently implemented this myself (yesterday actually) for the first time. The biggest hurdle for me was figuring out how to write the controller function. The function signature is what took me the longest to figure out (notice the \_search, searchField, searchOper, and searchString parameters as those are missing fr... |
438,675 | <p>How in jQuery can I select just the links inside a div element and not the child div elements contained within that div?</p>
<pre><code><div>
<a>Link 1</a>
<a>Link 2</a>
<div>
<a>Not these 1</a>
<a>Not these 2</a>
</div&g... | [
{
"answer_id": 438683,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 4,
"selected": false,
"text": "<p>use the direct child selector ></p>\n\n<p>e.g</p>\n\n<pre><code>$('div>a')\n</code></pre>\n\n<p><strong>UPDATE:</str... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438675",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How in jQuery can I select just the links inside a div element and not the child div elements contained within that div?
```
<div>
<a>Link 1</a>
<a>Link 2</a>
<div>
<a>Not these 1</a>
<a>Not these 2</a>
</div>
</div>
``` | use the direct child selector >
e.g
```
$('div>a')
```
**UPDATE:**
to appease Mr RoBorg
If you do have anchors inside nested elements inside the first div then the following will work.
This uses a filter to ensure that the parent div is indeed the div you are targetting rather than a nested div.
[Demo](http://... |
438,684 | <p>I'm new to python, and have a list of longs which I want to join together into a comma separated string.</p>
<p>In PHP I'd do something like this:</p>
<pre><code>$output = implode(",", $array)
</code></pre>
<p>In Python, I'm not sure how to do this. I've tried using join, but this doesn't work since the elements ... | [
{
"answer_id": 438690,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 7,
"selected": true,
"text": "<p>You have to convert the ints to strings and then you can join them:</p>\n\n<pre><code>','.join([str(i) for i in list_of_ints... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438684",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] | I'm new to python, and have a list of longs which I want to join together into a comma separated string.
In PHP I'd do something like this:
```
$output = implode(",", $array)
```
In Python, I'm not sure how to do this. I've tried using join, but this doesn't work since the elements are the wrong type (i.e., not str... | You have to convert the ints to strings and then you can join them:
```
','.join([str(i) for i in list_of_ints])
``` |
438,704 | <p>I have a table in a ASP.NET MVC application that I want to be sortable (serverside) and filterable using AJAX. I wanted it to be fairly easy to use in other places and didn't feel like hardcoding the sorting and filtering into query expressions so I looked for a way to build the expressions dynamically and the best ... | [
{
"answer_id": 438714,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "<p>Just a thought, but have you looked at ADO.NET Data Services? This provides a REST-enabled API much like the above... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a table in a ASP.NET MVC application that I want to be sortable (serverside) and filterable using AJAX. I wanted it to be fairly easy to use in other places and didn't feel like hardcoding the sorting and filtering into query expressions so I looked for a way to build the expressions dynamically and the best way... | Just a thought, but have you looked at ADO.NET Data Services? This provides a REST-enabled API much like the above with a lot of standard LINQ functionality built in.
I can't think of an interest dynamic LINQ exploit of the top of my head, but if this was me I'd be *at least* white-listing members (`OrderID`, `Custome... |
438,707 | <p>Hi I am developing a simple application based upon ASP.NET MVC. I have altered the default master.css to my have my own styles. Now the only problem is that i am adding background-image property to my one of my UL->Li->A to create menus. It is working fine in firefox but the images are not showing up at all in Inter... | [
{
"answer_id": 438721,
"author": "Andrew G. Johnson",
"author_id": 428190,
"author_profile": "https://Stackoverflow.com/users/428190",
"pm_score": 0,
"selected": false,
"text": "<p>Add the XHTMLfor #nav-menu, also if you have a live link of this problem post that as well</p>\n"
},
{
... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438707",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17519/"
] | Hi I am developing a simple application based upon ASP.NET MVC. I have altered the default master.css to my have my own styles. Now the only problem is that i am adding background-image property to my one of my UL->Li->A to create menus. It is working fine in firefox but the images are not showing up at all in Internet... | I Got the issue, the images were created using CMYK. So FF was showing them using approximate colors while Internet explorer was totally ignoring them. Changing the format solve the issue. Thanks for your help guys. |
438,711 | <p>I have a few tables that have similar fields but not exactly the same.</p>
<p>The same fields they have are description (text field) and modified (unixtime)</p>
<p>I would like to select the last modified items from these tables based on unixtime. I cant use UNION since the tables aren't the same and the multiple ... | [
{
"answer_id": 438727,
"author": "Riho",
"author_id": 44715,
"author_profile": "https://Stackoverflow.com/users/44715",
"pm_score": 3,
"selected": true,
"text": "<p>How different they are?\nMaybe you can get the common fields out:</p>\n\n<pre><code>select t1.name1 as name from table1\nun... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22459/"
] | I have a few tables that have similar fields but not exactly the same.
The same fields they have are description (text field) and modified (unixtime)
I would like to select the last modified items from these tables based on unixtime. I cant use UNION since the tables aren't the same and the multiple table select time... | How different they are?
Maybe you can get the common fields out:
```
select t1.name1 as name from table1
union
select t2.name2 as name from table2
``` |
438,712 | <p>I have a SharePoint WebPart project in visual studio. As part of the project I am referencing the interop.ActiveDS.dll.</p>
<p>I can compile the project successfully and add/deploy the solution to SharePoint. When I try to run the WebPart in SharePoint I get the error:</p>
<pre><code>That assembly does not allow p... | [
{
"answer_id": 438767,
"author": "78lro",
"author_id": 12318,
"author_profile": "https://Stackoverflow.com/users/12318",
"pm_score": 1,
"selected": false,
"text": "<p>Deploying it to the GAC seems to be a possible solution:</p>\n\n<p><a href=\"http://social.msdn.microsoft.com/Forums/en-U... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438712",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12318/"
] | I have a SharePoint WebPart project in visual studio. As part of the project I am referencing the interop.ActiveDS.dll.
I can compile the project successfully and add/deploy the solution to SharePoint. When I try to run the WebPart in SharePoint I get the error:
```
That assembly does not allow partially trusted call... | The problem is that Interop.ActiveDs.dll does not allow partially trusted callers. Your best bet is to deploy a signed interop assembly to the GAC:
```
TlbImp %windir%\system32\ActiveDs.tlb /out:Interop.ActiveDs.dll /keyfile:KeyFile.snk
``` |
438,715 | <p>I using a genric list(m_equipmentList ) which is collection of objects (Schedule_Payitem).<br>
How can sort list according to a proerty of child object ?</p>
<pre><code>Dim m_equipmentList As New List(Of Schedule_Payitem)
</code></pre>
<p>Need to sort m_equipmentList on basis of resourceid property of Schedule_Pa... | [
{
"answer_id": 438730,
"author": "cmsjr",
"author_id": 23114,
"author_profile": "https://Stackoverflow.com/users/23114",
"pm_score": 0,
"selected": false,
"text": "<p>Try this</p>\n\n<pre><code>Dim m_equipmentList As New List(Of Schedule_Payitem)\n\n\nm_equipmentList.Sort(delegate(Schedu... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34588/"
] | I using a genric list(m\_equipmentList ) which is collection of objects (Schedule\_Payitem).
How can sort list according to a proerty of child object ?
```
Dim m_equipmentList As New List(Of Schedule_Payitem)
```
Need to sort m\_equipmentList on basis of resourceid property of Schedule\_Payitem. | Are you using VB9? If so, I'd use a [lambda expression](http://www.danielmoth.com/Blog/2007/02/lambda-expressions-in-vb9.html) to create a `Comparer(Of Schedule_PayItem)`. Otherwise, write a short class to implement `IComparer(Of Schedule_PayItem)`. pass whichever one you've got into List.Sort.
An example for the lamb... |
438,720 | <p>I am registering a function with the onload method of a html form, I need to unregister this event hander function on unload of the form. How do I do it in Internet Explorer 6?</p>
| [
{
"answer_id": 438732,
"author": "Dimi Takis",
"author_id": 52039,
"author_profile": "https://Stackoverflow.com/users/52039",
"pm_score": 2,
"selected": false,
"text": "<p>Use detachEvent</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/ms536411(VS.85).aspx\" rel=\"nofollow no... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am registering a function with the onload method of a html form, I need to unregister this event hander function on unload of the form. How do I do it in Internet Explorer 6? | if you have added the onload in your HTML or via JavaScript
```
<form onload="blah()">
```
or
```
myForm.onload = blah;
```
then
```
myForm.onload = null;
```
should do it
if you've used attachEvent
```
myForm.attachEvent( 'onload', blah );
```
use
```
myForm.detachEvent( 'onload', blah );
```
**EDIT*... |
438,776 | <p>Does anyone know how one can get the total number of calls to an MSSQL2000 server during a specified time, let’s say 24 hours?</p>
<p>We want figures of how many calls our production machine gets per day, but we can’t find any good tools/strategies for this.</p>
<p>Best regards
Fredrik</p>
| [
{
"answer_id": 438785,
"author": "Kev",
"author_id": 419,
"author_profile": "https://Stackoverflow.com/users/419",
"pm_score": 1,
"selected": false,
"text": "<p>You could use SQL Profiler?</p>\n\n<p><a href=\"http://technet.microsoft.com/en-us/library/aa173918(SQL.80).aspx\" rel=\"nofoll... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21575/"
] | Does anyone know how one can get the total number of calls to an MSSQL2000 server during a specified time, let’s say 24 hours?
We want figures of how many calls our production machine gets per day, but we can’t find any good tools/strategies for this.
Best regards
Fredrik | I think using SQL Profiler here is overkill in this situation, particularly as it can create a substantial load on the server depending on what you trace. SQL Server exposes the raw values used for its performance counters via the sysperfinfo system table; you should just be able to run this query once each day and sub... |
438,795 | <p>I have created a very simple test app to try and solve this problem described to me by a co-worker. He was able to trigger it in C#, but I believe he needed the solution to be more generic and wanted it to be done strictly in the XAML. The problem was: How do you trigger the Storyboard inside of a UserControl to b... | [
{
"answer_id": 439872,
"author": "NR.",
"author_id": 48142,
"author_profile": "https://Stackoverflow.com/users/48142",
"pm_score": 1,
"selected": false,
"text": "<p>You can access the storyboard by using the StaticResource. You need only assign the resource to the Storyboard on the Begin... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53501/"
] | I have created a very simple test app to try and solve this problem described to me by a co-worker. He was able to trigger it in C#, but I believe he needed the solution to be more generic and wanted it to be done strictly in the XAML. The problem was: How do you trigger the Storyboard inside of a UserControl to begin ... | I think the idea of responding to external events within UserControl is not a very safe one. Within UserControl, you'd want to react only to events that are born within the control.
Can you flip the situation around and do the following: ?
* Expose the UC property that needs to be animated as a dependency property (b... |
438,803 | <p>I have this kind of code in some applications (from microsoft)</p>
<pre><code>[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Naming",
"CA1702:CompoundWordsShouldBeCasedCorrectly",
MessageId = "CounterClockwise",
Scope = "member",
Target = "ScePhotoViewer.PhotoDisplayControl.#Ro... | [
{
"answer_id": 438846,
"author": "Stu Mackellar",
"author_id": 28591,
"author_profile": "https://Stackoverflow.com/users/28591",
"pm_score": 5,
"selected": true,
"text": "<p>This attribute is used by <a href=\"http://en.wikipedia.org/wiki/Team_Foundation_Server\" rel=\"noreferrer\">Team ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have this kind of code in some applications (from microsoft)
```
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage(
"Microsoft.Naming",
"CA1702:CompoundWordsShouldBeCasedCorrectly",
MessageId = "CounterClockwise",
Scope = "member",
Target = "ScePhotoViewer.PhotoDisplayControl.#RotatePhotoCount... | This attribute is used by [Team Foundation Server](http://en.wikipedia.org/wiki/Team_Foundation_Server)'s (TFS) code analysis functionality to exclude code fragments that would otherwise trigger warnings. You can safely remove them if you're not using TFS code analysis.
The attributes can be added by hand or, more usu... |
438,810 | <pre><code>"\u4000\f".TrimEnd(new char[0])
</code></pre>
<p>is equal to <code>"\u4000"</code>. </p>
<p>I am passing an empty array, so according to the MSDN documentation nothing should be removed and <code>"\u4000\f"</code> should be returned. Is there a reason for this behaviour?</p>
<p>EDIT: Clarified expected be... | [
{
"answer_id": 438834,
"author": "TcKs",
"author_id": 20382,
"author_profile": "https://Stackoverflow.com/users/20382",
"pm_score": 2,
"selected": false,
"text": "<p>The <a href=\"http://msdn.microsoft.com/en-us/library/system.string.trimend.aspx\" rel=\"nofollow noreferrer\">documentati... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438810",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9204/"
] | ```
"\u4000\f".TrimEnd(new char[0])
```
is equal to `"\u4000"`.
I am passing an empty array, so according to the MSDN documentation nothing should be removed and `"\u4000\f"` should be returned. Is there a reason for this behaviour?
EDIT: Clarified expected behaviour
EDIT: Apparently, this changed in 3.5, I was l... | the documentation says "If trimChars is null (Nothing in Visual Basic) or an *empty array*, white-space characters are removed instead. "
So no, not a bug. |
438,813 | <p>This is an incredibly simple question (I'm new to Python).</p>
<p>I basically want a data structure like a PHP array -- i.e., I want to initialise it and then just add values into it.</p>
<p>As far as I can tell, this is not possible with Python, so I've got the maximum value I might want to use as an index, but I... | [
{
"answer_id": 438824,
"author": "Anteru",
"author_id": 39912,
"author_profile": "https://Stackoverflow.com/users/39912",
"pm_score": 2,
"selected": false,
"text": "<p>Use the list constructor, and append your items, like this:</p>\n\n<pre><code>l = list ()\nl.append (\"foo\")\nl.append ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438813",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] | This is an incredibly simple question (I'm new to Python).
I basically want a data structure like a PHP array -- i.e., I want to initialise it and then just add values into it.
As far as I can tell, this is not possible with Python, so I've got the maximum value I might want to use as an index, but I can't figure out... | Depending on how you are going to use the list, it may be that you actually want a dictionary. This will work:
```
d = {}
for row in rows:
c = list_of_categories.index(row["id"])
print c
d[c] = row["name"]
```
... or more compactly:
```
d = dict((list_of_categories.index(row['id']), row['name']) for row in r... |
438,821 | <p>I was browsing the html of my favorite site...ahem...and I saw this in the markup:</p>
<pre><code><link href="/Content/all.min.css?d=20090107" rel="stylesheet" type="text/css" />
</code></pre>
<p>what does "?d=20090107" do? I'm assuming it's a date of some kind, but I'm not sure why it's in the path to the f... | [
{
"answer_id": 438828,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 7,
"selected": true,
"text": "<p>That is there to add some uniqueness to the filename, so that when they change the CSS file, they can change the extra ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17744/"
] | I was browsing the html of my favorite site...ahem...and I saw this in the markup:
```
<link href="/Content/all.min.css?d=20090107" rel="stylesheet" type="text/css" />
```
what does "?d=20090107" do? I'm assuming it's a date of some kind, but I'm not sure why it's in the path to the file. Any ideas? | That is there to add some uniqueness to the filename, so that when they change the CSS file, they can change the extra bit to be totally sure that every client will reload the CSS rather than use a cached version.
The webserver will ignore the parameter and serve /Content/all.min.css normally
Note: While it's *possib... |
438,835 | <p>So I'm running subtext 1.95 on IIS6 and .net 2.0 framework. What I'd like to do is create a nice vanity URL to a particular article that is published inside the subtext system. The vanity url should look like this: mydomain.com/blog/toc/, but the subtext article that it is pointing to actually has a path like this: ... | [
{
"answer_id": 2069843,
"author": "Haacked",
"author_id": 598,
"author_profile": "https://Stackoverflow.com/users/598",
"pm_score": 2,
"selected": false,
"text": "<p><strong>Note, this applies to Subtext 2.1.2 and below</strong></p>\n\n<p>URL matching is handled in Web.config. You can se... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438835",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27497/"
] | So I'm running subtext 1.95 on IIS6 and .net 2.0 framework. What I'd like to do is create a nice vanity URL to a particular article that is published inside the subtext system. The vanity url should look like this: mydomain.com/blog/toc/, but the subtext article that it is pointing to actually has a path like this: myd... | **Note, this applies to Subtext 2.1.2 and below**
URL matching is handled in Web.config. You can search for a line that looks like this:
```
<HttpHandler pattern="(?:/archive/\d{4}/\d{2}/\d{2}/[-_,+\.\w]+\.aspx)$" controls="viewpost.ascx,Comments.ascx,PostComment.ascx"/>
```
And change the regex there. Unfortunatel... |
438,853 | <p>With valid HTML the following finds the object as expected in all browsers but gets NULL in IE (6 & 7).</p>
<pre><code>$(document).ready(function() {
alert( '$(.rollover):\n' + $('.rollover'));
});
</code></pre>
<p>I've tried by switching it to something simpler like $('a') but I always get NULL in IE.</p>... | [
{
"answer_id": 438878,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 0,
"selected": false,
"text": "<p>I think we'd have to see the HTML. I've never had a problem with class selection in jQuery/IE. You should get <... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6432/"
] | With valid HTML the following finds the object as expected in all browsers but gets NULL in IE (6 & 7).
```
$(document).ready(function() {
alert( '$(.rollover):\n' + $('.rollover'));
});
```
I've tried by switching it to something simpler like $('a') but I always get NULL in IE.
**Update:**
After running the pa... | If you're having $ conflicts there are many way to avoid this as documented [here](http://docs.jquery.com/Using_jQuery_with_Other_Libraries). |
438,870 | <p>I've created an application controller abstract class that my controllers derive from (As described in the following <a href="http://www.asp.net/Learn/mvc/tutorial-13-cs.aspx" rel="nofollow noreferrer">article</a>)</p>
<p>The following is an example of what my code looks like</p>
<pre><code>public abstract class A... | [
{
"answer_id": 438912,
"author": "Kieron",
"author_id": 5791,
"author_profile": "https://Stackoverflow.com/users/5791",
"pm_score": 1,
"selected": false,
"text": "<p>It could be that the call is crashing in the constructor because the UserId (this.UserId) hasn't been initialised yet.</p>... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've created an application controller abstract class that my controllers derive from (As described in the following [article](http://www.asp.net/Learn/mvc/tutorial-13-cs.aspx))
The following is an example of what my code looks like
```
public abstract class ApplicationController : Controller
{
private ProjectDat... | Try this instead of using the constructor:-
```
public abstract class ApplicationController : Controller
{
private ProjectDataContext datacontext = new ProjectDataContext();
protected ProjectDataContext DataContext
{
get { return datacontext; }
}
protected override void Initialize(System.... |
438,872 | <p>to my project i need document editor for many types of documents(tabular data, invoices, letters, some formulars,...) and i am looking for text format and editor to acompish my task</p>
<ul>
<li>is there some MS Word like format? </li>
<li>I know for example rtf, I need formating, invissible comment will be veeery ... | [
{
"answer_id": 438912,
"author": "Kieron",
"author_id": 5791,
"author_profile": "https://Stackoverflow.com/users/5791",
"pm_score": 1,
"selected": false,
"text": "<p>It could be that the call is crashing in the constructor because the UserId (this.UserId) hasn't been initialised yet.</p>... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53854/"
] | to my project i need document editor for many types of documents(tabular data, invoices, letters, some formulars,...) and i am looking for text format and editor to acompish my task
* is there some MS Word like format?
* I know for example rtf, I need formating, invissible comment will be veeery good
* open format
* s... | Try this instead of using the constructor:-
```
public abstract class ApplicationController : Controller
{
private ProjectDataContext datacontext = new ProjectDataContext();
protected ProjectDataContext DataContext
{
get { return datacontext; }
}
protected override void Initialize(System.... |
438,875 | <p>I am writing an application in Java using Swing. I am trying to implement functionality to save and load simulation states for at simulation i am running. The entire simulation is kept as an object, disconnected from Swing. I am trying to serialize my Simulation class with this code:</p>
<pre><code>public void save... | [
{
"answer_id": 438896,
"author": "Douglas Leeder",
"author_id": 3978,
"author_profile": "https://Stackoverflow.com/users/3978",
"pm_score": 2,
"selected": false,
"text": "<p>You've got some deeply nested ArrayLists.</p>\n\n<p>I think maybe it's just going depth first, and that means it's... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438875",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54564/"
] | I am writing an application in Java using Swing. I am trying to implement functionality to save and load simulation states for at simulation i am running. The entire simulation is kept as an object, disconnected from Swing. I am trying to serialize my Simulation class with this code:
```
public void saveSimulationStat... | Interesting post from Chen:
[When debugging a stack overflow, you want to focus on the repeating recursive part](https://web.archive.org/web/20140424233104/http://blogs.msdn.com/b/oldnewthing/archive/2009/01/07/9286576.aspx)
In your case:
```java
at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.j... |
438,894 | <p>I need to stop my program when an exception is raised in Python.
How do I implement this?</p>
| [
{
"answer_id": 438901,
"author": "Keltia",
"author_id": 16143,
"author_profile": "https://Stackoverflow.com/users/16143",
"pm_score": 3,
"selected": false,
"text": "<p>As far as I know, if an exception is not caught by your script, it will be interrupted.</p>\n"
},
{
"answer_id":... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438894",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46646/"
] | I need to stop my program when an exception is raised in Python.
How do I implement this? | ```
import sys
try:
print("stuff")
except:
sys.exit(1) # exiting with a non zero value is better for returning from an error
``` |
438,938 | <p>I have the following table in MSSQL2005</p>
<pre><code>id | business_key | result
1 | 1 | 0
2 | 1 | 1
3 | 2 | 1
4 | 3 | 1
5 | 4 | 1
6 | 4 | 0
</code></pre>
<p>And now i want to group based on the business_key returning the complete entry with the highest id.
So my expected result is:</p>
<pre><code>business_key |... | [
{
"answer_id": 438957,
"author": "Chris Simpson",
"author_id": 28896,
"author_profile": "https://Stackoverflow.com/users/28896",
"pm_score": 3,
"selected": false,
"text": "<pre><code>select\n drv.business_key,\n mytable.result\nfrom mytable\n inner join\n (\n select \n busine... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438938",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54583/"
] | I have the following table in MSSQL2005
```
id | business_key | result
1 | 1 | 0
2 | 1 | 1
3 | 2 | 1
4 | 3 | 1
5 | 4 | 1
6 | 4 | 0
```
And now i want to group based on the business\_key returning the complete entry with the highest id.
So my expected result is:
```
business_key | result
1 | 1
2 | 1
3 | 1
4 | 0
```... | An alternative solution, which may give you better performance (test both ways and check the execution plans):
```
SELECT
T1.id,
T1.business_key,
T1.result
FROM
dbo.My_Table T1
LEFT OUTER JOIN dbo.My_Table T2 ON
T2.business_key = T1.business_key AND
T2.id > T1.id
WHERE
T2.id IS NULL
... |
438,939 | <p>In the code below I tried in two ways to access the parent version of methodTwo, but the result was always 2. Is there any way to get the 1 result from a ChildClass instance without modifying these two classes?</p>
<pre><code>class ParentClass
{
public int methodOne()
{
return methodTwo();
}
... | [
{
"answer_id": 438948,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 6,
"selected": false,
"text": "<p>Inside of <code>ChildClass.methodTwo()</code>, you can call <code>base.methodTwo()</code>.</p>\n\n<p>Outside of the ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438939",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48465/"
] | In the code below I tried in two ways to access the parent version of methodTwo, but the result was always 2. Is there any way to get the 1 result from a ChildClass instance without modifying these two classes?
```
class ParentClass
{
public int methodOne()
{
return methodTwo();
}
virtual publ... | At the IL level, you could probably issue a `call` rather than a `callvirt`, and get the job done - but if we limit ourselves to C# ;-p (**edit** darn! the runtime stops you: `VerificationException`: "Operation could destabilize the runtime."; remove the `virtual` and it works fine; too clever by half...)
Inside the `... |
438,953 | <p>I'd like to allow users of a web-based CMS to upload Flash files and include them in the content. I'll probably use SWFObject to render the flash , but I need the width and height. Is this possible to determine these via C# when I do the upload?</p>
<p>Thanks.</p>
| [
{
"answer_id": 439198,
"author": "savageguy",
"author_id": 52555,
"author_profile": "https://Stackoverflow.com/users/52555",
"pm_score": 4,
"selected": true,
"text": "<p>There is likely an easier way but,</p>\n\n<p>you can download \"FlashTools.zip\" from <a href=\"http://blogs.msdn.com/... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14072/"
] | I'd like to allow users of a web-based CMS to upload Flash files and include them in the content. I'll probably use SWFObject to render the flash , but I need the width and height. Is this possible to determine these via C# when I do the upload?
Thanks. | There is likely an easier way but,
you can download "FlashTools.zip" from <http://blogs.msdn.com/mswanson/archive/2006/10/15/example-c-code-for-reading-flash-swf-files.aspx> and compile the project. Then add a reference to the "FlashTools.dll" assembly. You can then get height/width using:
```
SWFFile swf = new SWFFi... |
438,954 | <p>Is there a way to get struts 2 (using tiles) to build the whole page before sending it to the browser? I don't want the page to be build "progressively" in the browser one part at a time.</p>
<p>The main problem I'm trying to solve is that internet explorer 7 flashes/blinks the page even if only some of the content... | [
{
"answer_id": 438976,
"author": "JeeBee",
"author_id": 17832,
"author_profile": "https://Stackoverflow.com/users/17832",
"pm_score": 1,
"selected": true,
"text": "<p>Can you use the \"flush\" attribute on the tiles components?</p>\n\n<pre><code><tiles:insertAttribute name=\"body\" fl... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13709/"
] | Is there a way to get struts 2 (using tiles) to build the whole page before sending it to the browser? I don't want the page to be build "progressively" in the browser one part at a time.
The main problem I'm trying to solve is that internet explorer 7 flashes/blinks the page even if only some of the content changes (... | Can you use the "flush" attribute on the tiles components?
```
<tiles:insertAttribute name="body" flush="false"/>
```
In addition if the output buffer gets too big, it will flush anyway. Try increasing the buffer size?
```
<%@ page language="java" buffer="500kb" autoFlush="false" %>
``` |
438,959 | <p>I need to write an error log to a XML file using Visual Basic 6.0. Is there an easy way to do this?</p>
<p>The error log will contain the error number, source, desc, and a timestamp.</p>
<p>Thanks,
Jeff</p>
| [
{
"answer_id": 438983,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 2,
"selected": false,
"text": "<p>Probably it's best to use Microsoft's MSXML libraries to do that.</p>\n\n<p>There is a sample in the knowledge bas... | 2009/01/13 | [
"https://Stackoverflow.com/questions/438959",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I need to write an error log to a XML file using Visual Basic 6.0. Is there an easy way to do this?
The error log will contain the error number, source, desc, and a timestamp.
Thanks,
Jeff | If you are writing the log-file only, I'd recommend just concatenating a string like this:
```
Public Function GetXmlEntry(errNumber as Long, description as String) as String
GetXmlEntry = "<entry><error-number>" & errNumber & "</error-number><description>" & description & "</description></entry>"
End Function
```... |
439,003 | <p>Question says it all really, the default is for it to map as a <code>string</code> but I need it to map as an <code>int</code>.</p>
<p>I'm currently using <code>PersistenceModel</code> for setting my conventions if that makes any difference. Thanks in advance.</p>
<p><strong>Update</strong>
Found that getting onto... | [
{
"answer_id": 439520,
"author": "James Gregory",
"author_id": 27206,
"author_profile": "https://Stackoverflow.com/users/27206",
"pm_score": 0,
"selected": false,
"text": "<p>You could create an NHibernate <code>IUserType</code>, and specify it using <code>CustomTypeIs<T>()</code> ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439003",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6369/"
] | Question says it all really, the default is for it to map as a `string` but I need it to map as an `int`.
I'm currently using `PersistenceModel` for setting my conventions if that makes any difference. Thanks in advance.
**Update**
Found that getting onto the latest version of the code from the trunk resolved my woes... | The way to define this convention changed sometimes ago, it's now :
```
public class EnumConvention : IUserTypeConvention
{
public void Accept(IAcceptanceCriteria<IPropertyInspector> criteria)
{
criteria.Expect(x => x.Property.PropertyType.IsEnum);
}
public void Apply(IPropertyInstance target... |
439,007 | <p>I'm writing a little utility that starts with selecting a file, and then I need to select a folder. I'd like to default the folder to where the selected file was.</p>
<p><code>OpenFileDialog.FileName</code> returns the <strong>full path & filename</strong> - what I want is to obtain just the <strong>path portio... | [
{
"answer_id": 439025,
"author": "Jeff Yates",
"author_id": 23234,
"author_profile": "https://Stackoverflow.com/users/23234",
"pm_score": 8,
"selected": true,
"text": "<p>Use the <a href=\"http://msdn.microsoft.com/en-us/library/system.io.path.aspx\" rel=\"noreferrer\"><code>Path</code><... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10410/"
] | I'm writing a little utility that starts with selecting a file, and then I need to select a folder. I'd like to default the folder to where the selected file was.
`OpenFileDialog.FileName` returns the **full path & filename** - what I want is to obtain just the **path portion (sans filename)**, so I can use that as th... | Use the [`Path`](http://msdn.microsoft.com/en-us/library/system.io.path.aspx) class from [`System.IO`](http://msdn.microsoft.com/en-us/library/system.io.aspx). It contains useful calls for manipulating file paths, including [`GetDirectoryName`](http://msdn.microsoft.com/en-us/library/system.io.path.getdirectoryname.asp... |
439,010 | <p>I have the following html page:</p>
<pre><code><html>
<body>
<script>
var check = 0;
function doNow()
{
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
{
if(check == 0)
void(el[i].checked=1)
else
void(... | [
{
"answer_id": 439049,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "<p>My suggestion is to use a checkbox instead of a button. When someone clicks on the checkbox, all other checkboxes will be s... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439010",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48094/"
] | I have the following html page:
```
<html>
<body>
<script>
var check = 0;
function doNow()
{
void(d=document);
void(el=d.getElementsByTagName('INPUT'));
for(i=0;i<el.length;i++)
{
if(check == 0)
void(el[i].checked=1)
else
void(el[i].checked=0)
}
if(check... | It's because when the page is reloaded, the Javascript is parsed and your declaration
```
var check = 0;
```
unsurprisingly causes the check variable to be reset to zero at this point. Thus after the page is reinitialised, the first click of the button will enable all checkboxes. It seems that the issue here stems ... |
439,038 | <p>I have tried with the following, but it just says "& was unexpected at this time."</p>
<pre><code>@echo off
:enter-input
echo Please enter a number between 1 and 15:
echo 1 = Selection one
echo 2 = Selection two
echo 4 = Selection three
echo 8 = Selection four
echo x = Quit
set INPUT=
set /P INPUT=Type number:... | [
{
"answer_id": 439082,
"author": "loraderon",
"author_id": 22092,
"author_profile": "https://Stackoverflow.com/users/22092",
"pm_score": 4,
"selected": true,
"text": "<p>I found a way of doing this.</p>\n\n<pre><code>@echo off\n:enter-input\necho Please enter a number between 1 and 15:\n... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22092/"
] | I have tried with the following, but it just says "& was unexpected at this time."
```
@echo off
:enter-input
echo Please enter a number between 1 and 15:
echo 1 = Selection one
echo 2 = Selection two
echo 4 = Selection three
echo 8 = Selection four
echo x = Quit
set INPUT=
set /P INPUT=Type number: %=%
if "%INPUT%"... | I found a way of doing this.
```
@echo off
:enter-input
echo Please enter a number between 1 and 15:
echo 1 = Selection one
echo 2 = Selection two
echo 4 = Selection three
echo 8 = Selection four
echo x = Quit
set /P INPUT=Type number:
if "%INPUT%" == "" goto enter-input
if "%INPUT%" == "x" goto end
if "%INPUT%" == ... |
439,047 | <p>I've encountered posts which have stated, "I'd love to use Extension A but it doesn't work with Extension B". Is this something that I need to be concerned about when building a Firefox extension?</p>
<p>What are some of the common reasons for extensions to conflict with one another? What are the best practices to ... | [
{
"answer_id": 439072,
"author": "Jason S",
"author_id": 44330,
"author_profile": "https://Stackoverflow.com/users/44330",
"pm_score": 1,
"selected": false,
"text": "<p>Not sure (resource contention is the obvious place to look) but you may have better luck posting to <a href=\"http://gr... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50644/"
] | I've encountered posts which have stated, "I'd love to use Extension A but it doesn't work with Extension B". Is this something that I need to be concerned about when building a Firefox extension?
What are some of the common reasons for extensions to conflict with one another? What are the best practices to ensure tha... | The most common reason for extension conflicts is the use of common names in a shared namespace. For example, if two extensions define a global variable named "log" in a browser.xul overlay, only one of them will function as expected, since the other's "log" will be overwritten.
The common solution is learning which o... |
439,056 | <p>Is a </p>
<pre><code>select * from myView
</code></pre>
<p>faster than the query itself to create the view (in order to have the same resultSet):</p>
<pre><code>select * from ([query to create same resultSet as myView])
</code></pre>
<p>?</p>
<p>It's not totally clear to me if the view uses some sort of cachin... | [
{
"answer_id": 439061,
"author": "Mark Brittingham",
"author_id": 15592,
"author_profile": "https://Stackoverflow.com/users/15592",
"pm_score": 11,
"selected": true,
"text": "<p><strong>Yes</strong>, views <em>can</em> have a clustered index assigned and, when they do, they'll store temp... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439056",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311500/"
] | Is a
```
select * from myView
```
faster than the query itself to create the view (in order to have the same resultSet):
```
select * from ([query to create same resultSet as myView])
```
?
It's not totally clear to me if the view uses some sort of caching making it faster compared to a simple query. | **Yes**, views *can* have a clustered index assigned and, when they do, they'll store temporary results that can speed up resulting queries.
Microsoft's own documentation makes it very clear that Views can improve performance.
First, most views that people create are *simple* views and do not use this feature, and ar... |
439,071 | <p>I have a Database nearly 1.9Gb Database in size, and MSDE2000 does not allow DBs that exceed 2.0Gb</p>
<p>I need to shrink this DB (and many others like this at various client locations).</p>
<p>I have found and deleted many 100's of 1000's of records which are considered unneeded:
these records account for a larg... | [
{
"answer_id": 439081,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 0,
"selected": false,
"text": "<p>You also have to modify the minimum size of the data and log files. DBCC SHRINKDATABASE will shrink the data <em>i... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11356/"
] | I have a Database nearly 1.9Gb Database in size, and MSDE2000 does not allow DBs that exceed 2.0Gb
I need to shrink this DB (and many others like this at various client locations).
I have found and deleted many 100's of 1000's of records which are considered unneeded:
these records account for a large percentage of s... | ```
ALTER DATABASE MyDatabase SET RECOVERY SIMPLE
GO
DBCC SHRINKFILE (MyDatabase_Log, 5)
GO
ALTER DATABASE MyDatabase SET RECOVERY FULL
GO
``` |
439,084 | <p>I want to execute another ruby script from my Shoes app. I try</p>
<pre><code>button "..." do
`ruby -rubygems /Users/kemiisto/Desktop/Ruby/gears.rb`
end
</code></pre>
<p>but nothing happens. In the case of other commands, for example </p>
<pre><code>button "..." do
`open /Applications/TextEdit.app/`
end
<... | [
{
"answer_id": 439303,
"author": "CJ Bryan",
"author_id": 43896,
"author_profile": "https://Stackoverflow.com/users/43896",
"pm_score": 2,
"selected": false,
"text": "<p>Things are happening, you're just not doing anything with the text that your commands are returning. When you run a sy... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to execute another ruby script from my Shoes app. I try
```
button "..." do
`ruby -rubygems /Users/kemiisto/Desktop/Ruby/gears.rb`
end
```
but nothing happens. In the case of other commands, for example
```
button "..." do
`open /Applications/TextEdit.app/`
end
```
all works fine. Any ideas? | Things are happening, you're just not doing anything with the text that your commands are returning. When you run a system command via 'system' or backticks each command returns whatever the command dumped to STDOUT.
```
Shoes.app do
@s = stack {}
button "go!" do
@out = `ls -al`
@s.clear { para @out }
e... |
439,086 | <p>Ok, so I have an abstract class called Product. I have 3 tables called Items, Kits, and Packages that implement Product. Product has a public property that exposes the object's primary key.</p>
<p>That said I have a form where I pass a product. I would would like to pull that product out of a fresh datacontext w... | [
{
"answer_id": 439108,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 3,
"selected": false,
"text": "<p>No, because the type argument has to be known at compile-time to appear in source code.</p>\n\n<p>You could either ma... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12862/"
] | Ok, so I have an abstract class called Product. I have 3 tables called Items, Kits, and Packages that implement Product. Product has a public property that exposes the object's primary key.
That said I have a form where I pass a product. I would would like to pull that product out of a fresh datacontext without having... | With thanks to Mr. Skeet a bright member of my team pointed out the following solution.
```
public BuilderInclusionsForm(Product p) : this()
{
IEnumerable<Product> ps = db2.GetTable(p.GetType()).Cast<Product>();
product = ps.SingleOrDefault(a => a.ProductID == p.ProductID);
}
```
Sorry to waste your time. Pl... |
439,097 | <p>In a C++ application that can use just about any relational database, what would be the best way of generating queries that can be easily extended to allow for a database engine's eccentricities? </p>
<p>In other words, the code may need to retrieve data in a way that is not consistent among the various database e... | [
{
"answer_id": 439133,
"author": "BradC",
"author_id": 21398,
"author_profile": "https://Stackoverflow.com/users/21398",
"pm_score": 1,
"selected": false,
"text": "<p><strong>Best option: Pick a database, and code to it.</strong></p>\n\n<p>How often are you going to up and swap out the d... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2494/"
] | In a C++ application that can use just about any relational database, what would be the best way of generating queries that can be easily extended to allow for a database engine's eccentricities?
In other words, the code may need to retrieve data in a way that is not consistent among the various database engines. Wha... | I would think that what you would want to do, if you needed the ability to support multiple databases, would be to create a data provider interface (or abstract class) and associated concrete implementations. The data provider would need to support your standard query operators and other common, supported functionality... |
439,110 | <p>I have a site I'm working on where I want to mark if a row of data has been changed.
If something has been changed in that row I would mark it with a custom attribute
like so.</p>
<pre><code><tr>
<td isDirty="true">
....row data
<td>
</tr>
</code></pre>
<p>This works great with jQu... | [
{
"answer_id": 439113,
"author": "aivarsak",
"author_id": 53698,
"author_profile": "https://Stackoverflow.com/users/53698",
"pm_score": 0,
"selected": false,
"text": "<p>I strongly recommend to stick to standards. Web is already messed up ;)</p>\n"
},
{
"answer_id": 439117,
"... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439110",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1231/"
] | I have a site I'm working on where I want to mark if a row of data has been changed.
If something has been changed in that row I would mark it with a custom attribute
like so.
```
<tr>
<td isDirty="true">
....row data
<td>
</tr>
```
This works great with jQuery and it doesn't add to much code to my page.
B... | Why don't you use the jQuery data capability?
Your example will be (I don't know the condition to select proper td):
```
$("tr td").data("isDirty", true);
```
take a look at [documentation](http://docs.jquery.com/Core/data#name) |
439,115 | <p>How do I get a random <a href="https://docs.python.org/3.6/library/decimal.html#decimal-objects" rel="noreferrer"><code>decimal.Decimal</code></a> instance? It appears that the random module only returns floats which are a pita to convert to Decimals.</p>
| [
{
"answer_id": 439169,
"author": "Kiv",
"author_id": 49559,
"author_profile": "https://Stackoverflow.com/users/49559",
"pm_score": 4,
"selected": false,
"text": "<p>From the <a href=\"http://docs.python.org/dev/3.0/library/decimal.html\" rel=\"noreferrer\">standard library reference</a> ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439115",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6950/"
] | How do I get a random [`decimal.Decimal`](https://docs.python.org/3.6/library/decimal.html#decimal-objects) instance? It appears that the random module only returns floats which are a pita to convert to Decimals. | What's "a random decimal"? Decimals have arbitrary precision, so generating a number with as much randomness as you can hold in a Decimal would take the entire memory of your machine to store.
You have to know how many decimal digits of precision you want in your random number, at which point it's easy to just grab an... |
439,129 | <p>I am using <a href="http://en.wikipedia.org/wiki/Styled_Layer_Descriptor" rel="nofollow noreferrer">SLD</a> to style output from my geoserver. I have couple types of objects to be displayed. Each type have different icons, but text description is generated from the same information (text field in the database). I ca... | [
{
"answer_id": 439146,
"author": "gimpf",
"author_id": 15529,
"author_profile": "https://Stackoverflow.com/users/15529",
"pm_score": 2,
"selected": false,
"text": "<p>Please clarify: What would you want to use <em>check-out</em> hooks for?</p>\n\n<p>I've never really been a CVS user, so ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439129",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37086/"
] | I am using [SLD](http://en.wikipedia.org/wiki/Styled_Layer_Descriptor) to style output from my geoserver. I have couple types of objects to be displayed. Each type have different icons, but text description is generated from the same information (text field in the database). I cannot use object\_type as image name beca... | Please clarify: What would you want to use *check-out* hooks for?
I've never really been a CVS user, so I do not know what common use-cases the solved (wanted to...) by using check-out hooks (actually I haven't known them).
SVN provides pre-commit and post-commit hooks (among some others), which should be able to do ... |
439,138 | <p>I have a table like this (Oracle, 10)</p>
<pre><code>Account Bookdate Amount
1 20080101 100
1 20080102 101
2 20080102 200
1 20080103 -200
...
</code></pre>
<p>What I need is new table grouped by Account order by Account asc and Bookdate asc... | [
{
"answer_id": 439350,
"author": "Tom H",
"author_id": 5696608,
"author_profile": "https://Stackoverflow.com/users/5696608",
"pm_score": 2,
"selected": false,
"text": "<p>I'll start with this very important caveate: do NOT create a table to hold this data. When you do you will find that ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11621/"
] | I have a table like this (Oracle, 10)
```
Account Bookdate Amount
1 20080101 100
1 20080102 101
2 20080102 200
1 20080103 -200
...
```
What I need is new table grouped by Account order by Account asc and Bookdate asc with a running total fiel... | Do you really need the extra table?
You can get that data you need with a simple query, which you can obviously create as a view if you want it to appear like a table.
This will get you the data you are looking for:
```
select
account, bookdate, amount,
sum(amount) over (partition by account order by bookd... |
439,152 | <p>I am trying to understand how does joins work internally. What will be the difference between the way in which the following two queries would run?</p>
<pre><code>For example
(A)
Select *
FROM TABLE1
FULL JOIN TABLE2 ON TABLE1.ID = TABLE2.ID
FULL JOIN TABLE3 ON TABLE1.ID = TABLE3.ID
And
(B)
Select *
FROM TAB... | [
{
"answer_id": 439183,
"author": "Tony Andrews",
"author_id": 18747,
"author_profile": "https://Stackoverflow.com/users/18747",
"pm_score": 3,
"selected": false,
"text": "<p>Your DBMS's optimiser will determine how best to perform the query. Usually this is done by \"cost based optimisa... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439152",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38997/"
] | I am trying to understand how does joins work internally. What will be the difference between the way in which the following two queries would run?
```
For example
(A)
Select *
FROM TABLE1
FULL JOIN TABLE2 ON TABLE1.ID = TABLE2.ID
FULL JOIN TABLE3 ON TABLE1.ID = TABLE3.ID
And
(B)
Select *
FROM TABLE1
FULL JOIN ... | Your DBMS's optimiser will determine how best to perform the query. Usually this is done by "cost based optimisation", where a number of different query plans are considered and the most efficient one selected. **If** your two queries are logically identical, it is most likely that the optimiser will end up using the s... |
439,162 | <p>I typically declare the following in every class:</p>
<pre><code>private static readonly log4net.ILog log = log4net.LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
</code></pre>
<p>and use the static member within each class to log at different levels (info, debug,... | [
{
"answer_id": 469036,
"author": "empi",
"author_id": 49048,
"author_profile": "https://Stackoverflow.com/users/49048",
"pm_score": -1,
"selected": false,
"text": "<p>Lately, i created something like this:</p>\n\n<pre><code>public static class Logger\n{\n private static bool isLoaded ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25856/"
] | I typically declare the following in every class:
```
private static readonly log4net.ILog log = log4net.LogManager.GetLogger(
System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
```
and use the static member within each class to log at different levels (info, debug, etc.)
I saw that somewhe... | I basically use
```
public class MyClass
{
private static readonly ILog log = Log.Get<MyClass>();
}
```
where Log.Get is a class that basically does this internally
```
return LogManager.GetLogger(typeof(T));
```
The startup cost is even smaller than the reflection way as well as cleaner imo.
**Update:** giv... |
439,166 | <p>I'm hoping to clear some things up with anonymous delegates and lambda expressions being used to create a method for event handlers in C#, for myself at least.</p>
<p>Suppose we have an event that adds either an anonymous delegate or a lambda expression (for you lucky crowds that can use newer versions of .NET). </... | [
{
"answer_id": 439206,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 1,
"selected": false,
"text": "<p>I think the problem is you seem to be proceeding from the assumption that having a delegate assigned to an object... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439166",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8945/"
] | I'm hoping to clear some things up with anonymous delegates and lambda expressions being used to create a method for event handlers in C#, for myself at least.
Suppose we have an event that adds either an anonymous delegate or a lambda expression (for you lucky crowds that can use newer versions of .NET).
```
SomeCl... | If object X has an event handler whose *target* is object Y, then object X being alive means that object Y can't be garbage collected. It doesn't stop object X from being garbage collected.
Normally when something is disposed, it will become garbage pretty soon anyway, which means you don't have a problem.
The proble... |
439,167 | <p>I want to change Control(@Control) directive in a way to make it redistributable and want to use ClassName attribute</p>
<p>so I changed this</p>
<p><strong>From :</strong></p>
<pre><code><%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductShower.ascx.cs" Inherits=&quo... | [
{
"answer_id": 439582,
"author": "mbillard",
"author_id": 810,
"author_profile": "https://Stackoverflow.com/users/810",
"pm_score": 3,
"selected": true,
"text": "<p>With the new way, you're missing the <strong>CodeFile</strong> and <strong>Inherits</strong> attributes.</p>\n\n<p>The <str... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50506/"
] | I want to change Control(@Control) directive in a way to make it redistributable and want to use ClassName attribute
so I changed this
**From :**
```
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ProductShower.ascx.cs" Inherits="MyCompany.Web.Controls.ProductShower" %>
```
**To :**
```
<%@ Control L... | With the new way, you're missing the **CodeFile** and **Inherits** attributes.
The **Inherits** attribute tells the control which class has the code-behind. |
439,173 | <p>I have a a C# (FFx 3.5) application that loads DLLs as plug-ins. These plug-ins are loaded in separate AppDomains (for lots of good reasons, and this architecture cannot change). This is all well and good.</p>
<p>I now have a requirement to show a Dialog from one of those plug-ins. Bear in mind that I <em>cannot... | [
{
"answer_id": 442316,
"author": "Jonathan C Dickinson",
"author_id": 24064,
"author_profile": "https://Stackoverflow.com/users/24064",
"pm_score": 3,
"selected": true,
"text": "<p>Try using appdomain1's main form's BeginInvoke with a delegate that displays the form from appdomain2. So i... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13154/"
] | I have a a C# (FFx 3.5) application that loads DLLs as plug-ins. These plug-ins are loaded in separate AppDomains (for lots of good reasons, and this architecture cannot change). This is all well and good.
I now have a requirement to show a Dialog from one of those plug-ins. Bear in mind that I *cannot* return the dia... | Try using appdomain1's main form's BeginInvoke with a delegate that displays the form from appdomain2. So in Pseudocode:
```
Appdomain1:
AppDomain2.DoSomething(myMainForm);
AppDomain2:
DoSomething(Form parent)
{
Form foolishForm = new Form();
parent.BeginInvoke(new Action( delegate { fooli... |
439,175 | <p>When working with namespaces such as System.Data.Odbc or System.Data.OracleClient the various data reader methods generally require an integer corresponding to a column be provided to the functions (e.g. <a href="http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledatareader.getint32.aspx" rel="no... | [
{
"answer_id": 439204,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>I typically use option 3. I like it because if the underlying query ever changes the column order it will still wo... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1185/"
] | When working with namespaces such as System.Data.Odbc or System.Data.OracleClient the various data reader methods generally require an integer corresponding to a column be provided to the functions (e.g. [OracleDataReader.GetInt32](http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracledatareader.getint... | I agree with Andrew Hare, with the addition that I've enclosed the functionality in an overloaded extension method that simplifies the operation:
```
public static string GetStringByName(this OracleDataReader reader,
string columnName,
string ... |
439,184 | <p>I have a problem with LazyInitializationException even though I'm using openSessionInViewInterceptor. I've read so many posts about that topic and I've tried three or four different approaches to it.</p>
<p>First thing is that I don't want to set to false the lazzy attribute in the Hibernate configuration file. So,... | [
{
"answer_id": 488004,
"author": "Miguel Ping",
"author_id": 22992,
"author_profile": "https://Stackoverflow.com/users/22992",
"pm_score": 1,
"selected": false,
"text": "<p>I think you need a filter at the <strong>web.xml</strong> level:</p>\n\n<pre><code><filter>\n <filter-n... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439184",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a problem with LazyInitializationException even though I'm using openSessionInViewInterceptor. I've read so many posts about that topic and I've tried three or four different approaches to it.
First thing is that I don't want to set to false the lazzy attribute in the Hibernate configuration file. So, I want an... | I think you need a filter at the **web.xml** level:
```
<filter>
<filter-name>Spring OpenEntityManagerInViewFilter</filter-name>
<filter-class>org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter</filter-class>
</filter>
```
Only this way will spring be able to know when your view is being rende... |
439,187 | <p>I am having some trouble with <a href="http://pastebin.com/mbd132a7" rel="nofollow noreferrer">this code</a>. The problem is when i Request the Server to send me some data and the client just Disconnects when the server tries to send me data, the application Exists.</p>
<p>Here's the lines I think cause the problem... | [
{
"answer_id": 439258,
"author": "Greg Rogers",
"author_id": 5963,
"author_profile": "https://Stackoverflow.com/users/5963",
"pm_score": 4,
"selected": true,
"text": "<p>Perhaps your application is receiving SIGPIPE during the write/send and not ignoring it? Try ignoring this signal or i... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439187",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39106/"
] | I am having some trouble with [this code](http://pastebin.com/mbd132a7). The problem is when i Request the Server to send me some data and the client just Disconnects when the server tries to send me data, the application Exists.
Here's the lines I think cause the problem
```
int SendBinary(int *byte, int length)
{
... | Perhaps your application is receiving SIGPIPE during the write/send and not ignoring it? Try ignoring this signal or installing a do-nothing handler for it. |
439,215 | <p>I'm thinking about including the Apache POI into my application. Main goal is to output RTF document, but DOC would be nice, too. But the documentation is not very detailed about writing a HWPFDocument and everything I found on the web isn't helpful at all.</p>
<p>I can read DOC files, that's working without any pr... | [
{
"answer_id": 439320,
"author": "Igor Zelaya",
"author_id": 22769,
"author_profile": "https://Stackoverflow.com/users/22769",
"pm_score": 0,
"selected": false,
"text": "<p>Well,</p>\n\n<p>It has been a long time since the last time I used POI. I read that the HWPFDocument is now orphan... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439215",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/834/"
] | I'm thinking about including the Apache POI into my application. Main goal is to output RTF document, but DOC would be nice, too. But the documentation is not very detailed about writing a HWPFDocument and everything I found on the web isn't helpful at all.
I can read DOC files, that's working without any problem. But... | If you want to do RTF, These are text files and they are support in all versions of Word.
you can use itext for simple stuff
<http://itextdocs.lowagie.com/tutorial/rtf/index.php>
ro
you can export them the hard way
//-- save as example.doc -------------
```
{
\rtf1
\ansi
\ansicpg1252
\deff0
\deflang1033
{\font... |
439,218 | <p>Why is my mod_rewrite doing this?</p>
<pre><code>add path info postfix: /home/mobelluk/public_html/about.php -> /home/mobelluk/public_html/about.php/
</code></pre>
<p>which results in an unwanted trailing slash on EVERYTHING.</p>
<p>I have disabled all my .htaccess rules so they're out of the equation.</p>
| [
{
"answer_id": 441069,
"author": "Grant Wagner",
"author_id": 9254,
"author_profile": "https://Stackoverflow.com/users/9254",
"pm_score": 3,
"selected": true,
"text": "<p>Is it possible the new server has <a href=\"http://httpd.apache.org/docs/2.2/mod/mod_dir.html\" rel=\"nofollow norefe... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26107/"
] | Why is my mod\_rewrite doing this?
```
add path info postfix: /home/mobelluk/public_html/about.php -> /home/mobelluk/public_html/about.php/
```
which results in an unwanted trailing slash on EVERYTHING.
I have disabled all my .htaccess rules so they're out of the equation. | Is it possible the new server has [mod\_dir](http://httpd.apache.org/docs/2.2/mod/mod_dir.html) loaded, with `DirectorySlash On` where the old one did not and that is leading to this problem?
(Note that `DirectorySlash On` is the default if `mod_dir` is loaded and nothing is overriding it) |
439,226 | <p>I am trying to take the string "<code><BR></code>" in VB.NET and convert it to HTML through XSLT. When the HTML comes out, though, it looks like this:</p>
<pre><code>&lt;BR&gt;
</code></pre>
<p>I can only assume it goes ahead and tries to render it. Is there any way I can convert those <code>&l... | [
{
"answer_id": 439237,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 4,
"selected": true,
"text": "<p>Check the XSLT has:</p>\n\n<pre><code><xsl:output method=\"html\"/>\n</code></pre>\n\n<hr>\n\n<p>edit: explanatio... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13244/"
] | I am trying to take the string "`<BR>`" in VB.NET and convert it to HTML through XSLT. When the HTML comes out, though, it looks like this:
```
<BR>
```
I can only assume it goes ahead and tries to render it. Is there any way I can convert those `</>` back into the brackets so I get the line break I'm tr... | Check the XSLT has:
```
<xsl:output method="html"/>
```
---
edit: explanation from comments
By default XSLT outputs as XML(1) which means it will escape any significant characters. You can override this in specific instances with the attribute `disable-output-escaping="yes"` (intro [here](http://www.dpawson.co.uk/... |
439,255 | <p>I want to extract the first folder in the URL below, in this example it is called 'extractThisFolderName' but the folder could have any name and be any length. With this in mind how can I use substring to extract the first folder name?</p>
<p>The string: www.somewebsite.com/extractThisFolderName/leave/this/behind</... | [
{
"answer_id": 439264,
"author": "Daniel Schaffer",
"author_id": 2596,
"author_profile": "https://Stackoverflow.com/users/2596",
"pm_score": 4,
"selected": false,
"text": "<p>If you're getting a Uri, why not just do uri.Segments[0]?</p>\n\n<p>Or even <code>path.Split(new Char[] { '/' })[... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439255",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I want to extract the first folder in the URL below, in this example it is called 'extractThisFolderName' but the folder could have any name and be any length. With this in mind how can I use substring to extract the first folder name?
The string: www.somewebsite.com/extractThisFolderName/leave/this/behind
```
String... | If you're getting a Uri, why not just do uri.Segments[0]?
Or even `path.Split(new Char[] { '/' })[1]` ? |
439,265 | <p>I have a dropdown, I have a datasource, I have <code>AutoPostBack</code> set to <code>true</code>.<br>
I want to add a first entry to the datasource that says something like "--- select country ---" and selecting this entry won't cause postback.<br>
This feels like it should be easy to do, yet I can't seem to be abl... | [
{
"answer_id": 439280,
"author": "Daniel Schaffer",
"author_id": 2596,
"author_profile": "https://Stackoverflow.com/users/2596",
"pm_score": 5,
"selected": true,
"text": "<p>In your aspx page (the important part is handling the DataBound event and setting CausesValidation=\"true\" to fo... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1287/"
] | I have a dropdown, I have a datasource, I have `AutoPostBack` set to `true`.
I want to add a first entry to the datasource that says something like "--- select country ---" and selecting this entry won't cause postback.
This feels like it should be easy to do, yet I can't seem to be able to find a good solution. ... | In your aspx page (the important part is handling the DataBound event and setting CausesValidation="true" to force validation of a drop down list):
```
<asp:DropDownList ID="ddlCountries" runat="server" DataSourceID="dsCountries" AutoPostBack="true" OnDataBound="ddlCountries_DataBound" CausesValidation="true" />
<asp:... |
439,269 | <p>I'm using the following to grab some updated HTML and insert it into a div with id "content"</p>
<pre><code>var updater = new Ajax.PeriodicalUpdater('content', '/Doc?'+d.getTime(),
{
method: 'post',
frequency: 5,
});
</code></pre>
<p>The problem is that when the server is shut down (it's running inside... | [
{
"answer_id": 439292,
"author": "Vinze",
"author_id": 26859,
"author_profile": "https://Stackoverflow.com/users/26859",
"pm_score": 1,
"selected": false,
"text": "<p>you can add a onFailure option in the option list as the Ajax.PeriodicalUpdater inherits the properties of Ajax.Request (... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/194/"
] | I'm using the following to grab some updated HTML and insert it into a div with id "content"
```
var updater = new Ajax.PeriodicalUpdater('content', '/Doc?'+d.getTime(),
{
method: 'post',
frequency: 5,
});
```
The problem is that when the server is shut down (it's running inside of an app that is modifyi... | Pass an object (not a string) as the first parameter to PeriodicalUpdater. The value keyed as 'success' will only be called on successful AJAX calls.
```
new Ajax.PeriodicalUpdater({success: 'content'}, '/Doc?'+d.getTime(),
{
method: 'post',
frequency: 5,
});
```
[More on Ajax.Updater](http://www.prototy... |
439,286 | <p>So I've been able to get Greasemonkey and jQuery 1.2.6 to work together without issue, but, now I'm wondering how to embed additional jQuery plugins into my Greasemonkey script, such as Eric Martin's SimpleModal plugin (<a href="http://www.ericmmartin.com/projects/simplemodal/" rel="noreferrer">http://www.ericmmarti... | [
{
"answer_id": 439378,
"author": "Steve Davis",
"author_id": 21131,
"author_profile": "https://Stackoverflow.com/users/21131",
"pm_score": 5,
"selected": true,
"text": "<p>First, if you are OK with not having Firebug debugging access the easiest way to include jquery is to use the requir... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38375/"
] | So I've been able to get Greasemonkey and jQuery 1.2.6 to work together without issue, but, now I'm wondering how to embed additional jQuery plugins into my Greasemonkey script, such as Eric Martin's SimpleModal plugin (<http://www.ericmmartin.com/projects/simplemodal/>).
The following code gets jQuery loaded, but I'm... | First, if you are OK with not having Firebug debugging access the easiest way to include jquery is to use the require settings:
```
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js
// @require http://ajax.googleapis.com/ajax/libs/jqueryui/1.5.2/jquery-ui.min.js
```
Following... |
439,297 | <p>I've created a javascript function that allows me to validate if one field or the other is filled (called, shockingly enough, <code>oneortheother</code>). Essentially, it checks if neither is filled, or both, and throws an error.</p>
<p>One of the fields being validated is a <code>input type="file"</code> field. I... | [
{
"answer_id": 439410,
"author": "jacobangel",
"author_id": 31318,
"author_profile": "https://Stackoverflow.com/users/31318",
"pm_score": 2,
"selected": true,
"text": "<p>I am not sure how your validation function works, but it seems like you could add a hidden input that holds the url o... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439297",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16645/"
] | I've created a javascript function that allows me to validate if one field or the other is filled (called, shockingly enough, `oneortheother`). Essentially, it checks if neither is filled, or both, and throws an error.
One of the fields being validated is a `input type="file"` field. I'm displaying below the field the... | I am not sure how your validation function works, but it seems like you could add a hidden input that holds the url of the uploaded preview file OR the value in the file input. Then you could just compare the url input with the hidden input.
But it seems likely you'll just need to write a custom validation function. |
439,302 | <p>Is there a way in Java to get a method to lock (mutex) the object which it is in?</p>
<p>I know this sounds confusing but basically I wan't an equivelent to this snippet of C# but in Java.</p>
<pre><code>lock(this)
{
// Some code here...
}
</code></pre>
<p>I've been tasked with reimplementing an API written i... | [
{
"answer_id": 439317,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 5,
"selected": true,
"text": "<p>The equivalent of that is:</p>\n\n<pre><code>synchronized (this)\n{\n}\n</code></pre>\n\n<p>(And no, you shouldn't gen... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20400/"
] | Is there a way in Java to get a method to lock (mutex) the object which it is in?
I know this sounds confusing but basically I wan't an equivelent to this snippet of C# but in Java.
```
lock(this)
{
// Some code here...
}
```
I've been tasked with reimplementing an API written in .Net into Java, and I've been a... | The equivalent of that is:
```
synchronized (this)
{
}
```
(And no, you shouldn't generally do it in either C# or Java. Prefer locking on private references which nothing else has access to. You may be aware of that already, of course - but I didn't want to leave an answer without the warning :) |
439,307 | <p>I've actually asked about this already in <a href="https://stackoverflow.com/questions/406279/asp-net-web-architecture-design">this post</a> although we've gone back to the drawing board and found it's much more difficult than we initially thought. We develop a large (and very much relied upon) Intranet system whic... | [
{
"answer_id": 439344,
"author": "Mark Brittingham",
"author_id": 15592,
"author_profile": "https://Stackoverflow.com/users/15592",
"pm_score": 1,
"selected": false,
"text": "<p>Kezzer - are you sure that you want to take an existing (and working, I assume) system and completely rewrite ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39693/"
] | I've actually asked about this already in [this post](https://stackoverflow.com/questions/406279/asp-net-web-architecture-design) although we've gone back to the drawing board and found it's much more difficult than we initially thought. We develop a large (and very much relied upon) Intranet system which has evolved t... | * You shouldn't have to, just like the idea behind complex types. You can drop in min-views into a full fledged view to separate repetition.
* You can use Html.ActionLink for creating links to pages and you can use Html.RenderPartial or Html.RenderAction to render a whole action into your page.
* For sure. Like I said ... |
439,309 | <p>How can I configure my WCF service to run under the administrator account? (this is not for production, just testing).</p>
<p>Is it simply a web.config tweak?</p>
<p>IIS 7 hosted WCF service.</p>
| [
{
"answer_id": 439344,
"author": "Mark Brittingham",
"author_id": 15592,
"author_profile": "https://Stackoverflow.com/users/15592",
"pm_score": 1,
"selected": false,
"text": "<p>Kezzer - are you sure that you want to take an existing (and working, I assume) system and completely rewrite ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | How can I configure my WCF service to run under the administrator account? (this is not for production, just testing).
Is it simply a web.config tweak?
IIS 7 hosted WCF service. | * You shouldn't have to, just like the idea behind complex types. You can drop in min-views into a full fledged view to separate repetition.
* You can use Html.ActionLink for creating links to pages and you can use Html.RenderPartial or Html.RenderAction to render a whole action into your page.
* For sure. Like I said ... |
439,323 | <p>In java I can simply test classes directly with </p>
<pre><code>public static void main()
</code></pre>
<p>I then just add quick code and under Eclipse "Run" the class. Is there anything similar in C++ .NET ?</p>
<p>Right now I have to create an empty project, reference the correct headers then set that project a... | [
{
"answer_id": 439362,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 2,
"selected": false,
"text": "<p><a href=\"http://en.wikipedia.org/wiki/Unit_testing\" rel=\"nofollow noreferrer\">Unit tests</a>. There's also the ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6367/"
] | In java I can simply test classes directly with
```
public static void main()
```
I then just add quick code and under Eclipse "Run" the class. Is there anything similar in C++ .NET ?
Right now I have to create an empty project, reference the correct headers then set that project as start up project. | [Unit tests](http://en.wikipedia.org/wiki/Unit_testing). There's also the [object test bench](http://msdn.microsoft.com/en-us/library/c3775d98(VS.80).aspx) if you're using VS. |
439,334 | <p>I've developed a windows service application using Visual Studio 2008 / C#.</p>
<p>I have an app.config file in the project. When installed, the app.exe.config file appears beside the executable but it appears not to be reading the values from it when I try to access them through ConfigurationManager.AppSettings.</... | [
{
"answer_id": 439349,
"author": "Alex Reitbort",
"author_id": 11525,
"author_profile": "https://Stackoverflow.com/users/11525",
"pm_score": 1,
"selected": false,
"text": "<p>App.config file should be renamed to your_exe_file_name.exe.config and placed near the exe file.</p>\n"
},
{
... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439334",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've developed a windows service application using Visual Studio 2008 / C#.
I have an app.config file in the project. When installed, the app.exe.config file appears beside the executable but it appears not to be reading the values from it when I try to access them through ConfigurationManager.AppSettings.
Has it cop... | I located the error and it was related to file permissions. After installing the service, my local user account didn't have access to modify the app.exe.config file.
The tool I was using to edit was not informing me it was being denied access to save the file - that's notepad++ if anyone is interested - so I couldn't ... |
439,358 | <p>How to get real image width & height (cross browser) by JavaScript function ?</p>
| [
{
"answer_id": 439373,
"author": "Andrzej Doyle",
"author_id": 45664,
"author_profile": "https://Stackoverflow.com/users/45664",
"pm_score": 2,
"selected": false,
"text": "<p>Yay, <a href=\"http://www.google.co.uk/search?q=javascript+image+width+height\" rel=\"nofollow noreferrer\">Googl... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439358",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44533/"
] | How to get real image width & height (cross browser) by JavaScript function ? | First of all, you have a greater chance of getting your question answered if you'd just ask it in a more polite way, and supplying as much relevant information as possible.
Anyway...
For as far as I know, you can use the **`.width` property** across pretty much all browsers:
```
function getDimensions(id) {
var ... |
439,382 | <p>Hi is there away to detect the length of a byte before I get the error message:</p>
<p>Length cannot be less than zero. Parameter name: length</p>
<p>I get the error on this line:</p>
<p>new_username = new_username.Substring(0, new_username.IndexOf(" Joined "))</p>
<p>I am removing the "joined" from the string I... | [
{
"answer_id": 439394,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>Try this:</p>\n\n<pre><code>new_username = new_Username.Replace(\" Joined \", \"\")\n</code></pre>\n\n<p>Be warned ... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439382",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Hi is there away to detect the length of a byte before I get the error message:
Length cannot be less than zero. Parameter name: length
I get the error on this line:
new\_username = new\_username.Substring(0, new\_username.IndexOf(" Joined "))
I am removing the "joined" from the string I get....how can I ignore it ... | I would test to see what IndexOf returned before using it in this context:
```
if(new_username.IndexOf(" Joined") > 0)
{
new_username = new_username.Substring(0, new_username.IndexOf(" Joined "))
}
``` |
439,390 | <p>This is a crude korn shell script that someone else wrote. I don't know much about using shell syntax and I'm not even sure if this is possible.</p>
<p>Is there any way for me to run this file and be prompted for the date so that I don't have to manually go into the script and change it each time?</p>
<p>For exam... | [
{
"answer_id": 439415,
"author": "Scottie T",
"author_id": 6688,
"author_profile": "https://Stackoverflow.com/users/6688",
"pm_score": 2,
"selected": false,
"text": "<p>$1 is the first command line argument. This goes up to $9. Check this <a href=\"http://www.bolthole.com/solaris/ksh-v... | 2009/01/13 | [
"https://Stackoverflow.com/questions/439390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42229/"
] | This is a crude korn shell script that someone else wrote. I don't know much about using shell syntax and I'm not even sure if this is possible.
Is there any way for me to run this file and be prompted for the date so that I don't have to manually go into the script and change it each time?
For example, I want to rep... | If you want to be prompted (as opposed to passing the date in as a parameter), use the following logic (or something similar):
```
date=
while [ -z $date ]
do
echo -n 'Date? '
read date
done
```
That loop will continue to prompt for the date until the user enters something (anything) other than a simple RETU... |