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 |
|---|---|---|---|---|---|---|
362,489 | <p>Using <a href="https://numpy.org/" rel="nofollow noreferrer">NumPy</a>, a matrix A has n rows and m columns, and I want add a guard ring to matrix A. That guard ring is all zero.</p>
<p>What should I do? Use Reshape? But the element is not enough to make a n+1 m+1 matrix.</p>
<p>Or etc.?</p>
<p>Thanks in advance</p>... | [
{
"answer_id": 363040,
"author": "Alex Coventry",
"author_id": 1941213,
"author_profile": "https://Stackoverflow.com/users/1941213",
"pm_score": 4,
"selected": true,
"text": "<p>Following up on your <a href=\"https://stackoverflow.com/questions/362489/how-do-i-add-a-guard-ring-to-a-matri... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362489",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44354/"
] | Using [NumPy](https://numpy.org/), a matrix A has n rows and m columns, and I want add a guard ring to matrix A. That guard ring is all zero.
What should I do? Use Reshape? But the element is not enough to make a n+1 m+1 matrix.
Or etc.?
Thanks in advance
###### I mean an extra ring of cells that always contain 0 s... | Following up on your [comment](https://stackoverflow.com/questions/362489/how-do-i-add-a-guard-ring-to-a-matrix-in-numpy#362576):
```
>>> import numpy
>>> a = numpy.array(range(9)).reshape((3,3))
>>> b = numpy.zeros(tuple(s+2 for s in a.shape), a.dtype)
>>> b[tuple(slice(1,-1) for s in a.shape)] = a
>>> b
array([[0, ... |
362,516 | <p>How can one ignore Unexpected element situation in JAXB ans still get all other kind of javax.xml.bind.UnmarshalException?</p>
<pre><code>obj = unmler.unmarshal(new StringReader(xml))
</code></pre>
<p>Notice i still want to get the obj result of the xml parsing.</p>
| [
{
"answer_id": 362533,
"author": "João",
"author_id": 35323,
"author_profile": "https://Stackoverflow.com/users/35323",
"pm_score": 5,
"selected": true,
"text": "<p>The solution.</p>\n\n<p>In JAXB implementing ValidationEventHandler like so:</p>\n\n<pre><code>class CustomValidationEventH... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362516",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35323/"
] | How can one ignore Unexpected element situation in JAXB ans still get all other kind of javax.xml.bind.UnmarshalException?
```
obj = unmler.unmarshal(new StringReader(xml))
```
Notice i still want to get the obj result of the xml parsing. | The solution.
In JAXB implementing ValidationEventHandler like so:
```
class CustomValidationEventHandler implements ValidationEventHandler{
public boolean handleEvent(ValidationEvent evt) {
System.out.println("Event Info: "+evt);
if(evt.getMessage().contains("Unexpected element"))
re... |
362,522 | <p>I recently tried switching from using <code>python-mode.el</code> to <code>python.el</code> for editing python files in emacs, found the experience a little alien and unproductive, and scurried back. I've been using <code>python-mode.el</code> for something like ten years, so perhaps I'm a little set in my ways. I... | [
{
"answer_id": 362596,
"author": "Johan Dahlin",
"author_id": 14337,
"author_profile": "https://Stackoverflow.com/users/14337",
"pm_score": 1,
"selected": false,
"text": "<p>python-mode.el is written by the Python community. python.el is written by the emacs community. I've used python-m... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362522",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1941213/"
] | I recently tried switching from using `python-mode.el` to `python.el` for editing python files in emacs, found the experience a little alien and unproductive, and scurried back. I've been using `python-mode.el` for something like ten years, so perhaps I'm a little set in my ways. I'd be interested in hearing from anyon... | For what it's worth, I do not see the behavior you are seeing in issue #1, "Each buffer visiting a python file gets its own inferior interactive python shell."
This is what I did using python.el from Emacs 22.2.
C-x C-f foo.py
[insert: print "foo"]
C-x C-f bar.py
[insert: print "bar"]
C-c C-z [\*Python\* buffer app... |
362,541 | <p>I'm new to TDD. So any help would be appreciated. I'm using NUnit and Rhino mocks.
How can I set the ID value to 1 in my mock object?</p>
<p>I had a look at this: <a href="http://www.iamnotmyself.com/2008/06/26/RhinoMocksAndReadOnlyPropertyInjectionPart2.aspx" rel="nofollow noreferrer">http://www.iamnotmyself.com/2... | [
{
"answer_id": 362596,
"author": "Johan Dahlin",
"author_id": 14337,
"author_profile": "https://Stackoverflow.com/users/14337",
"pm_score": 1,
"selected": false,
"text": "<p>python-mode.el is written by the Python community. python.el is written by the emacs community. I've used python-m... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11538/"
] | I'm new to TDD. So any help would be appreciated. I'm using NUnit and Rhino mocks.
How can I set the ID value to 1 in my mock object?
I had a look at this: <http://www.iamnotmyself.com/2008/06/26/RhinoMocksAndReadOnlyPropertyInjectionPart2.aspx>
but the reflection doesn't seem to work against interfaces.
```
publ... | For what it's worth, I do not see the behavior you are seeing in issue #1, "Each buffer visiting a python file gets its own inferior interactive python shell."
This is what I did using python.el from Emacs 22.2.
C-x C-f foo.py
[insert: print "foo"]
C-x C-f bar.py
[insert: print "bar"]
C-c C-z [\*Python\* buffer app... |
362,548 | <p>I am trying to find the best practice for generating and outputting html which would require a database query first to obtain the info. Currently in the aspx page I have a div with runat server:</p>
<pre><code><div runat="server" id="leaflet"></div>
</code></pre>
<p>Now just as a start to do a bit of t... | [
{
"answer_id": 362557,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 1,
"selected": false,
"text": "<p>I'd use either string.Format, if the number of fields is fixed (and relatively small), or a StringBuilder, otherwise... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362548",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16989/"
] | I am trying to find the best practice for generating and outputting html which would require a database query first to obtain the info. Currently in the aspx page I have a div with runat server:
```
<div runat="server" id="leaflet"></div>
```
Now just as a start to do a bit of testing I have a method that runs on pa... | I would use `<asp:Literal runat="server" enableViewState="false" id="leaflet" />`. This doesn't generate any tags on the page, and doesn't stuff all the text in the ViewState.
And yes, use StringBuilder if you need to concatenate many long strings. This will be way more memory efficient.
The other solution would be t... |
362,555 | <p><code>FromIp</code> contains <code>"192.168.1.1"</code>. I want to get the last number, but I can't figure out what's wrong here:</p>
<pre><code>
Dim str As String
str = FromIP.Text.Substring(FromIP.Text.LastIndexOf("."), FromIP.Text.Length).ToString()
MessageBox.Show(FromIP.Text.Length)
</code></pre>
| [
{
"answer_id": 362562,
"author": "Eduardo Molteni",
"author_id": 2385,
"author_profile": "https://Stackoverflow.com/users/2385",
"pm_score": 3,
"selected": true,
"text": "<p>Tested code:</p>\n\n<pre><code> Dim FromIp As String = \"192.168.1.1\"\n Dim str As String\n str = FromIp... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362555",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | `FromIp` contains `"192.168.1.1"`. I want to get the last number, but I can't figure out what's wrong here:
```
Dim str As String
str = FromIP.Text.Substring(FromIP.Text.LastIndexOf("."), FromIP.Text.Length).ToString()
MessageBox.Show(FromIP.Text.Length)
``` | Tested code:
```
Dim FromIp As String = "192.168.1.1"
Dim str As String
str = FromIp.Substring(FromIp.LastIndexOf(".") + 1).ToString()
MessageBox.Show(str)
```
* You must add 1 to LastIndexOf to skip the dot
* There no need put the lenght of the Substring when you want all the rest of the string
But... |
362,556 | <p>i'm having an issue with creating a query in oracle which doesnt seem to want to join on missing values </p>
<p>the table i have is this:</p>
<pre><code>table myTable(refnum, contid, type)
values are:
1, 10, 90000
2, 20, 90000
3, 30, 90000
4, 20, 10000
5, 30, 10000
6, 10, 20000
7, 20, 20000
8, 30, 20000
</code></... | [
{
"answer_id": 362569,
"author": "Tom Haigh",
"author_id": 22224,
"author_profile": "https://Stackoverflow.com/users/22224",
"pm_score": 6,
"selected": true,
"text": "<p>You are correct in saying that left joins will return nulls for the right where there is no match, but you are not all... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21180/"
] | i'm having an issue with creating a query in oracle which doesnt seem to want to join on missing values
the table i have is this:
```
table myTable(refnum, contid, type)
values are:
1, 10, 90000
2, 20, 90000
3, 30, 90000
4, 20, 10000
5, 30, 10000
6, 10, 20000
7, 20, 20000
8, 30, 20000
```
a break down of the fiel... | You are correct in saying that left joins will return nulls for the right where there is no match, but you are not allowing these nulls to be returned when you add this restriction to your where clause:
```
and b.id_tp_cd = 10000
and c.id_tp_cd = 20000
```
You should be able to put these in the 'on' clause of the jo... |
362,570 | <p>I am using Carbide (just upgraded to 2.0) to develop an S60 3rd Edition application.</p>
<p>I would like to know the easiest way to change the icon (both the application icon on the device menu <strong>and</strong> the icon at the top left of the main view) because I have the need to skin my application in many dif... | [
{
"answer_id": 368063,
"author": "Riho",
"author_id": 44715,
"author_profile": "https://Stackoverflow.com/users/44715",
"pm_score": 1,
"selected": false,
"text": "<p>If you want to change the icon in your SIS file and then overinstall it on device then you may have to reboot your device ... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33604/"
] | I am using Carbide (just upgraded to 2.0) to develop an S60 3rd Edition application.
I would like to know the easiest way to change the icon (both the application icon on the device menu **and** the icon at the top left of the main view) because I have the need to skin my application in many different ways as easily a... | To change the app icon when you run your app use (in the status bar):
```
CEikStatusPane* sp=iEikonEnv->AppUiFactory()->StatusPane();
CAknContextPane* cp=(CAknContextPane *)sp->ControlL(TUid::Uid(EEikStatusPaneUidContext));
_LIT(KContextBitMapFile, "my_bitmap_file.mbm");
CFbsBitmap* bitmap = iEikonEnv->CreateBitmapL(K... |
362,586 | <p>I am trying to use the Data View Web Part in Sharepoint. There are many articles on the web related to populating it with data. My question is, what if the data source is empty? Is there a way to display a default message in this scenario?</p>
| [
{
"answer_id": 366807,
"author": "Bjørn Furuknap",
"author_id": 28382,
"author_profile": "https://Stackoverflow.com/users/28382",
"pm_score": 3,
"selected": true,
"text": "<p>You can do this in the XSL stylesheet, which is what SharePoint Designer does when you set the text to display if... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362586",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am trying to use the Data View Web Part in Sharepoint. There are many articles on the web related to populating it with data. My question is, what if the data source is empty? Is there a way to display a default message in this scenario? | You can do this in the XSL stylesheet, which is what SharePoint Designer does when you set the text to display if data source is empty.
```
<xsl:variable name="dvt_IsEmpty" select="$dvt_RowCount = 0" />
<xsl:choose>
<xsl:when test="$dvt_IsEmpty">
<xsl:call-template name="dvt_1.empty" />
... |
362,603 | <p>How do I set a disabled TextBox's current text color to be the same as its current background color in C#?</p>
<p>Simply doing txtLala.ForeColor = txtLala.BackColor does not seems to work.</p>
| [
{
"answer_id": 362608,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 0,
"selected": false,
"text": "<p>If this is a readonly textbox, you need to explicitly set your BackColor first, then your statement will work.</p>\n\n<... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362603",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I set a disabled TextBox's current text color to be the same as its current background color in C#?
Simply doing txtLala.ForeColor = txtLala.BackColor does not seems to work. | This works:
```
txtLala.Text = "Red";
txtLala.BackColor = System.Drawing.Color.Red;
txtLala.ForeColor = txtLala.BackColor;
txtLala.ReadOnly = true;
```
Try setting the `color`, before the `readonly`. And also check how you are setting the color!
**EDIT**
Try this
```
txtLala.Attributes.Add("style","background-col... |
362,614 | <p>How do I call onclick on a radiobutton list using javascript?</p>
| [
{
"answer_id": 362634,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 5,
"selected": false,
"text": "<p>How are you generating the radio button list? If you're just using HTML:</p>\n\n<pre><code><input type=\"radio\" onc... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362614",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I call onclick on a radiobutton list using javascript? | How are you generating the radio button list? If you're just using HTML:
```
<input type="radio" onclick="alert('hello');"/>
```
If you're generating these via something like ASP.NET, you can add that as an attribute to each element in the list. You can run this after you populate your list, or inline it if you buil... |
362,670 | <p>I am dropping something in a ListView in WPF. I need to know the item in the (X,Y) position I am dropping. How can I do this?</p>
<hr>
<p>The WPF ListView doesn't have GetItemAt. I return to my original problem.</p>
| [
{
"answer_id": 362686,
"author": "arul",
"author_id": 15409,
"author_profile": "https://Stackoverflow.com/users/15409",
"pm_score": -1,
"selected": false,
"text": "<p>You want to use the <a href=\"http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.getitemat.aspx\" rel=... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362670",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12514/"
] | I am dropping something in a ListView in WPF. I need to know the item in the (X,Y) position I am dropping. How can I do this?
---
The WPF ListView doesn't have GetItemAt. I return to my original problem. | Done! Thanks to this article
<http://www.codeproject.com/KB/WPF/WPF_Drag_And_Drop_Sample.aspx>
```
private int GetCurrentIndex(GetPositionDelegate getPosition)
{
int index = -1;
for (int i = 0; i < clasesListView.Items.Count; ++i)
{
ListViewItem item = GetListViewItem(i);
if (this.IsMouseO... |
362,737 | <p>I am developing an interface that takes as input an encrypted byte stream -- probably a very <em>large</em> one -- that generates output of more or less the same format.</p>
<p>The input format is this:</p>
<pre><code>{N byte envelope}
- encryption key IDs &c.
{X byte encrypted body}
</code></pre>
<p>The ... | [
{
"answer_id": 362792,
"author": "Gunnar Steinn",
"author_id": 33468,
"author_profile": "https://Stackoverflow.com/users/33468",
"pm_score": 0,
"selected": false,
"text": "<p>Can you split the body at arbitrary locations? </p>\n\n<p>If so, I would have two threads, input thread and outpu... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362737",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23309/"
] | I am developing an interface that takes as input an encrypted byte stream -- probably a very *large* one -- that generates output of more or less the same format.
The input format is this:
```
{N byte envelope}
- encryption key IDs &c.
{X byte encrypted body}
```
The output format is the same.
Here's the usual... | I won't create one class to handle in- and output - one class, one responsibility. I would like two filter streams, one for input/decryption and one for output/encryption:
```
InputStream decrypted = new DecryptingStream(inputStream, decryptionParameters);
...
OutputStream encrypted = new EncryptingStream(outputSream,... |
362,739 | <p>Is there anyway how to check which website is being used with that pool without browsing each website and checks its assigned pool?</p>
<p>I have approximately 35 websites and I can't afford browsing the websites one by one....</p>
<p>Thanks</p>
| [
{
"answer_id": 362792,
"author": "Gunnar Steinn",
"author_id": 33468,
"author_profile": "https://Stackoverflow.com/users/33468",
"pm_score": 0,
"selected": false,
"text": "<p>Can you split the body at arbitrary locations? </p>\n\n<p>If so, I would have two threads, input thread and outpu... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362739",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44973/"
] | Is there anyway how to check which website is being used with that pool without browsing each website and checks its assigned pool?
I have approximately 35 websites and I can't afford browsing the websites one by one....
Thanks | I won't create one class to handle in- and output - one class, one responsibility. I would like two filter streams, one for input/decryption and one for output/encryption:
```
InputStream decrypted = new DecryptingStream(inputStream, decryptionParameters);
...
OutputStream encrypted = new EncryptingStream(outputSream,... |
362,740 | <p>For years and years, I've tried to understand the <a href="http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4" rel="noreferrer">part</a> of Java specification that deals with memory model and concurrency. I have to admit that I've failed miserably. Yes' I understand about locks and "synchronized"... | [
{
"answer_id": 362750,
"author": "Filip Korling",
"author_id": 25098,
"author_profile": "https://Stackoverflow.com/users/25098",
"pm_score": 3,
"selected": false,
"text": "<p>I wont try to explain these issues here but instead refer you to Brian Goetz excellent book on the subject. </p>\... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362740",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | For years and years, I've tried to understand the [part](http://java.sun.com/docs/books/jls/third_edition/html/memory.html#17.4) of Java specification that deals with memory model and concurrency. I have to admit that I've failed miserably. Yes' I understand about locks and "synchronized" and wait() and notify(). And I... | I'm not going to attempt to actually answer your questions here - instead I'll redirect you to the book which I seeing recommended for advice on this topic: [Java Concurrency in Practice](https://rads.stackoverflow.com/amzn/click/com/0321349601).
One word of warning: if there *are* answers here, expect quite a few of ... |
362,748 | <p>I have a product registration form that allows the user to add additional product fields by clicking "add product". When the user clicks add product, Javascript creates new product field in an existing div.</p>
<p>I currently allow up to 10 products to be added on the form, so I setup a div structure like this:</p>... | [
{
"answer_id": 362782,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": 3,
"selected": true,
"text": "<p>You can dynamically add more DIVs easily. I use <a href=\"http://prototypejs.org\" rel=\"nofollow nor... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362748",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26180/"
] | I have a product registration form that allows the user to add additional product fields by clicking "add product". When the user clicks add product, Javascript creates new product field in an existing div.
I currently allow up to 10 products to be added on the form, so I setup a div structure like this:
```
<div id=... | You can dynamically add more DIVs easily. I use [Prototype](http://prototypejs.org):
```
$("someContainerDiv").insert(new Element("div", { id: "product_"+prodId, 'class':'prod' }))
```
Then put your contents in `$("product_"+prodId).innerHTML`. |
362,770 | <p>My question is, if an interface that is implemented implicitly by extending a class that already implements it, should be explicitly implemented by the class, if the class wants to advertise the fact, that it fulfills the contract of that interface. </p>
<p>For instance, if you want to write a class, that fulfills ... | [
{
"answer_id": 362781,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 4,
"selected": false,
"text": "<p>Avoid redundancy. Use method 2.</p>\n\n<p>Use @Override for overrides.</p>\n"
},
{
"answer_id": 362786,
... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21005/"
] | My question is, if an interface that is implemented implicitly by extending a class that already implements it, should be explicitly implemented by the class, if the class wants to advertise the fact, that it fulfills the contract of that interface.
For instance, if you want to write a class, that fulfills the contra... | I asked [this same question long ago on my blog](http://tech.puredanger.com/2007/03/30/java-inheritance-question/). There is a long discussion there as well if you're interested in seeing some other people's thoughts. It's interesting to note that both strategies are taken within the JDK.
I ultimately decided that a ... |
362,790 | <p>I need to get all dlls in my application root directory. What is the best way to do that?</p>
<pre><code>string root = Application.StartupPath;
</code></pre>
<p>Or,</p>
<pre><code>string root = new FileInfo(Assembly.GetExecutingAssembly().Location).FullName;
</code></pre>
<p>And after that,</p>
<pre><code>Direc... | [
{
"answer_id": 362842,
"author": "Greg Dean",
"author_id": 1200558,
"author_profile": "https://Stackoverflow.com/users/1200558",
"pm_score": 7,
"selected": true,
"text": "<p><code>AppDomain.CurrentDomain.BaseDirectory</code> is my go to way of doing so.</p>\n\n<p>However:</p>\n\n<p><code... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41956/"
] | I need to get all dlls in my application root directory. What is the best way to do that?
```
string root = Application.StartupPath;
```
Or,
```
string root = new FileInfo(Assembly.GetExecutingAssembly().Location).FullName;
```
And after that,
```
Directory.GetFiles(root, "*.dll");
```
Which way is better? Are... | `AppDomain.CurrentDomain.BaseDirectory` is my go to way of doing so.
However:
`Application.StartupPath` gets the directory of your executable
`AppDomain.BaseDirectory` gets the directory used to resolve assemblies
Since they can be different, perhaps you want to use Application.StartupPath, unless you care about as... |
362,791 | <p>I am actually trying to start a process for winzip and zip a folder. This i am doing using the below code in vb.</p>
<pre><code>Dim startInfo As New System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process
Dim tempFileName As String
Try
startInfo = New System.Diagnostics.ProcessStartInfo(... | [
{
"answer_id": 362806,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "<p>It might be something to do with the user that IIS is running as; try changing the app-pool to run in your identit... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362791",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20951/"
] | I am actually trying to start a process for winzip and zip a folder. This i am doing using the below code in vb.
```
Dim startInfo As New System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process
Dim tempFileName As String
Try
startInfo = New System.Diagnostics.ProcessStartInfo( _
"c:\Pr... | I believe that the .Net framework has built in zip capabilities. I would try using those first. Your zip program probably isn't running because of permissions on the web server.
Edit
I just checked and there seems to be limited zip support in System.IO.Compression. But according to [this discussion](http://social.msd... |
362,808 | <p>I have a fresh install of django 1.0 and a simple page served from it takes 5 secs to load. On my colleague's computer it takes almost no time.</p>
<p>I start the server using </p>
<pre>
python manage.py testserver
</pre>
<p>I can see each GET request (PNGs and style sheets) take about half a second.</p>
<p>Anot... | [
{
"answer_id": 362855,
"author": "seanyboy",
"author_id": 1726,
"author_profile": "https://Stackoverflow.com/users/1726",
"pm_score": 0,
"selected": false,
"text": "<p>Disable AV Scanning & see if that makes a difference. It could also be caused by Vista. Upgrade to the latest servic... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5978/"
] | I have a fresh install of django 1.0 and a simple page served from it takes 5 secs to load. On my colleague's computer it takes almost no time.
I start the server using
```
python manage.py testserver
```
I can see each GET request (PNGs and style sheets) take about half a second.
Another weird thing, which I th... | Firefox has a problem browsing to localhost on some Windows machines. You can solve it by switching off ipv6, which isn't really recommended. Using 127.0.0.1 directly is another way round the problem. |
362,830 | <p>I have a circular dependency between two functions. I would like each of these functions to reside in its own dll. Is it possible to build this with visual studio?</p>
<pre><code>foo(int i)
{
if (i > 0)
bar(i -i);
}
</code></pre>
<p>-> should compile into foo.dll</p>
<pre><code>bar(int i)
{
if (i &... | [
{
"answer_id": 362915,
"author": "Rob Prouse",
"author_id": 30827,
"author_profile": "https://Stackoverflow.com/users/30827",
"pm_score": 0,
"selected": false,
"text": "<p>It is not possible to do cleanly. Because they both depend on each other, if A changes, then B must be recompiled. B... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362830",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45711/"
] | I have a circular dependency between two functions. I would like each of these functions to reside in its own dll. Is it possible to build this with visual studio?
```
foo(int i)
{
if (i > 0)
bar(i -i);
}
```
-> should compile into foo.dll
```
bar(int i)
{
if (i > 0)
foo(i - i);
}
```
-> should ... | The reason it works on Unix-like systems is because they perform actual linking resolution at load time. A shared library does not know where its function definition will come from until it's loaded into a process. The downside of this is that you don't know either. A library can find and call functions in any other li... |
362,861 | <p>I'm implementing a COM interface that should return int values either <code>S_OK</code> or <code>E_FAIL</code>. I'm ok returning <code>S_OK</code> as I get that back from another call (Marshal.QueryInterface), but if I want to return a failure value what actual value do I use for <code>E_FAIL</code>?</p>
<p>(It's su... | [
{
"answer_id": 362876,
"author": "Binary Worrier",
"author_id": 18797,
"author_profile": "https://Stackoverflow.com/users/18797",
"pm_score": 4,
"selected": true,
"text": "<p>E_FAIL is Hex 80004005 in WinError.h</p>\n<p>You can see the full <a href=\"http://msdn.microsoft.com/en-us/libra... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362861",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8479/"
] | I'm implementing a COM interface that should return int values either `S_OK` or `E_FAIL`. I'm ok returning `S_OK` as I get that back from another call (Marshal.QueryInterface), but if I want to return a failure value what actual value do I use for `E_FAIL`?
(It's such a basic fundamental question that it's hard to fin... | E\_FAIL is Hex 80004005 in WinError.h
You can see the full [Common HRESULT Values](http://msdn.microsoft.com/en-us/library/windows/desktop/aa378137(v=vs.85).aspx). You don't have to install C++ just to see the values.
**UPDATE:**
The signed and unsigned versions of 0x80004005 are just two representations of the same... |
362,872 | <p>I'm getting the following exception when saving an object:</p>
<blockquote>
<p>Found shared references to a collection</p>
</blockquote>
<p>Does anyone know what this means?</p>
| [
{
"answer_id": 362913,
"author": "Elie",
"author_id": 23249,
"author_profile": "https://Stackoverflow.com/users/23249",
"pm_score": 0,
"selected": false,
"text": "<p>Do you have a reference to any of the objects in the collection somewhere else? Another session, possibly, or even within ... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I'm getting the following exception when saving an object:
>
> Found shared references to a collection
>
>
>
Does anyone know what this means? | [quick google says](http://forum.hibernate.org/viewtopic.php?p=2273553)
```
rel Group n --- 1 User
m ^
| | inh
| rel |
--------- n Member
```
>
> rel stands for relation (association)
> inh stands for inheritance
>
>
> The exception is thro... |
362,907 | <p>In a custom role provider (inheriting from RoleProvider) in .NET 2.0, the IsUserInRole method has been hard-coded to always return true:</p>
<pre><code>public override bool IsUserInRole(string username, string roleName) { return true; }
</code></pre>
<p>In an ASP.NET application configured to use this role provide... | [
{
"answer_id": 362990,
"author": "Andrew Rollings",
"author_id": 40410,
"author_profile": "https://Stackoverflow.com/users/40410",
"pm_score": 3,
"selected": true,
"text": "<p>I looked at Roles.IsUserInRole(string rolename) in .net reflector, and it resolves to the following:</p>\n\n<pre... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25837/"
] | In a custom role provider (inheriting from RoleProvider) in .NET 2.0, the IsUserInRole method has been hard-coded to always return true:
```
public override bool IsUserInRole(string username, string roleName) { return true; }
```
In an ASP.NET application configured to use this role provider, the following code retu... | I looked at Roles.IsUserInRole(string rolename) in .net reflector, and it resolves to the following:
```
public static bool IsUserInRole(string roleName)
{
return IsUserInRole(GetCurrentUserName(), roleName);
}
```
I would take a look at your current user. Here's why:
```
private static string GetCurrentUserNam... |
362,945 | <p>I want to select nodes for which a specific attribute does not exist. I've tried the Not() function, but it doesn't work. Is there a way for this?</p>
<p>Example:
The following Xpath query:</p>
<pre><code>group/msg[not(@owner)]
</code></pre>
<p>Should retrieve the first node but not the 2nd one. However, both Ske... | [
{
"answer_id": 363017,
"author": "Jonas Elfström",
"author_id": 44620,
"author_profile": "https://Stackoverflow.com/users/44620",
"pm_score": 4,
"selected": false,
"text": "<p>In some old and not very standard XPath engine I had to use <code>string-length(@attr)=0</code> for the same rea... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29568/"
] | I want to select nodes for which a specific attribute does not exist. I've tried the Not() function, but it doesn't work. Is there a way for this?
Example:
The following Xpath query:
```
group/msg[not(@owner)]
```
Should retrieve the first node but not the 2nd one. However, both SketchPath (tool to test Xpath queri... | In some old and not very standard XPath engine I had to use `string-length(@attr)=0` for the same reason. |
362,948 | <p>I spent several hours yesterday trying to digitally sign a short file using an X509 certificate (one of the "freemail" certificates from thawte). I finally got openssl to sign it as an SMIME message, but I can't successfully verify it, AND it's in the SMIME format -- I don't have access to a "sendmail" program which... | [
{
"answer_id": 365529,
"author": "Rasmus Faber",
"author_id": 5542,
"author_profile": "https://Stackoverflow.com/users/5542",
"pm_score": 1,
"selected": false,
"text": "<p>First you probably need to read up on the difference between a private key, a public key and a certificate. A certif... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44330/"
] | I spent several hours yesterday trying to digitally sign a short file using an X509 certificate (one of the "freemail" certificates from thawte). I finally got openssl to sign it as an SMIME message, but I can't successfully verify it, AND it's in the SMIME format -- I don't have access to a "sendmail" program which ca... | >
> So I can export that as a PKCS12 file but am not exactly sure how to use that.
>
>
>
If you use the openssl tool, you can use the command
```
openssl pkcs12 -in file.p12 -out file.pem
```
to convert it to pem-format.
**EDIT**:
>
> I'm having trouble figuring out what PEM and PKCS12 and all these things d... |
362,953 | <p>I just learned about the C++ construct called "placement new". It allows you to exactly control where a pointer points to in memory. It looks like this:</p>
<pre><code> #include <new> // Must #include this to use "placement new"
#include "Fred.h" // Declaration of class Fred
void someCode()
{... | [
{
"answer_id": 362964,
"author": "Edouard A.",
"author_id": 41363,
"author_profile": "https://Stackoverflow.com/users/41363",
"pm_score": 2,
"selected": false,
"text": "<p>I use this construct when doing C++ in kernel mode.</p>\n\n<p>I use the kernel mode memory allocator and construct t... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362953",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6688/"
] | I just learned about the C++ construct called "placement new". It allows you to exactly control where a pointer points to in memory. It looks like this:
```
#include <new> // Must #include this to use "placement new"
#include "Fred.h" // Declaration of class Fred
void someCode()
{
char memory[sizeof... | It is also used for embedded programming, where IO devices are often mapped to specific memory addresses |
362,955 | <p>Is it a good idea to have a factory class using generics to instantiate objects?</p>
<p>Let's say I have a class Animal and some subclasses (Cat, Dog, etc):</p>
<pre><code>abstract class Animal
{
public abstract void MakeSound();
}
class Cat : Animal
{
public override void MakeSound()
{
Consol... | [
{
"answer_id": 362967,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 2,
"selected": false,
"text": "<p>Depends on what you want to do with it. The example you gave is not that helpful, as all it does is simply call new... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is it a good idea to have a factory class using generics to instantiate objects?
Let's say I have a class Animal and some subclasses (Cat, Dog, etc):
```
abstract class Animal
{
public abstract void MakeSound();
}
class Cat : Animal
{
public override void MakeSound()
{
Console.Write("Mew mew");
... | Depends on what you want to do with it. The example you gave is not that helpful, as all it does is simply call new() which is something you can do in your code as well. A factory is more useful if you want to place logic which has to be ran during the object creation process somewhere outside the object to create but ... |
362,972 | <p>I am new to grails.I am doing web application that uploads the image from client side and it stores that in server.</p>
<p>My Gsp code is:</p>
<pre><code><g:uploadForm action="saveImage">
<input type="file" name="image">
<input type="submit" value="Submit">
</g:uploadForm>
</code></pre>
<... | [
{
"answer_id": 366087,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": true,
"text": "<p>I dont know the following answer is a right way to find the extension of the file.I am also new to this.But this answer is w... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40945/"
] | I am new to grails.I am doing web application that uploads the image from client side and it stores that in server.
My Gsp code is:
```
<g:uploadForm action="saveImage">
<input type="file" name="image">
<input type="submit" value="Submit">
</g:uploadForm>
```
My saveImage action in controller is:
```
def saveImag... | I dont know the following answer is a right way to find the extension of the file.I am also new to this.But this answer is working
Use **file.getOriginalFilename()** method.It returns a string like "test.jpg".Then you split the filename using tokenize method by ".".Then you take the last string element from the splitt... |
362,979 | <p>As the name suggests I am trying to group rows in a datatable. To go into further detail this table has identical rows except for one field(column). Basically what I am trying to do is put all the different fields of the identical rows and put them in single field whilst deleting the other rows.</p>
<p>Here is the ... | [
{
"answer_id": 363117,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>I had to do something similar recently with a <a href=\"http://en.wikipedia.org/wiki/Control_break\" rel=\"nofollow... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362979",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45471/"
] | As the name suggests I am trying to group rows in a datatable. To go into further detail this table has identical rows except for one field(column). Basically what I am trying to do is put all the different fields of the identical rows and put them in single field whilst deleting the other rows.
Here is the syntax tha... | Well, I can help with the looping structure. This doesn't match what you're doing exactly (it leaves the table intact and just builds a big string, and also assumes the table is sorted a particular way), but it will demonstrate classic control-break processing using your actual data. For this to work the table needs to... |
362,983 | <p>I am trying to get a list of all unit test assemblies under the root of my project. I can do this as follows:</p>
<pre><code><CreateItem Include="**\bin\**\*.UnitTest.*.dll">
<Output TaskParameter="Include" ItemName="Items"/>
</CreateItem>
</code></pre>
<p>However, this will find the same DLLs... | [
{
"answer_id": 366677,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 2,
"selected": false,
"text": "<p>I had a good search online and couldn't find any way of doing this. If anyone knows a clean built-in way then pleas... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362983",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5380/"
] | I am trying to get a list of all unit test assemblies under the root of my project. I can do this as follows:
```
<CreateItem Include="**\bin\**\*.UnitTest.*.dll">
<Output TaskParameter="Include" ItemName="Items"/>
</CreateItem>
```
However, this will find the same DLLs multiple times since they exist in multiple... | The [MSBuild Extension Pack](https://github.com/mikefourie/MSBuildExtensionPack) contains the task *MSBuildHelper*, supporting the command *RemoveDuplicateFiles*.
```
<CreateItem Include="**\bin\**\*.UnitTest.*.dll">
<Output TaskParameter="Include" ItemName="Items"/>
</CreateItem>
<MSBuild.ExtensionPack.Framework.... |
362,986 | <p>I want to capture the screen in my code to get an image - like using the 'print screen' button on the keyboard .</p>
<p>Does anyone have an idea how to do this? I have no starting point.</p>
| [
{
"answer_id": 363008,
"author": "Gary Willoughby",
"author_id": 13227,
"author_profile": "https://Stackoverflow.com/users/13227",
"pm_score": 8,
"selected": true,
"text": "<p>If using the .NET 2.0 (or later) framework you can use the <a href=\"http://msdn.microsoft.com/en-us/library/cdc... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362986",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12637/"
] | I want to capture the screen in my code to get an image - like using the 'print screen' button on the keyboard .
Does anyone have an idea how to do this? I have no starting point. | If using the .NET 2.0 (or later) framework you can use the [`CopyFromScreen()`](http://msdn.microsoft.com/en-us/library/cdcw1c3b.aspx) method detailed here:
<http://www.geekpedia.com/tutorial181_Capturing-screenshots-using-Csharp.html>
```
//Create a new bitmap.
var bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bou... |
362,993 | <p>I'm developing a basic dip-switch user control as a personal learning exercise. Originally I had it set up where you could declare some custom color properties on the user control, and they would be used on elements inside the control.</p>
<p>However, I recenly discovered ToggleButtons, and rebuilt my control to ta... | [
{
"answer_id": 363145,
"author": "Bryan Anderson",
"author_id": 21186,
"author_profile": "https://Stackoverflow.com/users/21186",
"pm_score": 2,
"selected": false,
"text": "<p>In the getters of your color properties you need to convert to brushes</p>\n\n<pre><code>Public Property SwitchB... | 2008/12/12 | [
"https://Stackoverflow.com/questions/362993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/641985/"
] | I'm developing a basic dip-switch user control as a personal learning exercise. Originally I had it set up where you could declare some custom color properties on the user control, and they would be used on elements inside the control.
However, I recenly discovered ToggleButtons, and rebuilt my control to take advanta... | In the getters of your color properties you need to convert to brushes
```
Public Property SwitchBkgndColor() As Brush
Get
Return CType(GetValue(SwitchBkgndColorProperty), Brush)
End Get
Set(ByVal value As Brush)
SetValue(SwitchBkgndColorProperty, value)
End Set
End Property
```
It m... |
363,006 | <p>When I do an update and zillions of files are updated, I often miss the one that aren't merged because of conflicts. The only way I have is to go through all my changelists and look at file icons.</p>
<p>Isn't there a nicer way ? even a console based command would do...</p>
| [
{
"answer_id": 363147,
"author": "Caleb Huitt - cjhuitt",
"author_id": 9876,
"author_profile": "https://Stackoverflow.com/users/9876",
"pm_score": 2,
"selected": false,
"text": "<p>You could immediately do an update again, which this time would just print out the conflicts. If you are u... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39263/"
] | When I do an update and zillions of files are updated, I often miss the one that aren't merged because of conflicts. The only way I have is to go through all my changelists and look at file icons.
Isn't there a nicer way ? even a console based command would do... | From the command line,
```
p4 resolve -n
```
will list each file with unresolved conflicts.
In p4v, you can right-click on the root of your depot or workspace and select "Resolve" to get a window where you can resolve conflicts interactively. |
363,007 | <p>I want to embed the native camera application into custom form.
The RECT r properties where I want to embed the camera are the following:</p>
<p>r.top = 26;
r.bottom = 220;
r.left = 0;
r.right = 320;</p>
<p>and this is the method which runs the native camera application:</p>
<blockquote>
<p>HRESULT CPhotoCaptur... | [
{
"answer_id": 363033,
"author": "ctacke",
"author_id": 13154,
"author_profile": "https://Stackoverflow.com/users/13154",
"pm_score": 1,
"selected": true,
"text": "<p>You're not too clear on what hwndOwner points to. My **guess* on how this probably works is that you need to create a Wi... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363007",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22996/"
] | I want to embed the native camera application into custom form.
The RECT r properties where I want to embed the camera are the following:
r.top = 26;
r.bottom = 220;
r.left = 0;
r.right = 320;
and this is the method which runs the native camera application:
>
> HRESULT CPhotoCapture::CameraCapture(HWND hwndOwner, L... | You're not too clear on what hwndOwner points to. My \*\*guess\* on how this probably works is that you need to create a Window that is a child of your main display Window whose location matches your rect (and is visible), then pass it's handle in and that the capture API then uses DShow to pipe the output of the frame... |
363,012 | <p>I've got around 750+ users that I'm going to create mailboxes for. Should I sleep for a bit between creates to not overload the exchange server or does it not matter? I've read that the actual mailbox is not created until the user accesses it or they get mail. I'm using CDOEXM and DirectoryServices in .NET 2.0.</p>
... | [
{
"answer_id": 363025,
"author": "Brian Knoblauch",
"author_id": 15689,
"author_profile": "https://Stackoverflow.com/users/15689",
"pm_score": 2,
"selected": true,
"text": "<p>I'd just go for it. I wouldn't expect only 750 to cause any sort of operational problem on anything resembling ... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40822/"
] | I've got around 750+ users that I'm going to create mailboxes for. Should I sleep for a bit between creates to not overload the exchange server or does it not matter? I've read that the actual mailbox is not created until the user accesses it or they get mail. I'm using CDOEXM and DirectoryServices in .NET 2.0.
```
Im... | I'd just go for it. I wouldn't expect only 750 to cause any sort of operational problem on anything resembling a modern server. |
363,026 | <p>I have the following linq code...</p>
<pre><code>CMSDataContext dc = new CMSDataContext();
var q = from u in dc.CMSUsers
join d in dc.tblDistricts
on u.DistrictCode equals d.District into orders
select u;
</code></pre>
<p>District shows this error:
Ambiguity between 'tblDistrict.Di... | [
{
"answer_id": 363198,
"author": "James Curran",
"author_id": 12725,
"author_profile": "https://Stackoverflow.com/users/12725",
"pm_score": 3,
"selected": true,
"text": "<p>If you have a FK releationship between two tables, LINQ-to-SQl will automatically create a property for it.</p>\n\n... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363026",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1316/"
] | I have the following linq code...
```
CMSDataContext dc = new CMSDataContext();
var q = from u in dc.CMSUsers
join d in dc.tblDistricts
on u.DistrictCode equals d.District into orders
select u;
```
District shows this error:
Ambiguity between 'tblDistrict.District' and 'tblDistrict.D... | If you have a FK releationship between two tables, LINQ-to-SQl will automatically create a property for it.
For example, if you Order object has a CustomerID which is a Foriegn key to the Customers table, Order will automatically have a Customer property. If you already have a Customer property, there will be a confli... |
363,038 | <p>I am messing around with different PHP logging frameworks. I am currently trying PEAR::Log. I figured that I would use its <code>singleton</code> function to make sure there was only one instance of the class around.</p>
<p>I have a small daemon-like script I wanted to add logging to because it was probably the s... | [
{
"answer_id": 363146,
"author": "Michał Niedźwiedzki",
"author_id": 2169,
"author_profile": "https://Stackoverflow.com/users/2169",
"pm_score": 2,
"selected": true,
"text": "<p>I don't know much about PEAR::Log, but why not create another singleton that wraps/simplifies logging.</p>\n\n... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28714/"
] | I am messing around with different PHP logging frameworks. I am currently trying PEAR::Log. I figured that I would use its `singleton` function to make sure there was only one instance of the class around.
I have a small daemon-like script I wanted to add logging to because it was probably the simplest script in the s... | I don't know much about PEAR::Log, but why not create another singleton that wraps/simplifies logging.
```
class Logger {
private static $log;
private function __construct() { }
public static function init(Log $log) {
self::$log = $log;
}
public static function get() {
return se... |
363,049 | <p>I have a <code>crontab</code> that looks like</p>
<pre><code>0 0 * * * pg_dump DB_NAME > /path/to/dumps/`date +%Y%m%d`.dmp
</code></pre>
<p>which works fine when I run it manually, but not when <code>cron</code> runs it. After digging through the logs, I see</p>
<pre><code>Dec 12 00:00:01 localhost crond[17638... | [
{
"answer_id": 363073,
"author": "Robert Gamble",
"author_id": 25222,
"author_profile": "https://Stackoverflow.com/users/25222",
"pm_score": 5,
"selected": true,
"text": "<p>You have to escape percent signs with a backslash:</p>\n\n<pre><code>0 0 * * * pg_dump DB_NAME > /path/to/dumps... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363049",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4203/"
] | I have a `crontab` that looks like
```
0 0 * * * pg_dump DB_NAME > /path/to/dumps/`date +%Y%m%d`.dmp
```
which works fine when I run it manually, but not when `cron` runs it. After digging through the logs, I see
```
Dec 12 00:00:01 localhost crond[17638]: (postgres) CMD (pg_dump DB_NAME > /path/to/dumps/`date +)
... | You have to escape percent signs with a backslash:
```
0 0 * * * pg_dump DB_NAME > /path/to/dumps/`date +\%Y\%m\%d`.dmp
```
From `man 5 crontab`:
>
> The ‘‘sixth’’ field (the rest of the line) specifies the command to
> be
> run. The entire command portion of the line, up to a
> newline or %
> character, will... |
363,084 | <p>How would I Export tables specifying only certain fields?</p>
<p>I am using mysql 5.0 - using either a sql command or mysqldump.</p>
<p>My table is X, and the fields I want to export are A,B,C</p>
| [
{
"answer_id": 363089,
"author": "Powerlord",
"author_id": 15880,
"author_profile": "https://Stackoverflow.com/users/15880",
"pm_score": 5,
"selected": true,
"text": "<pre><code>SELECT A,B,C\nFROM X\nINTO OUTFILE 'file name';\n</code></pre>\n\n<p>You need the FILE privilege to do this, a... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363084",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37109/"
] | How would I Export tables specifying only certain fields?
I am using mysql 5.0 - using either a sql command or mysqldump.
My table is X, and the fields I want to export are A,B,C | ```
SELECT A,B,C
FROM X
INTO OUTFILE 'file name';
```
You need the FILE privilege to do this, and it won't overwrite files.
`INTO OUTFILE` has a bunch of options to it as well, such as `FIELDS ENCLOSED BY`, `FIELDS ESCAPED BY`, etc... that you may want to [look up in the manual](http://dev.mysql.com/doc/refman/5.0/e... |
363,086 | <p>I want to create custom tooltips where I can put any kind of controls. I have derived from CDialog and used the <code>WS_POPUP | WS_BORDER</code> styles. I also add the <code>CS_DROPSHADOW</code> style in the OnInitDialog to get the tooltip shadow.</p>
<p>Then I manage myself the <code>WM_MOUSEHOVER</code> and <cod... | [
{
"answer_id": 363097,
"author": "Mark Ransom",
"author_id": 5987,
"author_profile": "https://Stackoverflow.com/users/5987",
"pm_score": 2,
"selected": false,
"text": "<p>When you create your window, don't set the WS_VISIBLE flag on it. Then you can use ShowWindow with SW_SHOWNA or SW_SH... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363086",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14053/"
] | I want to create custom tooltips where I can put any kind of controls. I have derived from CDialog and used the `WS_POPUP | WS_BORDER` styles. I also add the `CS_DROPSHADOW` style in the OnInitDialog to get the tooltip shadow.
Then I manage myself the `WM_MOUSEHOVER` and `WM_MOUSELEAVE` events to show/hide the tooltip... | Ok. I finally got it! I just had to return FALSE in the OnInitDialog method to avoid the dialog from being activated.
Thanks to all of you! |
363,096 | <p>IE causes a very unattractive flash or flicker when the page posts back. Without using an UpdatePanel, how can I reduce or remove it?</p>
<p>Most solutions suggest using page transitions like so:</p>
<pre><code><meta content="BlendTrans(Duration=0.1)" http-equiv="Page-Exit" />
</code></pre>
<p>We have been ... | [
{
"answer_id": 363127,
"author": "Dave Haynes",
"author_id": 7072,
"author_profile": "https://Stackoverflow.com/users/7072",
"pm_score": 3,
"selected": true,
"text": "<p>I think I have found the solution. It works in IE6, 7, and 8b2.</p>\n\n<pre><code><meta http-equiv=\"Page-Exit\" co... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7072/"
] | IE causes a very unattractive flash or flicker when the page posts back. Without using an UpdatePanel, how can I reduce or remove it?
Most solutions suggest using page transitions like so:
```
<meta content="BlendTrans(Duration=0.1)" http-equiv="Page-Exit" />
```
We have been using this with success for a couple of... | I think I have found the solution. It works in IE6, 7, and 8b2.
```
<meta http-equiv="Page-Exit" content="Alpha(opacity=100)" />
```
That will stop the flickering. |
363,099 | <p>I am using <a href="http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fillpolygon.aspx" rel="nofollow noreferrer">FillPolygon</a> with a semi-transparent color to draw a triangle (an arrow pointer). I have noticed that FillPolygon gives awkward results with an isocel triangle. One of the sides is overl... | [
{
"answer_id": 363352,
"author": "RS Conley",
"author_id": 7890,
"author_profile": "https://Stackoverflow.com/users/7890",
"pm_score": 1,
"selected": false,
"text": "<p>You want use a bitmap and do something like this. Note this is not runnable code.</p>\n\n<pre><code> Dim image As Ne... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4898/"
] | I am using [FillPolygon](http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fillpolygon.aspx) with a semi-transparent color to draw a triangle (an arrow pointer). I have noticed that FillPolygon gives awkward results with an isocel triangle. One of the sides is overlapping [DrawPolygon](http://msdn.microso... | You want use a bitmap and do something like this. Note this is not runnable code.
```
Dim image As New Bitmap(<my_Xsize>, <my_Ysize>)
Dim gr As Graphics = Graphics.FromImage(image)
<Draw your FillPolygon>
<Erase the leftside of the polygon>
<Draw your Polygon>
gr.DrawImage(image, <myXcoor>, <... |
363,159 | <p>hey guys, i'm getting an exception on the following </p>
<p>inner exception: {"Value cannot be null.\r\nParameter name: String"}</p>
<p>Which reads like a simple error message, but none of the values (image, fileName) are null. How can i find out where this null String is?</p>
<pre><code>RipHelper.UploadImage(ima... | [
{
"answer_id": 363173,
"author": "Joe",
"author_id": 13087,
"author_profile": "https://Stackoverflow.com/users/13087",
"pm_score": 3,
"selected": true,
"text": "<p>The exception is in the static constructor of the class Helpers.RipHelper, at line 23 of RipHelper.cs. This line is calling... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/461880/"
] | hey guys, i'm getting an exception on the following
inner exception: {"Value cannot be null.\r\nParameter name: String"}
Which reads like a simple error message, but none of the values (image, fileName) are null. How can i find out where this null String is?
```
RipHelper.UploadImage(image, fileName);
```
which c... | The exception is in the static constructor of the class Helpers.RipHelper, at line 23 of RipHelper.cs. This line is calling Int32.Parse, passing a null value.
Perhaps the static constructor is referencing a static field that has not yet been initialized. If you are having trouble debugging this, post the code of the c... |
363,171 | <p>So I have this regex:</p>
<pre><code>(^(\s+)?(?P<NAME>(\w)(\d{7}))((01f\.foo)|(\.bar|\.goo\.moo\.roo))$|(^(\s+)?(?P<NAME2>R1_\d{6}_\d{6}_)((01f\.foo)|(\.bar|\.goo\.moo\.roo))$))
</code></pre>
<p>Now if I try and do a match against this:</p>
<pre>
B048661501f.foo
</pre>
<p>I get this error:</p>
<pre>... | [
{
"answer_id": 363264,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 4,
"selected": true,
"text": "<p>No, you can't have two groups of the same name, this would somehow defy the purpose, wouldn't it?</p>\n\n<p>What you pro... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34395/"
] | So I have this regex:
```
(^(\s+)?(?P<NAME>(\w)(\d{7}))((01f\.foo)|(\.bar|\.goo\.moo\.roo))$|(^(\s+)?(?P<NAME2>R1_\d{6}_\d{6}_)((01f\.foo)|(\.bar|\.goo\.moo\.roo))$))
```
Now if I try and do a match against this:
```
B048661501f.foo
```
I get this error:
```
File "C:\Python25\lib\re.py", line 188, in compile... | No, you can't have two groups of the same name, this would somehow defy the purpose, wouldn't it?
What you probably *really* want is this:
```
^\s*(?P<NAME>\w\d{7}|R1_(?:\d{6}_){2})(01f\.foo|\.(?:bar|goo|moo|roo))$
```
I refactored your regex as far as possible. I made the following assumptions:
You want to (corre... |
363,189 | <p>I have a sql statement that consists of multiple SELECT statements. I want to limit the total number of rows coming back to let's say 1000 rows. I thought that using the SET ROWCOUNT 1000 directive would do this...but it does not. For example:</p>
<pre><code>SET ROWCOUNT 1000
select orderId from TableA
select nam... | [
{
"answer_id": 363195,
"author": "Dave Markle",
"author_id": 24995,
"author_profile": "https://Stackoverflow.com/users/24995",
"pm_score": 2,
"selected": false,
"text": "<p>Not in one statement. You're going to have to subtract @@ROWCOUNT from the total rows you want after each statemen... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4398/"
] | I have a sql statement that consists of multiple SELECT statements. I want to limit the total number of rows coming back to let's say 1000 rows. I thought that using the SET ROWCOUNT 1000 directive would do this...but it does not. For example:
```
SET ROWCOUNT 1000
select orderId from TableA
select name from TableB
... | Not in one statement. You're going to have to subtract @@ROWCOUNT from the total rows you want after each statement, and use a variable (say, "@RowsLeft") to store the remaining rows you want. You can then SELECT TOP @RowsLeft from each individual query... |
363,200 | <p>I have a QTreeWidget with a column filled with some numbers, how can I sort them?</p>
<p>If I use setSortingEnabled(true); I can sort correctly only strings, so my column is sorted:</p>
<p>1
10
100
2
20
200</p>
<p>but this is not the thing I want!
Suggestions?</p>
| [
{
"answer_id": 363242,
"author": "dsm",
"author_id": 7780,
"author_profile": "https://Stackoverflow.com/users/7780",
"pm_score": -1,
"selected": false,
"text": "<p>numbers sort by numeric value, but strings sort the opposite way (i.e. <code>\"19999\" < \"2\"</code>).</p>\n\n<p>More sp... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39339/"
] | I have a QTreeWidget with a column filled with some numbers, how can I sort them?
If I use setSortingEnabled(true); I can sort correctly only strings, so my column is sorted:
1
10
100
2
20
200
but this is not the thing I want!
Suggestions? | You can sort overriding the < operator and changing sort condiction like this.
```
class TreeWidgetItem : public QTreeWidgetItem {
public:
TreeWidgetItem(QTreeWidget* parent):QTreeWidgetItem(parent){}
private:
bool operator<(const QTreeWidgetItem &other)const {
int column = treeWidget()->sortColumn();
... |
363,209 | <p>I would like to know if it is possible to copy/move files to a destination based on the origin name.</p>
<p>Basically, I have a /mail folder, which has several subfolders such as cur and new etc. I then have an extracted backup in /mail/home/username that is a duplicate. mv -f will not work, as I do not have permis... | [
{
"answer_id": 363253,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not entirely clear on what it is that you want to do, but you could try the following:</p>\n\n<pre><code>for ... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363209",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I would like to know if it is possible to copy/move files to a destination based on the origin name.
Basically, I have a /mail folder, which has several subfolders such as cur and new etc. I then have an extracted backup in /mail/home/username that is a duplicate. mv -f will not work, as I do not have permission to ov... | For copying, you should consider using `cpio` in 'pass' mode (`-p`):
```
cd /mail; find . -type f | cpio -pvdmB /home/username/mail
```
The `-v` is for verbose; `-d` creates directories as necessary; `-m` preserves the modification times on the files; `-B` means use a larger block size, and may be irrelevant here (i... |
363,211 | <p>ASP.NET MVC routes have names when mapped:</p>
<pre><code>routes.MapRoute(
"Debug", // Route name -- how can I use this later????
"debug/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = string.Empty } );
</code></pre>
<p>Is there a way to get the route name, e.g. "Debug" i... | [
{
"answer_id": 363856,
"author": "Nicolas Cadilhac",
"author_id": 29244,
"author_profile": "https://Stackoverflow.com/users/29244",
"pm_score": 7,
"selected": true,
"text": "<p>The route name is not stored in the route unfortunately. It is just used internally in MVC as a key in a collec... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43649/"
] | ASP.NET MVC routes have names when mapped:
```
routes.MapRoute(
"Debug", // Route name -- how can I use this later????
"debug/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = string.Empty } );
```
Is there a way to get the route name, e.g. "Debug" in the above example? I'd l... | The route name is not stored in the route unfortunately. It is just used internally in MVC as a key in a collection. I think this is something you can still use when creating links with HtmlHelper.RouteLink for example (maybe somewhere else too, no idea).
Anyway, I needed that too and here is what I did:
```
public s... |
363,218 | <p>I used packager to make an executable file for the following code:</p>
<pre><code>Shoes.app do
stack :margin => 10 do
@edit = edit_box :width => 1.0 do
@para.text = @edit.text
end
@para = para ""
end
end
</code></pre>
<p>then I got error message:</p>
<p>Error in C:/Program Files/Common... | [
{
"answer_id": 404738,
"author": "bugmagnet",
"author_id": 426,
"author_profile": "https://Stackoverflow.com/users/426",
"pm_score": 1,
"selected": false,
"text": "<p>Might be something <a href=\"http://www.mail-archive.com/ironruby-core@rubyforge.org/msg02138.html\" rel=\"nofollow noref... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363218",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45755/"
] | I used packager to make an executable file for the following code:
```
Shoes.app do
stack :margin => 10 do
@edit = edit_box :width => 1.0 do
@para.text = @edit.text
end
@para = para ""
end
end
```
then I got error message:
Error in C:/Program Files/Common Files/Shoes/0.r1134/lib/shoes.rb line ... | Might be something [here](http://www.mail-archive.com/ironruby-core@rubyforge.org/msg02138.html) wherein saving the file in BOM-less UTF-8 is suggested. |
363,223 | <p>I have a script which will be run interactively by non-technical users. The script writes status updates to STDOUT so that the user can be sure that the script is running OK.</p>
<p>I want both STDOUT and STDERR redirected to the terminal (so that the user can see that the script is working as well as see if there ... | [
{
"answer_id": 363239,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 9,
"selected": true,
"text": "<p>Use "tee" to redirect to a file and the screen. Depending on the shell you use, you first have to redirect... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1019/"
] | I have a script which will be run interactively by non-technical users. The script writes status updates to STDOUT so that the user can be sure that the script is running OK.
I want both STDOUT and STDERR redirected to the terminal (so that the user can see that the script is working as well as see if there was a prob... | Use "tee" to redirect to a file and the screen. Depending on the shell you use, you first have to redirect stderr to stdout using
```
./a.out 2>&1 | tee output
```
or
```
./a.out |& tee output
```
In csh, there is a built-in command called "script" that will capture everything that goes to the screen to a file. Y... |
363,231 | <p>i'm using ASP.net with .NET 3.5 on IIS7 (Vista) with the URL Rewrite Module from Microsoft.</p>
<p>This means, that i have a </p>
<pre><code><system.webServer>
<rewrite>...</rewrite>
...
</system.webServer>
</code></pre>
<p>section within the web.config, but i get a warning, that w... | [
{
"answer_id": 870732,
"author": "Randy Burgess",
"author_id": 51482,
"author_profile": "https://Stackoverflow.com/users/51482",
"pm_score": 2,
"selected": false,
"text": "<p>I believe you need to have the URL Rewrite Module \"installed\" within the web.config file on your system.</p>\n\... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34464/"
] | i'm using ASP.net with .NET 3.5 on IIS7 (Vista) with the URL Rewrite Module from Microsoft.
This means, that i have a
```
<system.webServer>
<rewrite>...</rewrite>
...
</system.webServer>
```
section within the web.config, but i get a warning, that within the system.webServer the element "rewrite" is not a... | I was able to get this working in Visual Studio 2010.
Start with Ruslan's post [here](http://ruslany.net/2010/04/visual-studio-xml-intellisense-for-url-rewrite-2-0/) and download the 2.0 IntelliSense file. Then, just follow the directions he posted previously [here](http://ruslany.net/2009/08/visual-studio-xml-intelli... |
363,234 | <p>Is it possible to get a URL from an action without knowing ViewContext (e.g., in a controller)? Something like this:</p>
<pre><code>LinkBuilder.BuildUrlFromExpression(ViewContext context, Expression<Action<T>> action)
</code></pre>
<p>...but using Controller.RouteData instead of ViewContext. I seem t... | [
{
"answer_id": 363287,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 4,
"selected": true,
"text": "<p>Here's how I do it in a unit test:</p>\n\n<pre><code> private string RouteValueDictionaryToUrl(RouteValueDictionar... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363234",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29493/"
] | Is it possible to get a URL from an action without knowing ViewContext (e.g., in a controller)? Something like this:
```
LinkBuilder.BuildUrlFromExpression(ViewContext context, Expression<Action<T>> action)
```
...but using Controller.RouteData instead of ViewContext. I seem to have metal block on this. | Here's how I do it in a unit test:
```
private string RouteValueDictionaryToUrl(RouteValueDictionary rvd)
{
var context = MvcMockHelpers.FakeHttpContext("~/");
// _routes is a RouteCollection
var vpd = _routes.GetVirtualPath(
new RequestContext(context, _
rou... |
363,244 | <p>I chose AjaxToolKit to build a WebForm login. Has anyone else had problems trying to do this? I'm planning to use DropShadow Extender and RoundedCorners with Panels, but this is my first time working with panels.</p>
<p>Please check <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ConfirmButton/ConfirmBu... | [
{
"answer_id": 363287,
"author": "Craig Stuntz",
"author_id": 7714,
"author_profile": "https://Stackoverflow.com/users/7714",
"pm_score": 4,
"selected": true,
"text": "<p>Here's how I do it in a unit test:</p>\n\n<pre><code> private string RouteValueDictionaryToUrl(RouteValueDictionar... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363244",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1388553/"
] | I chose AjaxToolKit to build a WebForm login. Has anyone else had problems trying to do this? I'm planning to use DropShadow Extender and RoundedCorners with Panels, but this is my first time working with panels.
Please check [this link](http://www.asp.net/AJAX/AjaxControlToolkit/Samples/ConfirmButton/ConfirmButton.as... | Here's how I do it in a unit test:
```
private string RouteValueDictionaryToUrl(RouteValueDictionary rvd)
{
var context = MvcMockHelpers.FakeHttpContext("~/");
// _routes is a RouteCollection
var vpd = _routes.GetVirtualPath(
new RequestContext(context, _
rou... |
363,267 | <p><strong>Scenario</strong>: there is an <strong>Adobe Flex 3</strong> project which uses several third-party libraries and components in the form of <code>SWC</code> files.</p>
<p>How can we know "what is inside" those <code>SWC</code> files? Specifically, how can I make sure that the project uses the latest version... | [
{
"answer_id": 367022,
"author": "Philippe",
"author_id": 27219,
"author_profile": "https://Stackoverflow.com/users/27219",
"pm_score": 0,
"selected": false,
"text": "<p>You are making an interesting point.</p>\n\n<p>Adobe has provided a way to include basic metadatas in SWFs (and thus i... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363267",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45758/"
] | **Scenario**: there is an **Adobe Flex 3** project which uses several third-party libraries and components in the form of `SWC` files.
How can we know "what is inside" those `SWC` files? Specifically, how can I make sure that the project uses the latest versions of all those components?
According to [official Adobe F... | I would consider it good practice to include the version name in the .swc file itself. For example, if you use the Mate framework, the swc filename is something like Mate\_08\_5.swc. At a quick glance, you can see that you're using version 0.8.5.
As far as license goes, usually you distribute a LICENSE text file withi... |
363,268 | <p>I'm using the jQuery validation plugin to validate a form, and I'd like to remove the validation and submit the form if a certain link is clicked.</p>
<p>I am submitting form with javascript like <code>jQuery('form#listing').submit()</code>, so I must remove the validation rules/function with javascript.</p>
<p>Th... | [
{
"answer_id": 363299,
"author": "redsquare",
"author_id": 6440,
"author_profile": "https://Stackoverflow.com/users/6440",
"pm_score": 3,
"selected": false,
"text": "<p>You can add a css class of cancel to an element (button, input) so that it skips the validation</p>\n"
},
{
"a... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6705/"
] | I'm using the jQuery validation plugin to validate a form, and I'd like to remove the validation and submit the form if a certain link is clicked.
I am submitting form with javascript like `jQuery('form#listing').submit()`, so I must remove the validation rules/function with javascript.
The problem is that I can't fi... | Trigger the DOM submit method to skip the validation:
```
$("#listing")[0].submit();
``` |
363,276 | <p>How can I hide the div without using <code>display:none</code> or JavaScript?</p>
<p>In my country, a lot of Blackberrys come with the CSS support disabled (the mobile companies here are not so good to developers). I have text that says</p>
<pre><code><div class="BBwarn">
please activate your css support and... | [
{
"answer_id": 363288,
"author": "Tom Ritter",
"author_id": 8435,
"author_profile": "https://Stackoverflow.com/users/8435",
"pm_score": 2,
"selected": false,
"text": "<p>You could position it absolutely off the screen.</p>\n\n<p>But I, also, am not a mobile developer.</p>\n"
},
{
... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363276",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45759/"
] | How can I hide the div without using `display:none` or JavaScript?
In my country, a lot of Blackberrys come with the CSS support disabled (the mobile companies here are not so good to developers). I have text that says
```
<div class="BBwarn">
please activate your css support and a link
</div>
```
I want to hide th... | This is a common way:
`margin-left: -9999;` |
363,285 | <p>I go to <a href="https://mywebsite/MyApp/Myservice.svc" rel="noreferrer">https://mywebsite/MyApp/Myservice.svc</a> and get the following error:</p>
<p>(The link works if I use http:// )</p>
<p>"<em>The service '/MyApp/MyService.svc' cannot be activated due to an exception during compilation. The exception message... | [
{
"answer_id": 364296,
"author": "Sixto Saez",
"author_id": 9711,
"author_profile": "https://Stackoverflow.com/users/9711",
"pm_score": 2,
"selected": false,
"text": "<p>I think you are trying to configure your service in a similar way to the following config. There is more information h... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28643/"
] | I go to <https://mywebsite/MyApp/Myservice.svc> and get the following error:
(The link works if I use http:// )
"*The service '/MyApp/MyService.svc' cannot be activated due to an exception during compilation. The exception message is: Could not find a base address that matches scheme https for the endpoint with bindi... | It turned out that my problem was that I was using a load balancer to handle the SSL, which then sent it over http to the actual server, which then complained.
Description of a fix is here: <http://blog.hackedbrain.com/2006/09/26/how-to-ssl-passthrough-with-wcf-or-transportwithmessagecredential-over-plain-http/>
Edit... |
363,286 | <p>I have used a jQuery multiple file upload control [ MultiFile from fyneworks <a href="http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview" rel="nofollow noreferrer">http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview</a> ] to collect some filenames but can't work out how to upload them ... | [
{
"answer_id": 363289,
"author": "Steve Davies",
"author_id": 24209,
"author_profile": "https://Stackoverflow.com/users/24209",
"pm_score": 3,
"selected": false,
"text": "<p>(I have answered this question myself, I just had problems finding the answer via goole or SO and it seems useful ... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363286",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24209/"
] | I have used a jQuery multiple file upload control [ MultiFile from fyneworks <http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview> ] to collect some filenames but can't work out how to upload them on the server.
The standard asp:FileUpload control only seems to allow single files and I don't want to us... | (I have answered this question myself, I just had problems finding the answer via goole or SO and it seems useful ...)
This code works for what I need, thanks to Suprotim Agarwal <http://www.dotnetcurry.com/ShowArticle.aspx?ID=68>
Once the files have been chosen using a suitable jQuery multiple upload control (eg Mul... |
363,295 | <p>I'm trying to follow code-to-interface on a project. Should I be creating an interface first then implementing that interface for entity classes? I'm thinking this might be taking the interface first approach too far and entities should be ignored. This is what I mean...</p>
<pre><code>public interface Address {... | [
{
"answer_id": 363313,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 3,
"selected": true,
"text": "<p>I think creating Interfaces for Entities is probably not necessary.</p>\n\n<p>The purpose of creating Interfaces (or at leas... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1294/"
] | I'm trying to follow code-to-interface on a project. Should I be creating an interface first then implementing that interface for entity classes? I'm thinking this might be taking the interface first approach too far and entities should be ignored. This is what I mean...
```
public interface Address {
public String ... | I think creating Interfaces for Entities is probably not necessary.
The purpose of creating Interfaces (or at least, one of the purposes) is to make it easier to swap out one concrete implementation in favour of another. This is obviously a good thing for your DAOs, Business Logic etc.
But unless you have plans for ... |
363,320 | <p>I've seen the designer code, and I have seen code which builds the ObjectDataSource in the code-behind, however both methods communicate directly with the database via either text commands or stored procs. This seems like unnecessary code duplication to me since my data access layer has a method already which return... | [
{
"answer_id": 363382,
"author": "mtt",
"author_id": 45771,
"author_profile": "https://Stackoverflow.com/users/45771",
"pm_score": 0,
"selected": false,
"text": "<p>do you use object data source or datatable?\nmake a choose from one of them that not to be duplicate</p>\n"
},
{
"a... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363320",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/149/"
] | I've seen the designer code, and I have seen code which builds the ObjectDataSource in the code-behind, however both methods communicate directly with the database via either text commands or stored procs. This seems like unnecessary code duplication to me since my data access layer has a method already which returns a... | In order to use a standard .Net DataSet as an DataSource for a Reporting Services Report I had to:
1. Create an ADO DataSet which uses the same stored procedure as the DAL method
2. Use the ADO DataSet to populate the fields in the Report in the designer
3. In the aspx page, use the following:
```html
<rsweb:ReportVi... |
363,324 | <p>I have the following code, which will not work. The javascript gives no errors and appears to load fine. but clicking on a link will do nothing. An example of a link is:</p>
<pre><code><a href="#" onclick="updateByQuery('Layer3', "Ed Hardy");">Link 1</a><li>Link 2</li>
</code></pre>
<p>and ... | [
{
"answer_id": 363345,
"author": "ayaz",
"author_id": 23191,
"author_profile": "https://Stackoverflow.com/users/23191",
"pm_score": 3,
"selected": true,
"text": "<p>It may probably be due to the double-quote characters surrounding 'Ed Hardy'. Does this work:</p>\n\n<pre><code><a href=... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363324",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have the following code, which will not work. The javascript gives no errors and appears to load fine. but clicking on a link will do nothing. An example of a link is:
```
<a href="#" onclick="updateByQuery('Layer3', "Ed Hardy");">Link 1</a><li>Link 2</li>
```
and the code:
```
var xmlHttp
var layername
var url
f... | It may probably be due to the double-quote characters surrounding 'Ed Hardy'. Does this work:
```
<a href="#" onclick="updateByQuery('Layer3', 'Ed Hardy');">Link 1</a><li>Link 2</li>
``` |
363,325 | <p>I would like to parse a document using SAX, and create a subdocument from some of the elements, while processing others purely with SAX. So, given this document:</p>
<pre><code> <DOC>
<small>
<element />
</small>
<entries>
<!-- thousands here -->
<... | [
{
"answer_id": 363435,
"author": "Nick Holt",
"author_id": 41423,
"author_profile": "https://Stackoverflow.com/users/41423",
"pm_score": 1,
"selected": false,
"text": "<p>Seems to me the answer depends on whether you need the 'new document' in memory. If you do then use DOM, alternative... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363325",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23309/"
] | I would like to parse a document using SAX, and create a subdocument from some of the elements, while processing others purely with SAX. So, given this document:
```
<DOC>
<small>
<element />
</small>
<entries>
<!-- thousands here -->
</entries>
</DOC>
```
I would like to parse the DO... | One approach is to create a `ContentHandler` that watches for events that signal the entry or exit from a `<small>` element. This handler acts as a proxy, and in "normal" mode passes the SAX events straight through to the "real" `ContentHandler`.
However, when entry into a `<small>` element is detected, the proxy is ... |
363,326 | <p>What is the best way to get a value from a ICollection?
We know the Collection is empty apart from that. </p>
| [
{
"answer_id": 363386,
"author": "Chris",
"author_id": 44360,
"author_profile": "https://Stackoverflow.com/users/44360",
"pm_score": 5,
"selected": false,
"text": "<p>The simplest way to do this is:</p>\n\n<pre><code>foreach(object o in collection) {\n return o;\n}\n</code></pre>\n\n<p>... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | What is the best way to get a value from a ICollection?
We know the Collection is empty apart from that. | You can use LINQ for this:.
```
var foo = myICollection.OfType<YourType>().FirstOrDefault();
// or use a query
var bar = (from x in myICollection.OfType<YourType>() where x.SomeProperty == someValue select x)
.FirstOrDefault();
``` |
363,336 | <p>This is driving me nuts. I am using some 3rd-party code in a Windows .lib that, in debug mode, is causing an error similar to the following:</p>
<pre><code>Run-Time Check Failure #2 - Stack around the variable 'foo' was corrupted.
</code></pre>
<p>The error is thrown when either the object goes out of scope or is... | [
{
"answer_id": 363365,
"author": "coppro",
"author_id": 16855,
"author_profile": "https://Stackoverflow.com/users/16855",
"pm_score": 0,
"selected": false,
"text": "<p>Is your .lib file linked against the library's .lib? I assume from your example that you are including the header with t... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] | This is driving me nuts. I am using some 3rd-party code in a Windows .lib that, in debug mode, is causing an error similar to the following:
```
Run-Time Check Failure #2 - Stack around the variable 'foo' was corrupted.
```
The error is thrown when either the object goes out of scope or is deleted. Simply allocating... | OK, I tracked the problem down and it's a cracker, if anyone's interested. Basically, my .LIB, which exhibited the problem. had defined `_WIN32_WINNT` as `0x0501` (Windows 2000 and greater), but my EXE and the 3rd-party LIB had it defined as `0x0600` (Vista). Now, one of the headers included by the 3rd-party lib is `ss... |
363,356 | <p>I have a HTML table issue that I'd like to understand better.</p>
<p>Let's assume that I have a 3 row HTML</p>
<pre><code><table>
<tr>
<td style="text-align:right;">A1</td>
<td>A2</td>
</tr>
<tr>
<td style="text-align:right;">... | [
{
"answer_id": 363375,
"author": "cLFlaVA",
"author_id": 45109,
"author_profile": "https://Stackoverflow.com/users/45109",
"pm_score": 0,
"selected": false,
"text": "<p>Can you please provide your second example? When I created the following, it still looked the same. There's a chance ... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363356",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11541/"
] | I have a HTML table issue that I'd like to understand better.
Let's assume that I have a 3 row HTML
```
<table>
<tr>
<td style="text-align:right;">A1</td>
<td>A2</td>
</tr>
<tr>
<td style="text-align:right;">B1</td>
<td>B2</td>
</tr>
<tr>
<td colspan="2">A v... | If your question ends up with 2 tables, with the original like this:
```
<table>
<tr>
<td style="text-align:right;">A1</td>
<td>A2</td>
</tr>
<tr>
<td style="text-align:right;">B1</td>
<td>B2</td>
</tr>
</table>
```
And the looooong text into its own:
```
<table>
<tr>
<td colspan="2">A very loooooooo... |
363,370 | <p>I'm writing a database application that connects to SQL server. I'd like to implement a similar connection dialog box like the one in SQL Management Studio. I've already found a way to get the list of databases on a server, but I'd really like to get the list of available servers on the network so end users won't ha... | [
{
"answer_id": 363406,
"author": "Galwegian",
"author_id": 3201,
"author_profile": "https://Stackoverflow.com/users/3201",
"pm_score": 2,
"selected": true,
"text": "<p>From <a href=\"http://sqlserver2000.databases.aspfaq.com/how-do-i-find-all-the-available-sql-servers-on-my-network.html\... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363370",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5906/"
] | I'm writing a database application that connects to SQL server. I'd like to implement a similar connection dialog box like the one in SQL Management Studio. I've already found a way to get the list of databases on a server, but I'd really like to get the list of available servers on the network so end users won't have ... | From [here](http://sqlserver2000.databases.aspfaq.com/how-do-i-find-all-the-available-sql-servers-on-my-network.html):
```
CREATE PROCEDURE dbo.ListLocalServers
AS
BEGIN
SET NOCOUNT ON
CREATE TABLE #servers(sname VARCHAR(255))
INSERT #servers EXEC master..XP_CMDShell 'OSQL -L'
-- play with ISQL... |
363,377 | <p>I have a bit of code that I need to run in a different thread than the GUI as it currently causes the form to freeze whilst the code runs (10 seconds or so). </p>
<p>Assume I have never created a new thread before; what's a simple/basic example of how to do this in C# and using .NET Framework 2.0 or later? </p>
| [
{
"answer_id": 363394,
"author": "Andy",
"author_id": 3857,
"author_profile": "https://Stackoverflow.com/users/3857",
"pm_score": 5,
"selected": false,
"text": "<p>Try using the <a href=\"http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx\" rel=\"noreferr... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363377",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I have a bit of code that I need to run in a different thread than the GUI as it currently causes the form to freeze whilst the code runs (10 seconds or so).
Assume I have never created a new thread before; what's a simple/basic example of how to do this in C# and using .NET Framework 2.0 or later? | Good place to start reading is [Joe Albahari](http://www.albahari.com/threading/).
If you want to create your own thread, this is as simple as it gets:
```
using System.Threading;
new Thread(() =>
{
Thread.CurrentThread.IsBackground = true;
/* run your code here */
Console.WriteLine("Hello, world");
}... |
363,453 | <p>I have an application that has several objects (about 50 so far, but growing). There is only one instance of each of these objects in the app and these instances get shared among components.</p>
<p>What I've done is derive all of the objects from a base BrokeredObject class:</p>
<pre><code>class BrokeredObject
{
... | [
{
"answer_id": 363517,
"author": "Boyan",
"author_id": 38106,
"author_profile": "https://Stackoverflow.com/users/38106",
"pm_score": 2,
"selected": false,
"text": "<p>Instead of GetInterfaceId() in the BrokeredObject base class, you could define that pure virtual method:</p>\n\n<pre><cod... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363453",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13154/"
] | I have an application that has several objects (about 50 so far, but growing). There is only one instance of each of these objects in the app and these instances get shared among components.
What I've done is derive all of the objects from a base BrokeredObject class:
```
class BrokeredObject
{
virtual int GetInter... | My use-case tended to get a little more complex - I needed the ability to do a little bit of object initialization and I needed to be able to load objects from different DLLs based on configuration (e.g. simulated versus actual for hardware). It started looking like COM and ATL was where I was headed, but I didn't want... |
363,465 | <p>So I totally buy into the basic tenents of ASP.NET, testability, SoC, HTML control...it's awesome. However being new to it I have a huge hang up with the markup. I know it comes from my hatred of classic ASP, and I can't help but feel like I've entered the twilight zone when <a href="http://www.flickr.com/photos/w... | [
{
"answer_id": 363485,
"author": "Chris James",
"author_id": 3193,
"author_profile": "https://Stackoverflow.com/users/3193",
"pm_score": 5,
"selected": true,
"text": "<p>There are things you can do to help clean up the markup, but I agree it can get a bit tag-soupy. </p>\n\n<ul>\n<li>You... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363465",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1975/"
] | So I totally buy into the basic tenents of ASP.NET, testability, SoC, HTML control...it's awesome. However being new to it I have a huge hang up with the markup. I know it comes from my hatred of classic ASP, and I can't help but feel like I've entered the twilight zone when [I see this](http://www.flickr.com/photos/we... | There are things you can do to help clean up the markup, but I agree it can get a bit tag-soupy.
* You can [make your own HTML helpers](http://weblogs.asp.net/stephenwalther/archive/2008/06/13/asp-net-mvc-tip-1-creating-new-html-helpers-with-extension-methods.aspx) to output data using extension methods, so you can h... |
363,491 | <p>I have this PHP code</p>
<pre><code>echo '<a href="#" onclick="updateByQuery(\'Layer3\', ' . json_encode($query) . ');">Link 1</a>';
</code></pre>
<p>which generates a link like this:</p>
<pre><code><a href="#" onclick="updateByQuery('Layer3', "Ed Hardy");">Link 1</a><li>Link 2</l... | [
{
"answer_id": 363499,
"author": "tpk",
"author_id": 8437,
"author_profile": "https://Stackoverflow.com/users/8437",
"pm_score": 1,
"selected": true,
"text": "<p>Try to do the reverse... use single quotes for html, and double quotes for javascript. That's how we do that in fact.</p>\n"
... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363491",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] | I have this PHP code
```
echo '<a href="#" onclick="updateByQuery(\'Layer3\', ' . json_encode($query) . ');">Link 1</a>';
```
which generates a link like this:
```
<a href="#" onclick="updateByQuery('Layer3', "Ed Hardy");">Link 1</a><li>Link 2</li>
```
Causing the javascript to not be called. How would I make it ... | Try to do the reverse... use single quotes for html, and double quotes for javascript. That's how we do that in fact. |
363,495 | <p>In a method, I want to be able to insert a value into a div which is part of the html document I choose to parse.</p>
<pre><code>public void AddToDiv(string div)
{
//Code to read the html document and look for the div
//(name specified as the parameter of this method).
}
</code></pre>
<p>Question is, I c... | [
{
"answer_id": 363520,
"author": "Binary Worrier",
"author_id": 18797,
"author_profile": "https://Stackoverflow.com/users/18797",
"pm_score": 3,
"selected": true,
"text": "<p>Personally, I'd check for existence, rather than allowing the exception to be thrown, it's easier to determine th... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363495",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32484/"
] | In a method, I want to be able to insert a value into a div which is part of the html document I choose to parse.
```
public void AddToDiv(string div)
{
//Code to read the html document and look for the div
//(name specified as the parameter of this method).
}
```
Question is, I could specify a div called ... | Personally, I'd check for existence, rather than allowing the exception to be thrown, it's easier to determine the flow of logic, and fits better with the intent of your code.
See these questions and answers for a broader discussion
[When to throw an exception](https://stackoverflow.com/questions/77127/when-to-throw-... |
363,503 | <pre><code>$(document).ready(function(){
$(".txtDate").datepicker({ showOn: "both",
buttonImage: "library/ui/datepicker/img/calendar2.gif", dateFormat: "yy/mm/dd", buttonImageOnly: true });
//added this checkbox click for something I given earlier
$("#Table input").click(function() {
if ... | [
{
"answer_id": 363539,
"author": "rz.",
"author_id": 7407,
"author_profile": "https://Stackoverflow.com/users/7407",
"pm_score": 1,
"selected": false,
"text": "<p>The first problem that I see is that there is no element with id \"Table input\" ie that matches \"#Table input\" -- at least... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39809/"
] | ```
$(document).ready(function(){
$(".txtDate").datepicker({ showOn: "both",
buttonImage: "library/ui/datepicker/img/calendar2.gif", dateFormat: "yy/mm/dd", buttonImageOnly: true });
//added this checkbox click for something I given earlier
$("#Table input").click(function() {
if ($(this... | Yea - my answer just got zapped too.
Anyway, if you are using asp.net then the names get mangled ( to something like ctl100\_Table ) and you need to put this into the jquery instead of Table.
Look at the actual rendered html in the browser to get the name you need to use.
You can try using $("[id$=Table]).attr("id")... |
363,504 | <p>I want to have a abstract view for any type of UI (web or window). In order to do that I must use Interface (IView ) in which I can only apply just rules about view. In fact, I want to set a some basic comple function to provide to its inheritances.</p>
<p>So in this way, I must use abstract class. The problem is</... | [
{
"answer_id": 363611,
"author": "Corbin March",
"author_id": 7625,
"author_profile": "https://Stackoverflow.com/users/7625",
"pm_score": 2,
"selected": false,
"text": "<p>You can inherit a concrete class (web form/window form), declare your class abstract, and still implement an interfa... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45771/"
] | I want to have a abstract view for any type of UI (web or window). In order to do that I must use Interface (IView ) in which I can only apply just rules about view. In fact, I want to set a some basic comple function to provide to its inheritances.
So in this way, I must use abstract class. The problem is
1) Interfa... | Will the functions you add change the definition of what the class is, or will you simply be creating functions to manipulate data that is already a part of the class?
If you need to redefine aspects of the base class of these two classes then yes, you will need to change your inheritance structure. But if the functio... |
363,528 | <p><strong>Question:</strong> How can I process a form using jQuery and the $.ajax request so that the data is passed to a script which writes it to a database?</p>
<p><strong>Problem:</strong>
I have a simple email signup form that when processed, adds the email along with the current date to a table in a MySQL datab... | [
{
"answer_id": 363602,
"author": "kgiannakakis",
"author_id": 24054,
"author_profile": "https://Stackoverflow.com/users/24054",
"pm_score": 2,
"selected": false,
"text": "<p>Instead if using data: dataStr, use:</p>\n\n<pre><code>data : {param: value, param2: value2}\n</code></pre>\n\n<p>... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363528",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | **Question:** How can I process a form using jQuery and the $.ajax request so that the data is passed to a script which writes it to a database?
**Problem:**
I have a simple email signup form that when processed, adds the email along with the current date to a table in a MySQL database. Processing the form without jQu... | Instead if using data: dataStr, use:
```
data : {param: value, param2: value2}
```
This is the proper way to do it for POST requests.
Also, I recommend using a form plug-in, like [this](http://malsup.com/jquery/form/). |
363,549 | <p>I am aware of the responses at
<a href="https://stackoverflow.com/questions/49002/prefer-composition-over-inheritance">Prefer composition over inheritance</a>
and am aware of the merits of composition over inheritance.</p>
<p>But there are cases where inheritance does have a good role to play. It's the incorrect... | [
{
"answer_id": 363574,
"author": "mtt",
"author_id": 45771,
"author_profile": "https://Stackoverflow.com/users/45771",
"pm_score": 0,
"selected": false,
"text": "<p>when all the tasks are in same roles ,inherience is more better .</p>\n"
},
{
"answer_id": 363582,
"author": "J... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363549",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/34644/"
] | I am aware of the responses at
[Prefer composition over inheritance](https://stackoverflow.com/questions/49002/prefer-composition-over-inheritance)
and am aware of the merits of composition over inheritance.
But there are cases where inheritance does have a good role to play. It's the incorrect use of inheritance hie... | *Preferring* composition isn't the same as mandating it in every situation. To add to your UI example, I'd say that both Java and .NET benefit from using an inheritance hierarchy for streams.
I suggest you have a look at the inheritance tree for Windows Presentation Foundation though - that's a relatively modern UI to... |
363,570 | <p>I have a update method in my data layer such this:</p>
<pre><code>public clacc datalayerSec_User
private objUIData as new UIData
Public Function Update(ByVal objUser As SEC_USER) As Boolean
Try
objUIData.SEC_USERs.Attach(objUser)
objUIData.Refresh(RefreshMode.KeepCurrentValues, objUser)
objUIData.Subm... | [
{
"answer_id": 363580,
"author": "Zachary Yates",
"author_id": 8360,
"author_profile": "https://Stackoverflow.com/users/8360",
"pm_score": 2,
"selected": false,
"text": "<p>If the DataContext that you retrieved the user object from hasn't been disconnected or disposed, I don't think need... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363570",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/439507/"
] | I have a update method in my data layer such this:
```
public clacc datalayerSec_User
private objUIData as new UIData
Public Function Update(ByVal objUser As SEC_USER) As Boolean
Try
objUIData.SEC_USERs.Attach(objUser)
objUIData.Refresh(RefreshMode.KeepCurrentValues, objUser)
objUIData.SubmitChanges(Conf... | The easiest way to get around this issue is to use the same DataContext when retrieving the user object and updating.
In general, a DataContext should be kept alive for a "unit of work", in other words, you use it to retrieve whatever object you want to change, then change its properties, and then just do SubmitChange... |
363,596 | <p>What is the best way to unit test a method that calls into multiple methods, for example:</p>
<pre><code>modify(string value)
{
if(value.Length > 5) replaceit(value);
else changeit(value);
}
</code></pre>
<p>This pseudo code has a modify method that (currently) calls either <code>replaceit()</code> or... | [
{
"answer_id": 363615,
"author": "Bill the Lizard",
"author_id": 1288,
"author_profile": "https://Stackoverflow.com/users/1288",
"pm_score": 4,
"selected": false,
"text": "<p>If you have already tested <code>replaceit()</code> and <code>changeit()</code> independently, then the only thin... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363596",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3291/"
] | What is the best way to unit test a method that calls into multiple methods, for example:
```
modify(string value)
{
if(value.Length > 5) replaceit(value);
else changeit(value);
}
```
This pseudo code has a modify method that (currently) calls either `replaceit()` or `changeit()`. I have already wrote test... | This is a classic state-based test vs. behavior-based test scenario.
In this ridiculously simple example testing the output is fine. At some point though, you'll run into tests where inspecting the state after execution is complicated. Instead you want to check the behavior (e.g. verify that changeit was called with a... |
363,655 | <p>I'm using C# on Framework 3.5. I'm looking to quickly group a Generic List<> by two properties. For the sake of this example lets say I have a List of an Order type with properties of CustomerId, ProductId, and ProductCount. How would I get the sum of ProductCounts grouped by CustomerId and ProductId using a lamb... | [
{
"answer_id": 363756,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 7,
"selected": true,
"text": "<pre><code>var sums = Orders.GroupBy(x => new { x.CustomerID, x.ProductID })\n .Select(group => group.Sum... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363655",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7215/"
] | I'm using C# on Framework 3.5. I'm looking to quickly group a Generic List<> by two properties. For the sake of this example lets say I have a List of an Order type with properties of CustomerId, ProductId, and ProductCount. How would I get the sum of ProductCounts grouped by CustomerId and ProductId using a lambda exp... | ```
var sums = Orders.GroupBy(x => new { x.CustomerID, x.ProductID })
.Select(group => group.Sum(x => x.ProductCount));
``` |
363,681 | <p>How do I generate a random <code>int</code> value in a specific range?</p>
<p>The following methods have bugs related to integer overflow:</p>
<pre class="lang-java prettyprint-override"><code>randomNum = minimum + (int)(Math.random() * maximum);
// Bug: `randomNum` can be bigger than `maximum`.
</code></pre>
<pre c... | [
{
"answer_id": 363691,
"author": "krosenvold",
"author_id": 23691,
"author_profile": "https://Stackoverflow.com/users/23691",
"pm_score": 8,
"selected": false,
"text": "<p>Use:</p>\n<pre><code>minValue + rn.nextInt(maxValue - minValue + 1)\n</code></pre>\n"
},
{
"answer_id": 3636... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363681",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42155/"
] | How do I generate a random `int` value in a specific range?
The following methods have bugs related to integer overflow:
```java
randomNum = minimum + (int)(Math.random() * maximum);
// Bug: `randomNum` can be bigger than `maximum`.
```
```java
Random rn = new Random();
int n = maximum - minimum + 1;
int i = rn.nex... | In **Java 1.7 or later**, the standard way to do this is as follows:
```
import java.util.concurrent.ThreadLocalRandom;
// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
int randomNum = ThreadLocalRandom.current().nextInt(min, max + 1);
```
See [the relevant JavaDoc](https://docs.o... |
363,706 | <p>This error should be a simple one but I cant seem to make it work. The problem lies in the fact that this very same code works earlier in the program. I don's see any reason for it to be sending an error on this instance and not the four previous ones. Reference the code below, and feel free to provide any criticism... | [
{
"answer_id": 363714,
"author": "Jimmy",
"author_id": 4435,
"author_profile": "https://Stackoverflow.com/users/4435",
"pm_score": 6,
"selected": true,
"text": "<pre><code>.8m instead of .8\n</code></pre>\n"
},
{
"answer_id": 363716,
"author": "Dylan Beattie",
"author_id"... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363706",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45151/"
] | This error should be a simple one but I cant seem to make it work. The problem lies in the fact that this very same code works earlier in the program. I don's see any reason for it to be sending an error on this instance and not the four previous ones. Reference the code below, and feel free to provide any criticism yo... | ```
.8m instead of .8
``` |
363,718 | <p>My designer handed me a design I'm not 100% sure how to do with jquery and css.
I am basicly trying to allow a user to "slide" the footer up to reveal more conent.</p>
<p>My html..</p>
<pre><code> <div id="footer">
<div id="expandingFooter"> hidden content</div>
content that is alway... | [
{
"answer_id": 363759,
"author": "cLFlaVA",
"author_id": 45109,
"author_profile": "https://Stackoverflow.com/users/45109",
"pm_score": 1,
"selected": false,
"text": "<p>Try something like this: </p>\n\n<pre><code><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4568/"
] | My designer handed me a design I'm not 100% sure how to do with jquery and css.
I am basicly trying to allow a user to "slide" the footer up to reveal more conent.
My html..
```
<div id="footer">
<div id="expandingFooter"> hidden content</div>
content that is always visible
</div>
```
I have a toggle... | You can leverage JQuery UI 1.6's Effects ([Effects Demo Page](http://ui.jquery.com/repository/real-world/effects/)). The following accomplished the desired effect for me.
```
$('#toggleButton').bind('click', function(e) {
$('#expandingFooter').toggle(
'slide',
{ easing: 'easeOutQuint', direction: ... |
363,720 | <p>I have a slow custom data source in a SSIS Dataa Flow Task.I have to run the package with multiple parameters</p>
<p>If I want to upload data to a DB using SQL Data Destination(Bulk Insert) the connection times out</p>
<p>If I write the data to a flat file I cannot run multiple instances of the package, since they... | [
{
"answer_id": 363759,
"author": "cLFlaVA",
"author_id": 45109,
"author_profile": "https://Stackoverflow.com/users/45109",
"pm_score": 1,
"selected": false,
"text": "<p>Try something like this: </p>\n\n<pre><code><!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363720",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30546/"
] | I have a slow custom data source in a SSIS Dataa Flow Task.I have to run the package with multiple parameters
If I want to upload data to a DB using SQL Data Destination(Bulk Insert) the connection times out
If I write the data to a flat file I cannot run multiple instances of the package, since they will write to th... | You can leverage JQuery UI 1.6's Effects ([Effects Demo Page](http://ui.jquery.com/repository/real-world/effects/)). The following accomplished the desired effect for me.
```
$('#toggleButton').bind('click', function(e) {
$('#expandingFooter').toggle(
'slide',
{ easing: 'easeOutQuint', direction: ... |
363,725 | <p>I have the following property in a custom control:</p>
<pre><code>List<myClass> _items;
public List<myClass> Items{
get { return _items; }
set { _items= value; }
}
</code></pre>
<p>In my codebehind, I add items to the collection as in...</p>
<pre><code>myCustomControl.items.Add(new myClass());... | [
{
"answer_id": 363870,
"author": "Victor",
"author_id": 42518,
"author_profile": "https://Stackoverflow.com/users/42518",
"pm_score": 1,
"selected": false,
"text": "<p>if you are talking about persisting the data across postbacks of the same page then you can manually add the items to th... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/337/"
] | I have the following property in a custom control:
```
List<myClass> _items;
public List<myClass> Items{
get { return _items; }
set { _items= value; }
}
```
In my codebehind, I add items to the collection as in...
```
myCustomControl.items.Add(new myClass());
```
However, these are not persisted across po... | Yikes! Don't put a List<> into the ViewState! It'll be massive!
If you add a List<string> that contains two elements - "abc" and "xyz" into the ViewState, it'll grow by 312 bytes.
If instead you add a string[] that contains the same two elements, it'll only grow by 24 bytes.
And that's just lists of strings! You can... |
363,729 | <p>Is there a way to say something like:</p>
<p>sizeof(type)? Or type.Size? </p>
<p>Right now I am looking at using code like:</p>
<pre><code>if (type.Equals(typeof(int)))
return sizeof(int);
else if (type.Equals(typeof(long)))
return sizeof(long);
</code></pre>
<p>etc, etc, for every single data type. </p>... | [
{
"answer_id": 363734,
"author": "JaredPar",
"author_id": 23283,
"author_profile": "https://Stackoverflow.com/users/23283",
"pm_score": 4,
"selected": false,
"text": "<p>Try Marshal.SizeOf()</p>\n\n<p><a href=\"http://msdn.microsoft.com/en-us/library/5s4920fa.aspx\" rel=\"noreferrer\">ht... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363729",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Is there a way to say something like:
sizeof(type)? Or type.Size?
Right now I am looking at using code like:
```
if (type.Equals(typeof(int)))
return sizeof(int);
else if (type.Equals(typeof(long)))
return sizeof(long);
```
etc, etc, for every single data type.
There must be an cleaner solution, no? | Try Marshal.SizeOf()
<http://msdn.microsoft.com/en-us/library/5s4920fa.aspx> |
363,730 | <pre><code> public sealed class UserLoginSingleton
{
UserLoginCollection _userLoginCol = new UserLoginCollection();
UserLoginSingleton()
{
}
public static UserLoginSingleton Instance
{
get
{
IDictionary items = HttpContext.Current.Items;
if (!items.Con... | [
{
"answer_id": 363763,
"author": "Mike Powell",
"author_id": 205,
"author_profile": "https://Stackoverflow.com/users/205",
"pm_score": 2,
"selected": false,
"text": "<p>The <code>HttpContext.Items</code> collection is per-request. So in your case when the user gets redirected to page2.a... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38230/"
] | ```
public sealed class UserLoginSingleton
{
UserLoginCollection _userLoginCol = new UserLoginCollection();
UserLoginSingleton()
{
}
public static UserLoginSingleton Instance
{
get
{
IDictionary items = HttpContext.Current.Items;
if (!items.Contains("... | The `HttpContext.Items` collection is per-request. So in your case when the user gets redirected to page2.aspx, the instance you created on page 1 is gone. For the same instance to be available across requests, you need to be using `HttpContext.Session` to store your instance. |
363,768 | <p>I'm using <a href="http://en.wikipedia.org/wiki/Eclipse_%28software%29#Releases" rel="noreferrer">Eclipse Ganymede</a>. Everything works fine, but I have an anal-retentive yearning for a warning-free Problems tab. Right now it (correctly) complains about my <a href="http://en.wikipedia.org/wiki/Apache_Ant" rel="no... | [
{
"answer_id": 483260,
"author": "David Pierre",
"author_id": 18296,
"author_profile": "https://Stackoverflow.com/users/18296",
"pm_score": 8,
"selected": true,
"text": "<p>The simplest is to supply a minimal DTD to shut it up.</p>\n\n<pre><code><!DOCTYPE project>\n</code></pre>\n\... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363768",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/409/"
] | I'm using [Eclipse Ganymede](http://en.wikipedia.org/wiki/Eclipse_%28software%29#Releases). Everything works fine, but I have an anal-retentive yearning for a warning-free Problems tab. Right now it (correctly) complains about my [Ant](http://en.wikipedia.org/wiki/Apache_Ant) scripts: "No grammar constraints (DTD or XM... | The simplest is to supply a minimal DTD to shut it up.
```
<!DOCTYPE project>
```
for ant files |
363,770 | <p>Let's say I have the following component called <strong><em>Base</em></strong>:</p>
<pre><code><cfcomponent output="false">
<cffunction name="init" access="public" returntype="Any" output="false">
<cfset variables.metadata = getmetadata(this)>
<cfreturn this>
</cf... | [
{
"answer_id": 483260,
"author": "David Pierre",
"author_id": 18296,
"author_profile": "https://Stackoverflow.com/users/18296",
"pm_score": 8,
"selected": true,
"text": "<p>The simplest is to supply a minimal DTD to shut it up.</p>\n\n<pre><code><!DOCTYPE project>\n</code></pre>\n\... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363770",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/31278/"
] | Let's say I have the following component called ***Base***:
```
<cfcomponent output="false">
<cffunction name="init" access="public" returntype="Any" output="false">
<cfset variables.metadata = getmetadata(this)>
<cfreturn this>
</cffunction>
<cffunction name="getmeta" access="public" ret... | The simplest is to supply a minimal DTD to shut it up.
```
<!DOCTYPE project>
```
for ant files |
363,776 | <p>Is there any way that I can reference a var or const as the default value for a function argument in actionscript 3.</p>
<p>I can define default values like null, string, int.</p>
<pre>function a( b = null ) {
blah...
}</pre>
<p>But what I want to do is <pre>function a( b = function(){} ) {
blah...
}</pre>... | [
{
"answer_id": 365120,
"author": "grapefrukt",
"author_id": 914,
"author_profile": "https://Stackoverflow.com/users/914",
"pm_score": 4,
"selected": true,
"text": "<p>Oddly enough it seems you can't do that, atleast I couldn't get it to work, it won't accept any references to static func... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363776",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40397/"
] | Is there any way that I can reference a var or const as the default value for a function argument in actionscript 3.
I can define default values like null, string, int.
```
function a( b = null ) {
blah...
}
```
But what I want to do is
```
function a( b = function(){} ) {
blah...
}
```
which it seems like ... | Oddly enough it seems you can't do that, atleast I couldn't get it to work, it won't accept any references to static functions as a default value.
The best I could do was this:
```
public function myFunction(functionArgument:Function = null):void {
if (functionArgument != null) {
functionArgument();
}... |
363,784 | <p>I want my JTextPane to insert spaces whenever I press Tab. Currently it inserts the tab character (ASCII 9). </p>
<p>Is there anyway to customize the tab policy of JTextPane (other than catching "tab-key" events and inserting the spaces myself seems an)?</p>
| [
{
"answer_id": 363866,
"author": "Paul Brinkley",
"author_id": 18160,
"author_profile": "https://Stackoverflow.com/users/18160",
"pm_score": 0,
"selected": false,
"text": "<p>As far as I know, you'd have to catch key events, as you say. Depending on usage, you might also get away with w... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27198/"
] | I want my JTextPane to insert spaces whenever I press Tab. Currently it inserts the tab character (ASCII 9).
Is there anyway to customize the tab policy of JTextPane (other than catching "tab-key" events and inserting the spaces myself seems an)? | You can set a javax.swing.text.Document on your JTextPane. The following example will give you an idea of what I mean :)
```
import java.awt.Dimension;
import javax.swing.JFrame;
import javax.swing.JTextPane;
import javax.swing.text.AttributeSet;
import javax.swing.text.BadLocationException;
import javax.swing.text.D... |
363,814 | <p>I'm writing a asp.net MVC site and I have written some extensions to the Html class to generate some html for me. </p>
<p>From within the extension method is it better to write directly to the Response.Output stream or have the extension method return a string?</p>
<p>What are the advantages / disadvantages of usi... | [
{
"answer_id": 364312,
"author": "chadmyers",
"author_id": 10862,
"author_profile": "https://Stackoverflow.com/users/10862",
"pm_score": 0,
"selected": false,
"text": "<p>First, I wouldn't use OutputStream for text output, I would use Response.Write().</p>\n\n<p>Second, returning a strin... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363814",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30772/"
] | I'm writing a asp.net MVC site and I have written some extensions to the Html class to generate some html for me.
From within the extension method is it better to write directly to the Response.Output stream or have the extension method return a string?
What are the advantages / disadvantages of using the Reponse.Ou... | Returning a string gives you the option of modifying/inspecting/capturing the result before it gets dumped to Response.Write(). |
363,838 | <p>I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of business days between the two dates. How can I call that function within my select?</p>
<p>Here's what I'd like to do.. </p>
<pre><code>SELECT getBusinessDays(a.opendate,a.closedate)
FROM accoun... | [
{
"answer_id": 363857,
"author": "user17670",
"author_id": 17670,
"author_profile": "https://Stackoverflow.com/users/17670",
"pm_score": 8,
"selected": true,
"text": "<p>Yes, you can do almost that: </p>\n\n<pre><code>SELECT dbo.GetBusinessDays(a.opendate,a.closedate) as BusinessDays\nFR... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13954/"
] | I have a user defined function in SQL called getBuisnessDays it takes @startdate and @enddate and returns the number of business days between the two dates. How can I call that function within my select?
Here's what I'd like to do..
```
SELECT getBusinessDays(a.opendate,a.closedate)
FROM account a
WHERE ...
``` | Yes, you can do almost that:
```
SELECT dbo.GetBusinessDays(a.opendate,a.closedate) as BusinessDays
FROM account a
WHERE...
``` |
363,848 | <p>Due to the packaged nature of the release, a SQL Server script (well more of a statement) needs to be created that can execute correctly on SQL Server 7.0 thru 2008 which can essentially achieve this:</p>
<pre><code>if exists(select * from sys.databases where name = 'Blah')
</code></pre>
<p>Reasons this is difficu... | [
{
"answer_id": 363854,
"author": "dkretz",
"author_id": 31641,
"author_profile": "https://Stackoverflow.com/users/31641",
"pm_score": 1,
"selected": false,
"text": "<p>Try</p>\n\n<p>USE database </p>\n\n<p>and test @@ERROR.</p>\n\n<blockquote>\n <p>USE database<br>\n IF @@ERROR <> ... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363848",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Due to the packaged nature of the release, a SQL Server script (well more of a statement) needs to be created that can execute correctly on SQL Server 7.0 thru 2008 which can essentially achieve this:
```
if exists(select * from sys.databases where name = 'Blah')
```
Reasons this is difficult:
SQL 7 'sys.databases'... | Try
USE database
and test @@ERROR.
>
> USE database
>
> IF @@ERROR <> 0 GOTO ErrExit
>
>
> logic ...
>
>
> RETURN 0
>
>
> ErrExit:
>
> RETURN 1
>
>
>
(or RAISERROR, or ...) |
363,864 | <p>This code throws up the compile error given in the title, can anyone tell me what to change?</p>
<pre><code>#include <iostream>
using namespace std;
int main(){
int myArray[10][10][10];
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
for (int x = 0;... | [
{
"answer_id": 363873,
"author": "coppro",
"author_id": 16855,
"author_profile": "https://Stackoverflow.com/users/16855",
"pm_score": 5,
"selected": true,
"text": "<p>You are subscripting a three-dimensional array <code>myArray[10][10][10]</code> four times <code>myArray[i][t][x][y]</cod... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363864",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33061/"
] | This code throws up the compile error given in the title, can anyone tell me what to change?
```
#include <iostream>
using namespace std;
int main(){
int myArray[10][10][10];
for (int i = 0; i <= 9; ++i){
for (int t = 0; t <=9; ++t){
for (int x = 0; x <= 9; ++x){
... | You are subscripting a three-dimensional array `myArray[10][10][10]` four times `myArray[i][t][x][y]`. You will probably need to add another dimension to your array. Also consider a container like [Boost.MultiArray](http://www.boost.org/doc/libs/1_37_0/libs/multi_array/doc/index.html), though that's probably over your ... |
363,884 | <p>I've seen the <code>@</code> symbol used in PowerShell to initialise arrays.</p>
<p>What exactly does the <code>@</code> symbol denote and where can I read more about it?</p>
| [
{
"answer_id": 363894,
"author": "Cadoo",
"author_id": 42583,
"author_profile": "https://Stackoverflow.com/users/42583",
"pm_score": 4,
"selected": false,
"text": "<p><strong>The Splatting Operator</strong></p>\n<p>To create an array, we create a variable and assign the array. Arrays are... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363884",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45817/"
] | I've seen the `@` symbol used in PowerShell to initialise arrays.
What exactly does the `@` symbol denote and where can I read more about it? | PowerShell will actually treat any comma-separated list as an array:
```
"server1","server2"
```
So the @ is optional in those cases. However, for associative arrays, the @ is required:
```
@{"Key"="Value";"Key2"="Value2"}
```
Officially, @ is the "array operator." You can read more about it in the documentation ... |
363,889 | <p>I've written a screen saver that displays a web page. It works exactly as I want it to on my main display, but in the preview and secondary displays, the web view is hanging off the top of the screen.</p>
<p>Example (from preview):</p>
<a href="http://skitch.com/dlsspy/6mds/screen-saver-bug" rel="nofollow norefer... | [
{
"answer_id": 363894,
"author": "Cadoo",
"author_id": 42583,
"author_profile": "https://Stackoverflow.com/users/42583",
"pm_score": 4,
"selected": false,
"text": "<p><strong>The Splatting Operator</strong></p>\n<p>To create an array, we create a variable and assign the array. Arrays are... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39975/"
] | I've written a screen saver that displays a web page. It works exactly as I want it to on my main display, but in the preview and secondary displays, the web view is hanging off the top of the screen.
Example (from preview):
[screen saver bug http://img.skitch.com/20081212-nk5cqrgfds1funr1a3p72aw25q.preview.jpg](http... | PowerShell will actually treat any comma-separated list as an array:
```
"server1","server2"
```
So the @ is optional in those cases. However, for associative arrays, the @ is required:
```
@{"Key"="Value";"Key2"="Value2"}
```
Officially, @ is the "array operator." You can read more about it in the documentation ... |
363,892 | <p>I am using My.Settings in visual studio 2008 to store information, for when the user runs the program again.</p>
<p>I have that working fine... but as I am using 12 textboxes I don't want to write...</p>
<p>my.settings.grade1 = textbox1.text</p>
<p>for each one, and I am also making calculations using the stored ... | [
{
"answer_id": 363915,
"author": "Jayden",
"author_id": 44873,
"author_profile": "https://Stackoverflow.com/users/44873",
"pm_score": 1,
"selected": false,
"text": "<p>On your form that has the textboxes, add them to a collection or an array of textboxes when the form is initialised.</p>... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363892",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | I am using My.Settings in visual studio 2008 to store information, for when the user runs the program again.
I have that working fine... but as I am using 12 textboxes I don't want to write...
my.settings.grade1 = textbox1.text
for each one, and I am also making calculations using the stored information, so I dont w... | On your form that has the textboxes, add them to a collection or an array of textboxes when the form is initialised.
Then, iterate through the collection or array of textboxes to assign to the setting value.
If you don't want to manually code the assignment of the textboxes into the array, then in your form initialis... |
363,893 | <p>I have seen sample source code around that uses different ways of releasing/dealloc'ing objects, so I was wondering which way is deemed the "best" one. A few options on <code>-dealloc</code>:</p>
<p>1) Release objects</p>
<pre><code>- (void)dealloc {
[obj1 release];
[obj2 release];
[super dealloc];
}
<... | [
{
"answer_id": 363980,
"author": "Marco",
"author_id": 30480,
"author_profile": "https://Stackoverflow.com/users/30480",
"pm_score": 4,
"selected": true,
"text": "<p>Method 1 is the only recommended method. It's also good practice to set them to nil AFTER you've released them.</p>\n\n<p>... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35478/"
] | I have seen sample source code around that uses different ways of releasing/dealloc'ing objects, so I was wondering which way is deemed the "best" one. A few options on `-dealloc`:
1) Release objects
```
- (void)dealloc {
[obj1 release];
[obj2 release];
[super dealloc];
}
```
2) Set objects to nil
```
... | Method 1 is the only recommended method. It's also good practice to set them to nil AFTER you've released them.
Method 2 only works for properties that manage their own object/value retaining, so it's not universally applicable. And if you implement your own setter method that performs other actions when the property ... |
363,899 | <p>I've several web user controls on my asp.net page and I wanna pass values between them. For example :</p>
<p>There is a dropDownList in one of them and when user selects any item from dropDownList, it can pass the selected value to the other user control which includes GridView to show related data of selected item... | [
{
"answer_id": 363912,
"author": "Victor",
"author_id": 42518,
"author_profile": "https://Stackoverflow.com/users/42518",
"pm_score": 3,
"selected": true,
"text": "<p>On the DropDownList onChange event you could then assign the selected item value to the property of the other user contro... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363899",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44852/"
] | I've several web user controls on my asp.net page and I wanna pass values between them. For example :
There is a dropDownList in one of them and when user selects any item from dropDownList, it can pass the selected value to the other user control which includes GridView to show related data of selected item value fro... | On the DropDownList onChange event you could then assign the selected item value to the property of the other user control.
Ok, your UserControls should have properties that allow data to be set. For example in Control2 you would have:
```
public string needData {
get { return MyData; }
set {
MyData = value;
/... |
363,908 | <p>Here's an example:</p>
<pre><code>>git status
# On branch master
nothing to commit (working directory clean)
>git checkout -b test-branch
>vi test.c
>git add test.c
>git commit -m "modified test.c"
>vi README
>git add README
>git commit -m "modified README"
</code></pre>
<p>Now I want to do... | [
{
"answer_id": 364065,
"author": "ididak",
"author_id": 28888,
"author_profile": "https://Stackoverflow.com/users/28888",
"pm_score": 7,
"selected": true,
"text": "<p>Have you tried: <code>git rebase -i master</code>?</p>\n"
},
{
"answer_id": 364646,
"author": "Otto",
"au... | 2008/12/12 | [
"https://Stackoverflow.com/questions/363908",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45824/"
] | Here's an example:
```
>git status
# On branch master
nothing to commit (working directory clean)
>git checkout -b test-branch
>vi test.c
>git add test.c
>git commit -m "modified test.c"
>vi README
>git add README
>git commit -m "modified README"
```
Now I want to do a '`git rebase -i`' that will let me rebase all c... | Have you tried: `git rebase -i master`? |