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 |
|---|---|---|---|---|---|---|
457,803 | <p>In Unix C programming, is it considered good practice to explicitly close file handles before the process exits, or is it instead good practice to let the OS close the file handles and thus avoid unnecessary code?</p>
<p>Which of the two would generally be considered as the preferred alternative?</p>
<p>Example:</... | [
{
"answer_id": 457810,
"author": "Joao da Silva",
"author_id": 46329,
"author_profile": "https://Stackoverflow.com/users/46329",
"pm_score": 1,
"selected": false,
"text": "<p>It's very good practice to close the descriptor if your program will go on but the descriptor isn't required anym... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/276/"
] | In Unix C programming, is it considered good practice to explicitly close file handles before the process exits, or is it instead good practice to let the OS close the file handles and thus avoid unnecessary code?
Which of the two would generally be considered as the preferred alternative?
Example:
```
int main (int... | Generally the code that's doing the opening and closing doesn't know if the process is going to immediately exit - so it's best to include explicit code.
Even if the code is residing on the top-level main() function, it would still be a good idea in case the code is ever re-used. |
457,814 | <p>Some of my classes have final fields that are populated from the constructor as well as properties that can be assigned from getters and setters.</p>
<p>If I can do this using spring, what does the springcontext.xml file look like that creates objects in this way?</p>
<p>Thank you</p>
| [
{
"answer_id": 457845,
"author": "Simon Groenewolt",
"author_id": 31884,
"author_profile": "https://Stackoverflow.com/users/31884",
"pm_score": 4,
"selected": true,
"text": "<pre><code><bean id=\"testWithConstructorArg\"\n class=\"com.Test\">\n <constructor-arg ref... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2443/"
] | Some of my classes have final fields that are populated from the constructor as well as properties that can be assigned from getters and setters.
If I can do this using spring, what does the springcontext.xml file look like that creates objects in this way?
Thank you | ```
<bean id="testWithConstructorArg"
class="com.Test">
<constructor-arg ref="referencingSomething"/>
</bean>
```
more: <http://www.javalobby.org/java/forums/t18396.html> |
457,826 | <p>Please advise how to pass parameters into a function called using <code>setInterval</code>.</p>
<p>My example <code>setInterval(funca(10,3), 500);</code> is incorrect. </p>
| [
{
"answer_id": 457830,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 10,
"selected": true,
"text": "<p>You need to create an anonymous function so the actual function isn't executed right away.</p>\n\n<pre><code>setInte... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50851/"
] | Please advise how to pass parameters into a function called using `setInterval`.
My example `setInterval(funca(10,3), 500);` is incorrect. | You need to create an anonymous function so the actual function isn't executed right away.
```
setInterval( function() { funca(10,3); }, 500 );
``` |
457,837 | <p>Is there anyway to make an image map W3C XHTML 1.0 Strict compliant?</p>
<p>I'm working on <a href="http://www.xebra.com/indexnew.html" rel="nofollow noreferrer">this page</a> and when I click my W3C Validator badge I receive a validation error. </p>
<pre><code>There is no attribute "type", <area type="rect" c... | [
{
"answer_id": 457859,
"author": "Mike B",
"author_id": 3609,
"author_profile": "https://Stackoverflow.com/users/3609",
"pm_score": 2,
"selected": false,
"text": "<p>Image Maps aren't used as much as they used to be, but a couple of websites (Facebook, MySpace, Flickr) use them to tag ph... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18149/"
] | Is there anyway to make an image map W3C XHTML 1.0 Strict compliant?
I'm working on [this page](http://www.xebra.com/indexnew.html) and when I click my W3C Validator badge I receive a validation error.
```
There is no attribute "type", <area type="rect" coords="21,19,155,76" ...
```
Are there any tags for the XHTM... | Success!
--------
I found the answer thanks to someone at [Ozone Asylum](http://www.ozoneasylum.com/) who directed me to a, [A List Apart article](http://www.alistapart.com/articles/sprites/) on [css sprites](http://www.alistapart.com/articles/sprites/). You can do the same thing it's just not as strait forward. (But ... |
457,856 | <p>There is a data file and some image files that I have to download to our local servers every night using asp.net. What is the best way to do this?</p>
<p>UPDATE</p>
<p>Ok, after viewing the responses I see my initial post of using asp.net is a poor choice. How would you write it for a console app in C#. I am not s... | [
{
"answer_id": 457873,
"author": "TheTXI",
"author_id": 22164,
"author_profile": "https://Stackoverflow.com/users/22164",
"pm_score": 0,
"selected": false,
"text": "<p>To do it every night you would set it up as a scheduled task on your server to hit a particular asp.net web page to exec... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457856",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45429/"
] | There is a data file and some image files that I have to download to our local servers every night using asp.net. What is the best way to do this?
UPDATE
Ok, after viewing the responses I see my initial post of using asp.net is a poor choice. How would you write it for a console app in C#. I am not sure what classes ... | >
>
> >
> > "How would you write it for a console app in C#."
> >
> >
> >
>
>
>
Create a C# console application. Add a reference to System.Net.
```
using System;
using System.Net;
namespace Downloader
{
class Program
{
public static void Main(string[] args)
{
using (WebC... |
457,896 | <p>Why is it impossible to have a reference to void? The only thing I found in the C++ Standard is this line, at <strong>8.3.2.1</strong></p>
<blockquote>
<p>A declarator that specifies the type "reference to <em>cv</em> void" is ill-formed.</p>
</blockquote>
<p>Why is it that way? Why can't I write a "generic" fun... | [
{
"answer_id": 457921,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 2,
"selected": false,
"text": "<p>A reference is a reference to an instance of something.\nAn instance of something can't be of type <code>void</code>.\nA... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457896",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20984/"
] | Why is it impossible to have a reference to void? The only thing I found in the C++ Standard is this line, at **8.3.2.1**
>
> A declarator that specifies the type "reference to *cv* void" is ill-formed.
>
>
>
Why is it that way? Why can't I write a "generic" function that accept a `void&`?
Just to be clear, I h... | If you did have a reference to void, what would you do with it? It wouldn't be a number, or a character, or a pointer, or anything like that. Your hypothetical generic function couldn't perform any operation on it, except taking its address (and not its size).
"void" has two uses: to disclaim any knowledge of type (as... |
457,909 | <p>I need to describe an external library in a Jamfile. The location of the library is held in an environment variable.</p>
<pre><code>set EX_LIB_PATH=C:\Program Files\Ext
</code></pre>
<p>Here is the snippet from the Jamfile:</p>
<p>--snip--</p>
<pre><code>lib extlin : : <file>$(EXT_LIB_PATH)/lib/library.li... | [
{
"answer_id": 782247,
"author": "AFoglia",
"author_id": 79513,
"author_profile": "https://Stackoverflow.com/users/79513",
"pm_score": 0,
"selected": false,
"text": "<p>Did you try putting it in quotes?</p>\n\n<pre><code>lib extlin : : <file>\"$(EXT_LIB_PATH)/lib/library.lib\" ;\n<... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457909",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56716/"
] | I need to describe an external library in a Jamfile. The location of the library is held in an environment variable.
```
set EX_LIB_PATH=C:\Program Files\Ext
```
Here is the snippet from the Jamfile:
--snip--
```
lib extlin : : <file>$(EXT_LIB_PATH)/lib/library.lib ;
```
--spin--
bjam croaks saying that "C:\Pro... | A bit late, but for reference, try this:
```
lib extlin : : <file>"$(EXT_LIB_PATH:J=\ )/lib/library.lib" ;
```
Worked for me on Boost.Jam Version 3.1.10. OS=NT. |
457,927 | <p>I've been using Git now for a couple of months on a project with one other developer. I have several years of experience with <a href="http://en.wikipedia.org/wiki/Apache_Subversion" rel="noreferrer">SVN</a>, so I guess I bring a lot of baggage to the relationship.</p>
<p>I have heard that Git is excellent for bran... | [
{
"answer_id": 457960,
"author": "Bombe",
"author_id": 43582,
"author_profile": "https://Stackoverflow.com/users/43582",
"pm_score": 3,
"selected": false,
"text": "<p>With Git there is no “correct” workflow. Use whatever floats your boat. However, if you constantly get conflicts when mer... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19964/"
] | I've been using Git now for a couple of months on a project with one other developer. I have several years of experience with [SVN](http://en.wikipedia.org/wiki/Apache_Subversion), so I guess I bring a lot of baggage to the relationship.
I have heard that Git is excellent for branching and merging, and so far, I just ... | "Conflicts" mean "parallel evolutions of a same content". So if it goes "all to hell" during a merge, it means you have massive evolutions on the same set of files.
The reason why a rebase is then better than a merge is that:
* you rewrite your local commit history with the one of the master (and then reapply your wo... |
457,929 | <p>I have this little script to toggle a contact form when a button is clicked :</p>
<pre><code>$(document).ready(function(){
$("#button").click(function () {
$("#form").toggle("slow");
});
});
</code></pre>
<p>All is working OK in Firefox, but in IE it seems like the toggle's fade-in effect doesn't g... | [
{
"answer_id": 457940,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 4,
"selected": true,
"text": "<p>This may be what you're looking for. Also, there is a <a href=\"http://malsup.com/jquery/fadetest.html\" rel=\"nofollow ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457929",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56717/"
] | I have this little script to toggle a contact form when a button is clicked :
```
$(document).ready(function(){
$("#button").click(function () {
$("#form").toggle("slow");
});
});
```
All is working OK in Firefox, but in IE it seems like the toggle's fade-in effect doesn't gets 100% complete, and the... | This may be what you're looking for. Also, there is a [functional demo of another similar method](http://malsup.com/jquery/fadetest.html) available online.:
```
//-------------------------------------------------------------------------------------------------------
// ClearTypeFadeTo / ClearTypeFadeIn / ClearTypeFade... |
457,932 | <p>I have a <code>System.Windows.Forms.TreeView</code> docked inside a panel. I am setting a node selected programmatically. What method or property would I use to have the treeview scroll the selected into view?</p>
| [
{
"answer_id": 457938,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 6,
"selected": true,
"text": "<pre><code>node.EnsureVisible();\n</code></pre>\n\n<p>for example:</p>\n\n<pre><code>if(treeView.SelectedNode != null)... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54009/"
] | I have a `System.Windows.Forms.TreeView` docked inside a panel. I am setting a node selected programmatically. What method or property would I use to have the treeview scroll the selected into view? | ```
node.EnsureVisible();
```
for example:
```
if(treeView.SelectedNode != null) treeView.SelectedNode.EnsureVisible();
```
(see [MSDN](http://msdn.microsoft.com/en-us/library/system.windows.forms.treenode.ensurevisible.aspx)) |
457,933 | <p>Is it possible to create a java representation of a package-level oracle associative array. For example, given the following:</p>
<pre><code>CREATE OR REPLACE PACKAGE MyPackage AS
TYPE t_numbers IS TABLE OF NUMBER INDEX BY PLS_INTEGER;
</code></pre>
<p>I find I cannot write the following java:</p>
<pre><code>... | [
{
"answer_id": 458090,
"author": "tuinstoel",
"author_id": 43901,
"author_profile": "https://Stackoverflow.com/users/43901",
"pm_score": 4,
"selected": true,
"text": "<p>See <a href=\"http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3696816290928\" rel=\"nofollow noref... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45062/"
] | Is it possible to create a java representation of a package-level oracle associative array. For example, given the following:
```
CREATE OR REPLACE PACKAGE MyPackage AS
TYPE t_numbers IS TABLE OF NUMBER INDEX BY PLS_INTEGER;
```
I find I cannot write the following java:
```
ArrayDescriptor descriptor =
Arra... | See <http://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:3696816290928> and especially <http://download.oracle.com/docs/cd/B10501_01/java.920/a96654/oci_func.htm#1017512> . |
457,934 | <p>I´m in need to pass some results from the database around. Instead of pass a whole dataset, or a constructed sql query, I tried to pass a LinqDataSource configured object.</p>
<p>On the source page, I configure the LinqDataSource object properties <strong>Where</strong> and <strong>WhereParameters</strong> using the... | [
{
"answer_id": 458067,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 0,
"selected": false,
"text": "<p>What is your goal? If you want to keep the application from having to go back to the database, then you will need t... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457934",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27959/"
] | I´m in need to pass some results from the database around. Instead of pass a whole dataset, or a constructed sql query, I tried to pass a LinqDataSource configured object.
On the source page, I configure the LinqDataSource object properties **Where** and **WhereParameters** using the values set by the user on the cont... | You should **not** be storing the DataContext in Session (or anywhere) for the following reasons:
* The DataContext isn't thread safe
* The DataContext is designed as a Unit-Of-Work tool
If you query a collection within the DataContext it is internally cached, so when you requery it you don't do a round-trip to the d... |
457,951 | <p>i am currently trying to convert an integer into a list.</p>
<p>E.g.</p>
<p>1234 => List composed of 1, 2, 3, 4</p>
<p>I have this:</p>
<pre><code>(string->list (number->string 1234))
</code></pre>
<p>Unfortunately it adds #'s and \'s to it. I am guessing this is a string representation of a number. How c... | [
{
"answer_id": 457982,
"author": "Kyle Cronin",
"author_id": 658,
"author_profile": "https://Stackoverflow.com/users/658",
"pm_score": 4,
"selected": true,
"text": "<p>Here's a function I wrote that breaks the number down by dividing by 10 each time:</p>\n\n<pre><code>(define (num->li... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34395/"
] | i am currently trying to convert an integer into a list.
E.g.
1234 => List composed of 1, 2, 3, 4
I have this:
```
(string->list (number->string 1234))
```
Unfortunately it adds #'s and \'s to it. I am guessing this is a string representation of a number. How can i remove these symbols. Since i need to reorder th... | Here's a function I wrote that breaks the number down by dividing by 10 each time:
```
(define (num->list num)
(if (< num 10)
(list num)
(append (num->list (floor (/ num 10)))
(list (- num (* 10 (floor (/ num 10))))))))
```
Obviously this will only work with positive integers, but if you ... |
457,970 | <p>I have an xml file from which I am extracting html using LINQ to XML. This is a sample of the file:</p>
<pre><code><?xml version="1.0" encoding="utf-8" ?>
<tips>
<tip id="0">
This is the first tip.
</tip>
<tip id="1">
Use <b>Windows Live Writer</b> or <b>... | [
{
"answer_id": 457999,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 4,
"selected": true,
"text": "<p>Call <code>t.ToString()</code> instead of <code>Value</code>. That will return the XML as a string. You may want to us... | 2009/01/19 | [
"https://Stackoverflow.com/questions/457970",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56719/"
] | I have an xml file from which I am extracting html using LINQ to XML. This is a sample of the file:
```
<?xml version="1.0" encoding="utf-8" ?>
<tips>
<tip id="0">
This is the first tip.
</tip>
<tip id="1">
Use <b>Windows Live Writer</b> or <b>Microsoft Word 2007</b> to create and publish content.
</tip>
<... | Call `t.ToString()` instead of `Value`. That will return the XML as a string. You may want to use the overload taking SaveOptions to disable formatting. I can't check right now, but I suspect it will include the element tag (and elements) so you would need to strip this off.
Note that if your HTML isn't valid XML, you... |
458,027 | <p>How can I create an editable but transparent image in Java ME?</p>
| [
{
"answer_id": 475673,
"author": "Lawrence Dol",
"author_id": 8946,
"author_profile": "https://Stackoverflow.com/users/8946",
"pm_score": 0,
"selected": false,
"text": "<p>Use a GIF or PNG - both support transparent pixels.</p>\n"
},
{
"answer_id": 3725096,
"author": "Vijay C... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458027",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I create an editable but transparent image in Java ME? | If you want to create the transparent image programmatically then following is the snippet.
```
int width = 50, height = 50;
Image image = Image.createImage(width,height);
int[] rgbArr = new int[width * height];
image.getRGB(rgbArr, 0, width, 0, 0, width, height);
for (int i = 0; i < rgbArr.length; i++) {
if(... |
458,060 | <p>I need the code to a couter that is allowed to overflow and where < > continue to tell earlier values from later values, for some defined interval.</p>
<p>To clarify, one possible implementation would be:</p>
<p>Consider two such counters <code>cur</code> and <code>dut</code> (device under test), consider two f... | [
{
"answer_id": 458075,
"author": "shodanex",
"author_id": 11589,
"author_profile": "https://Stackoverflow.com/users/11589",
"pm_score": 0,
"selected": false,
"text": "<p>It seems to me you just wrote it :). \nWhy not translate your post into some C code ? </p>\n"
},
{
"answer_id... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458060",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24937/"
] | I need the code to a couter that is allowed to overflow and where < > continue to tell earlier values from later values, for some defined interval.
To clarify, one possible implementation would be:
Consider two such counters `cur` and `dut` (device under test), consider two functions:
```
bool isEarlier(cur, dut) ... | I think you're talking about handling the wraparound of the number circle correctly. It's quite easy, actually.
This doesn't do precisely what you said (not sure why you have that "exception" interval), but:
```
typedef unsigned short uint16_t;
typedef signed short int16_t;
// abstract out 16-bit types in case "short... |
458,098 | <p>I’m having a little Architecture problem. In my project I have a Business Logic Layer (BLL) that contains all my business rules, models and OO API for the interface. Each object has static methods like getById that return an instance of said object. Each object also has methods like save and, delete. This is very st... | [
{
"answer_id": 458153,
"author": "Craig Wilson",
"author_id": 25333,
"author_profile": "https://Stackoverflow.com/users/25333",
"pm_score": 5,
"selected": true,
"text": "<p>I think your data access pattern is fine. What you are not doing is coupling your BLL to the OracleDAL. You are c... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I’m having a little Architecture problem. In my project I have a Business Logic Layer (BLL) that contains all my business rules, models and OO API for the interface. Each object has static methods like getById that return an instance of said object. Each object also has methods like save and, delete. This is very strai... | I think your data access pattern is fine. What you are not doing is coupling your BLL to the OracleDAL. You are coupling to the DAL interfaces. A certain bit of coupling is absolutely required or you could never get anything done.
I assume that your DataFactory and the INewsItemRepository classes exist outside your DA... |
458,109 | <p>Where is the best place to put the constant in a condition? Left side or Right side?</p>
<p>I personally use in the right side:</p>
<pre><code>if($value > 23)
{
}
</code></pre>
| [
{
"answer_id": 458115,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 3,
"selected": true,
"text": "<p>The right side. The left side is a tradition in C/C++ because people sometimes forget and uses \"=\" instead of \"=... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458109",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36532/"
] | Where is the best place to put the constant in a condition? Left side or Right side?
I personally use in the right side:
```
if($value > 23)
{
}
``` | The right side. The left side is a tradition in C/C++ because people sometimes forget and uses "=" instead of "==" and putting the const on the left side causes a compilation error in this case. |
458,114 | <p>I was looking for an answer for a <a href="https://stackoverflow.com/questions/457463/putting-jcombobox-into-jtable">previous question</a> and had an ingenious idea to overcome a limit on <code>JTable</code>. I need the editor to be different on a row by row basis, whereas <code>JTable</code> can only handle a sin... | [
{
"answer_id": 458213,
"author": "Cogsy",
"author_id": 48234,
"author_profile": "https://Stackoverflow.com/users/48234",
"pm_score": 1,
"selected": false,
"text": "<p>My theory is that when all the mouse listeners registered to the Table/TableCell are invoked, the ones installed to the A... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458114",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9774/"
] | I was looking for an answer for a [previous question](https://stackoverflow.com/questions/457463/putting-jcombobox-into-jtable) and had an ingenious idea to overcome a limit on `JTable`. I need the editor to be different on a row by row basis, whereas `JTable` can only handle a single editor for each column.
So my id... | I'm not sure why your code isn't working (it's been a while since I've done Swing), but why don't you just override
```
public TableCellEditor getCellEditor(int row, int column)
```
On your JTable? Maintain a map of the combo boxes you want to use for each row and in your overriden method return the correct one. |
458,121 | <p>Say I have some windows method and a struct:</p>
<pre><code>struct SomeStruct{
int foo;
int bar;
int baz;
int bat;
}
SomeMethod(int a,int wParam, int lParam)
{
SomeStruct s;
// get lParam into SomeStruct
}
</code></pre>
<p>How to I get the lParam into a SomeStruct variable? I'm thinking that I need somethi... | [
{
"answer_id": 458150,
"author": "ChrisW",
"author_id": 49942,
"author_profile": "https://Stackoverflow.com/users/49942",
"pm_score": 4,
"selected": true,
"text": "<p>Yes, assuming that lParam 'really' contains a pointer to the struct, then you get at it by 'casting':</p>\n\n<pre><code> ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53007/"
] | Say I have some windows method and a struct:
```
struct SomeStruct{
int foo;
int bar;
int baz;
int bat;
}
SomeMethod(int a,int wParam, int lParam)
{
SomeStruct s;
// get lParam into SomeStruct
}
```
How to I get the lParam into a SomeStruct variable? I'm thinking that I need something like this (but feel fre... | Yes, assuming that lParam 'really' contains a pointer to the struct, then you get at it by 'casting':
```
SomeStruct* s; //declare pointer-to-struct variable
s = (SomeStruct*) lParam; //assign integer value as pointer to struct
printf("the value of s->foo is %d", s->foo); //print result
``` |
458,146 | <p>I have a domain model that has the concept of an Editor and a Project.</p>
<p>An Editor owns a number of Projects, and a Project has not only an Editor owner, but also a number of Editor members. Therefore, an Editor also has a number of "joined" Projects.</p>
<p>I am taking a DDD approach to modelling this and u... | [
{
"answer_id": 471704,
"author": "moffdub",
"author_id": 10759,
"author_profile": "https://Stackoverflow.com/users/10759",
"pm_score": 2,
"selected": false,
"text": "<p>It depends on your application's needs. If it is a big problem to load all of the Projects for a given Editor, then try... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50136/"
] | I have a domain model that has the concept of an Editor and a Project.
An Editor owns a number of Projects, and a Project has not only an Editor owner, but also a number of Editor members. Therefore, an Editor also has a number of "joined" Projects.
I am taking a DDD approach to modelling this and using the Repositor... | >
> Am I misinterpreting the intent of the Repository pattern?
>
>
>
I'm going to say "yeah", but know that me and every person I've worked with has asked the same thing for the same reason... *"You're not thinking 4th dimensionally, Marty".*
Let's simplify it a little and stick with constructors instead of Creat... |
458,173 | <p>This question is <em>NOT</em> about race-conditions, atomicity, or why you should use locks in your code. I already know about those.</p>
<p>UPDATE: My question isn't "does weirdness with volatile memory exist" (i know it does), my question is "doesn't the .NET runtime abstract that away so you'll never see it". </... | [
{
"answer_id": 458193,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 7,
"selected": true,
"text": "<p>The point is: it might work, but it isn't <strong>guaranteed</strong> to work by the spec. What people are usually ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458173",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | This question is *NOT* about race-conditions, atomicity, or why you should use locks in your code. I already know about those.
UPDATE: My question isn't "does weirdness with volatile memory exist" (i know it does), my question is "doesn't the .NET runtime abstract that away so you'll never see it".
See <http://www.y... | The point is: it might work, but it isn't **guaranteed** to work by the spec. What people are usually after is code that works for the right reasons, rather than working by a fluke combination of the compiler, the runtime and the JIT, which *might* change between framework versions, the physical CPU, the platform, and ... |
458,175 | <p>I would like to randomly sort a result in a repeatable fashion for purposes such as paging. For this NEWID() is too random in that the same results cannot be re-obtained. Order by Rand(seed) would be ideal as with the same seed the same random collection would result. Unfortunately, the Rand() state resets with ever... | [
{
"answer_id": 458203,
"author": "Jack Ryan",
"author_id": 28882,
"author_profile": "https://Stackoverflow.com/users/28882",
"pm_score": 1,
"selected": false,
"text": "<p>You can use a value from each row to re-evaluate the rand function:</p>\n\n<pre><code>Select *, Rand(@seed + id) as r... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458175",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51275/"
] | I would like to randomly sort a result in a repeatable fashion for purposes such as paging. For this NEWID() is too random in that the same results cannot be re-obtained. Order by Rand(seed) would be ideal as with the same seed the same random collection would result. Unfortunately, the Rand() state resets with every r... | Building off of gkrogers hash suggestion this works great. Any thoughts on performance?
```
declare @seed as int;
set @seed = 10;
create table temp (
id int,
date datetime)
insert into temp (id, date) values (1,'20090119')
insert into temp (id, date) values (2,'20090118')
insert into temp (id, date) values (3,'20090... |
458,182 | <p>I was wondering whether SVN actually compresses the binary content on the server during Commits? I know that the binary store the diffgrams for comparison and versioning but wondered whether a new file commited would occupy the same volume on the server as it does on the client pc?</p>
| [
{
"answer_id": 458205,
"author": "Eddie Parker",
"author_id": 56349,
"author_profile": "https://Stackoverflow.com/users/56349",
"pm_score": 5,
"selected": true,
"text": "<p>I believe so. </p>\n\n<p>From here: <a href=\"http://svn.apache.org/repos/asf/subversion/trunk/INSTALL\" rel=\"nore... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I was wondering whether SVN actually compresses the binary content on the server during Commits? I know that the binary store the diffgrams for comparison and versioning but wondered whether a new file commited would occupy the same volume on the server as it does on the client pc? | I believe so.
From here: <http://svn.apache.org/repos/asf/subversion/trunk/INSTALL>
>
>
> ```
> * libz (REQUIRED for client and server)
>
> ```
>
>
```
Subversion uses zlib for compressing binary differences.
These diff streams are used everywhere -- over the network,
in the repository, and i... |
458,209 | <p>After these instructions in the Python interpreter one gets a window with a plot:</p>
<pre><code>from matplotlib.pyplot import *
plot([1,2,3])
show()
# other code
</code></pre>
<p>Unfortunately, I don't know how to continue to interactively explore the figure created by <code>show()</code> while the program does f... | [
{
"answer_id": 458246,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 5,
"selected": false,
"text": "<p>It is better to always check with the library you are using if it supports usage in a <strong>non-blocking</strong> way.... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54567/"
] | After these instructions in the Python interpreter one gets a window with a plot:
```
from matplotlib.pyplot import *
plot([1,2,3])
show()
# other code
```
Unfortunately, I don't know how to continue to interactively explore the figure created by `show()` while the program does further calculations.
Is it possible ... | Use `matplotlib`'s calls that won't block:
Using `draw()`:
```
from matplotlib.pyplot import plot, draw, show
plot([1,2,3])
draw()
print('continue computation')
# at the end call show to ensure window won't close.
show()
```
Using interactive mode:
```
from matplotlib.pyplot import plot, ion, show
ion() # enables... |
458,218 | <p>We are doing the analysis phase of a call centre system. To get round a potential tricky authentication problem, we might need to read the LAN ID of the agent and use that as their user id in the system.</p>
<p>Is it possible to read the LAN ID from ASP.NET, or even from Javascript?</p>
| [
{
"answer_id": 458240,
"author": "alex",
"author_id": 50564,
"author_profile": "https://Stackoverflow.com/users/50564",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure what a LAN ID is exactly. I'll just assume you mean a MAC address?</p>\n\n<p>If so, I don't believe it's poss... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/50931/"
] | We are doing the analysis phase of a call centre system. To get round a potential tricky authentication problem, we might need to read the LAN ID of the agent and use that as their user id in the system.
Is it possible to read the LAN ID from ASP.NET, or even from Javascript? | If you switch on Integrated Windows authentication for the website (and switch off anonymous access) then the user will be authenticated by their domain account whenever they access the website. You can retrieve their username in code using
```
Page.User.Identity.Name
```
I have done this successfully in several int... |
458,225 | <p>Ok, so I'm trying to make a nice superclass for data-access objects that can generate a tsql query to search all of the subclass's public string properties. I want to use reflection to get the type of the subclass and then iterate through all of the public string properties on the object, since those property names... | [
{
"answer_id": 458290,
"author": "matt_dev",
"author_id": 39086,
"author_profile": "https://Stackoverflow.com/users/39086",
"pm_score": 1,
"selected": false,
"text": "<p>I think most repository patterns use interfaces rather then abstract classes like this...</p>\n\n<pre><code> public cl... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458225",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25847/"
] | Ok, so I'm trying to make a nice superclass for data-access objects that can generate a tsql query to search all of the subclass's public string properties. I want to use reflection to get the type of the subclass and then iterate through all of the public string properties on the object, since those property names are... | When you call a static method "via" a derived class, the compiler resolves the method so the IL actually contains the base class. For instance:
```
public class Base
{
static void Foo() {}
}
public class Derived : Base {}
class Test
{
static void Main()
{
Derived.Foo();
}
}
```
The call in ... |
458,226 | <p>I have a VB.NET application and use some third party (closed source) ActiveX controls. One of the controls represents a "camera" (connected over several interfaces) and I try to write an example how to work with several cameras in one application. To do this I allocate multiple "camera" objects dynamically as an arr... | [
{
"answer_id": 458274,
"author": "user50612",
"author_id": 50612,
"author_profile": "https://Stackoverflow.com/users/50612",
"pm_score": 1,
"selected": false,
"text": "<p>The \"MyHook\" event handler needs to have the same signature (i.e. accept the same argument types in the same order)... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458226",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47725/"
] | I have a VB.NET application and use some third party (closed source) ActiveX controls. One of the controls represents a "camera" (connected over several interfaces) and I try to write an example how to work with several cameras in one application. To do this I allocate multiple "camera" objects dynamically as an array ... | Following up on the comments to Waves' post, you can elegantly handle the missing "sender" argument with a lambda expression:
```
Public Sub New()
InitializeComponent()
For camera As Integer = 1 To 4
Dim cam As Camera = DirectCast(Me.Controls("Camera" + camera.ToString), Camera)
AddHandler cam.Pr... |
458,253 | <p>You have a method on a class that has 2 parameters, one of which is a file path, the other is irrelevant.</p>
<pre><code>InterestingResult result = foo.Bar(irrelevant, filePathInfo);
</code></pre>
<p>In the spirit of having fast snappy unit tests, you find yourself considering refactoring this method to pull out t... | [
{
"answer_id": 458264,
"author": "driAn",
"author_id": 50430,
"author_profile": "https://Stackoverflow.com/users/50430",
"pm_score": 4,
"selected": true,
"text": "<p>How about using a Stream as argument instead? That way you can pass a <a href=\"http://msdn.microsoft.com/de-de/library/sy... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458253",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46449/"
] | You have a method on a class that has 2 parameters, one of which is a file path, the other is irrelevant.
```
InterestingResult result = foo.Bar(irrelevant, filePathInfo);
```
In the spirit of having fast snappy unit tests, you find yourself considering refactoring this method to pull out the file path to remove the... | How about using a Stream as argument instead? That way you can pass a [MemoryStream](http://msdn.microsoft.com/de-de/library/system.io.memorystream(VS.80).aspx) in your unit test, and a [FileStream](http://msdn.microsoft.com/en-us/library/system.io.filestream.aspx) in production code. |
458,258 | <p>Is there a tool to import/convert COM type libraries into C# code rather than generating an assembly? The TLBIMP tool and the TypeLibaryConverter class only generate assemblies.</p>
<p>I've had some success ripping the C# <code>ComImport</code> definitions by running Reflector over the generated Interop assembly an... | [
{
"answer_id": 458360,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 2,
"selected": false,
"text": "<p>This won't help you out today, but there is a feature coming in the next version of C#. It's called NoPia or Type Em... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458258",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1278/"
] | Is there a tool to import/convert COM type libraries into C# code rather than generating an assembly? The TLBIMP tool and the TypeLibaryConverter class only generate assemblies.
I've had some success ripping the C# `ComImport` definitions by running Reflector over the generated Interop assembly and copying a pasting t... | As I originally suspected the best solution is going with [ILMerge](http://www.microsoft.com/downloads/details.aspx?FamilyID=22914587-b4ad-4eae-87cf-b14ae6a939b0). I can't be selective about parts of a COM API to embed, but it works well enough.
Here is the Post Build Event Command Line I'm using, which should be easy... |
458,288 | <p>Using ASP.NET MVC Preview 5 (though this has also been tried with the Beta), it appears that querystring defaults in a route override the value that is passed in on the query string. A repro is to write a controller like this:</p>
<pre><code>public class TestController : Controller
{
public ActionResult Foo(int... | [
{
"answer_id": 458420,
"author": "Spoike",
"author_id": 3713,
"author_profile": "https://Stackoverflow.com/users/3713",
"pm_score": -1,
"selected": false,
"text": "<p>I thought the point with Routing in MVC is to get rid of querystrings. Like this:</p>\n\n<pre><code>routes.MapRoute(\n ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458288",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13552/"
] | Using ASP.NET MVC Preview 5 (though this has also been tried with the Beta), it appears that querystring defaults in a route override the value that is passed in on the query string. A repro is to write a controller like this:
```
public class TestController : Controller
{
public ActionResult Foo(int x)
{
... | The best way to look at ASP.NET MVC with QueryStrings is to think of them as values that the route does not know about. As you found out, the QueryString is not part of the RouteData, therefore, you should keep what you are passing as a query string separate from the route values.
A way to work around them is to creat... |
458,291 | <p>I have a table which uses three columns as a composite key.</p>
<p>One of these column values is used as a sequence tracker for ordered related records. When I insert a new record I have to increment the sequence numbers for the related records that come after the new record.</p>
<p>I can do this directly in SQL S... | [
{
"answer_id": 458519,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 2,
"selected": false,
"text": "<p>Changing primary keys is a \"code smell\" in my book.</p>\n"
},
{
"answer_id": 458575,
"author": "brun... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458291",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] | I have a table which uses three columns as a composite key.
One of these column values is used as a sequence tracker for ordered related records. When I insert a new record I have to increment the sequence numbers for the related records that come after the new record.
I can do this directly in SQL Server Management ... | The fix we implemented was as follows
* Deleted the relationship that used the composite key
* Added autoincrement ID field, set that as primary key
* Added Unique contstraint to the three fields that we were previously using as our
* Re-created the relationship using the three fields that were previously our primary ... |
458,299 | <p>im re-factoring php on zend code and all the code is full of <code>$_GET["this"]</code> and <code>$_POST["that"]</code>. I have always used the more phpish <code>$this->_request->getPost('this')</code> and <code>$this->_request->getQuery('that')</code> (this one being not so much logical with the getquer... | [
{
"answer_id": 458312,
"author": "Brian Fisher",
"author_id": 43816,
"author_profile": "https://Stackoverflow.com/users/43816",
"pm_score": 6,
"selected": true,
"text": "<p>I usually use $this->_request->getParams(); to retrieve either the post or the URL parameters. Then I use the <a h... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458299",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47846/"
] | im re-factoring php on zend code and all the code is full of `$_GET["this"]` and `$_POST["that"]`. I have always used the more phpish `$this->_request->getPost('this')` and `$this->_request->getQuery('that')` (this one being not so much logical with the getquery insteado of getGet).
So i was wondering if my method was... | I usually use $this->\_request->getParams(); to retrieve either the post or the URL parameters. Then I use the [Zend\_Filter\_Input](http://framework.zend.com/manual/en/zend.filter.input.html) to do validation and filtering. The getParams() does not do validation.
Using the Zend\_Filter\_Input you can do application l... |
458,300 | <p>I want to use ICallBackEventHandler however when I use it to call back to the server I find that my form control objects don't have the latest form values. Is there a way to force populate the values with the form data?</p>
<p>Thanks.</p>
| [
{
"answer_id": 503738,
"author": "sandesh247",
"author_id": 9178,
"author_profile": "https://Stackoverflow.com/users/9178",
"pm_score": 2,
"selected": false,
"text": "<p>Have a look at <a href=\"http://msdn.microsoft.com/en-us/magazine/cc163863.aspx\" rel=\"nofollow noreferrer\">http://m... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458300",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47036/"
] | I want to use ICallBackEventHandler however when I use it to call back to the server I find that my form control objects don't have the latest form values. Is there a way to force populate the values with the form data?
Thanks. | Have a look at <http://msdn.microsoft.com/en-us/magazine/cc163863.aspx>.
In short, you have to clear the variable '\_\_theFormPostData', and call the 'WebForm\_InitCallback()' before the 'CallbackEventReference' script. This updates the form values with the user input values. Something like this:
```
// from the abov... |
458,304 | <p>As the question states, I would mainly like to know whether or not my code is running in the simulator, but would also be interested in knowing the specific iphone version that is running or being simulated.</p>
<p>EDIT: I added the word 'programmatically' to the question name. The point of my question is to be abl... | [
{
"answer_id": 458361,
"author": "Pete",
"author_id": 76,
"author_profile": "https://Stackoverflow.com/users/76",
"pm_score": 7,
"selected": false,
"text": "<h1>Updated code:</h1>\n<p>This is purported to work officially.</p>\n<pre><code>#if TARGET_IPHONE_SIMULATOR\nNSString *hello = @&q... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2323/"
] | As the question states, I would mainly like to know whether or not my code is running in the simulator, but would also be interested in knowing the specific iphone version that is running or being simulated.
EDIT: I added the word 'programmatically' to the question name. The point of my question is to be able to dynam... | Already asked, but with a very different title.
[What #defines are set up by Xcode when compiling for iPhone](https://stackoverflow.com/questions/146986/what-defines-are-setup-by-xcode-when-compiling-for-iphone)
I'll repeat my answer from there:
It's in the SDK docs under "Compiling source code conditionally"
The r... |
458,307 | <p>My application (written in WPF/C#) will monitor a live video source and will need to store small video segments and image stills. I'm hesitant to use a user defined "temp" directory since this would potentially allow a user to modify or delete these files causing major issues with my application. Alternatively, I ha... | [
{
"answer_id": 458313,
"author": "driAn",
"author_id": 50430,
"author_profile": "https://Stackoverflow.com/users/50430",
"pm_score": 2,
"selected": false,
"text": "<p>Maybe you want to look at <a href=\"http://msdn.microsoft.com/en-us/library/3ak841sy.aspx\" rel=\"nofollow noreferrer\">I... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458307",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52653/"
] | My application (written in WPF/C#) will monitor a live video source and will need to store small video segments and image stills. I'm hesitant to use a user defined "temp" directory since this would potentially allow a user to modify or delete these files causing major issues with my application. Alternatively, I have ... | Couldn't you use the appdata store rather than a user-elected store?
```
System.Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData)
``` |
458,311 | <p>I have Python 2.6 and I want to install easy _ install module. The problem is that the only available installation package of easy _ install for Python 2.6 is an .egg file! What should I do?</p>
| [
{
"answer_id": 458339,
"author": "nosklo",
"author_id": 17160,
"author_profile": "https://Stackoverflow.com/users/17160",
"pm_score": 5,
"selected": true,
"text": "<p>You could try <a href=\"http://peak.telecommunity.com/dist/ez_setup.py\" rel=\"nofollow noreferrer\">this script</a>.</p>... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/85185/"
] | I have Python 2.6 and I want to install easy \_ install module. The problem is that the only available installation package of easy \_ install for Python 2.6 is an .egg file! What should I do? | You could try [this script](http://peak.telecommunity.com/dist/ez_setup.py).
```
#!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setupt... |
458,325 | <p>is there a way, hot to apply paginator limit on select, which I send to findDependentRowset function? for example:</p>
<pre><code>$select = $row->select();
$select->order('item_name');
$row->findDependentRowset($table, null, $select)
</code></pre>
<p>thank's</p>
| [
{
"answer_id": 471493,
"author": "waney",
"author_id": 58123,
"author_profile": "https://Stackoverflow.com/users/58123",
"pm_score": 1,
"selected": false,
"text": "<p>You need just add limit to your select passed to findDependentRowset. \nIt will look like this: </p>\n\n<pre><code>$selec... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39014/"
] | is there a way, hot to apply paginator limit on select, which I send to findDependentRowset function? for example:
```
$select = $row->select();
$select->order('item_name');
$row->findDependentRowset($table, null, $select)
```
thank's | You need just add limit to your select passed to findDependentRowset.
It will look like this:
```
$select = $row->select()->limit($itemCountPerPage,$offset);
$select->order('item_name');
$row->findDependentRowset($table, null, $select);
``` |
458,328 | <p>I am trying to write some code that will determine if a list of SQL servers are up. I have tried to WMI, SQLDMO, SqlDataSourceEnumerator, and Pinging port 1433 of each server, with varying degrees of success (see results below).</p>
<p>Using SQLDMO and SqlDataSourceEnumerator, i found 3 out of 6, it has to be said ... | [
{
"answer_id": 458584,
"author": "Mladen Prajdic",
"author_id": 31345,
"author_profile": "https://Stackoverflow.com/users/31345",
"pm_score": 3,
"selected": true,
"text": "<p>i don't know about DMO which is deprecated anyway but in SMO you can do Server.IsClustered.</p>\n\n<p>you may als... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458328",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/178/"
] | I am trying to write some code that will determine if a list of SQL servers are up. I have tried to WMI, SQLDMO, SqlDataSourceEnumerator, and Pinging port 1433 of each server, with varying degrees of success (see results below).
Using SQLDMO and SqlDataSourceEnumerator, i found 3 out of 6, it has to be said that 2 of ... | i don't know about DMO which is deprecated anyway but in SMO you can do Server.IsClustered.
you may also want to look at this:
<http://www.sqldbatips.com/showarticle.asp?ID=45> |
458,363 | <p>I am trying to write a function to determine if a file exists. The two methods prove to return inconsistent results (fileExists() seems to provide accurate results, compared to isFileFound(), that returns false positives - i would have expected an exception when trying to create the instance). </p>
<pre><code>prote... | [
{
"answer_id": 458376,
"author": "M4N",
"author_id": 19635,
"author_profile": "https://Stackoverflow.com/users/19635",
"pm_score": 6,
"selected": true,
"text": "<p>You can create a FileInfo for an non-existing file. But then you can check the FileInfo.Exists property to determine whether... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/178/"
] | I am trying to write a function to determine if a file exists. The two methods prove to return inconsistent results (fileExists() seems to provide accurate results, compared to isFileFound(), that returns false positives - i would have expected an exception when trying to create the instance).
```
protected bool isFi... | You can create a FileInfo for an non-existing file. But then you can check the FileInfo.Exists property to determine whether the file exists, e.g:
```
FileInfo fi = new FileInfo(somePath);
bool exists = fi.Exists;
```
**Update**:
In a short test this also worked for UNC paths, e.g. like this:
```
FileInfo fi = new ... |
458,364 | <p>I have the following data:</p>
<pre><code>ExamEntry Student_ID Grade
11 1 80
12 2 70
13 3 20
14 3 68
15 4 75
</code></pre>
<p>I want to find all the students that passed an exam. In this ca... | [
{
"answer_id": 458393,
"author": "Quassnoi",
"author_id": 55159,
"author_profile": "https://Stackoverflow.com/users/55159",
"pm_score": 1,
"selected": false,
"text": "<pre><code>SELECT student_id, MAX(ExamEntry)\nFROM data\nWHERE Grade > :threshold\nGROUP BY student_id\n</code></pre>\... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458364",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/393302/"
] | I have the following data:
```
ExamEntry Student_ID Grade
11 1 80
12 2 70
13 3 20
14 3 68
15 4 75
```
I want to find all the students that passed an exam. In this case, if there are few exams... | If your query is very slow at with 1000 records in your table, there is something wrong.
For a modern Database system a table containing, 1000 entries is considered very very small.
Most likely, you did not provid a (primary) key for your table?
Assuming that a student would pass if at least on of the grades is abo... |
458,381 | <p>I have two tables. </p>
<p>In one table there are two columns, one has the ID and the other the abstracts of a document about 300-500 words long. There are about 500 rows.</p>
<p>The other table has only one column and >18000 rows. Each cell of that column contains a distinct acronym such as NGF, EPO, TPO etc.</p>... | [
{
"answer_id": 458527,
"author": "Aaron Maenpaa",
"author_id": 2603,
"author_profile": "https://Stackoverflow.com/users/2603",
"pm_score": 1,
"selected": false,
"text": "<p>It seems to me that you are trying to join the two tables where the acronym appears in the abstract. ie (pseudo SQL... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458381",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have two tables.
In one table there are two columns, one has the ID and the other the abstracts of a document about 300-500 words long. There are about 500 rows.
The other table has only one column and >18000 rows. Each cell of that column contains a distinct acronym such as NGF, EPO, TPO etc.
I am interested in ... | It seems to me that you are trying to join the two tables where the acronym appears in the abstract. ie (pseudo SQL):
```
SELECT acronym.id, document.id
FROM acronym, document
WHERE acronym.value IN explode(documents.abstract)
```
Given the desired semantics you can use the most straight forward approach:
```
acron... |
458,386 | <p>So I am working with an API that returns results in XML. Let's just say for argument sake I am returned the following:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<Properties>
<Property>
<Name>Joes Crab Shack</Name>
<Address>111 Shack Street</Add... | [
{
"answer_id": 458401,
"author": "driAn",
"author_id": 50430,
"author_profile": "https://Stackoverflow.com/users/50430",
"pm_score": 2,
"selected": false,
"text": "<p>Deserialize into an xml tree, try <a href=\"http://www.php.net/simplexml\" rel=\"nofollow noreferrer\">SimpleXML</a>. Tha... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458386",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/428190/"
] | So I am working with an API that returns results in XML. Let's just say for argument sake I am returned the following:
```
<?xml version="1.0" encoding="UTF-8"?>
<Properties>
<Property>
<Name>Joes Crab Shack</Name>
<Address>111 Shack Street</Address>
</Property>
<Property>
<Name>Joh... | Something like this should get the job done.
```
$request_xml = '<?xml version="1.0" encoding="UTF-8"?>
<Properties>
<Property>
<Name>Joes Crab Shack</Name>
<Address>111 Shack Street</Address>
</Property>
<Property>
<Name>Johns Shoe Store</Name>
<Address>123 Shoe Avenue</Add... |
458,436 | <p>I want to create a zip file. Add a folder to the zip file and then add a bunch of files to that folder.</p>
<p>So I want to end up with a zip file with a single folder with files in.</p>
<p>I dont know if its bad practice to have folders in zip files or something but google gives me nothing on the subject.</p>
<... | [
{
"answer_id": 458478,
"author": "RSabet",
"author_id": 49219,
"author_profile": "https://Stackoverflow.com/users/49219",
"pm_score": 2,
"selected": false,
"text": "<p>after adding some imports your code runs fine for me, how do you call the script, maybe you could tell us the folder str... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458436",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56763/"
] | I want to create a zip file. Add a folder to the zip file and then add a bunch of files to that folder.
So I want to end up with a zip file with a single folder with files in.
I dont know if its bad practice to have folders in zip files or something but google gives me nothing on the subject.
I started out with this... | Ok, after i understood what you want, it is as simple as using the second argument of `zipfile.write`, where you can use whatever you want:
```
import zipfile
myZipFile = zipfile.ZipFile("zip.zip", "w" )
myZipFile.write("test.py", "dir\\test.py", zipfile.ZIP_DEFLATED )
```
creates a zipfile where `test.py` would be ... |
458,460 | <p>My C# application loads XML documents using the following code:</p>
<pre><code>XmlDocument doc = new XmlDocument();
doc.Load(path);
</code></pre>
<p>Some of these documents contain encoded characters, for example:</p>
<pre><code><xsl:text>&#10;</xsl:text>
</code></pre>
<p>I notice that when these... | [
{
"answer_id": 458473,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 2,
"selected": false,
"text": "<p>Are you sure the character is dropped? character 10 is just a line feed- it wouldn't exactly show up in your debug... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458460",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5471/"
] | My C# application loads XML documents using the following code:
```
XmlDocument doc = new XmlDocument();
doc.Load(path);
```
Some of these documents contain encoded characters, for example:
```
<xsl:text> </xsl:text>
```
I notice that when these documents are loaded, ` ` gets dropped.
My question: How ca... | Are you sure the character is dropped? character 10 is just a line feed- it wouldn't exactly show up in your debugger window. It could also be treated as whitespace. Have you tried playing with the whitespace settings on your xmldocument?
---
If you need to preserve the encoding you only have two choices: a CDATA sec... |
458,464 | <p>I have I huge backup of posts of my blog. All posts has images like:</p>
<p>"<a href="http://www.mysite.com/nonono-nonono.jpg" rel="nofollow noreferrer">http://www.mysite.com/nonono-nonono.jpg</a>" </p>
<p>or </p>
<p>"<a href="http://www.mysite.com/nonono-nonono.gif" rel="nofollow noreferrer">http://www.mysite.co... | [
{
"answer_id": 458501,
"author": "Steve Losh",
"author_id": 13498,
"author_profile": "https://Stackoverflow.com/users/13498",
"pm_score": 1,
"selected": false,
"text": "<p>Regular expressions will be your best bet... maybe something like this (based on the one from <a href=\"http://strfr... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458464",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have I huge backup of posts of my blog. All posts has images like:
"<http://www.mysite.com/nonono-nonono.jpg>"
or
"<http://www.mysite.com/nonono-nonono.gif>"
or even
"<http://www.mysite.com/nonono.jpg>"
But I have other links for urls on the same domain like ""<http://www.mysite.com/category/post.html>" and ... | Regular expressions will be your best bet... maybe something like this (based on the one from [strfriend](http://strfriend.com/))?
```
^((ht|f)tp(s?)\:\/\/|~/|/)?([\w]+:\w+@)?([a-zA-Z]{1}([\w\-]+\.)+([\w]{2,5}))(:[\d]{1,5})?((/?\w+/)+|/?)(\w+\.(jpg|gif|png))?
``` |
458,466 | <p>How do I expand/collapse an html field in Firefox? I incorporated a few JavaScript examples from the web, but they only worked in IE. (I'm limited to HTML and JS)</p>
<p>Suggestions are appreciated. </p>
<p>Thanks.</p>
<p>Yes, I would like to show/hide divs and such.</p>
| [
{
"answer_id": 458511,
"author": "Eddie Parker",
"author_id": 56349,
"author_profile": "https://Stackoverflow.com/users/56349",
"pm_score": 1,
"selected": false,
"text": "<p>I'm afraid I don't understand your question entirely.</p>\n\n<p>First off, what do you mean by 'html field'? Do y... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458466",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52256/"
] | How do I expand/collapse an html field in Firefox? I incorporated a few JavaScript examples from the web, but they only worked in IE. (I'm limited to HTML and JS)
Suggestions are appreciated.
Thanks.
Yes, I would like to show/hide divs and such. | If your input field has an ID attribute, you can use CSS to style it as needed. I recommend using a library like jQuery, but I have provided an example without as well:
```
// hiding without jQuery
document.getElementById('myInput').style.display = 'none'
// showing without jQuery
document.getElementById('myIn... |
458,467 | <p>How do i get the location of the file that i used to open my programs with? </p>
<p>Example: if i create a new extention ".xyz" say and i tell windows that i want to open the file type .xyz with myapplication, then it starts my aplication. Great, but how does my application get a handle on the file path of the file... | [
{
"answer_id": 459158,
"author": "Rob Kennedy",
"author_id": 33732,
"author_profile": "https://Stackoverflow.com/users/33732",
"pm_score": 5,
"selected": true,
"text": "<p>When you created your file association, you specified the command line that Explorer should run to activate your pro... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458467",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53915/"
] | How do i get the location of the file that i used to open my programs with?
Example: if i create a new extention ".xyz" say and i tell windows that i want to open the file type .xyz with myapplication, then it starts my aplication. Great, but how does my application get a handle on the file path of the file that was ... | When you created your file association, you specified the command line that Explorer should run to activate your program. The shell puts the name of the document file on the command line, too, so in your program, **check the command-line arguments**. How you do that depends on your language and development environment.... |
458,476 | <p>Is iterating through the vector using an iterator and copying to a list the most optimal method of copying. Any recommendations?</p>
| [
{
"answer_id": 458488,
"author": "Kasprzol",
"author_id": 5957,
"author_profile": "https://Stackoverflow.com/users/5957",
"pm_score": 8,
"selected": true,
"text": "<p>Why would you iterate and not use the standard copy algorithm?</p>\n\n<pre><code>std::copy( vector.begin(), vector.end(),... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458476",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43756/"
] | Is iterating through the vector using an iterator and copying to a list the most optimal method of copying. Any recommendations? | Why would you iterate and not use the standard copy algorithm?
```
std::copy( vector.begin(), vector.end(), std::back_inserter( list ) );
``` |
458,481 | <p>Can <a href="http://en.wikipedia.org/wiki/Shor%27s_algorithm" rel="nofollow noreferrer">Shor's algorithm</a> be used for encryption, more specifically WEP encryption?</p>
| [
{
"answer_id": 458488,
"author": "Kasprzol",
"author_id": 5957,
"author_profile": "https://Stackoverflow.com/users/5957",
"pm_score": 8,
"selected": true,
"text": "<p>Why would you iterate and not use the standard copy algorithm?</p>\n\n<pre><code>std::copy( vector.begin(), vector.end(),... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458481",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20730/"
] | Can [Shor's algorithm](http://en.wikipedia.org/wiki/Shor%27s_algorithm) be used for encryption, more specifically WEP encryption? | Why would you iterate and not use the standard copy algorithm?
```
std::copy( vector.begin(), vector.end(), std::back_inserter( list ) );
``` |
458,482 | <p>I am currently working on a REST library for .net, and I would like to hear some opinions about an open point I have: REST and authentication.</p>
<p>Here is an example of an RESTful interface used with the library:</p>
<pre><code>[RestRoot("/user")]
public interface IUserInterface
{
[RestPut("/")]
void Add(U... | [
{
"answer_id": 458547,
"author": "workmad3",
"author_id": 16035,
"author_profile": "https://Stackoverflow.com/users/16035",
"pm_score": 2,
"selected": false,
"text": "<p>The rest authentication I've seen treats the sessions as a REST resource for creation, destruction etc. and then the s... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458482",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21566/"
] | I am currently working on a REST library for .net, and I would like to hear some opinions about an open point I have: REST and authentication.
Here is an example of an RESTful interface used with the library:
```
[RestRoot("/user")]
public interface IUserInterface
{
[RestPut("/")]
void Add(User user);
[RestGet... | I tend to believe that authentication details belong in the header, not the URI. If you rely on a token being placed on the URI, then every URI in your application will need to be encoded to include the token. It would also negatively impact caching. Resources with a token that is constantly changing will no longer be ... |
458,489 | <p>When I try to make a very large boolean array using Java, such as:</p>
<pre><code> boolean[] isPrime1 = new boolean[600851475144];
</code></pre>
<p>I get a possible loss of precision error?</p>
<p>Is it too big?</p>
| [
{
"answer_id": 458502,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 2,
"selected": false,
"text": "<p>An array index is an int, not a long, so your \"array\" is too big to fit into an array. <strike>One of the java Co... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54223/"
] | When I try to make a very large boolean array using Java, such as:
```
boolean[] isPrime1 = new boolean[600851475144];
```
I get a possible loss of precision error?
Is it too big? | To store 600 *billion* bits, you need an absolute minimum address space of 75 *gigabytes*! Good luck with that!
Even worse, the Java spec doesn't specify that a `boolean` array will use a single bit of memory for each element - it could ([and in some cases does](http://eblog.chrononsystems.com/hidden-evils-of-javas-by... |
458,525 | <p>I have a class that has a vector of another class objects as a member. In many functions of this class I have to do same operation on all the objects in the vector:</p>
<pre><code>class Small
{
public:
void foo();
void bar(int x);
// and many more functions
};
class Big
{
public:
void foo()
... | [
{
"answer_id": 458539,
"author": "Eddie Parker",
"author_id": 56349,
"author_profile": "https://Stackoverflow.com/users/56349",
"pm_score": 2,
"selected": false,
"text": "<p>If you're using the std library, you should take a look at <a href=\"http://www.sgi.com/tech/stl/for_each.html\" r... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458525",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44673/"
] | I have a class that has a vector of another class objects as a member. In many functions of this class I have to do same operation on all the objects in the vector:
```
class Small
{
public:
void foo();
void bar(int x);
// and many more functions
};
class Big
{
public:
void foo()
{
fo... | Well you can rewrite the for loops to use iterators and more of the STL like this:
```
void foo() {
std::for_each(VectorOfSmalls.begin(), VectorOfSmalls.end(), std::mem_fun(&Small::foo));
}
void bar() {
std::for_each(VectorOfSmalls.begin(), VectorOfSmalls.end(), std::mem_fun(&Small::bar));
}
```
beyond that... |
458,550 | <p>Is there a standard way to associate version string with a Python package in such way that I could do the following?</p>
<pre class="lang-py prettyprint-override"><code>import foo
print(foo.version)
</code></pre>
<p>I would imagine there's some way to retrieve that data without any extra hardcoding, since minor/majo... | [
{
"answer_id": 458658,
"author": "Matt",
"author_id": 49135,
"author_profile": "https://Stackoverflow.com/users/49135",
"pm_score": -1,
"selected": false,
"text": "<p>For what it's worth, if you're using NumPy distutils, <code>numpy.distutils.misc_util.Configuration</code> has a <a href=... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39167/"
] | Is there a standard way to associate version string with a Python package in such way that I could do the following?
```py
import foo
print(foo.version)
```
I would imagine there's some way to retrieve that data without any extra hardcoding, since minor/major strings are specified in `setup.py` already. Alternative ... | Not directly an answer to your question, but you should consider naming it `__version__`, not `version`.
This is almost a quasi-standard. Many modules in the standard library use `__version__`, and this is also used in [lots](http://www.google.com/codesearch?as_q=__version__&btnG=Search+Code&hl=en&as_lang=python&as_li... |
458,556 | <p>I have a website which uses PHP and HTML pages, I want to create a session which stores a username from the login page. But the login pages are php and the next pages are html.</p>
<p>Is this a problem or can I just add a small statement of php into the html page saying</p>
<pre><code> <?PHP session_start();
$_... | [
{
"answer_id": 458571,
"author": "Gumbo",
"author_id": 53114,
"author_profile": "https://Stackoverflow.com/users/53114",
"pm_score": 2,
"selected": false,
"text": "<p>As the sessions are handled by PHP, it needs PHP to maintain the state. You need at least <code>session_start()</code> to... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45344/"
] | I have a website which uses PHP and HTML pages, I want to create a session which stores a username from the login page. But the login pages are php and the next pages are html.
Is this a problem or can I just add a small statement of php into the html page saying
```
<?PHP session_start();
$_session['loginid']=$_pos... | If you have access to your apache configuration, or a simple .htaccess file, you can tell Apache to handle php code inside of an .html file. You can do this by creating an **.htaccess** file (remember the . (dot) as the first character in that filename) on the document root of the site (probably public\_html/) and putt... |
458,558 | <p>I'm working on Linux system (Ubuntu 7.04 server with a 2.6.20 kernel). </p>
<p>I've got a program that has a thread (thread1) waiting on a select for a UDP socket to become readable.
I'm using the select (with my socket as the single readfd and the single exceptfd) instead of just calling recvfrom because I want a ... | [
{
"answer_id": 458612,
"author": "John Zwinck",
"author_id": 4323,
"author_profile": "https://Stackoverflow.com/users/4323",
"pm_score": 2,
"selected": false,
"text": "<p>UDP is a connectionless protocol. Since there is no connection, none can be broken, so the consumer doesn't know tha... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5801/"
] | I'm working on Linux system (Ubuntu 7.04 server with a 2.6.20 kernel).
I've got a program that has a thread (thread1) waiting on a select for a UDP socket to become readable.
I'm using the select (with my socket as the single readfd and the single exceptfd) instead of just calling recvfrom because I want a timeout.
... | Maybe you should use something else to wake up the select. Maybe a pipe or something like that. |
458,596 | <p>I support a web site which generates content XML that is then translated into web pages using XSLT. I have been asked to create a new stylesheet which will transform the output of the "archive" page into Atom for syndication. The problem I'm running into is that the archive page contains a rather large number of i... | [
{
"answer_id": 458650,
"author": "baretta",
"author_id": 30052,
"author_profile": "https://Stackoverflow.com/users/30052",
"pm_score": 5,
"selected": true,
"text": "<p>position()/last() returns position/last position within the current context, so when the navigator is positioned in one ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/46387/"
] | I support a web site which generates content XML that is then translated into web pages using XSLT. I have been asked to create a new stylesheet which will transform the output of the "archive" page into Atom for syndication. The problem I'm running into is that the archive page contains a rather large number of items ... | position()/last() returns position/last position within the current context, so when the navigator is positioned in one <month>, position() will return <day> within that month, and last() will return last <day> within that month, but i guess you know that.
Therefore, what you could do is flatten all <day>'s in an arra... |
458,597 | <p>I have a bunch (750K) of records in one table that I have to see they're in another table. The second table has millions of records, and the data is something like this:</p>
<p>Source table<br>
<code>9999-A1B-1234X</code>, with the middle part potentially being longer than three digits</p>
<p>Target table<br>
<cod... | [
{
"answer_id": 458614,
"author": "Otávio Décio",
"author_id": 48684,
"author_profile": "https://Stackoverflow.com/users/48684",
"pm_score": 0,
"selected": false,
"text": "<p>First thing is to make sure you have an index for that column on the searched table. Second is to do the LIKE <em>... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458597",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56783/"
] | I have a bunch (750K) of records in one table that I have to see they're in another table. The second table has millions of records, and the data is something like this:
Source table
`9999-A1B-1234X`, with the middle part potentially being longer than three digits
Target table
`DescriptionPhrase9999-A1B-1234X(9... | What about doing it all in the DB, rather than pulling records into your .Net app:
```
UPDATE source_table s SET some_field = true WHERE EXISTS
(
SELECT target_join_field FROM target_table t
WHERE t.target_join_field LIKE '%' + s.source_join_field + '%'
)
```
This will reduce the total number of queries f... |
458,609 | <p>I have a number of files that I checked into SVN without having set up their Mime types correctly. SVN initially classified them as binary.</p>
<p>I've since set their Mime type in SVN via propset to "text/plain; charset=UTF-8" and I'vc made sure that all the files are UTF-8 signed. When I do 'svn blame filename'... | [
{
"answer_id": 458761,
"author": "Stefan",
"author_id": 48003,
"author_profile": "https://Stackoverflow.com/users/48003",
"pm_score": 7,
"selected": true,
"text": "<p>Setting the svn:mime-type property to just \"text/plain\" helps:</p>\n\n<pre><code>svn propset svn:mime-type text/plain b... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458609",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49251/"
] | I have a number of files that I checked into SVN without having set up their Mime types correctly. SVN initially classified them as binary.
I've since set their Mime type in SVN via propset to "text/plain; charset=UTF-8" and I'vc made sure that all the files are UTF-8 signed. When I do 'svn blame filename', svn says t... | Setting the svn:mime-type property to just "text/plain" helps:
```
svn propset svn:mime-type text/plain build.xml
svn commit build.xml
```
Also, you can force Subversion to treat a file as text when blaming:
```
svn blame file/to/blame --force
``` |
458,632 | <p>I'm writing an iPhone app. It's already been published, but I would like to add a feature where its version number is displayed.</p>
<p>I'd rather not have to do this manually with each version I release... </p>
<p>Is there a way in objective-C to find out what the version is of my app?</p>
| [
{
"answer_id": 458675,
"author": "D'Arcy Rittich",
"author_id": 39430,
"author_profile": "https://Stackoverflow.com/users/39430",
"pm_score": 0,
"selected": false,
"text": "<p>This is a good thing to handle with a revision control system. That way when you get a bug report from a user, y... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458632",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm writing an iPhone app. It's already been published, but I would like to add a feature where its version number is displayed.
I'd rather not have to do this manually with each version I release...
Is there a way in objective-C to find out what the version is of my app? | [As I describe here](https://stackoverflow.com/questions/372218/insert-subversion-revision-number-in-xcode#414792), I use a script to rewrite a header file with my current Subversion revision number. That revision number is stored in the kRevisionNumber constant. I can then access the version and revision number using ... |
458,644 | <p>I found a way to extend classes in VBScript, but are there any ways to pass in parameters or overload the constructor? I am currently using an Init function to initialize the properties, but would like to be able to do this when I create the object.<br>
This is my sample class:</p>
<pre><code>Class Test
Privat... | [
{
"answer_id": 458652,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 2,
"selected": false,
"text": "<p>You have to do it in two steps. VB Script doesn't support overloading so you can't modify the default constructor wit... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458644",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38695/"
] | I found a way to extend classes in VBScript, but are there any ways to pass in parameters or overload the constructor? I am currently using an Init function to initialize the properties, but would like to be able to do this when I create the object.
This is my sample class:
```
Class Test
Private strText
P... | Just to alter slightly on svinto's method...
```
Class Test
Private m_s
Public Default Function Init(s)
m_s = s
Set Init = Me
End Function
Public Function Hello()
Hello = m_s
End Function
End Class
Dim o : Set o = (New Test)("hello world")
```
Is how I do it. Sadly no overloading though.
[ed... |
458,645 | <p>How can I create an array of dates, one for every day, starting Jan 1st 2008 to Dec 31st 2008 in ActionScript 3?</p>
<p>It would be ideal if it worked on any date range... </p>
| [
{
"answer_id": 458829,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 0,
"selected": false,
"text": "<p>There's nothing fancy to it: just use two for loops, with the inner loop checking the month index (\"Thirty... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458645",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I create an array of dates, one for every day, starting Jan 1st 2008 to Dec 31st 2008 in ActionScript 3?
It would be ideal if it worked on any date range... | I needed an array of days between 2 dates because my application has a custom hSlider with 2 thumbs which allow the user to change the range of date they wish to bind the data to. (think google finanace) ...
My solution:
```
var startDate:Date = Application.application._model.minDate;
var endDate:Date = Appl... |
458,647 | <p>I moved a Subversion repository from a Windows box to a UNIX machine. In both environments I've handled authentication through Apache.</p>
<p>On the UNIX box after the move, I could checkout source but received the following error when committing anything:</p>
<pre><code>svn: Can't open file '/home/brianly/svn/tes... | [
{
"answer_id": 458662,
"author": "orip",
"author_id": 37020,
"author_profile": "https://Stackoverflow.com/users/37020",
"pm_score": 3,
"selected": true,
"text": "<p>What you should do is change the directory owner to the apache process user, e.g.</p>\n\n<pre><code>chown -R apache /home/b... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458647",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/636/"
] | I moved a Subversion repository from a Windows box to a UNIX machine. In both environments I've handled authentication through Apache.
On the UNIX box after the move, I could checkout source but received the following error when committing anything:
```
svn: Can't open file '/home/brianly/svn/test/db/txn-current-lock... | What you should do is change the directory owner to the apache process user, e.g.
```
chown -R apache /home/brianly/svn/test
```
You need to run `chown` as root (directly or through `sudo`).
You can see who the user is with (if it's linux):
```
ps -fadeww|grep httpd
```
And don't forget to change it back to 755 ... |
458,697 | <p>I'm looping through a list of items, and I'd like to get a request parameter based on the item's index.
I could easily do it with a scriptlet as done below, but I'd like to use expression language.</p>
<pre><code><c:forEach var="item" items="${list}" varStatus="count">
<!-- This would work -->
&l... | [
{
"answer_id": 458706,
"author": "Peter Štibraný",
"author_id": 47190,
"author_profile": "https://Stackoverflow.com/users/47190",
"pm_score": 5,
"selected": true,
"text": "<pre><code><c:set var=\"index\" value=\"item_${count.index}\" />\n${param[index]}\n</code></pre>\n\n<p>Unfortu... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1310/"
] | I'm looping through a list of items, and I'd like to get a request parameter based on the item's index.
I could easily do it with a scriptlet as done below, but I'd like to use expression language.
```
<c:forEach var="item" items="${list}" varStatus="count">
<!-- This would work -->
<%=request.getParameter("ite... | ```
<c:set var="index" value="item_${count.index}" />
${param[index]}
```
Unfortunately, + doesn't work for strings like in plain Java, so
```
${param["index_" + count.index]}
```
doesn't work ;-( |
458,699 | <p>Problem statement: Implement a plug-in system that allows the associated assemblies to be overwritten (avoid file locking). In .Net, specific assemblies may not be unloaded, only entire AppDomains may be unloaded.</p>
<p>I'm posting this because when I was trying to solve the problem, every solution made reference ... | [
{
"answer_id": 458702,
"author": "Abtin Forouzandeh",
"author_id": 52515,
"author_profile": "https://Stackoverflow.com/users/52515",
"pm_score": 4,
"selected": true,
"text": "<ol>\n<li>Check if the assembly is already loaded (to avoid memory leaks caused by loading the same assembly over... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458699",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/52515/"
] | Problem statement: Implement a plug-in system that allows the associated assemblies to be overwritten (avoid file locking). In .Net, specific assemblies may not be unloaded, only entire AppDomains may be unloaded.
I'm posting this because when I was trying to solve the problem, every solution made reference to using m... | 1. Check if the assembly is already loaded (to avoid memory leaks caused by loading the same assembly over and over again).
2. If its not loaded, read the assembly into a byte array. This will prevent locking the file.
3. Supply the byte array as an arguement to Assembly.Load
The following code assumes you know the Fu... |
458,715 | <p>I'm having a hard time figuring out how Firefox and Chrome determining what fields are for a password and how they autocomplete them on other forms.</p>
<p>For my login form, I have this:</p>
<pre><code><p>
<label for="login_email">Email:</label><br />
<input id="login_email" nam... | [
{
"answer_id": 458720,
"author": "TravisO",
"author_id": 35116,
"author_profile": "https://Stackoverflow.com/users/35116",
"pm_score": 0,
"selected": false,
"text": "<p>Well all browsers are going to pick up the most obvious field names:</p>\n\n<ul>\n<li>firstname </li>\n<li>lastname </l... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458715",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32465/"
] | I'm having a hard time figuring out how Firefox and Chrome determining what fields are for a password and how they autocomplete them on other forms.
For my login form, I have this:
```
<p>
<label for="login_email">Email:</label><br />
<input id="login_email" name="login[email]" size="30" type="text">
</p>
<p... | Seems that changing name and id attributes has no effect on the password managers in Firefox and Chrome, all they see is a password\_field and the field above it and that is good enough for them.
So I'm just making the password field in create a new user as a text field. |
458,719 | <p>Let's say that I have a class Foo:</p>
<pre><code>public class Foo
{
public static var bar:String = "test";
}
</code></pre>
<p>How can I reference bar at runtime using the string "Foo" or/and and instance of Foo and the string "bar"?</p>
<p>I.e. </p>
<pre><code>var x:Object = new Foo();
...
x["bar"]
</code>... | [
{
"answer_id": 458743,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 4,
"selected": true,
"text": "<p>It's a static variable, so you won't be able to access it using an <em>instance</em> of foo; it's accessed st... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458719",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] | Let's say that I have a class Foo:
```
public class Foo
{
public static var bar:String = "test";
}
```
How can I reference bar at runtime using the string "Foo" or/and and instance of Foo and the string "bar"?
I.e.
```
var x:Object = new Foo();
...
x["bar"]
```
...doesn't work, debug mode in IntelliJ got m... | It's a static variable, so you won't be able to access it using an *instance* of foo; it's accessed statically, using ClassName.variableName notation, like so:
trace(Foo.bar);
// yields: "test"
As well, because you've declared both Foo and bar public, you should be able to access Foo.bar that way from anywhere in yo... |
458,721 | <p>I find long sequences of standard includes annoying:</p>
<pre><code>#include <vector>
#include <string>
#include <sstream>
#include <iostream>
</code></pre>
<p>Considering these header files change only very rarely, is there a reason why I should not make a "std.h" file #including all std h... | [
{
"answer_id": 458738,
"author": "Brian Ensink",
"author_id": 1254,
"author_profile": "https://Stackoverflow.com/users/1254",
"pm_score": 5,
"selected": true,
"text": "<p>Including unnecessary header files will increase compile times.</p>\n"
},
{
"answer_id": 458759,
"author"... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I find long sequences of standard includes annoying:
```
#include <vector>
#include <string>
#include <sstream>
#include <iostream>
```
Considering these header files change only very rarely, is there a reason why I should not make a "std.h" file #including all std headers and just use that everywhere? | Including unnecessary header files will increase compile times. |
458,725 | <p>I have an index -- let's call it <code>IX_MY_INDEX</code> -- in a SQL Server table (both compatibility modes 80 and 90) that I would like to determine the size of. How do I do this?</p>
<p><strong>Update:</strong> Allain Lalonde's second solution below only works when the compatibility mode is set to 90; however, t... | [
{
"answer_id": 458754,
"author": "Allain Lalonde",
"author_id": 2443,
"author_profile": "https://Stackoverflow.com/users/2443",
"pm_score": 5,
"selected": true,
"text": "<p>You can determine the size of all indexes on a table (and other things) like so: </p>\n\n<pre><code>EXEC sp_spaceus... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1944/"
] | I have an index -- let's call it `IX_MY_INDEX` -- in a SQL Server table (both compatibility modes 80 and 90) that I would like to determine the size of. How do I do this?
**Update:** Allain Lalonde's second solution below only works when the compatibility mode is set to 90; however, the particular database I am workin... | You can determine the size of all indexes on a table (and other things) like so:
```
EXEC sp_spaceused TableName;
```
For a full breakdown you may:
```
SELECT *
FROM sys.dm_db_index_physical_stats(db_id(), object_id('TableName'), null, null, 'DETAILED');
``` |
458,795 | <p>If I have a non-template (i.e. "normal") class and wish to have a template friend function, how do I write it without causing a compiler error? Here is an example to illustrate what I am trying to do:</p>
<pre><code>template <class T>
void bar(T* ptr);
class MyClass // note that this isn't a template class... | [
{
"answer_id": 458861,
"author": "mskfisher",
"author_id": 44390,
"author_profile": "https://Stackoverflow.com/users/44390",
"pm_score": 0,
"selected": false,
"text": "<p>This is more of a workaround than a fix, but have you attempted to list the specializations as friends?</p>\n"
},
... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458795",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16457/"
] | If I have a non-template (i.e. "normal") class and wish to have a template friend function, how do I write it without causing a compiler error? Here is an example to illustrate what I am trying to do:
```
template <class T>
void bar(T* ptr);
class MyClass // note that this isn't a template class
{
private:
void ... | Are you sure what you've posted gives the error? The following (using Visual Studio 2005) works fine for me:
```
#include <iostream>
template <class T>
void bar(T* ptr);
class MyClass // note that this isn't a template class
{
private:
void foo();
template <class T>
friend void bar(T*); // ERROR: compi... |
458,802 | <p>I'd like the community's take on some thoughts I've had about Linq to Sql and other ORM mappers.</p>
<p>I like Linq to Sql and the idea of expressing data access logic (or CRUD operations in general) in your native development tongue rather than having to deal with the "impedance mismatch" between C# and SQL. For ... | [
{
"answer_id": 458821,
"author": "Jim Anderson",
"author_id": 42439,
"author_profile": "https://Stackoverflow.com/users/42439",
"pm_score": 5,
"selected": false,
"text": "<p>I think the popularity of ORMs has been spawned by developers developing data layers and writing the same CRUD cod... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15592/"
] | I'd like the community's take on some thoughts I've had about Linq to Sql and other ORM mappers.
I like Linq to Sql and the idea of expressing data access logic (or CRUD operations in general) in your native development tongue rather than having to deal with the "impedance mismatch" between C# and SQL. For example, to... | For at least 6 years I have been using my own ORM that is based on a very simple concept: projection. Each table is projected into a class, and SQL is generated on the fly based on the class definition. It still requires me to know SQL but it takes care of the 90% simple CRUD, and I never had to manage connections, etc... |
458,806 | <p>We use FxCop for all of our projects. For our UnitTests I am not sure it is worth it. We end up with many suppresses:</p>
<pre><code>[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = SuppressJustifications.CA1822MethodIsUsedExternallyAsNonStatic)]
[SuppressMessage("Microsoft.... | [
{
"answer_id": 458810,
"author": "Steven A. Lowe",
"author_id": 9345,
"author_profile": "https://Stackoverflow.com/users/9345",
"pm_score": 2,
"selected": false,
"text": "<p>not worth the effort; FxCop is for production coding standards, not internal test code</p>\n\n<p>(however, it does... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458806",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5189/"
] | We use FxCop for all of our projects. For our UnitTests I am not sure it is worth it. We end up with many suppresses:
```
[SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic", Justification = SuppressJustifications.CA1822MethodIsUsedExternallyAsNonStatic)]
[SuppressMessage("Microsoft.Usage", "CA1806:... | When I teach our unit test / TDD class, I usually tell people to write test code following the same principles as they would when writing prober production code. However, I acknowledge that some of the FxCop rules may generate too much noise.
Couldn't you use a suitable subset of the FxCop rules for the test code? |
458,820 | <p>In the IntelliJ console, stack traces automatically contain hyperlinks that bring you to the relevant source files. The links appear at the end of each line in the format (Log4jLoggerTest.java:25). I can configure log4j to output text in a similar format.</p>
<pre><code>log4j.appender.Console.layout.ConversionPat... | [
{
"answer_id": 459144,
"author": "Stefan Arentz",
"author_id": 56837,
"author_profile": "https://Stackoverflow.com/users/56837",
"pm_score": 1,
"selected": false,
"text": "<p>I don't think there is a way. But I think I submitted this as a feature request a long time ago. Maybe you should... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458820",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23572/"
] | In the IntelliJ console, stack traces automatically contain hyperlinks that bring you to the relevant source files. The links appear at the end of each line in the format (Log4jLoggerTest.java:25). I can configure log4j to output text in a similar format.
```
log4j.appender.Console.layout.ConversionPattern=%d{ABSOLUTE... | Yes you can, try this pattern:
```
<param name="ConversionPattern" value="%-5p - [%-80m] - at %c.%M(%F:%L)%n"/>
``` |
458,839 | <p>In using vim, when I start a comment with //, immediately after I type a space, it begins a new comment line.</p>
<p>For instance, if I typed the following:</p>
<pre><code>//hello world my name is stefan
</code></pre>
<p>I would get:</p>
<pre><code>//hello
//world
//my
//name
//is
//stefan
</code></pre>
<p>This... | [
{
"answer_id": 458871,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 4,
"selected": true,
"text": "<p>My guess is that you mixed up \"tw\" (aka textwidth) and the old vi command to set the text margin \"wm\". \"tw\" se... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458839",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13257/"
] | In using vim, when I start a comment with //, immediately after I type a space, it begins a new comment line.
For instance, if I typed the following:
```
//hello world my name is stefan
```
I would get:
```
//hello
//world
//my
//name
//is
//stefan
```
This behavior has manifested itself in python code as well, ... | My guess is that you mixed up "tw" (aka textwidth) and the old vi command to set the text margin "wm". "tw" sets the actual width of the page (ie. tw=77 means you want 77 letters per line) but "wm" set the how far from the edge of the screen to wrap, so on an 80 column screen "wm=3" would have the same effect as "tw=77... |
458,852 | <p>I’m trying to automate the refreshing of data in my Excel Reports. Here the script:</p>
<pre><code>$ExcelApp = new-object -ComObject Excel.Application
$ExcelApp.Visible = $false
$ExcelApp.DisplayAlerts = $false
$Workbook = $ExcelApp.Workbooks.Open("RefreshTest.xlsx", 3, $false, 5, $null, $null, $true)
$Workbook.Re... | [
{
"answer_id": 461327,
"author": "Marco Shaw",
"author_id": 26478,
"author_profile": "https://Stackoverflow.com/users/26478",
"pm_score": 2,
"selected": false,
"text": "<p>Your logic seems to be fine, and this works for me (XP SP2 and PowerShell v2).</p>\n\n<p>Just before you call Save()... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I’m trying to automate the refreshing of data in my Excel Reports. Here the script:
```
$ExcelApp = new-object -ComObject Excel.Application
$ExcelApp.Visible = $false
$ExcelApp.DisplayAlerts = $false
$Workbook = $ExcelApp.Workbooks.Open("RefreshTest.xlsx", 3, $false, 5, $null, $null, $true)
$Workbook.RefreshAll()
$Wo... | Your logic seems to be fine, and this works for me (XP SP2 and PowerShell v2).
Just before you call Save(), just for fun, add this line to see what gets printed:
```
$Workbook|Get-Member *Save*
```
I tried with a blank file. Is your file big perhaps? I wonder if you have a large file, and maybe need to add a "Start... |
458,857 | <p>As you might know, <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/aa367988%28v=vs.85%29.aspx" rel="noreferrer">msiexec</a> is a command line application that you can use to install an MSI file. As you might know, you can run it in silent or invisible mode.</p>
<p>If the installer requires the user... | [
{
"answer_id": 459261,
"author": "Dirk Vollmar",
"author_id": 40347,
"author_profile": "https://Stackoverflow.com/users/40347",
"pm_score": 2,
"selected": false,
"text": "<p><strong>How to configure silent MSI setup</strong></p>\n\n<p>An MSI installation can be configured on the command ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54760/"
] | As you might know, [msiexec](http://msdn.microsoft.com/en-us/library/windows/desktop/aa367988%28v=vs.85%29.aspx) is a command line application that you can use to install an MSI file. As you might know, you can run it in silent or invisible mode.
If the installer requires the user to answer specific questions about wh... | Think of the user interface with MSI as *optional*. This means no answers should be *required* as the developer has sensible defaults in place so that things don't break.
We distribute our software in MSI format to corporate customers, I also provide them with documentation on the basics of Orca (**orca.msi** is dist... |
458,879 | <p>I can't display the first entry from my query that returns multiple answers. For example, a search with a result set of five will return the second to fifth and miss the first entry. If I search for something that has one entry as output it doesn't return anything but just hangs because it is the first and only en... | [
{
"answer_id": 458916,
"author": "Cozzman",
"author_id": 18191,
"author_profile": "https://Stackoverflow.com/users/18191",
"pm_score": 3,
"selected": true,
"text": "<p>You are calling rs.next() twice before accessing the results. I would say that there are two options, first replace the ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56224/"
] | I can't display the first entry from my query that returns multiple answers. For example, a search with a result set of five will return the second to fifth and miss the first entry. If I search for something that has one entry as output it doesn't return anything but just hangs because it is the first and only entry i... | You are calling rs.next() twice before accessing the results. I would say that there are two options, first replace the while with a do...while loop, or remove the if/else statement and keep track of the results in a counter, and at the end check if the counter is 0 and display the message then. |
458,897 | <p>Say I have a <code>div</code> containing an unlimited number of child <code>div</code>s. Is there an easy way to get jQuery to select the <em>n</em>th <code>div</code> and every <code>div</code> after it so I can change those (in this case, call <code>remove()</code> on old <code>div</code>s)?</p>
| [
{
"answer_id": 458920,
"author": "pilif",
"author_id": 5083,
"author_profile": "https://Stackoverflow.com/users/5083",
"pm_score": 2,
"selected": false,
"text": "<p>Typing this out of my head and the jQuery API doc (read: this is not tested), but the first thing I'd do is to</p>\n\n<pre>... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1902010/"
] | Say I have a `div` containing an unlimited number of child `div`s. Is there an easy way to get jQuery to select the *n*th `div` and every `div` after it so I can change those (in this case, call `remove()` on old `div`s)? | You can use the [":gt()"](http://docs.jquery.com/Selectors/gt#index) selector:
```
// div's 10 and higher
$('div:gt(9)').show()
``` |
458,902 | <p>I have a text column with repeated values, for example:</p>
<pre><code> | A |
---|---------|
1 | emails |
2 | foo |
3 | foo |
4 | bar |
5 | bar |
6 | stuff |
7 | stuff |
8 | stuff |
</code></pre>
<p>What I would like to do is to have another column with numbers, so that each... | [
{
"answer_id": 459001,
"author": "Alex P",
"author_id": 235442,
"author_profile": "https://Stackoverflow.com/users/235442",
"pm_score": 0,
"selected": false,
"text": "<p>There are a number of ways of doing this, depending on the exact nature of your table of data.</p>\n\n<p>If the repeat... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458902",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14022/"
] | I have a text column with repeated values, for example:
```
| A |
---|---------|
1 | emails |
2 | foo |
3 | foo |
4 | bar |
5 | bar |
6 | stuff |
7 | stuff |
8 | stuff |
```
What I would like to do is to have another column with numbers, so that each number matches the value ... | Depending on what you mean by value -
If you mean "repeating group" then a macro like this may work -
```
Sub Check()
Dim start As Integer
start = 1
For Row = 2 To 12
Cells.Item(Row, 2) = start
If Cells.Item(Row, 1) <> Cells.Item(Row + 1, 1) Then
start = start + 1
End ... |
458,913 | <p>I have an small question I didn't found an answer yet: how do I get in c# and using Microsoft.SqlServer.Smo the table a foreign key column is referring to? </p>
<pre><code>foreach (Column column in currentTable.Columns) {
if (column.IsForeignKey) {
//GET TABLE FOREIGN KEY REFERS TO
... | [
{
"answer_id": 458940,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 5,
"selected": true,
"text": "<p>You should start from the table itself, and enumerate all of it's foreign keys. Sample code:</p>\n\n<pre><code>foreach (Fo... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1929/"
] | I have an small question I didn't found an answer yet: how do I get in c# and using Microsoft.SqlServer.Smo the table a foreign key column is referring to?
```
foreach (Column column in currentTable.Columns) {
if (column.IsForeignKey) {
//GET TABLE FOREIGN KEY REFERS TO
}
}
``` | You should start from the table itself, and enumerate all of it's foreign keys. Sample code:
```
foreach (ForeignKey key in currentTable.ForeignKeys)
{
foreach (ForeignKeyColumn column in key.Columns)
{
Console.WriteLine("Column: {0} is a foreign key to Table: {1}",column.Name,key.ReferencedTable);
... |
458,915 | <p>I can search word in vim with <code>/word</code>. How can I search only for <code>word</code>, excluding searches for <code>word1</code> and <code>word2</code>?</p>
| [
{
"answer_id": 458919,
"author": "Nathan Fellman",
"author_id": 1084,
"author_profile": "https://Stackoverflow.com/users/1084",
"pm_score": 9,
"selected": true,
"text": "<p>like this:</p>\n\n<pre><code>/\\<word\\>\n</code></pre>\n\n<p><code>\\<</code> means beginning of a word, ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43756/"
] | I can search word in vim with `/word`. How can I search only for `word`, excluding searches for `word1` and `word2`? | like this:
```
/\<word\>
```
`\<` means beginning of a word, and `\>` means the end of a word,
Adding @Roe's comment:
VIM provides a shortcut for this. If you already have *word* on screen and you want to find other instances of it, you can put the cursor on the word and press `'*'` to search forward in the file... |
458,922 | <p>The following code renders great in FF3 but doesn't work in IE7. Does anyone have an idea how to fix it?</p>
<pre><code><div style="padding-top:3px;padding-bottom:5px;width:650px;background:blue">
<div style="height:50px;float:left;display:inline;width:500px;background:gray">http://www.brainsolis.co... | [
{
"answer_id": 458942,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 2,
"selected": false,
"text": "<p>You do not need to <em>float</em> an element, and <em>display:inline</em> at the same time. Additionally, you do not ne... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | The following code renders great in FF3 but doesn't work in IE7. Does anyone have an idea how to fix it?
```
<div style="padding-top:3px;padding-bottom:5px;width:650px;background:blue">
<div style="height:50px;float:left;display:inline;width:500px;background:gray">http://www.brainsolis.com/2008/10/twitter-tools-fo... | You do not need to *float* an element, and *display:inline* at the same time. Additionally, you do not need to set *width:100%* for DIV elements. They will naturally take up all available horizontal space.
The following CSS should achieve what you are attempting.
```
div.container {
}
div.floated {
width:50px;... |
458,927 | <p>I am following <a href="http://akrabat.com/2008/02/21/simple-zend_form-example/" rel="nofollow noreferrer">this tutorial</a> on Zend Forms. I copied it verbatim and I got this error</p>
<blockquote>
<p>Fatal error: Class 'forms_ContactForm' not found in /Quickstart/application/controllers/IndexController.php on ... | [
{
"answer_id": 458942,
"author": "Sampson",
"author_id": 54680,
"author_profile": "https://Stackoverflow.com/users/54680",
"pm_score": 2,
"selected": false,
"text": "<p>You do not need to <em>float</em> an element, and <em>display:inline</em> at the same time. Additionally, you do not ne... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458927",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27620/"
] | I am following [this tutorial](http://akrabat.com/2008/02/21/simple-zend_form-example/) on Zend Forms. I copied it verbatim and I got this error
>
> Fatal error: Class 'forms\_ContactForm' not found in /Quickstart/application/controllers/IndexController.php on line 10
>
>
>
Which led me to believe it wasn't loadi... | You do not need to *float* an element, and *display:inline* at the same time. Additionally, you do not need to set *width:100%* for DIV elements. They will naturally take up all available horizontal space.
The following CSS should achieve what you are attempting.
```
div.container {
}
div.floated {
width:50px;... |
458,954 | <p>I've been tasked with writing some XSLT 2.0 to translate an XML document to another XML document. I'm relatively new to XSLT but I have learn alot during the days I've do this. During this time I have had to map simple values, i.e. 002 -> TH etc. This has been fine for small lists of less than 10 values, I used xsl:... | [
{
"answer_id": 459767,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 2,
"selected": false,
"text": "<p>Here is a way to do what you intend, using an <code><xsl:key></code> and otherwise following your method two.</p>... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458954",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I've been tasked with writing some XSLT 2.0 to translate an XML document to another XML document. I'm relatively new to XSLT but I have learn alot during the days I've do this. During this time I have had to map simple values, i.e. 002 -> TH etc. This has been fine for small lists of less than 10 values, I used xsl:cho... | Here is an **XSLT 2.0 solution**.
Source XML file:
================
```
<input>
<data>001</data>
<data>002</data>
<data>005</data>
</input>
```
"Mapping" xml file:
===================
```
<map>
<default>?-?-?</default>
<input value="001">RZ</input>
<input value="002">TH</input>
<input value="00... |
458,958 | <p>I am trying to configure my CruiseControl.NET server to send emails to those the contribute to the source; however, I cannot seem to configure the email publisher properly. I am receiving the following error from CruiseControl.NET.</p>
<blockquote>
<p>Exception: Unused node detected: <subjectSettings><s... | [
{
"answer_id": 462557,
"author": "Alex",
"author_id": 26564,
"author_profile": "https://Stackoverflow.com/users/26564",
"pm_score": 3,
"selected": true,
"text": "<p>Are you building CruiseControl from scratch? because it looks like that functionality was only checked in a few weeks ago, ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458958",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19977/"
] | I am trying to configure my CruiseControl.NET server to send emails to those the contribute to the source; however, I cannot seem to configure the email publisher properly. I am receiving the following error from CruiseControl.NET.
>
> Exception: Unused node detected: <subjectSettings><subject buildResult="Success" v... | Are you building CruiseControl from scratch? because it looks like that functionality was only checked in a few weeks ago, and if you are using one of the releases that functionality isn't in there. |
458,972 | <p>From my bash shell I would like to call a program n times with a different numbered parameter, which has to be in a fixed format like "%02i"</p>
<p>One way would be:</p>
<pre><code>for ((i=23; i<42;i++)); do
sh ../myprogram `printf "%02i\n" $i`
done
</code></pre>
<p>Is there a way to improve the <code>pri... | [
{
"answer_id": 459019,
"author": "Commodore Jaeger",
"author_id": 4659,
"author_profile": "https://Stackoverflow.com/users/4659",
"pm_score": 5,
"selected": true,
"text": "<p>In Bash, <code>printf</code> is provided by the shell (see <a href=\"http://linux.die.net/man/1/bash\" rel=\"nore... | 2009/01/19 | [
"https://Stackoverflow.com/questions/458972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43613/"
] | From my bash shell I would like to call a program n times with a different numbered parameter, which has to be in a fixed format like "%02i"
One way would be:
```
for ((i=23; i<42;i++)); do
sh ../myprogram `printf "%02i\n" $i`
done
```
Is there a way to improve the `printf..` part? I believe this might be a pe... | In Bash, `printf` is provided by the shell (see [the bash(1) manpage](http://linux.die.net/man/1/bash), search for "printf"), so you don't even have the (minimal) overhead of `fork()` and `exec()` to execute a separate command -- unless you run it from within backticks. Bash's built-in printf lets you assign the output... |
459,034 | <p>In a .NET Windows service (C#), how can I get the computer name?</p>
<p>Is this a reliable method, or should I wrap it in a try/catch?</p>
| [
{
"answer_id": 459042,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 6,
"selected": true,
"text": "<p>Look at the <a href=\"http://msdn.microsoft.com/en-us/library/system.environment_properties(VS.80).aspx\" rel=\"noreferr... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459034",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] | In a .NET Windows service (C#), how can I get the computer name?
Is this a reliable method, or should I wrap it in a try/catch? | Look at the [Environment class](http://msdn.microsoft.com/en-us/library/system.environment_properties(VS.80).aspx). There're lots of nice things in there, including the [MachineName](http://msdn.microsoft.com/en-us/library/system.environment.machinename(VS.80).aspx):
```
string CurrentMachineName = Environment.Machine... |
459,065 | <p>Ok, I have two tables that I am joining and doing a select on to get three fields back (timestamp, message, and articleNum). Now, this data is basically a log of when an article was created and modified, I have to write the logic to process those three fields I got back. In order to figure out when an article was cr... | [
{
"answer_id": 459073,
"author": "Ian P",
"author_id": 10853,
"author_profile": "https://Stackoverflow.com/users/10853",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure I understand the question..</p>\n\n<p>You want to look in message and extract Created Time and Modified Time?</p... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459065",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/49887/"
] | Ok, I have two tables that I am joining and doing a select on to get three fields back (timestamp, message, and articleNum). Now, this data is basically a log of when an article was created and modified, I have to write the logic to process those three fields I got back. In order to figure out when an article was creat... | I'm making some assumptions here:
If you're table stores a row for each of your messages (added/updated), then this query would return one row per article, with the columns you need (articleNum, Created, Updated):
```
SELECT
A.articleNum,
MCreated.Timestamp AS Created,
MUpdated.Timestamp Updated
FROM Article... |
459,083 | <p>My little brother is just getting into programming, and for his Science Fair project, he's doing a simulation of a flock of birds in the sky. He's gotten most of his code written, and it works nicely, but the birds need to move <em>every moment</em>.</p>
<p>Tkinter, however, hogs the time for its own event loop, an... | [
{
"answer_id": 459131,
"author": "Dave Ray",
"author_id": 40310,
"author_profile": "https://Stackoverflow.com/users/40310",
"pm_score": 8,
"selected": true,
"text": "<p>Use the <code>after</code> method on the <code>Tk</code> object:</p>\n\n<pre><code>from tkinter import *\n\nroot = Tk()... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459083",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56805/"
] | My little brother is just getting into programming, and for his Science Fair project, he's doing a simulation of a flock of birds in the sky. He's gotten most of his code written, and it works nicely, but the birds need to move *every moment*.
Tkinter, however, hogs the time for its own event loop, and so his code won... | Use the `after` method on the `Tk` object:
```
from tkinter import *
root = Tk()
def task():
print("hello")
root.after(2000, task) # reschedule event in 2 seconds
root.after(2000, task)
root.mainloop()
```
Here's the declaration and documentation for the `after` method:
```
def after(self, ms, func=None... |
459,103 | <p>I have a similar scenario as this one:</p>
<pre><code>public class TestLinq2Xml
{
private XElement GenerateSomeXml()
{
return XElement.Parse(@"<MyObject>
<Properties>
<Name>My object 1</Name>
... | [
{
"answer_id": 459123,
"author": "AnthonyWJones",
"author_id": 17516,
"author_profile": "https://Stackoverflow.com/users/17516",
"pm_score": 3,
"selected": true,
"text": "<p>The XElement.Parse returns an XElement which is the <code><MyObject></code> node. Try:-</p>\n\n<p>var name ... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459103",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15763/"
] | I have a similar scenario as this one:
```
public class TestLinq2Xml
{
private XElement GenerateSomeXml()
{
return XElement.Parse(@"<MyObject>
<Properties>
<Name>My object 1</Name>
<Position>0; 0; 0</Position... | The XElement.Parse returns an XElement which is the `<MyObject>` node. Try:-
var name = xmlTree.Element("Properties").Element("Name").Value; |
459,107 | <p>I have a C++ method signature that looks like this:</p>
<pre><code> static extern void ImageProcessing(
[MarshalAs(UnmanagedType.LPArray)]ushort[] inImage,
[MarshalAs(UnmanagedType.LPArray)]ushort[] outImage,
int inYSize, int inXSize);
</code></pre>
<p>I've wrapped the function in timing... | [
{
"answer_id": 459128,
"author": "ctacke",
"author_id": 13154,
"author_profile": "https://Stackoverflow.com/users/13154",
"pm_score": 2,
"selected": false,
"text": "<p>Take a look at <a href=\"http://community.opennetcf.com/articles/cf/archive/2008/01/31/performance-implications-of-cross... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21981/"
] | I have a C++ method signature that looks like this:
```
static extern void ImageProcessing(
[MarshalAs(UnmanagedType.LPArray)]ushort[] inImage,
[MarshalAs(UnmanagedType.LPArray)]ushort[] outImage,
int inYSize, int inXSize);
```
I've wrapped the function in timing methods, both internal an... | The answer is, sadly, far more mundane than these suggestions, although they do help. Basically, I messed up with how I was doing timing.
The timing code that I was using was this:
```
Ipp32s timer;
ippGetCpuFreqMhz(&timer);
Ipp64u globalStart = ippGetCpuClocks();
globalStart = ippGetCpuClocks() *2 - globalStart; //u... |
459,119 | <p>I have three entities: Customer, Device and LocationTag. </p>
<p>Customers have a list of LocationTags (nothing more than an ID and a Description). They also have a list of Devices.</p>
<p>Devices are tagged with a subset of the Customer's LocationTags, so Devices have a List of LocationTags, too (but only of t... | [
{
"answer_id": 459140,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 1,
"selected": false,
"text": "<p>What version of .Net/Visual Studio are you using? XDocument wasn't added to the framework until .Net 3.5.</p>\n"
... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459119",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32620/"
] | I have three entities: Customer, Device and LocationTag.
Customers have a list of LocationTags (nothing more than an ID and a Description). They also have a list of Devices.
Devices are tagged with a subset of the Customer's LocationTags, so Devices have a List of LocationTags, too (but only of the Customer's).
If ... | If I recall correctly you need to add the System.Xml.Linq dll in the project references. |
459,146 | <p>I'm looking into horizontal partitioning for a table that has time-series data in it. I've discovered that partitioning is much easier in 2005 than it was in 2000 but I can't seem to find this answer:</p>
<p><strong>Can I add/drop columns of a partitioned table?</strong></p>
<p>Are special steps required because i... | [
{
"answer_id": 459160,
"author": "E.J. Brennan",
"author_id": 53686,
"author_profile": "https://Stackoverflow.com/users/53686",
"pm_score": 2,
"selected": false,
"text": "<p><em>In addition to performing SWITCH operations that involve partitioned tables, ALTER TABLE can be used to change... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459146",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29/"
] | I'm looking into horizontal partitioning for a table that has time-series data in it. I've discovered that partitioning is much easier in 2005 than it was in 2000 but I can't seem to find this answer:
**Can I add/drop columns of a partitioned table?**
Are special steps required because it's partitioned? | I couldn't find a definitive answer (I found the doc @E.J. Brennan referenced to be a little dense and unclear). So I added to [this example](http://weblogs.sqlteam.com/dmauri/archive/2005/07/18/7147.aspx) and have tested that, **yes, you can add/drop columns**:
```
USE adventureworks
go
create partition function Yea... |
459,161 | <p>Django templates offer the builtin tag <code>cycle</code> for alternating between several values at different points in a template (or for loop in a template) but this tag does not reset when it is accessed in a scope outside of the <code>cycle</code>s definition. I.e., if you have two or more lists in your templat... | [
{
"answer_id": 459202,
"author": "Steve Losh",
"author_id": 13498,
"author_profile": "https://Stackoverflow.com/users/13498",
"pm_score": 1,
"selected": false,
"text": "<p>The easiest answer might be: \"give up and use jQuery.\" If that's acceptable it's probably easier than fighting wi... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459161",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39396/"
] | Django templates offer the builtin tag `cycle` for alternating between several values at different points in a template (or for loop in a template) but this tag does not reset when it is accessed in a scope outside of the `cycle`s definition. I.e., if you have two or more lists in your template, the rows of all of whic... | The easiest workaround (until the resetcycle patch gets fixed up and applied) is to use the built-in "divisibleby" filter with forloop.counter:
```
{% for entry in blog.entries %}
<div class="{% if forloop.counter|divisibleby:2 %}even{% else %}odd{% endif %}" id="{{ entry.id }}">
{{ entry.text }}
</div>
{% end... |
459,168 | <p>How do I escape the dot in the indexer? The first DataBinder.Eval works as expected. The second throws an exception.</p>
<pre><code>System.ArgumentException: DataBinding: 'dict["a' is not a valid indexed expression.
Dictionary<string, int> dict = new Dictionary<string, int>();
dict.Add("aaa", 111);
... | [
{
"answer_id": 459266,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 1,
"selected": false,
"text": "<p>Use this method instead:</p>\n\n<pre><code>Console.WriteLine(DataBinder.GetIndexedPropertyValue(blah, \"dict[\\\"a.aa\\\"... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28736/"
] | How do I escape the dot in the indexer? The first DataBinder.Eval works as expected. The second throws an exception.
```
System.ArgumentException: DataBinding: 'dict["a' is not a valid indexed expression.
Dictionary<string, int> dict = new Dictionary<string, int>();
dict.Add("aaa", 111);
dict.Add("bbb", 222);
dict.Ad... | DataBinder.Eval first splits a string up by expression parts via a set array of char tokens (which it defines in a static constructor as):
```
expressionPartSeparator = new char[] { '.' };
```
It then passes these parts into a private Eval method that will either use DataBinder.GetPropertyValue or DataBinder.GetInde... |
459,171 | <p>Is there a way using WPF to get a video element to start playing when a user puts there mouse pointer over the element? I am wanting to make an interactive digital resource and want a clip of the movie to play when the mouse over the element to click to take them to the movie section. Any help would be great.</p>
<... | [
{
"answer_id": 459270,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 1,
"selected": false,
"text": "<p>If you're using a MediaElement to play your video, just listen for the <a href=\"http://msdn.microsoft.com/en-us/library/... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44785/"
] | Is there a way using WPF to get a video element to start playing when a user puts there mouse pointer over the element? I am wanting to make an interactive digital resource and want a clip of the movie to play when the mouse over the element to click to take them to the movie section. Any help would be great.
This is ... | Found an issue with the
```
<MediaElement Margin="12"
Name="mediaElement1"
Source="mediaFile.avi"
LoadedBehavior="Manual"
MouseEnter="mediaElement1_MouseEnter"
MouseLeave="mediaElement1_MouseLeave"
... |
459,182 | <p>How can I use expect to send a password to an ssh connection.</p>
<p>say the password was p@ssword
and the ssh command was
ssh me@127.0.0.1</p>
<p>What would I do with expect to a make it input the password when it says</p>
<p>me@127.0.0.1's password:<br />
?</p>
<p>The proper action of using an SSH key pair isn... | [
{
"answer_id": 459191,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>Would it not be easier to use public key authentication and use a key with no passphrase?</p>\n\n<p>As the user on the... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459182",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12243/"
] | How can I use expect to send a password to an ssh connection.
say the password was p@ssword
and the ssh command was
ssh me@127.0.0.1
What would I do with expect to a make it input the password when it says
me@127.0.0.1's password:
?
The proper action of using an SSH key pair isn't an option because I would have ... | I always used the "proper" solution, but I used expect in other situations.
[Here](http://linux-bsd-central.com/index.php/content/view/26/) I found following suggestion:
```
#!/usr/local/bin/expect
spawn sftp -b cmdFile user@yourserver.com
expect "password:"
send "shhh!\n";
interact
``` |
459,189 | <p>I am looking to make a phone call from software and have the software read a message to the recipient. I have been using Asterisk, but have found it somewhat are to maintain and it was a pain to configure. I'm wondering if there are any services where you can send it a piece of text and a phone number and it will re... | [
{
"answer_id": 459191,
"author": "Paul Dixon",
"author_id": 6521,
"author_profile": "https://Stackoverflow.com/users/6521",
"pm_score": 2,
"selected": false,
"text": "<p>Would it not be easier to use public key authentication and use a key with no passphrase?</p>\n\n<p>As the user on the... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5441/"
] | I am looking to make a phone call from software and have the software read a message to the recipient. I have been using Asterisk, but have found it somewhat are to maintain and it was a pain to configure. I'm wondering if there are any services where you can send it a piece of text and a phone number and it will read ... | I always used the "proper" solution, but I used expect in other situations.
[Here](http://linux-bsd-central.com/index.php/content/view/26/) I found following suggestion:
```
#!/usr/local/bin/expect
spawn sftp -b cmdFile user@yourserver.com
expect "password:"
send "shhh!\n";
interact
``` |
459,203 | <p>I'm using Visual Studios' built-in ASP.NET Development Server (VWD) to test my web site during development.</p>
<p>I would like this ASP.NET web site to use extensionless URLs (pages don't require the aspx extension). Ordinarily I would configure a custom 404 in IIS that directs to an ASPX page. How would I do th... | [
{
"answer_id": 459412,
"author": "Darin Dimitrov",
"author_id": 29407,
"author_profile": "https://Stackoverflow.com/users/29407",
"pm_score": 1,
"selected": false,
"text": "<p>There's nothing special you need to do. Just remove the .aspx extension from the ASPX page file and it should wo... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12689/"
] | I'm using Visual Studios' built-in ASP.NET Development Server (VWD) to test my web site during development.
I would like this ASP.NET web site to use extensionless URLs (pages don't require the aspx extension). Ordinarily I would configure a custom 404 in IIS that directs to an ASPX page. How would I do this with VWD?... | Here is an example of a Web.Config using UrlRewritingNet. Doing this will allow you to do extensionless Rewriting without having to write any HttpModule or anything like that.
(full article [here](http://dotnetblogger.com/post/2009/08/05/URL-Rewriting-Made-Easy-Part-2-(Extensionless-URLs-IIS7-and-URLReWritingNet).aspx... |
459,207 | <p>I have created a function outside of <code>$(document).ready()</code>, but am still using jQuery inside of it. For example:</p>
<pre><code>testFunction(){
$('#test').hide();
alert('test');
}
</code></pre>
<p>When I call <code>testFunction()</code> after the page has completely loaded, #test is not hidden but I... | [
{
"answer_id": 459219,
"author": "Genericrich",
"author_id": 39932,
"author_profile": "https://Stackoverflow.com/users/39932",
"pm_score": 0,
"selected": false,
"text": "<p>Is there an element with an ID of test in the page?</p>\n\n<p>Is JQuery loaded?</p>\n\n<p>If you have added #test a... | 2009/01/19 | [
"https://Stackoverflow.com/questions/459207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/74552/"
] | I have created a function outside of `$(document).ready()`, but am still using jQuery inside of it. For example:
```
testFunction(){
$('#test').hide();
alert('test');
}
```
When I call `testFunction()` after the page has completely loaded, #test is not hidden but I do see the alert.
What must I do in order to u... | You can use '`#test`' as a selector, you just need to give [jQuery some context](http://docs.jquery.com/Core/jQuery#expressioncontext), as it always assumes you're talking about an ID in the current document, not the parent:
```
// Selects the test element from the parent
var test = $('#test', parent)
```
**EDIT** ... |