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
491,052
<p>I have a div in my HTML page. I am showing this div based on some condition, but the div is displaying behind the HTML element where I pointed the mouse cursor.</p> <p>I have tried all values for z-index from 0 - 999999. Can anyone tell me why this is happening?</p> <p>Is there any minimum or maximum value of Z-IN...
[ { "answer_id": 491093, "author": "roborourke", "author_id": 42147, "author_profile": "https://Stackoverflow.com/users/42147", "pm_score": 4, "selected": false, "text": "<p>Z-Index only works for elements that have <code>position: relative;</code> or <code>position: absolute;</code> appli...
2009/01/29
[ "https://Stackoverflow.com/questions/491052", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2572740/" ]
I have a div in my HTML page. I am showing this div based on some condition, but the div is displaying behind the HTML element where I pointed the mouse cursor. I have tried all values for z-index from 0 - 999999. Can anyone tell me why this is happening? Is there any minimum or maximum value of Z-INDEX property of C...
<http://www.w3.org/TR/CSS21/visuren.html#z-index> > > **'z-index'** > > > *Value*: auto | <integer> | inherit > > > <http://www.w3.org/TR/CSS21/syndata.html#numbers> > > Some value types may have integer > values (denoted by <integer>) or > real number values (denoted by > <number>). Real numbers and > in...
491,059
<p>I have to build a rather large form with many controls. The controls are divided in <em>basic</em> controls/settings and <em>extended</em> controls/settings. The user can decide if he wants to see only the basic or both basic and extended controls.</p> <p>I've dropped all extended controls onto their own JPanel so ...
[ { "answer_id": 491064, "author": "tddmonkey", "author_id": 51577, "author_profile": "https://Stackoverflow.com/users/51577", "pm_score": 0, "selected": false, "text": "<p>You could use GridLayout instead of GroupLayout which will give you uniform spacing between the columns</p>\n" }, ...
2009/01/29
[ "https://Stackoverflow.com/questions/491059", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23368/" ]
I have to build a rather large form with many controls. The controls are divided in *basic* controls/settings and *extended* controls/settings. The user can decide if he wants to see only the basic or both basic and extended controls. I've dropped all extended controls onto their own JPanel so that I can easily switch...
As far as I know, no Swing LayoutManager (from JRE or open source) can span several panels. I am currently working on such a feature (which I called "layouts synchronization") for my [DesignGridLayout](https://designgridlayout.dev.java.net/) project, but it is not something easy to implements (I have started about 2 w...
491,065
<p>How do you handle primitive types when using a IoC container?</p> <p>I.e. given that you have:</p> <pre><code>class Pinger { private int timeout; private string targetMachine; public Pinger(int timeout, string targetMachine) { this.timeout = timeout; this.targetMachine = targetMachine;...
[ { "answer_id": 491079, "author": "Gerrie Schenck", "author_id": 57036, "author_profile": "https://Stackoverflow.com/users/57036", "pm_score": 3, "selected": true, "text": "<p>Make another interface for this.</p>\n\n<p>Then you will get something like:</p>\n\n<pre><code>public Pinger(IExt...
2009/01/29
[ "https://Stackoverflow.com/questions/491065", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5776/" ]
How do you handle primitive types when using a IoC container? I.e. given that you have: ``` class Pinger { private int timeout; private string targetMachine; public Pinger(int timeout, string targetMachine) { this.timeout = timeout; this.targetMachine = targetMachine; } public vo...
Make another interface for this. Then you will get something like: ``` public Pinger(IExtraConfiguration extraConfig) { timeout = extraconfig.TimeOut; targetmachine = extraconfig.TargetMachine; } ``` I don't know about other IOC containers, but Castle Windsor resolves these extra constructor parameters automa...
491,066
<p>I am using the code <a href="http://en.wikipedia.org/wiki/MooTools" rel="nofollow noreferrer">MooTools</a> (1.11) and jQuery (1.2.6). It's working fine when these are separate. While I am integrating Firefox, it throws:</p> <blockquote> <p>(document).ready(){} is not a function. </p> </blockquote> <p>Is anything...
[ { "answer_id": 491083, "author": "roborourke", "author_id": 42147, "author_profile": "https://Stackoverflow.com/users/42147", "pm_score": 1, "selected": false, "text": "<p>jQuery and MooTools both use '$' as a shorthand way of calling their main functions. The jQuery team have built in a...
2009/01/29
[ "https://Stackoverflow.com/questions/491066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
I am using the code [MooTools](http://en.wikipedia.org/wiki/MooTools) (1.11) and jQuery (1.2.6). It's working fine when these are separate. While I am integrating Firefox, it throws: > > (document).ready(){} is not a function. > > > Is anything wrong in my concept? What do I do to rectify it?
``` jQuery.noConflict(); jQuery(function($){ $works with jQuery here. }); $ Works with MooTools here. ``` However, that said, I would suggest you ditch the MooTools. Its complete modification of all object prototypes can cause cause jQuery's functions to randomly and unexplainable cause errors, and on top of...
491,067
<p>I need to find out the physical path of a grails GSP file. </p> <p>My requirement is that I want to create a new layout file at run-time and use that in the application. </p> <p>I have been able to achieve this without problem when the application runs on jetty (grails run-app), however, when I deploy the app on J...
[ { "answer_id": 491249, "author": "Siegfried Puchbauer", "author_id": 46301, "author_profile": "https://Stackoverflow.com/users/46301", "pm_score": 4, "selected": true, "text": "<p>Here is some groovy code to lookup the layout-folder path in the production environment (eg. when deployed a...
2009/01/29
[ "https://Stackoverflow.com/questions/491067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26424/" ]
I need to find out the physical path of a grails GSP file. My requirement is that I want to create a new layout file at run-time and use that in the application. I have been able to achieve this without problem when the application runs on jetty (grails run-app), however, when I deploy the app on Jboss, the path at...
Here is some groovy code to lookup the layout-folder path in the production environment (eg. when deployed as war on jboss): ``` import org.codehaus.groovy.grails.commons.ApplicationHolder ... File layoutFolder = ApplicationHolder.application.parentContext.getResource("WEB-INF/grails-app/views/layouts").file d...
491,072
<p>I have an iframe with a class name="blaclass". Inside it, I have one div with no name (or id) and inside this id there is a div with class name = "classs". Inside this div, lie two images (with no class name/id).</p> <p>How can I get those image.src? If there is a Prototype version even better! </p> <p>PS: I canno...
[ { "answer_id": 491471, "author": "heeen", "author_id": 38893, "author_profile": "https://Stackoverflow.com/users/38893", "pm_score": 3, "selected": true, "text": "<p>a.html:</p>\n\n<pre><code>&lt;!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\"\n \"http://www.w3.org/TR/xh...
2009/01/29
[ "https://Stackoverflow.com/questions/491072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42153/" ]
I have an iframe with a class name="blaclass". Inside it, I have one div with no name (or id) and inside this id there is a div with class name = "classs". Inside this div, lie two images (with no class name/id). How can I get those image.src? If there is a Prototype version even better! PS: I cannot add class names...
a.html: ``` <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <body onLoad="foo()"> <iframe src="b.html"> </iframe> <script type="text/javascript"> function foo() { alert(...
491,075
<p><strong>Background</strong>:</p> <p>I have a tab bar application. Each tab contains navigation controller allowing the user to transition from one view to the other showing a drill down information of the data (each view is being handled by a view controller and each view controller class has <code>didReceiveMemory...
[ { "answer_id": 491145, "author": "Airsource Ltd", "author_id": 18017, "author_profile": "https://Stackoverflow.com/users/18017", "pm_score": 3, "selected": false, "text": "<p>I do my clean up like this:</p>\n\n<pre><code>-(void)setView:(UIView*)view\n{\n [super setView:view];\n if(...
2009/01/29
[ "https://Stackoverflow.com/questions/491075", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
**Background**: I have a tab bar application. Each tab contains navigation controller allowing the user to transition from one view to the other showing a drill down information of the data (each view is being handled by a view controller and each view controller class has `didReceiveMemoryWarning` method). Lists are ...
This is an old question, but I don't see a proper answer, so here goes: When a memory warning is received, `-didReceiveMemoryWarning` gets called in ALL view controllers, whether they are the "current" one or not. The view controllers are simply listening for the memory warning event broadcast. If the view controller...
491,111
<p>I've got a rather funny problem with WPF. I have a tree-view, and selecting items works fine so far. The problem is, I want to unselect the currently selected item when the user clicks inside the blank area of the treeview. By default, the treeview keeps the current item selected, and I have added a context-menu opt...
[ { "answer_id": 494482, "author": "Mark Carpenter", "author_id": 47645, "author_profile": "https://Stackoverflow.com/users/47645", "pm_score": 0, "selected": false, "text": "<p>This will deselect the currently selected TreeViewItem if none were clicked:</p>\n\n<pre><code>private void MyTr...
2009/01/29
[ "https://Stackoverflow.com/questions/491111", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39912/" ]
I've got a rather funny problem with WPF. I have a tree-view, and selecting items works fine so far. The problem is, I want to unselect the currently selected item when the user clicks inside the blank area of the treeview. By default, the treeview keeps the current item selected, and I have added a context-menu option...
The un-selectable problem can be solved with a call to Focus on the TreeView after setting TreeViewItem.IsSelected.
491,130
<p>Is Dynamic SQL more vulnerable to SQL Injection/hacking? If yes, how to prevent?</p>
[ { "answer_id": 491136, "author": "Frederik Gheysels", "author_id": 55774, "author_profile": "https://Stackoverflow.com/users/55774", "pm_score": 4, "selected": true, "text": "<p>If you use parameters instead of string concatenation to specify your filter-criteria, then it should not be v...
2009/01/29
[ "https://Stackoverflow.com/questions/491130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53262/" ]
Is Dynamic SQL more vulnerable to SQL Injection/hacking? If yes, how to prevent?
If you use parameters instead of string concatenation to specify your filter-criteria, then it should not be vulnerable for Sql injection. For instance: do this: ``` string sqlQuery = "SELECT * FROM Persons WHERE Persons.Name LIKE @name"; SqlCommand cmd = new SqlCommand ( sqlQuery ); ... cmd.Parameters.Add ("@name"...
491,147
<p>So I was looking at some code that was checked in and I got all puzzled over:</p> <pre><code>// Amount of days before cancellation can't be done enum Cancellation { Limit = 2 }; </code></pre> <p>Asking the guy who checked it in he argued that it's much better to use enums instead of static variables, bettern than ...
[ { "answer_id": 491157, "author": "Sergio", "author_id": 32037, "author_profile": "https://Stackoverflow.com/users/32037", "pm_score": 0, "selected": false, "text": "<p>I think that you should use enums if you have a set of values directly connected.</p>\n\n<p>Something like: enum Status ...
2009/01/29
[ "https://Stackoverflow.com/questions/491147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713/" ]
So I was looking at some code that was checked in and I got all puzzled over: ``` // Amount of days before cancellation can't be done enum Cancellation { Limit = 2 }; ``` Asking the guy who checked it in he argued that it's much better to use enums instead of static variables, bettern than this: ``` private static ...
Enums are typed. That is, if you have a method where you have to pass a certain 'state' to a method for instance, you can only pass 'valid' arguments. For instance: ``` enum OrderState { pending = 1, shipped = 2 } public IList<Order> GetOrdersInState( OrderState ) { } ``` This is a good example -imho- of usin...
491,149
<p>say we have simple asp.net repeater, in a row we have one checkbox, one label (database-id of the record) and not visible (used for postback) and one text (in a tabelcell)</p> <p>now i want to make it like in windows, if you click on the text, the checkbox should be selected or deselected.</p> <p>has somebody a l...
[ { "answer_id": 491184, "author": "meouw", "author_id": 12161, "author_profile": "https://Stackoverflow.com/users/12161", "pm_score": 0, "selected": false, "text": "<p>How about something like this?</p>\n\n<pre><code>$('.yourtableclass td').click( function( e ) {\n var cb = $(this).chi...
2009/01/29
[ "https://Stackoverflow.com/questions/491149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49034/" ]
say we have simple asp.net repeater, in a row we have one checkbox, one label (database-id of the record) and not visible (used for postback) and one text (in a tabelcell) now i want to make it like in windows, if you click on the text, the checkbox should be selected or deselected. has somebody a link or solution f...
assume that you wont't need jQuery and the table-construct ``` <asp:Repeater runat="server"> <ItemTemplate> <asp:CheckBox runat="server" Text="your text" /> </ItemTemplate> </asp:Repeater> ``` this renders basically the solution provided by Ricardo Vega whatever you get in the property text of the ch...
491,177
<p>Hi I'm pretty new to Stack Overflow so I hope that I'm doing this correctly and that someone out there has the answer I need.</p> <p>I'm currently coding a program in Java with Eclipse IDE an my question is this:</p> <p>I need a snippet of code that does the following</p> <p>It's supposed to get a .TXT file conta...
[ { "answer_id": 491196, "author": "tddmonkey", "author_id": 51577, "author_profile": "https://Stackoverflow.com/users/51577", "pm_score": 4, "selected": true, "text": "<p>This sounds a bit too much like a homework assignment to warrant providing a full answer, but I'll give you some tips ...
2009/01/29
[ "https://Stackoverflow.com/questions/491177", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52900/" ]
Hi I'm pretty new to Stack Overflow so I hope that I'm doing this correctly and that someone out there has the answer I need. I'm currently coding a program in Java with Eclipse IDE an my question is this: I need a snippet of code that does the following It's supposed to get a .TXT file containing text and from that...
This sounds a bit too much like a homework assignment to warrant providing a full answer, but I'll give you some tips on where to look in the Java API: FileReader and BufferedReader for getting the data in. Collections API for storing your data A custom data structure for storing your list of words and occurence count...
491,183
<p>Quite often I would complete numerous daily tasks i.e. not working on anything one component in particular. Therefore, I find it quite difficult to remember these individual tasks in our next day stand up meeting. Is it ok to bring a small sticky note with a few reminder points on the previous days tasks? For exampl...
[ { "answer_id": 491186, "author": "Nik Reiman", "author_id": 14302, "author_profile": "https://Stackoverflow.com/users/14302", "pm_score": 5, "selected": true, "text": "<p>A key point of scrum is that it's not written in stone -- you should adapt it to whatever works best in your organiza...
2009/01/29
[ "https://Stackoverflow.com/questions/491183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42435/" ]
Quite often I would complete numerous daily tasks i.e. not working on anything one component in particular. Therefore, I find it quite difficult to remember these individual tasks in our next day stand up meeting. Is it ok to bring a small sticky note with a few reminder points on the previous days tasks? For example, ...
A key point of scrum is that it's not written in stone -- you should adapt it to whatever works best in your organization. However, the daily standup meeting is meant to be *short*, so if you bring notes, you should use them as a reference, not like a meeting agenda.
491,192
<p>The LoadIt() method below takes 5-10 seconds to complete. I want the message area to display "Loading..." before LoadIt() starts and display "Reloaded" after it finishes. </p> <p>How can I do that?</p> <p>The following code doesn't work. It seems to not update the label until everything is finished, at which point...
[ { "answer_id": 491186, "author": "Nik Reiman", "author_id": 14302, "author_profile": "https://Stackoverflow.com/users/14302", "pm_score": 5, "selected": true, "text": "<p>A key point of scrum is that it's not written in stone -- you should adapt it to whatever works best in your organiza...
2009/01/29
[ "https://Stackoverflow.com/questions/491192", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
The LoadIt() method below takes 5-10 seconds to complete. I want the message area to display "Loading..." before LoadIt() starts and display "Reloaded" after it finishes. How can I do that? The following code doesn't work. It seems to not update the label until everything is finished, at which point it just displays...
A key point of scrum is that it's not written in stone -- you should adapt it to whatever works best in your organization. However, the daily standup meeting is meant to be *short*, so if you bring notes, you should use them as a reference, not like a meeting agenda.
491,195
<p>I have a data template that is defined in a XAML file. The root of the XAML is <strong>not</strong> a resource dictionary but the data template itself. Now I want to add this data template to the resources of a control. Unfortunately, I don't know what key to use.</p> <pre><code>myControl.Resources.Add(???, dataTem...
[ { "answer_id": 491186, "author": "Nik Reiman", "author_id": 14302, "author_profile": "https://Stackoverflow.com/users/14302", "pm_score": 5, "selected": true, "text": "<p>A key point of scrum is that it's not written in stone -- you should adapt it to whatever works best in your organiza...
2009/01/29
[ "https://Stackoverflow.com/questions/491195", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22038/" ]
I have a data template that is defined in a XAML file. The root of the XAML is **not** a resource dictionary but the data template itself. Now I want to add this data template to the resources of a control. Unfortunately, I don't know what key to use. ``` myControl.Resources.Add(???, dataTemplate); ``` Although I us...
A key point of scrum is that it's not written in stone -- you should adapt it to whatever works best in your organization. However, the daily standup meeting is meant to be *short*, so if you bring notes, you should use them as a reference, not like a meeting agenda.
491,198
<p>I need to add functionality to copy a rectangular selection of nodes and columns, but I can't find any way to actually select multiple columns in a Virtual Treeview (beside toFullRowSelect).</p> <p>Am I just missing something? And if not, is there a descendant out there with grid-like multicolumn select support?</p...
[ { "answer_id": 491410, "author": "DiGi", "author_id": 12042, "author_profile": "https://Stackoverflow.com/users/12042", "pm_score": 1, "selected": false, "text": "<p>You can try enable/add <em>toGridExtensions</em> in <em>TreeOptions.MiscOptions</em>. It enables free moving in columns by...
2009/01/29
[ "https://Stackoverflow.com/questions/491198", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1604/" ]
I need to add functionality to copy a rectangular selection of nodes and columns, but I can't find any way to actually select multiple columns in a Virtual Treeview (beside toFullRowSelect). Am I just missing something? And if not, is there a descendant out there with grid-like multicolumn select support?
So after some testing I came up with the following, thanks DiGi for the extra push. DrawSelection won't work with this solution so it needs to be disabled. Since I don't think I'll need to do this again soon I didn't write a descendant. Set toDisableDrawSelection, toExtendedFocus and toMultiSelect to True. Declare th...
491,199
<p><a href="http://en.wikibooks.org/wiki/Ada_Programming/Types/range" rel="noreferrer">Ada</a>, <a href="http://web.mit.edu/sunsoft_v5.1/www/pascal/lang_ref/ref_data.doc.html" rel="noreferrer">Pascal</a> and many other languages support ranges, a way to subtype integers. A range is a signed integer value which ranges f...
[ { "answer_id": 491227, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 2, "selected": false, "text": "<p>Java has had an assert keyword since version 1.4. If you're doing programming by contract, you're free to use those to...
2009/01/29
[ "https://Stackoverflow.com/questions/491199", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59825/" ]
[Ada](http://en.wikibooks.org/wiki/Ada_Programming/Types/range), [Pascal](http://web.mit.edu/sunsoft_v5.1/www/pascal/lang_ref/ref_data.doc.html) and many other languages support ranges, a way to subtype integers. A range is a signed integer value which ranges from a value (first) to another (last). It's easy to impleme...
Subrange types are not actually very useful in practice. We do not often allocate fixed length arrays, and there is also no reason for fixed sized integers. Usually where we do see fixed sized arrays they are acting as an enumeration, and we have a better (although "heavier") solution to that. Subrange types also comp...
491,229
<p>You can modify the columns and the <strong>ItemTemplate</strong> of columns in a <strong>GridView</strong>'s <strong>HeaderRow</strong>. But the same is not possible on the <strong>FooterRow</strong> since it's read-only.</p> <p>Is there any way that I can programmatically add a <strong>TextBox</strong> control to...
[ { "answer_id": 491248, "author": "NeedHack", "author_id": 44950, "author_profile": "https://Stackoverflow.com/users/44950", "pm_score": 1, "selected": false, "text": "<p>I may be missing something but can't you hook into the RowDataBound event and add your controls like this?</p>\n\n<pre...
2009/01/29
[ "https://Stackoverflow.com/questions/491229", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20946/" ]
You can modify the columns and the **ItemTemplate** of columns in a **GridView**'s **HeaderRow**. But the same is not possible on the **FooterRow** since it's read-only. Is there any way that I can programmatically add a **TextBox** control to a FooterRow in a **GridView** control? Note: I don't need databinding on t...
Yes I have tried this myself and it works fine, here's the full code... ``` <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://ww...
491,257
<p>Is there a way to highlight a string in a text (but not ALL such strings) in a buffer where font-lock-mode is on. </p> <p>Let's imagine I have a buffer with SQL mode and I want to highlight a string in it. The following code does not work</p> <pre><code>(set-text-properties 10 20 '(face hi-yellow)) </code></pre>...
[ { "answer_id": 491452, "author": "danielpoe", "author_id": 60183, "author_profile": "https://Stackoverflow.com/users/60183", "pm_score": 4, "selected": true, "text": "<p>Have a look at <a href=\"http://www.emacswiki.org/emacs/HighlightTemporarily\" rel=\"noreferrer\">http://www.emacswiki...
2009/01/29
[ "https://Stackoverflow.com/questions/491257", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59704/" ]
Is there a way to highlight a string in a text (but not ALL such strings) in a buffer where font-lock-mode is on. Let's imagine I have a buffer with SQL mode and I want to highlight a string in it. The following code does not work ``` (set-text-properties 10 20 '(face hi-yellow)) ``` When I call ``` (font-lock-m...
Have a look at <http://www.emacswiki.org/emacs/HighlightTemporarily>. Both MarkerPens and Highlight provide functions to highlight a region.
491,267
<p>If you have a disabled button on a winform how can you show a tool-tip on mouse-over to inform the user why the button is disabled?</p>
[ { "answer_id": 491278, "author": "BobbyShaftoe", "author_id": 38426, "author_profile": "https://Stackoverflow.com/users/38426", "pm_score": 3, "selected": false, "text": "<p>So assuming your control is called <code>button1</code> you could do something like this.<br>\nYou have to do it b...
2009/01/29
[ "https://Stackoverflow.com/questions/491267", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18349/" ]
If you have a disabled button on a winform how can you show a tool-tip on mouse-over to inform the user why the button is disabled?
Sam Mackrill, thanks for your answer, great idea to use the Tag to know what Control you are leaving. However you still need the IsShown flag as per BobbyShaftoe's answer. If you have the mouse in the wrong spot, if the ToolTip comes up under it, it can fire another MouseMove event (even though you did not physically m...
491,271
<p>I'm trying to understand how error handling works when using the Authorize [Authorize] Action Filter in MVC Preview 4.</p> <p>I have an action that looks like this:</p> <pre><code>[Authorize(Roles = "DOMAIN\\NOTAUTHORISED_ROLE" )] [HandleError] public ActionResult NeedAuthorisation() { throw new NotImplemented...
[ { "answer_id": 491356, "author": "Keith Williams", "author_id": 50189, "author_profile": "https://Stackoverflow.com/users/50189", "pm_score": 0, "selected": false, "text": "<p>If you've got CustomErrors set to Off or RemoteOnly then you won't get re-directed to the page specified by Hand...
2009/01/29
[ "https://Stackoverflow.com/questions/491271", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60147/" ]
I'm trying to understand how error handling works when using the Authorize [Authorize] Action Filter in MVC Preview 4. I have an action that looks like this: ``` [Authorize(Roles = "DOMAIN\\NOTAUTHORISED_ROLE" )] [HandleError] public ActionResult NeedAuthorisation() { throw new NotImplementedException(); } ``` ...
I eventually found [this MVC tutorial](http://www.asp.net/learn/mvc/tutorial-18-vb.aspx) which solved my problem: > > Exactly what happens when you attempt to invoke a controller action > without being the right permissions depends on the type of > authentication enabled. By default, when using the ASP.NET Developm...
491,286
<p>I have this table where the is initially blank. Then when the document is ready I call a function that runs an AJAX query for the table content. The initial content is sorted awesomely! But when I call my function again with different parameters to get new content, things start to go wrong. The table fills with the...
[ { "answer_id": 557338, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>I believe you will need to use livequery to let tablesorter know about the new ajax content.</p>\n\n<p>This one took me a w...
2009/01/29
[ "https://Stackoverflow.com/questions/491286", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have this table where the is initially blank. Then when the document is ready I call a function that runs an AJAX query for the table content. The initial content is sorted awesomely! But when I call my function again with different parameters to get new content, things start to go wrong. The table fills with the new...
I believe you will need to use livequery to let tablesorter know about the new ajax content. This one took me a while to wrap my head around, but basically this should work, after you include the livequery js: ``` $("#table").livequery(function(){ $(this).tablesorter({ ... }) }); ``` Noah
491,293
<p>When a user clicks on an ListBoxItem, I want to it to be a bold larger font red background yellow</p> <p>Everything works except the background. It seems that there is a standard (blue) background for the selected item. How do I override that and change the selected background yellow?</p> <p>Here is the code:</p> ...
[ { "answer_id": 491659, "author": "Stefano Driussi", "author_id": 49209, "author_profile": "https://Stackoverflow.com/users/49209", "pm_score": 2, "selected": false, "text": "<p>This code should work for setting background. The problem is that you need to create a ControlTemplate and assi...
2009/01/29
[ "https://Stackoverflow.com/questions/491293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4639/" ]
When a user clicks on an ListBoxItem, I want to it to be a bold larger font red background yellow Everything works except the background. It seems that there is a standard (blue) background for the selected item. How do I override that and change the selected background yellow? Here is the code: ``` <Window x:Class=...
It can be done a lot simpler. The Background color for the selected ListBox items are taken from the SystemColors. So, what you need to do is override the SystemColors in the Resources of your ListBox: ``` <ListBox.Resources> <!--Selected color when the ListBox is focused--> <SolidColorBrush x:Key="{x:Static S...
491,304
<p>I want to use pimpl idiom with inheritance.</p> <p>Here is the base public class and its implementation class:</p> <pre><code>class A { public: A(){pAImpl = new AImpl;}; void foo(){pAImpl-&gt;foo();}; private: AImpl* pAImpl; }; class AImpl { public: void foo(){/*do something*/...
[ { "answer_id": 491329, "author": "EricSchaefer", "author_id": 8976, "author_profile": "https://Stackoverflow.com/users/8976", "pm_score": 0, "selected": false, "text": "<p>I would do (1) because A's privates are or no business for B.</p>\n\n<p>Actually I would not pass it to A as you sug...
2009/01/29
[ "https://Stackoverflow.com/questions/491304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44673/" ]
I want to use pimpl idiom with inheritance. Here is the base public class and its implementation class: ``` class A { public: A(){pAImpl = new AImpl;}; void foo(){pAImpl->foo();}; private: AImpl* pAImpl; }; class AImpl { public: void foo(){/*do something*/}; }; ``` And I want t...
``` class A { public: A(bool DoNew = true){ if(DoNew) pAImpl = new AImpl; }; void foo(){pAImpl->foo();}; protected: void SetpAImpl(AImpl* pImpl) {pAImpl = pImpl;}; private: AImpl* pAImpl; }; class AImpl { public: void foo(){/*do something*/}; }; c...
491,314
<p>I understand that the name of selectNode/selectSingleNode methods actually suggests that they are designed to return a node, however maybe there is some other way or a setting available to enable XPath evaluator to return data of other types (that are also valid XPath results)</p> <pre> oDocument.selectSingleNode("...
[ { "answer_id": 491328, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 3, "selected": true, "text": "<p><code>selectSingleNode()</code> and <code>selectNodes()</code> select nodes identified by an XPath expression.</p>\n\n<p...
2009/01/29
[ "https://Stackoverflow.com/questions/491314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23815/" ]
I understand that the name of selectNode/selectSingleNode methods actually suggests that they are designed to return a node, however maybe there is some other way or a setting available to enable XPath evaluator to return data of other types (that are also valid XPath results) ``` oDocument.selectSingleNode("'1'"); ...
`selectSingleNode()` and `selectNodes()` select nodes identified by an XPath expression. Their return values are of type `IXMLDOMNode` and `IXMLDOMNodeList`, respectively. Nothing else can be returned. Expressions that do not return a node set (but otherwise are valid XPath expressions) will result in an error.
491,325
<p>An application needs a counter, which value to be stored in a text file. Sometimes it happens on very short intervals.</p> <p>This test code rewrites a text file very often (f.e. every 100 milliseconds):</p> <pre><code>int counter = 0; while (true) { WriteToFile(counter); counter++; Thread.Sleep(100);...
[ { "answer_id": 491339, "author": "Dave Markle", "author_id": 24995, "author_profile": "https://Stackoverflow.com/users/24995", "pm_score": 2, "selected": false, "text": "<p>I think the easiest thing to do would be to use the transactional filesystem in Windows Vista/2008:</p>\n\n<p><a hr...
2009/01/29
[ "https://Stackoverflow.com/questions/491325", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
An application needs a counter, which value to be stored in a text file. Sometimes it happens on very short intervals. This test code rewrites a text file very often (f.e. every 100 milliseconds): ``` int counter = 0; while (true) { WriteToFile(counter); counter++; Thread.Sleep(100); } private void Writ...
Various options spring to mind:- 1) keep a temporary copy of the current file, e.g. rename old file, write new file, delete old file (or write new file with temporary name, delete old file, rename new file), but perhaps your are writing out the file too often for this kind of thing 2) write multiple files, with a per...
491,330
<p>Hi I am newish to php and I have created an update page for Content Management System. I have a file upload in this case a picture. I have other inputs that contain text and I can get them to populate my form and thats fine and works great because the user can see what has already been entered. But the file name for...
[ { "answer_id": 491338, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 2, "selected": false, "text": "<p>You have to use the <a href=\"http://docs.php.net/manual/en/reserved.variables.files.php\" rel=\"nofollow noreferrer\"><c...
2009/01/29
[ "https://Stackoverflow.com/questions/491330", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60163/" ]
Hi I am newish to php and I have created an update page for Content Management System. I have a file upload in this case a picture. I have other inputs that contain text and I can get them to populate my form and thats fine and works great because the user can see what has already been entered. But the file name for th...
You have to use the [`$_FILES` variable](http://docs.php.net/manual/en/reserved.variables.files.php) for uploaded files. For further information, see [Handling file uploads](http://docs.php.net/manual/en/features.file-upload.php) in the PHP manual.
491,334
<pre><code>true.ToString() false.toString(); Output: True False </code></pre> <p>Is there a valid reason for it being "True" and not "true"? It breaks when writing XML as XML's boolean type <em>is lower case</em>, and also isn't compatible with C#'s true/false (not sure about CLS though).</p> <p><strong>Update</str...
[ { "answer_id": 491355, "author": "Rune Grimstad", "author_id": 30366, "author_profile": "https://Stackoverflow.com/users/30366", "pm_score": 3, "selected": false, "text": "<p>How is it not compatible with C#? Boolean.Parse and Boolean.TryParse is case insensitive and the parsing is done ...
2009/01/29
[ "https://Stackoverflow.com/questions/491334", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21574/" ]
``` true.ToString() false.toString(); Output: True False ``` Is there a valid reason for it being "True" and not "true"? It breaks when writing XML as XML's boolean type *is lower case*, and also isn't compatible with C#'s true/false (not sure about CLS though). **Update** Here is my very hacky way of getting aro...
Only people from Microsoft can really answer that question. However, I'd like to offer some fun facts about it ;) First, this is what it says in MSDN about the **Boolean.ToString()** method: > > **Return Value** > > > Type: System.String > > > *TrueString* if the value of this > instance is true, or *FalseStrin...
491,343
<p>I have a table with about 2,000,000 rows. I need to query one of the columns to retrieve the rows where a string exsists as part of the value. </p> <p>When I run the query I will know the position of the string, but not before hand. So a view which takes a substring is not an option.</p> <p>As far as I can see I h...
[ { "answer_id": 491379, "author": "John", "author_id": 59754, "author_profile": "https://Stackoverflow.com/users/59754", "pm_score": 1, "selected": false, "text": "<p>I suggest reconsidering your logic.</p>\n\n<p>Instead of looking for where a string exists, it may be faster to check if i...
2009/01/29
[ "https://Stackoverflow.com/questions/491343", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56672/" ]
I have a table with about 2,000,000 rows. I need to query one of the columns to retrieve the rows where a string exsists as part of the value. When I run the query I will know the position of the string, but not before hand. So a view which takes a substring is not an option. As far as I can see I have three options...
In Oracle 10: ``` CREATE TABLE test (tst_test VARCHAR2(200)); CREATE INDEX ix_re_1 ON test(REGEXP_REPLACE(REGEXP_SUBSTR(tst_test, 'KEY1=[^,]*'), 'KEY1=([^,]*)', '\1')) SELECT * FROM TEST WHERE REGEXP_REPLACE(REGEXP_SUBSTR(TST_TEST, 'KEY1=[^,]*'), 'KEY1=([^,]*)', '\1') = 'TEST' ``` This will use newly selecte...
491,345
<p>Given this linq query against an EF data context:</p> <pre><code>var customers = data.Customers.Where(c =&gt; c.EmailDomain.StartsWith(term)) </code></pre> <p>You’d expect it to produce SQL like this, right?</p> <pre><code>SELECT {cols} FROM Customers WHERE EmailDomain LIKE @term+’%’ </code></pre> <p>Well, actua...
[ { "answer_id": 491433, "author": "Timothy Khouri", "author_id": 11917, "author_profile": "https://Stackoverflow.com/users/11917", "pm_score": 3, "selected": true, "text": "<p>The reason is that CharIndex is a lot faster and cleaner for SQL to perform than LIKE. The reason is, that you <s...
2009/01/29
[ "https://Stackoverflow.com/questions/491345", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27782/" ]
Given this linq query against an EF data context: ``` var customers = data.Customers.Where(c => c.EmailDomain.StartsWith(term)) ``` You’d expect it to produce SQL like this, right? ``` SELECT {cols} FROM Customers WHERE EmailDomain LIKE @term+’%’ ``` Well, actually, it does something like this: ``` SELECT {cols}...
The reason is that CharIndex is a lot faster and cleaner for SQL to perform than LIKE. The reason is, that you ***can*** have some crazy "LIKE" clauses. Example: ``` SELECT * FROM Customer WHERE EmailDomain LIKE 'abc%de%sss%' ``` But, the "CHARINDEX" function (which is basically "IndexOf") ONLY handles finding the f...
491,374
<p>I think I understand the concept of a delegate in C# as a pointer to a method, but I cant find any good examples of where it would be a good idea to use them. What are some examples that are either significantly more elegant/better with delegates or cant be solved using other methods? </p>
[ { "answer_id": 491383, "author": "cjk", "author_id": 52201, "author_profile": "https://Stackoverflow.com/users/52201", "pm_score": 3, "selected": false, "text": "<p>I primarily use the for easy asynch programming. Kicking off a method using a delegates Begin... method is really easy if ...
2009/01/29
[ "https://Stackoverflow.com/questions/491374", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56564/" ]
I think I understand the concept of a delegate in C# as a pointer to a method, but I cant find any good examples of where it would be a good idea to use them. What are some examples that are either significantly more elegant/better with delegates or cant be solved using other methods?
What exactly do you mean by delegates? Here are two ways in which they can be used: ``` void Foo(Func<int, string> f) { //do stuff string s = f(42); // do more stuff } ``` and ``` void Bar() { Func<int, string> f = delegate(i) { return i.ToString(); } //do stuff string s = f(42); // do more stuff } ``` The...
491,375
<p>Is there any reason to expose an internal collection as a ReadOnlyCollection rather than an IEnumerable if the calling code only iterates over the collection?</p> <pre><code>class Bar { private ICollection&lt;Foo&gt; foos; // Which one is to be preferred? public IEnumerable&lt;Foo&gt; Foos { ... } ...
[ { "answer_id": 491405, "author": "Stu Mackellar", "author_id": 28591, "author_profile": "https://Stackoverflow.com/users/28591", "pm_score": 5, "selected": false, "text": "<p>If you do this then there's nothing stopping your callers casting the IEnumerable back to ICollection and then mo...
2009/01/29
[ "https://Stackoverflow.com/questions/491375", "https://Stackoverflow.com", "https://Stackoverflow.com/users/276/" ]
Is there any reason to expose an internal collection as a ReadOnlyCollection rather than an IEnumerable if the calling code only iterates over the collection? ``` class Bar { private ICollection<Foo> foos; // Which one is to be preferred? public IEnumerable<Foo> Foos { ... } public ReadOnlyCollection<...
**More modern solution** Unless you need the internal collection to be mutable, you could use the [`System.Collections.Immutable`](https://www.nuget.org/packages/System.Collections.Immutable/) package, change your field type to be an immutable collection, and then expose that directly - assuming `Foo` itself is immuta...
491,376
<p>I found <a href="https://stackoverflow.com/questions/340762/which-languages-support-tail-recursion-optimization">this question</a> about which languages optimize tail recursion. Why C# doesn't optimize tail recursion, whenever possible?</p> <p>For a concrete case, why isn't this method optimized into a loop (<a hre...
[ { "answer_id": 491424, "author": "Noldorin", "author_id": 44389, "author_profile": "https://Stackoverflow.com/users/44389", "pm_score": 6, "selected": false, "text": "<p>This <a href=\"https://web.archive.org/web/20140724090729/http://connect.microsoft.com/VisualStudio/feedback/details/1...
2009/01/29
[ "https://Stackoverflow.com/questions/491376", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11236/" ]
I found [this question](https://stackoverflow.com/questions/340762/which-languages-support-tail-recursion-optimization) about which languages optimize tail recursion. Why C# doesn't optimize tail recursion, whenever possible? For a concrete case, why isn't this method optimized into a loop ([Visual Studio 2008](http:/...
JIT compilation is a tricky balancing act between not spending too much time doing the compilation phase (thus slowing down short lived applications considerably) vs. not doing enough analysis to keep the application competitive in the long term with a standard ahead-of-time compilation. Interestingly the [NGen](https...
491,417
<p>I've a TreeView that displays hierarchical data, while I select a TreeNode, I generate a series of links that map the path from selected node till root node</p> <p>Say: Root Node --> ChildNode --> SelectedNode</p> <p>What I need is, while clicking any of these links, select required node in TreeView?</p> <p>I k...
[ { "answer_id": 491432, "author": "petr k.", "author_id": 15497, "author_profile": "https://Stackoverflow.com/users/15497", "pm_score": 1, "selected": false, "text": "<p>Not yet, as far as I know. I was also looking for something similar to no success. I suspect as soon as F# hits VS2010 ...
2009/01/29
[ "https://Stackoverflow.com/questions/491417", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14118/" ]
I've a TreeView that displays hierarchical data, while I select a TreeNode, I generate a series of links that map the path from selected node till root node Say: Root Node --> ChildNode --> SelectedNode What I need is, while clicking any of these links, select required node in TreeView? I know that selecting a Tree...
[F# Refactor](http://fsharprefactor.codeplex.com/) open source project on CodePlex (Apache license).
491,429
<p>I want to get the PropertyInfo for a specific property. I could use:</p> <pre><code>foreach(PropertyInfo p in typeof(MyObject).GetProperties()) { if ( p.Name == "MyProperty") { return p } } </code></pre> <p>But there must be a way to do something similar to </p> <pre><code>typeof(MyProperty) as PropertyInfo ...
[ { "answer_id": 491456, "author": "Vojislav Stojkovic", "author_id": 58099, "author_profile": "https://Stackoverflow.com/users/58099", "pm_score": 4, "selected": false, "text": "<p>You can do this:</p>\n\n<pre><code>typeof(MyObject).GetProperty(\"MyProperty\")\n</code></pre>\n\n<p>However...
2009/01/29
[ "https://Stackoverflow.com/questions/491429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11801/" ]
I want to get the PropertyInfo for a specific property. I could use: ``` foreach(PropertyInfo p in typeof(MyObject).GetProperties()) { if ( p.Name == "MyProperty") { return p } } ``` But there must be a way to do something similar to ``` typeof(MyProperty) as PropertyInfo ``` Is there? Or am I stuck doing a ...
You can use the new `nameof()` operator that is part of C# 6 and available in Visual Studio 2015. More info [here](https://msdn.microsoft.com/en-us/library/dn986596.aspx). For your example you would use: ``` PropertyInfo result = typeof(MyObject).GetProperty(nameof(MyObject.MyProperty)); ``` The compiler will conve...
491,435
<p>In PHP you can do:</p> <p><code>print_r($var)</code> or <code>vardump($var)</code> </p> <p>which prints "human-readible" information about variable.</p> <p>Is there equivalent functions / helpers for those in Ruby / Rails ?</p>
[ { "answer_id": 491481, "author": "Antibaddy", "author_id": 30711, "author_profile": "https://Stackoverflow.com/users/30711", "pm_score": 4, "selected": false, "text": "<p>Try using pp.\nYou will need to require it in scripts (or in irb if your .irbc doesn't already do this):</p>\n\n<pre>...
2009/01/29
[ "https://Stackoverflow.com/questions/491435", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3911/" ]
In PHP you can do: `print_r($var)` or `vardump($var)` which prints "human-readible" information about variable. Is there equivalent functions / helpers for those in Ruby / Rails ?
In Rails templates you can do ``` <%= debug an_object %> ``` and it will do nice HTML PRE output.
491,447
<p>I have some queries that are causing timeouts in our live environment. (>30 seconds)</p> <p>If I run profiler and grab the exact SQL being run and run it from Management Studio then they take a long time to run the first time and then drop to a few hundred miliseconds each run after that.</p> <p>This is obviously ...
[ { "answer_id": 491467, "author": "Welbog", "author_id": 52443, "author_profile": "https://Stackoverflow.com/users/52443", "pm_score": 4, "selected": true, "text": "<p>According to <a href=\"http://morten.lyhr.dk/2007/10/how-to-clear-sql-server-query-cache.html\" rel=\"noreferrer\">http:/...
2009/01/29
[ "https://Stackoverflow.com/questions/491447", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40655/" ]
I have some queries that are causing timeouts in our live environment. (>30 seconds) If I run profiler and grab the exact SQL being run and run it from Management Studio then they take a long time to run the first time and then drop to a few hundred miliseconds each run after that. This is obviously SQL caching the d...
According to <http://morten.lyhr.dk/2007/10/how-to-clear-sql-server-query-cache.html>, you can run the following to clear the cache: ``` DBCC DROPCLEANBUFFERS DBCC FREEPROCCACHE ``` EDIT: I checked with the SQL Server documentation I have and this is at least true for SQL Server 2000.
491,454
<p><strong>EDIT</strong>: Duplicate of <a href="https://stackoverflow.com/questions/94906/how-do-i-return-random-numbers-as-a-column-in-sql-server-2005">How do I return random numbers as a column in SQL Server 2005?</a></p> <p>Hello How can I generate random numbers in mssql server 2005.</p> <p>for example: when I s...
[ { "answer_id": 491464, "author": "Tim", "author_id": 53444, "author_profile": "https://Stackoverflow.com/users/53444", "pm_score": 0, "selected": false, "text": "<p><a href=\"http://www.google.com/search?q=mssql+2005+generate+random\" rel=\"nofollow noreferrer\">easy google</a>: <a href=...
2009/01/29
[ "https://Stackoverflow.com/questions/491454", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53854/" ]
**EDIT**: Duplicate of [How do I return random numbers as a column in SQL Server 2005?](https://stackoverflow.com/questions/94906/how-do-i-return-random-numbers-as-a-column-in-sql-server-2005) Hello How can I generate random numbers in mssql server 2005. for example: when I select 500rows from table, each row must h...
``` SELECT TOP 500 CONVERT(INT, CONVERT(VARBINARY(16), NEWID())) FROM dbo.MyTable ```
491,460
<p>I am trying to build an iPhone app. But at the time of compiling there is a message showing that </p> <pre><code>[Session started at 2009-01-29 18:25:40 +0600.] 2009-01-29 18:25:44.238 SimpleGame[3691:20b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: in...
[ { "answer_id": 491464, "author": "Tim", "author_id": 53444, "author_profile": "https://Stackoverflow.com/users/53444", "pm_score": 0, "selected": false, "text": "<p><a href=\"http://www.google.com/search?q=mssql+2005+generate+random\" rel=\"nofollow noreferrer\">easy google</a>: <a href=...
2009/01/29
[ "https://Stackoverflow.com/questions/491460", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58554/" ]
I am trying to build an iPhone app. But at the time of compiling there is a message showing that ``` [Session started at 2009-01-29 18:25:40 +0600.] 2009-01-29 18:25:44.238 SimpleGame[3691:20b] *** Terminating app due to uncaught exception 'NSRangeException', reason: '*** -[NSCFArray objectAtIndex:]: index (1) beyond...
``` SELECT TOP 500 CONVERT(INT, CONVERT(VARBINARY(16), NEWID())) FROM dbo.MyTable ```
491,468
<p>I have a project for all my javascripts in side (that I made common for three projects). </p> <p>During a build I want to move these scripts to the three projects, how can I do this by editing <code>.csproj</code> and how?</p> <p><strong>Update:</strong></p> <p>I have in the same solution <code>webapplication1</c...
[ { "answer_id": 491492, "author": "Adam Naylor", "author_id": 17540, "author_profile": "https://Stackoverflow.com/users/17540", "pm_score": -1, "selected": false, "text": "<p>If you can use Visual Studio to build then use post <a href=\"http://visualstudiohacks.com/articles/general/custom...
2009/01/29
[ "https://Stackoverflow.com/questions/491468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a project for all my javascripts in side (that I made common for three projects). During a build I want to move these scripts to the three projects, how can I do this by editing `.csproj` and how? **Update:** I have in the same solution `webapplication1` and `webapplication2` and i'm editing `.csproj` for we...
There is two ways to do that: \_ Edit the .csproject, at the end of the file you should find a Target named AfterBuild (uncomment the target). ``` <ItemGroup> <JavascriptFiles Include="*.js"/> </ItemGroup> <Target Name="AfterBuild"> <Copy SourceFiles="@(JavascriptFiles)" DestinationFolder="Pa...
491,484
<p>I'm using MySQL in an ASP.NET project I'm currently working on, I did some tests to test the performance of the MySQL .NET provider but unfortunately I'm not very pleased with the results.</p> <p>A very simple loop that only opens the connection was 10x faster in SQL Server:</p> <pre><code>// MySQL const string C...
[ { "answer_id": 491504, "author": "edosoft", "author_id": 6399, "author_profile": "https://Stackoverflow.com/users/6399", "pm_score": 2, "selected": false, "text": "<p>SQL server uses connection pooling by default: each connection opened with the exact same connection string is returned t...
2009/01/29
[ "https://Stackoverflow.com/questions/491484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/676066/" ]
I'm using MySQL in an ASP.NET project I'm currently working on, I did some tests to test the performance of the MySQL .NET provider but unfortunately I'm not very pleased with the results. A very simple loop that only opens the connection was 10x faster in SQL Server: ``` // MySQL const string CONNECTION_STRING = "...
SQL server uses connection pooling by default: each connection opened with the exact same connection string is returned to the pool when closed. Returning a connection from the pool is much more efficient than creating a connection from scratch. I assume MySql doesn't provide connection pooling *by default*
491,490
<p>I want to use jQuery inside a firefox extension, I imported the library in the xul file like this:</p> <pre><code>&lt;script type="application/x-javascript" src="chrome://myExtension/content/jquery.js"&gt; &lt;/script&gt; </code></pre> <p>but the $() function is not recognized in the xul file neither do the jQuery...
[ { "answer_id": 492504, "author": "Eric Wendelin", "author_id": 25066, "author_profile": "https://Stackoverflow.com/users/25066", "pm_score": 0, "selected": false, "text": "<p>It may be bad practice, but have you considered including it inline?</p>\n" }, { "answer_id": 495031, ...
2009/01/29
[ "https://Stackoverflow.com/questions/491490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to use jQuery inside a firefox extension, I imported the library in the xul file like this: ``` <script type="application/x-javascript" src="chrome://myExtension/content/jquery.js"> </script> ``` but the $() function is not recognized in the xul file neither do the jQuery(). I googled about the problem and f...
I use the following `example.xul`: ``` <?xml version="1.0"?> <overlay id="example" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> <head></head> <script type="application/x-javascript" src="jquery.js"></script> <script type="application/x-javascript" src="example.js"></script> </overlay> ``` A...
491,523
<p>I have WPF listview bound to collection of objects. Objects are continuously added in to collection from remote server and same is reflecting in to listview. Now we have requirement that we should be able to freeze listview for some time, That is objects should still get added in to collection but should...
[ { "answer_id": 491552, "author": "Nir", "author_id": 3509, "author_profile": "https://Stackoverflow.com/users/3509", "pm_score": 0, "selected": false, "text": "<p>You should just stop updating the collection when the list is frozen, if you must keep adding to the collection even when the...
2009/01/29
[ "https://Stackoverflow.com/questions/491523", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have WPF listview bound to collection of objects. Objects are continuously added in to collection from remote server and same is reflecting in to listview. Now we have requirement that we should be able to freeze listview for some time, That is objects should still get added in to collection but should not appear i...
You can just break the binding. In your freeze button handler say: ``` listView = _list ``` Which will freeze it at that point. Then in your unfreeze handler set the binding back up: ``` listView.SetBinding(ListView.ItemsSourceProperty, New Binding("_list")) ``` I hope this helps.
491,527
<p>Edit: On further examination Firefox does not seem to be doing this, but Chrome definitely does. I guess its just a bug with a new browser - for every event an I/O Read also occurs in Chrome but not in FF.</p> <p>When I load the following page in a browser (I've tested in Chrome and Firefox 3 under Vista) and move ...
[ { "answer_id": 491568, "author": "annakata", "author_id": 13018, "author_profile": "https://Stackoverflow.com/users/13018", "pm_score": 1, "selected": false, "text": "<p>Well this is not how I'd handle this <em>at all</em>, and I can't replicate the behaviour so all I can tell you is the...
2009/01/29
[ "https://Stackoverflow.com/questions/491527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31409/" ]
Edit: On further examination Firefox does not seem to be doing this, but Chrome definitely does. I guess its just a bug with a new browser - for every event an I/O Read also occurs in Chrome but not in FF. When I load the following page in a browser (I've tested in Chrome and Firefox 3 under Vista) and move the mouse ...
Memory leaks related to event handlers are, generally speaking, related to enclosures. In other words, attaching a function to an event handler which points back to its element can prevent browsers from garbage-collecting either. (Thankfully, most newer browsers have "learned the trick" and no longer leak memory in thi...
491,528
<p>I want my TextBoxExtender to NOT allow a comma and a slash. How do I set it ? Using an escape sequence ?</p> <p>Thanks.</p>
[ { "answer_id": 491532, "author": "cgreeno", "author_id": 6088, "author_profile": "https://Stackoverflow.com/users/6088", "pm_score": 3, "selected": true, "text": "<p>I think you are looking for the <em>InvalidChars</em> Element. The FilteredTextBoxExtender can be set to filter either Val...
2009/01/29
[ "https://Stackoverflow.com/questions/491528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49189/" ]
I want my TextBoxExtender to NOT allow a comma and a slash. How do I set it ? Using an escape sequence ? Thanks.
I think you are looking for the *InvalidChars* Element. The FilteredTextBoxExtender can be set to filter either Valid or Invalid Characters. ``` <ajaxToolkit:FilteredTextBoxExtender ID="MyId" runat="server" TargetControlID="TextBoxName" FilterType="Custom" FilterMode="InvalidChars" ...
491,535
<p>Is there an easy way to tell a Two-way WPF data binding to wait a few milliseconds after the last change before updating the Source with the new property value?</p> <p>I'm implementing a filter feature for a ListBox where I have a textbox, and I want to filter the content of the ListBox according to what I type. I'...
[ { "answer_id": 492075, "author": "Bryan Anderson", "author_id": 21186, "author_profile": "https://Stackoverflow.com/users/21186", "pm_score": 2, "selected": false, "text": "<p>First, to answer your question, I would add the <a href=\"http://msdn.microsoft.com/en-us/library/system.windows...
2009/01/29
[ "https://Stackoverflow.com/questions/491535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1727/" ]
Is there an easy way to tell a Two-way WPF data binding to wait a few milliseconds after the last change before updating the Source with the new property value? I'm implementing a filter feature for a ListBox where I have a textbox, and I want to filter the content of the ListBox according to what I type. I'm using da...
I'm also a few years late, but if you're using WPF 4.5+ [there is now an property](http://msdn.microsoft.com/en-us/library/system.windows.data.bindingbase.delay.aspx) exactly for this purpose, it's called `Delay`. Description > > The amount of time, in milliseconds, to wait before updating the > binding source. > ...
491,537
<p>I am using nested repeaters to build a table for reasons I won't discuss here, but what I'm looking to do is have two datasources, one for the top level repeater that will correspond to the rows, and one for the second level repeater that will return cells within a row.</p> <p>What I'm wondering, however, is if I c...
[ { "answer_id": 491561, "author": "Cerebrus", "author_id": 53718, "author_profile": "https://Stackoverflow.com/users/53718", "pm_score": 3, "selected": true, "text": "<p>I think the best way would be to handle the ItemDataBound event of the Outer Repeater, <strong>Find</strong> the inner ...
2009/01/29
[ "https://Stackoverflow.com/questions/491537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26140/" ]
I am using nested repeaters to build a table for reasons I won't discuss here, but what I'm looking to do is have two datasources, one for the top level repeater that will correspond to the rows, and one for the second level repeater that will return cells within a row. What I'm wondering, however, is if I can somehow...
I think the best way would be to handle the ItemDataBound event of the Outer Repeater, **Find** the inner DataSource control and set a SelectParameter for it. ``` void MyOuterRepeater_ItemDataBound(Object sender, RepeaterItemEventArgs e) { // Find the Inner DataSource control in this Row. SqlDataSourc...
491,541
<p>I have an ASP .NET website that hosts a Java applet. The Java applet requires version 1.6 Update 11 of the Java runtime.</p> <p>How can I detect that a client has the appropriate runtime installed so that I can display an informative message if they do not?</p> <p>Thanks,</p> <p>Carl.</p> <p><strong>EDIT:</stron...
[ { "answer_id": 491558, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 5, "selected": true, "text": "<p>This page describes how to and lists some plugins that will allow you to detect Java with JavaScript: <a href=\"ht...
2009/01/29
[ "https://Stackoverflow.com/questions/491541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5449/" ]
I have an ASP .NET website that hosts a Java applet. The Java applet requires version 1.6 Update 11 of the Java runtime. How can I detect that a client has the appropriate runtime installed so that I can display an informative message if they do not? Thanks, Carl. **EDIT:** The solution must be platform independant...
This page describes how to and lists some plugins that will allow you to detect Java with JavaScript: <http://www.pinlady.net/PluginDetect/JavaDetect.htm> Other than that, try out this snippet as well: ``` if (navigator.javaEnabled()) { //Java is enabled } ```
491,549
<p>I want to add an element to the list in my Velocity macro. Is this only way to avoid 'true' text appearing to the Velocity output?</p> <pre><code>#set($path = []) #set($swallow = "a") #set ($swallow = $path.add("blaablaa")) </code></pre>
[ { "answer_id": 491689, "author": "joel.neely", "author_id": 3525, "author_profile": "https://Stackoverflow.com/users/3525", "pm_score": 3, "selected": true, "text": "<p>I have to agree with Terence Parr (father of <a href=\"http://www.stringtemplate.org/\" rel=\"nofollow noreferrer\">Str...
2009/01/29
[ "https://Stackoverflow.com/questions/491549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28841/" ]
I want to add an element to the list in my Velocity macro. Is this only way to avoid 'true' text appearing to the Velocity output? ``` #set($path = []) #set($swallow = "a") #set ($swallow = $path.add("blaablaa")) ```
I have to agree with Terence Parr (father of [StringTemplate](http://www.stringtemplate.org/)) who has relevant comments in [an Artima interview](http://www.artima.com/lejava/articles/stringtemplate.html) and [a good paper on model-view separation](http://www.cs.usfca.edu/~parrt/papers/mvc.templates.pdf). Templates sh...
491,554
<p>I've been developing a java application using git as source code repository. I'd like to share the project with other java developers and hg seems to be most used by them. </p> <p>My question is how do I convert a git repository to hg?</p> <p>If I tried googling "convert git to hg" and every search hit is about co...
[ { "answer_id": 491594, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://hgbook.red-bean.com/hgbookch1.html\" rel=\"noreferrer\">Distributed revision control with Mercurial</a> ...
2009/01/29
[ "https://Stackoverflow.com/questions/491554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3713/" ]
I've been developing a java application using git as source code repository. I'd like to share the project with other java developers and hg seems to be most used by them. My question is how do I convert a git repository to hg? If I tried googling "convert git to hg" and every search hit is about converting from hg ...
The [`hg convert`](https://www.mercurial-scm.org/wiki/ConvertExtension) utility isn't on by default after installation. In order to set it as such add the following to your `.hgrc` file. ``` [extensions] hgext.convert= ``` If you're using [TortoiseHg](https://tortoisehg.bitbucket.io/) on Windows then this file resid...
491,563
<p>A follow-up from <a href="https://stackoverflow.com/questions/488061/passing-multiple-parameters-to-controller-in-asp-net-mvc-also-generating-on-the/488127#488127">this question</a>, I've changed my controller and routing around so that now the sort value is assigned by ?sort= however I also want to implement the ab...
[ { "answer_id": 491582, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 0, "selected": false, "text": "<p>I don't fully understand the use-case - but you can add filters easily via <code>IQueryable&lt;T&gt;</code>:</p>\n...
2009/01/29
[ "https://Stackoverflow.com/questions/491563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/135/" ]
A follow-up from [this question](https://stackoverflow.com/questions/488061/passing-multiple-parameters-to-controller-in-asp-net-mvc-also-generating-on-the/488127#488127), I've changed my controller and routing around so that now the sort value is assigned by ?sort= however I also want to implement the ability for user...
Server tier ----------- Let's start with some pseudocode. ``` public ActionResult Open(string sort, string technician, string category, string priority) { // generate query // filter stuff // order/sort stuff } ``` It's important to get the order of operations right, here. Certain IQueryable provid...
491,566
<p>If I have data like this in a table</p> <pre><code>id data -- ---- 1 1 1 2 1 3 2 4 2 5 3 6 3 4 </code></pre> <p>How do I get results like this in a query (on sybase server)?</p> <pre><code>id data -- ---- 1 1, 2, 3 2 4, 5 3 6, 4 </code></pre>
[ { "answer_id": 491620, "author": "Dave Markle", "author_id": 24995, "author_profile": "https://Stackoverflow.com/users/24995", "pm_score": 2, "selected": false, "text": "<p>You can't do this in a straight GROUP BY in plain-vanilla SQL. You have to use a cursor (or a similar construct) t...
2009/01/29
[ "https://Stackoverflow.com/questions/491566", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4406/" ]
If I have data like this in a table ``` id data -- ---- 1 1 1 2 1 3 2 4 2 5 3 6 3 4 ``` How do I get results like this in a query (on sybase server)? ``` id data -- ---- 1 1, 2, 3 2 4, 5 3 6, 4 ```
I know that in MySQL there is [GROUP\_CONCAT](http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html#function_group-concat) and in Sybase I think it's [LIST](http://www.eggheadcafe.com/software/aspnet/28523243/-concatenate-string-us.aspx) as stated in another answer: ``` SELECT id, LIST(data||', ') FROM yourta...
491,595
<p>When building console applications that take parameters, you can use the arguments passed to <code>Main(string[] args)</code>. </p> <p>In the past I've simply indexed/looped that array and done a few regular expressions to extract the values. However, when the commands get more complicated, the parsing can get pret...
[ { "answer_id": 491623, "author": "abatishchev", "author_id": 41956, "author_profile": "https://Stackoverflow.com/users/41956", "pm_score": 5, "selected": false, "text": "<p>Look at <a href=\"http://github.com/mono/mono/tree/master/mcs/class/Mono.Options/\" rel=\"noreferrer\">http://githu...
2009/01/29
[ "https://Stackoverflow.com/questions/491595", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57132/" ]
When building console applications that take parameters, you can use the arguments passed to `Main(string[] args)`. In the past I've simply indexed/looped that array and done a few regular expressions to extract the values. However, when the commands get more complicated, the parsing can get pretty ugly. So I'm int...
I would strongly suggest using [NDesk.Options](http://www.ndesk.org/Options) ([Documentation](http://www.ndesk.org/doc/ndesk-options/)) and/or [Mono.Options](https://github.com/mono/mono/blob/master/mcs/class/Mono.Options/Mono.Options/Options.cs) (same API, different namespace). An [example from the documentation](http...
491,603
<p>I work on a web-application that is written in C#/ASP.NET. The original framers of this application chose to use encrypted query strings and <code>Viewstate</code> to control the 'security' and 'state' of the application.</p> <p>Having come from a GET/POST world before this, I don't have a good basis for understan...
[ { "answer_id": 491626, "author": "Anton Gogolev", "author_id": 60188, "author_profile": "https://Stackoverflow.com/users/60188", "pm_score": 0, "selected": false, "text": "<p>As far as ViewState is concerned, it is already encrypted and validated in pretty much every possible way by the ...
2009/01/29
[ "https://Stackoverflow.com/questions/491603", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16587/" ]
I work on a web-application that is written in C#/ASP.NET. The original framers of this application chose to use encrypted query strings and `Viewstate` to control the 'security' and 'state' of the application. Having come from a GET/POST world before this, I don't have a good basis for understanding why people would ...
A reason why you might do something like this is to prevent tampering with the URL to get access to data other than your own. For example, if you have the url: ``` http://foo.com/user.aspx?user_id=123 ``` it wouldn't be hard for me (or anyone) to change that to: ``` http://foo.com/user.aspx?user_id=124 ``` If you...
491,628
<p>We are using Rhino Mocks to perform some unit testing and need to mock two interfaces. Only one interface is implemented on the object and the other is implemented dynamically using an aspect-oriented approach. Is there an easy way to combine the two interfaces dynamically so that a mock can be created and the metho...
[ { "answer_id": 491885, "author": "jalbert", "author_id": 1360388, "author_profile": "https://Stackoverflow.com/users/1360388", "pm_score": 4, "selected": false, "text": "<p>It's not dynamic, but certainly easy: create an interface within your testing assembly which does nothing other tha...
2009/01/29
[ "https://Stackoverflow.com/questions/491628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31770/" ]
We are using Rhino Mocks to perform some unit testing and need to mock two interfaces. Only one interface is implemented on the object and the other is implemented dynamically using an aspect-oriented approach. Is there an easy way to combine the two interfaces dynamically so that a mock can be created and the methods ...
A mock with multiple interfaces using Rhino Mocks can be generated like so: ``` var mocker = new MockRepository(); var mock = mocker.CreateMultiMock<IPrimaryInterface>(typeof(IFoo), typeof(IBar)); mocker.ReplayAll(); ```
491,646
<p>I am working on debugging some code and noticed a bunch of auto generated methods and objects. </p> <p>At the top of the code for these I find the following comment:</p> <pre><code>//------------------------------------------------------------------------------ // &lt;auto-generated&gt; // This code was genera...
[ { "answer_id": 491656, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>It will entirely depend on what the code is.</p>\n\n<p>Presumably you know the class you're debugging - whether it's ...
2009/01/29
[ "https://Stackoverflow.com/questions/491646", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59376/" ]
I am working on debugging some code and noticed a bunch of auto generated methods and objects. At the top of the code for these I find the following comment: ``` //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runti...
``` //------------------------------------------------------------------------------ // <auto-generated> // This code was generated by a tool. // Runtime Version:2.0.50727.42 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. //...
491,647
<p>I need to be able to fill a <code>stackpanel</code> with <code>buttons</code> but the buttons <strong>must appear at the bottom of the stackpanel first and populate upwards</strong>. The buttons are created dynamically and there's an unknown number of them so visual hackery just won't work. I've tried experimentin...
[ { "answer_id": 491679, "author": "Oleg", "author_id": 47856, "author_profile": "https://Stackoverflow.com/users/47856", "pm_score": 2, "selected": false, "text": "<p>The best way to solve the problem is to implement custom container derived from stackpanel\nbut quick and dirty solution i...
2009/01/29
[ "https://Stackoverflow.com/questions/491647", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5559/" ]
I need to be able to fill a `stackpanel` with `buttons` but the buttons **must appear at the bottom of the stackpanel first and populate upwards**. The buttons are created dynamically and there's an unknown number of them so visual hackery just won't work. I've tried experimenting with vertical alignments but to no ava...
Like so: ``` <StackPanel VerticalAlignment="Bottom"> ... </StackPanel> ``` and to populate with buttons upward you must insert the buttons at position 0, instead of adding them.
491,670
<p>I have a web.sitemap with security trimming enabled, however I need to hide a menu item based on a role to a page that has no access rules in the web.config.</p> <p>i.e I have a Campaign page that is used to view existing campaigns as well as to add new campaigns, but I want the "New Campaigns" menu item to be hidd...
[ { "answer_id": 491763, "author": "devstuff", "author_id": 41321, "author_profile": "https://Stackoverflow.com/users/41321", "pm_score": 1, "selected": false, "text": "<p>The <code>roles</code> attribute in a <code>&lt;siteMapNode /&gt;</code> is an \"allow\" list, not a deny. Create/modi...
2009/01/29
[ "https://Stackoverflow.com/questions/491670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2808/" ]
I have a web.sitemap with security trimming enabled, however I need to hide a menu item based on a role to a page that has no access rules in the web.config. i.e I have a Campaign page that is used to view existing campaigns as well as to add new campaigns, but I want the "New Campaigns" menu item to be hidden for ano...
If this is just a special case for anonymous users, you could create a second SiteMap. Create a new file WebAnon.sitemap. Create a new sitemap provider in the web.config ``` <add name="anonProvider" type="System.Web.XmlSiteMapProvider" siteMapFile="WebAnon.sitemap" securityTrimmingEnabled="true"/> ``` Set the S...
491,678
<p>In <a href="http://php.net/quoted_printable_decode" rel="nofollow noreferrer">http://php.net/quoted_printable_decode</a>, I found ways to do it using preg_replace. Anyone who knows any code that could convert a normal NSString to something RFC 2045 section 6.7?</p> <p>Thanks in advance!</p>
[ { "answer_id": 494243, "author": "Jason Coco", "author_id": 34218, "author_profile": "https://Stackoverflow.com/users/34218", "pm_score": 2, "selected": true, "text": "<p>There's no method on Cocoa to decode a quoted printable string, but you could easily write something yourself, like:<...
2009/01/29
[ "https://Stackoverflow.com/questions/491678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59463/" ]
In <http://php.net/quoted_printable_decode>, I found ways to do it using preg\_replace. Anyone who knows any code that could convert a normal NSString to something RFC 2045 section 6.7? Thanks in advance!
There's no method on Cocoa to decode a quoted printable string, but you could easily write something yourself, like: ``` @interface NSString (QuotedPrintableStrings) +(NSString*)stringWithQuotedPrintableString:(const char *)qpString; @end @implementation NSString (QuotedPrintableStrings) +(NSString*)stringWithQuoted...
491,682
<p>People have different ideas of how to search for the same term.</p> <p>For example Tri-Valley, Trivalley, Tri Valley (and possibly even incorrect spellings)</p> <p>Currently that search is done like this</p> <pre><code>SELECT * FROM `table` WHERE `SchoolDistrict` LIKE '%tri valley%'; </code></pre> <p>Is there ...
[ { "answer_id": 491710, "author": "David Grant", "author_id": 40581, "author_profile": "https://Stackoverflow.com/users/40581", "pm_score": 3, "selected": true, "text": "<p>You could consider using <a href=\"http://dev.mysql.com/doc/refman/5.0/en/string-functions.html\" rel=\"nofollow nor...
2009/01/29
[ "https://Stackoverflow.com/questions/491682", "https://Stackoverflow.com", "https://Stackoverflow.com/users/144/" ]
People have different ideas of how to search for the same term. For example Tri-Valley, Trivalley, Tri Valley (and possibly even incorrect spellings) Currently that search is done like this ``` SELECT * FROM `table` WHERE `SchoolDistrict` LIKE '%tri valley%'; ``` Is there an easy way to say 'space dash or no spa...
You could consider using [SOUNDEX](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html), or [SOUNDS LIKE](http://dev.mysql.com/doc/refman/5.0/en/string-functions.html) if you have a lot of incorrect spellings. If you've got a lot of rows (or even if you don't), it might be wise to store the output of the `SOUN...
491,685
<p>I can't seem to change the read only flag on a file. I've tried this on Vista and XP with the same result, so I don't think it's a UAC related issue.</p> <p>Nothing I've done seems to work though. See the sample below. Can someone tell me what I'm doing wrong?</p> <pre><code>public bool UpdateResFile(string fileNa...
[ { "answer_id": 491723, "author": "dmajkic", "author_id": 39233, "author_profile": "https://Stackoverflow.com/users/39233", "pm_score": 1, "selected": false, "text": "<p>You are trying to change read-only flag on file WHEN you get an UnauthorisedAccessException. You can't do that. All you...
2009/01/29
[ "https://Stackoverflow.com/questions/491685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14509/" ]
I can't seem to change the read only flag on a file. I've tried this on Vista and XP with the same result, so I don't think it's a UAC related issue. Nothing I've done seems to work though. See the sample below. Can someone tell me what I'm doing wrong? ``` public bool UpdateResFile(string fileName, string language, ...
Is not possible to change the read only attribute of a file at UnauthorizedAccessException cause the application is executing with the permissions that you have in the computer. If you dont have permissions to change normally this file to read only, your application will not change this attribute either. Kind Regards...
491,704
<p>I've got an issue with MVC routing(or at least I think it's w/routing :) )...</p> <p>Just upgraded to MVC RC1, but I'm not sure that it's related as this is my first attempt at setting a MapRoute and corresponding RouteLink.</p> <p>here's the route:</p> <pre><code>routes.MapRoute("Test1", "Forecas...
[ { "answer_id": 491847, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 1, "selected": false, "text": "<p>RouteLink versus ActionLink is a red herring here. The only thing that matters is the rendered a href=\"[something]\...
2009/01/29
[ "https://Stackoverflow.com/questions/491704", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4232/" ]
I've got an issue with MVC routing(or at least I think it's w/routing :) )... Just upgraded to MVC RC1, but I'm not sure that it's related as this is my first attempt at setting a MapRoute and corresponding RouteLink. here's the route: ``` routes.MapRoute("Test1", "Forecast/CurrentLineItems/{property...
It could be caused by the usage of relative paths to include the scripts. When you click on the link the URL of the new page will be something like <http://[server]/Forecast/CurrentLineItems/xxx/2009/1> Now check the html code in the browser: If the URLs are in the form of '../../scripts/jquery-1.2.6.js', this will c...
491,705
<p>I've got a package set up like so:</p> <pre><code>packagename/ __init__.py numbers.py tools.py ...other stuff </code></pre> <p>Now inside <code>tools.py</code>, I'm trying to import the standard library module <code>fractions</code>. However, the <code>fractions</code> module itself imports the <co...
[ { "answer_id": 491813, "author": "SilentGhost", "author_id": 12855, "author_profile": "https://Stackoverflow.com/users/12855", "pm_score": 3, "selected": false, "text": "<p><a href=\"http://www.python.org/dev/peps/pep-0328/\" rel=\"noreferrer\">absolute and relative imports</a> can be us...
2009/01/29
[ "https://Stackoverflow.com/questions/491705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53850/" ]
I've got a package set up like so: ``` packagename/ __init__.py numbers.py tools.py ...other stuff ``` Now inside `tools.py`, I'm trying to import the standard library module `fractions`. However, the `fractions` module itself imports the `numbers` module, which is supposed to be the one in the stand...
[absolute and relative imports](http://www.python.org/dev/peps/pep-0328/) can be used since python2.5 (with `__future__` import) and seem to be what you're looking for.
491,707
<p>I have setup onclick event handler in the following manner:</p> <pre><code>element.onclick = function() { /*code */ } </code></pre> <p>Imagine there are event handlers setup using jQuery method bind() or similar handlers.</p> <pre><code>$('element').bind('click', function(){/*another function*/}) </code></pre> <...
[ { "answer_id": 491821, "author": "James", "author_id": 21677, "author_profile": "https://Stackoverflow.com/users/21677", "pm_score": 3, "selected": false, "text": "<p>I'm not 100% sure what you're asking but maybe this will help:</p>\n\n<p>You can create a new event object (compliant wit...
2009/01/29
[ "https://Stackoverflow.com/questions/491707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59692/" ]
I have setup onclick event handler in the following manner: ``` element.onclick = function() { /*code */ } ``` Imagine there are event handlers setup using jQuery method bind() or similar handlers. ``` $('element').bind('click', function(){/*another function*/}) ``` How can I prevent invoking handler defined with...
I'm not 100% sure what you're asking but maybe this will help: You can create a new event object (compliant with W3C DOM) via jQuery's exposed Event constructor: For example: ``` element.onclick = function(e) { var aBetterEventObject = jQuery.Event(e); // Now you can do what you want: (Cross-browser) aBe...
491,735
<p>I'm pretty sure that a Windows service gets C:\winnt (or similar) as its working directory when installed using InstallUtil.exe. Is there any way I can access, or otherwise capture (at install time), the directory from which the service was originally installed? At the moment I'm manually entering that into the ap...
[ { "answer_id": 491750, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": false, "text": "<p>Do you mean you want the directory containing the assembly? If so, that's easy: use <a href=\"http://msdn.microsoft.c...
2009/01/29
[ "https://Stackoverflow.com/questions/491735", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25462/" ]
I'm pretty sure that a Windows service gets C:\winnt (or similar) as its working directory when installed using InstallUtil.exe. Is there any way I can access, or otherwise capture (at install time), the directory from which the service was originally installed? At the moment I'm manually entering that into the app.exe...
You can use reflection to get the location of the executing assembly. Here's a simple routine that sets the working directory to the location of the executing assembly using reflection: ``` String path = System.Reflection.Assembly.GetExecutingAssembly().Location; path = System.IO.Path.GetDirectoryName(path); Directory...
491,739
<p>This question is inspired by <a href="https://stackoverflow.com/questions/491293/why-cant-i-set-the-background-color-of-a-selecfted-listboxitem-in-wpf">this recent question</a> and other situations I've encountered in my WPF development. How do I know whether it is enough to set a style on a control to override some...
[ { "answer_id": 492132, "author": "Ray Booysen", "author_id": 42124, "author_profile": "https://Stackoverflow.com/users/42124", "pm_score": 3, "selected": true, "text": "<p>Styles can be thought of very closely to CSS styles in HTML. If all you want to do is change the basic properties o...
2009/01/29
[ "https://Stackoverflow.com/questions/491739", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7583/" ]
This question is inspired by [this recent question](https://stackoverflow.com/questions/491293/why-cant-i-set-the-background-color-of-a-selecfted-listboxitem-in-wpf) and other situations I've encountered in my WPF development. How do I know whether it is enough to set a style on a control to override some default behav...
Styles can be thought of very closely to CSS styles in HTML. If all you want to do is change the basic properties of a control such as Background, Foreground or whatever properties it exposes then a Style is exactly what you need. Styles also allow you to apply triggers so for animations, a style is also sufficient. I...
491,773
<p>I need a workaround with this URL mapping in web.xml to create URLs with a letter, followed by a &quot;_&quot; followed by any combination of alphanumeric characters.</p> <p>I want to map a servlet to something like this:</p> <pre><code>/something_* </code></pre> <p>Instead of:</p> <pre><code>/something/* </code></p...
[ { "answer_id": 491829, "author": "Tom Hawtin - tackline", "author_id": 4725, "author_profile": "https://Stackoverflow.com/users/4725", "pm_score": 4, "selected": true, "text": "<p>Map a servlet to the containing directory. Inside that servlet, take apart the URL path and <a href=\"http:/...
2009/01/29
[ "https://Stackoverflow.com/questions/491773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1492/" ]
I need a workaround with this URL mapping in web.xml to create URLs with a letter, followed by a "\_" followed by any combination of alphanumeric characters. I want to map a servlet to something like this: ``` /something_* ``` Instead of: ``` /something/* ``` Using different "somethings" for different JSP's. Exa...
Map a servlet to the containing directory. Inside that servlet, take apart the URL path and [forward](http://download.oracle.com/javaee/6/api/javax/servlet/RequestDispatcher.html#forward%28javax.servlet.ServletRequest,%20javax.servlet.ServletResponse%29) to the appropriate [named servlet](http://download.oracle.com/jav...
491,777
<p>I have an HSQLDB database with a generated ID and I want the auto-incrementing values to always be above 100,000. Is this possible with HSQLDB? Is this possible with any database?</p>
[ { "answer_id": 491788, "author": "Mitch Wheat", "author_id": 16076, "author_profile": "https://Stackoverflow.com/users/16076", "pm_score": 2, "selected": false, "text": "<p>It is possible with SQL Server. When defining an auto number column you can define the starting number and the incr...
2009/01/29
[ "https://Stackoverflow.com/questions/491777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33863/" ]
I have an HSQLDB database with a generated ID and I want the auto-incrementing values to always be above 100,000. Is this possible with HSQLDB? Is this possible with any database?
According to the [HSQL Documentation](http://hsqldb.sourceforge.net/doc/guide/ch02.html): > > Since 1.7.2, the SQL standard syntax > is used by default, which allows the > initial value to be specified. The > supported form is( INTEGER > GENERATED BY DEFAULT AS IDENTITY(START > WITH n, [INCREMENT BY m])PRIMARY K...
491,780
<p>Using C# 3.5 I wanted to build up a predicate to send to a where clause piece by piece. I have created a very simple Console Application to illustrate the solution that I arrived at. This works perfectly. Absolutely perfectly. But I have NO idea how or why.</p> <pre><code> public static Func&lt;Tran, bool&gt;...
[ { "answer_id": 491806, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 0, "selected": false, "text": "<p>The += is syntactic sugar specifically implemented to support adding handlers to events. Since events are just a s...
2009/01/29
[ "https://Stackoverflow.com/questions/491780", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24108/" ]
Using C# 3.5 I wanted to build up a predicate to send to a where clause piece by piece. I have created a very simple Console Application to illustrate the solution that I arrived at. This works perfectly. Absolutely perfectly. But I have NO idea how or why. ``` public static Func<Tran, bool> GetPredicate() { ...
"delegate += method" is operator for multicast delegate to combine method to delegate. In the other hand "delegate -= method" is operator to remove method from delegate. It is useful for Action. ``` Action action = Method1; action += Method2; action += Method3; action -= Method2; action(); ``` In this case, only Met...
491,803
<p>I'm using the <a href="http://msdn.microsoft.com/en-us/library/aa730877(VS.80).aspx" rel="nofollow noreferrer">Custom Build Rules</a> feature in Visual Studio 2005, which allows to use macros such as <code>$(ConfigurationName)</code> in the XML .rules file.</p> <p>I need to pass only a subset of <code>$(Configurati...
[ { "answer_id": 492277, "author": "Kaarel", "author_id": 12547, "author_profile": "https://Stackoverflow.com/users/12547", "pm_score": 3, "selected": true, "text": "<p>Maybe look into <a href=\"http://www.iyouit.eu\" rel=\"nofollow noreferrer\">IYOUIT</a>. It is a</p>\n\n<blockquote>\n <...
2009/01/29
[ "https://Stackoverflow.com/questions/491803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm using the [Custom Build Rules](http://msdn.microsoft.com/en-us/library/aa730877(VS.80).aspx) feature in Visual Studio 2005, which allows to use macros such as `$(ConfigurationName)` in the XML .rules file. I need to pass only a subset of `$(ConfigurationName)` as a parameter to my command-line tool: If my target ...
Maybe look into [IYOUIT](http://www.iyouit.eu). It is a > > mobile application developed in > Python, and running on Nokia Series 60 > phones. > > > It uses OWL and reasoning. You can read the details in [this paper](https://www.iyouit.eu/portal/help/Introducing-IYOUIT.pdf).
491,809
<p>I was wondering, is there a best practice to write an OSX programm that copies or moves a file from one place to another? </p> <ul> <li>is there some NSSomething method I can call?</li> <li>Do I have to work with Input/Output streams?</li> <li>Or is the best way maybe to just rely on passing commands to the finder?...
[ { "answer_id": 491844, "author": "Marc Charbonneau", "author_id": 35136, "author_profile": "https://Stackoverflow.com/users/35136", "pm_score": 7, "selected": true, "text": "<p>NSFileManager and NSWorkspace both have methods to move, copy, and delete files. Usually you'd use NSFileManage...
2009/01/29
[ "https://Stackoverflow.com/questions/491809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54547/" ]
I was wondering, is there a best practice to write an OSX programm that copies or moves a file from one place to another? * is there some NSSomething method I can call? * Do I have to work with Input/Output streams? * Or is the best way maybe to just rely on passing commands to the finder? Bonus question: How do I g...
NSFileManager and NSWorkspace both have methods to move, copy, and delete files. Usually you'd use NSFileManager since its easier to work with: ``` if ( [[NSFileManager defaultManager] isReadableFileAtPath:source] ) [[NSFileManager defaultManager] copyItemAtURL:source toURL:destination error:nil]; ``` However, N...
491,812
<p>Trying to get a tab character into a <code>JMenuItem</code> using <code>\t</code> but it's not printing.</p> <p>I bet it's something really basic I'm missing. Here's the code</p> <pre><code>menuItem = new JMenuItem("New\tCtrl + N"); </code></pre> <p>Thanks</p>
[ { "answer_id": 491825, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 3, "selected": false, "text": "<p>You're not supposed to add keyboard shortcuts manually, there's an API for it, that puts them in the proper place. <a hr...
2009/01/29
[ "https://Stackoverflow.com/questions/491812", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Trying to get a tab character into a `JMenuItem` using `\t` but it's not printing. I bet it's something really basic I'm missing. Here's the code ``` menuItem = new JMenuItem("New\tCtrl + N"); ``` Thanks
Try this instead: ``` menuItem = new JMenuItem("New"); menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_N, ActionEvent.CTRL_MASK)); ``` You should also add mnemonics for usability: ``` menuItem.setMnemonic(KeyEvent.VK_N); ``` See the [Java Look and Feel Guidelines](http://java.sun.com/products/jlf/) for...
491,820
<p>I am trying to use an ajax 'POST' call through the jquery $.ajax function to send data to a php file. For some reason the callback is a success but the data is not getting to the php file. Here is an example of the code:</p> <pre><code> In JS file: $.ajax({ type: "POST", url: "setData.php", data: ...
[ { "answer_id": 491830, "author": "Ólafur Waage", "author_id": 22459, "author_profile": "https://Stackoverflow.com/users/22459", "pm_score": 2, "selected": true, "text": "<p>Try this and see if you get any info.</p>\n\n<pre><code>$.post(\"setData.php\", { myPOSTvar: \"myData\" },\n fun...
2009/01/29
[ "https://Stackoverflow.com/questions/491820", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to use an ajax 'POST' call through the jquery $.ajax function to send data to a php file. For some reason the callback is a success but the data is not getting to the php file. Here is an example of the code: ``` In JS file: $.ajax({ type: "POST", url: "setData.php", data: "myPOSTvar=myDat...
Try this and see if you get any info. ``` $.post("setData.php", { myPOSTvar: "myData" }, function(data){ alert("Data saved"); }); ```
491,828
<p>I try to put an event on document loading but not works... I'd put an alert box, but never seen it...</p> <pre><code>document.addEventListener ("load",initEventHandlers,false); function initEventHandlers () { document.getElementbyId ('croixzoom').addEventListener ('click',fermezoom,false); alert ("Hello, i\'m a ev...
[ { "answer_id": 491840, "author": "James", "author_id": 21677, "author_profile": "https://Stackoverflow.com/users/21677", "pm_score": 3, "selected": true, "text": "<p>The document does not have an onload / load event, try attaching it to 'window':</p>\n\n<pre><code>window.addEventListener...
2009/01/29
[ "https://Stackoverflow.com/questions/491828", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59382/" ]
I try to put an event on document loading but not works... I'd put an alert box, but never seen it... ``` document.addEventListener ("load",initEventHandlers,false); function initEventHandlers () { document.getElementbyId ('croixzoom').addEventListener ('click',fermezoom,false); alert ("Hello, i\'m a eventHAndlers") ...
The document does not have an onload / load event, try attaching it to 'window': ``` window.addEventListener ("load",initEventHandlers,false); ```
491,833
<p>I have a JSON String that I have converted into an object with:</p> <pre><code>data=eval("(" + jsonString + ")"); </code></pre> <p>I can access all the bits and display them with no issues. The question is how do i add to the object.</p> <p>For example:</p> <pre><code>data.car[0].name = "civic";&lt;BR&gt; data.c...
[ { "answer_id": 491841, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 0, "selected": false, "text": "<p>You should be able to use the syntax that you posted. Javascript lets you add properties to an object just by assignm...
2009/01/29
[ "https://Stackoverflow.com/questions/491833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51582/" ]
I have a JSON String that I have converted into an object with: ``` data=eval("(" + jsonString + ")"); ``` I can access all the bits and display them with no issues. The question is how do i add to the object. For example: ``` data.car[0].name = "civic";<BR> data.car[1].name = "s2000"; ``` So, if I have an input...
Using your example above, something like: ``` data.car[0] = { name: "civic" }; data.car[1] = { name: "s2000" }; ``` This will assign a new object to the array element, with one property 'name'. Alertnatively, for a bit more code re-use: ``` function car( name) { this.name = name } data.car[0] = new car("civic")...
491,837
<p>If I do the following in python,</p> <pre><code>string = raw_input('Enter the value') </code></pre> <p>it will return </p> <blockquote> <p>Enter the value</p> </blockquote> <p>and wait until I enter something into the prompt.</p> <p>Is there a way to retrieve/collect the input I entered in a variable <code>st...
[ { "answer_id": 491868, "author": "unwind", "author_id": 28169, "author_profile": "https://Stackoverflow.com/users/28169", "pm_score": 2, "selected": false, "text": "<p>This is very confusing ... I'm not familiar with a raw_string function in Python, but perhaps it's application-specific?...
2009/01/29
[ "https://Stackoverflow.com/questions/491837", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
If I do the following in python, ``` string = raw_input('Enter the value') ``` it will return > > Enter the value > > > and wait until I enter something into the prompt. Is there a way to retrieve/collect the input I entered in a variable `string`? I would like to use the entered value in the following way ...
there's no `raw_string` function in python's stdlib. do you mean raw\_input? ``` string = raw_input("Enter the value") # or just input in python3.0 print(string) ```
491,876
<p>I have an app that uses a local version of ODAC 11 below the directory that the .exe file is in. The idea is that we want our app to use the local ODAC 11 regardless of what else the user has installed on her machine.</p> <p>Oracle.DataAccess.dll is in the same directory as the .exe.</p> <p>It works fine when the...
[ { "answer_id": 501631, "author": "DCookie", "author_id": 8670, "author_profile": "https://Stackoverflow.com/users/8670", "pm_score": 0, "selected": false, "text": "<p>If you're using oracle client 10.2.0.1 or 10.2.0.2, Oracle Note 215255.1 indicates that if you apply patchset 10.2.0.3 it...
2009/01/29
[ "https://Stackoverflow.com/questions/491876", "https://Stackoverflow.com", "https://Stackoverflow.com/users/549/" ]
I have an app that uses a local version of ODAC 11 below the directory that the .exe file is in. The idea is that we want our app to use the local ODAC 11 regardless of what else the user has installed on her machine. Oracle.DataAccess.dll is in the same directory as the .exe. It works fine when the client machine ha...
So as I understand it, the issue was that while Oracle.DataAccess.dll was in the same directory as the app, it could not find its lower-level homies (oci, et al), hence the compatibility error. Turns out that if you want an application to work with ODAC 11 xcopy deployment regardless of what else the user may have ins...
491,890
<p>I need to edit a registry key and set the data value to "4"</p> <p>I know how to do it through the command prompt but am trying to find some Visual Basic code to do it.</p> <p>If it helps, this is the key:</p> <blockquote> <p>HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start</p> </blockquote>
[ { "answer_id": 491901, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 0, "selected": false, "text": "<p>You need to use the <a href=\"http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx\" rel=\"nofollow...
2009/01/29
[ "https://Stackoverflow.com/questions/491890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/60220/" ]
I need to edit a registry key and set the data value to "4" I know how to do it through the command prompt but am trying to find some Visual Basic code to do it. If it helps, this is the key: > > HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR\Start > > >
Here's how'd you do it in Visual Basic .NET ``` Dim key As RegistryKey = Registry.LocalMachine Dim subkey As RegistryKey subkey = key.OpenSubKey("SYSTEM\CurrentControlSet\Services\USBSTOR", True) subkey.SetValue("Start", 4) ``` You'll need to make sure to add ``` Imports System Imports Microsoft....
491,898
<p>I have a windows server which sends emails to me through a BASIC program. If the message body contains carriage returns/line feeds then the email never finishes. Only the first line is sent to me. I tried replacing them with \n but that didn't help as the email came to me with the \n in it. Any ideas?</p> <p>He...
[ { "answer_id": 491920, "author": "Patrick Cuff", "author_id": 7903, "author_profile": "https://Stackoverflow.com/users/7903", "pm_score": 2, "selected": false, "text": "<p>You can put the body in a text file and have blat send that:</p>\n\n<pre><code>blat [text file here] -to mike.roosa@...
2009/01/29
[ "https://Stackoverflow.com/questions/491898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9938/" ]
I have a windows server which sends emails to me through a BASIC program. If the message body contains carriage returns/line feeds then the email never finishes. Only the first line is sent to me. I tried replacing them with \n but that didn't help as the email came to me with the \n in it. Any ideas? Here is the comm...
If you want to do it all inline use the '|' character ``` -body 1st line|second line|third line ```
491,899
<p>I have an XmlDocument object in memory, here is a sample of the data:</p> <pre><code>&lt;terms&gt; &lt;letter name="F"&gt; &lt;term&gt; &lt;name&gt;fascículo&lt;/name&gt; &lt;translation language="en"&gt;fascicle&lt;/translation&gt; &lt;definition&gt;pequeño paquete de fibras nerviosas o musculares&lt;/defini...
[ { "answer_id": 491983, "author": "Robert MacLean", "author_id": 53236, "author_profile": "https://Stackoverflow.com/users/53236", "pm_score": 3, "selected": true, "text": "<p>The following will add the element for you</p>\n\n<p><code>xDoc.Descendants(\"term\").Single(t =&gt; t.Descendant...
2009/01/29
[ "https://Stackoverflow.com/questions/491899", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3193/" ]
I have an XmlDocument object in memory, here is a sample of the data: ``` <terms> <letter name="F"> <term> <name>fascículo</name> <translation language="en">fascicle</translation> <definition>pequeño paquete de fibras nerviosas o musculares</definition> </term> ``` (There are many terms in the actual document)...
The following will add the element for you `xDoc.Descendants("term").Single(t => t.Descendants("name").Single().Value == name).Add(new XElement("image", "hi there"));` The biggest issue I see which is making this clunky is the fact you need to switch back and forward between XmlDocument and XDocument. My recommendati...
491,906
<p>Let's say you have a table containing articles and you want want to display a list of them, excluding the actual article text. When you get a list of the article objects using LINQ or the Entity Framework, is there a LOT of overhead associated with getting that text column too? I assume that when you start enumera...
[ { "answer_id": 492053, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 1, "selected": false, "text": "<p>The overhead isn't huge (just the cost of sending the data over the wire), but if you don't need the data sure, don'...
2009/01/29
[ "https://Stackoverflow.com/questions/491906", "https://Stackoverflow.com", "https://Stackoverflow.com/users/57698/" ]
Let's say you have a table containing articles and you want want to display a list of them, excluding the actual article text. When you get a list of the article objects using LINQ or the Entity Framework, is there a LOT of overhead associated with getting that text column too? I assume that when you start enumerating ...
If you don't need the data you should definitely create a different type. By convention I typically name this sort of class "nnnInfo" or "nnnListItem". To create ArticleListItem, in L2S, simply drag the table to your DataContext designer a second time. Then rename it from 'Article1' to 'ArticleListItem' and remove the ...
491,914
<p>Where can I find reference code that implements a HTTP Basic Authentication client in pure JavaScript, suitable for AJAX?</p> <p>Extra points for code, or pointers to code, that can be used independent of JS toolkits like YUI. No points for Java, Flash/Flex, PHP frameworks, etc.</p>
[ { "answer_id": 491954, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 5, "selected": false, "text": "<p>There is a good article/tutorial written by <a href=\"http://www.peej.co.uk/\" rel=\"noreferrer\">Paul James</a>. I used...
2009/01/29
[ "https://Stackoverflow.com/questions/491914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52963/" ]
Where can I find reference code that implements a HTTP Basic Authentication client in pure JavaScript, suitable for AJAX? Extra points for code, or pointers to code, that can be used independent of JS toolkits like YUI. No points for Java, Flash/Flex, PHP frameworks, etc.
The five-parameter version of the `XMLHttpRequest.open` method allows you to specify the username and password. ([WHATWG spec](https://xhr.spec.whatwg.org/#the-open()-method)) ``` xhr.open(method, url, async, username, password) ```
491,921
<p>I'm having some brain failure in understanding reading and writing text to a file (Python 2.4).</p> <pre><code># The string, which has an a-acute in it. ss = u'Capit\xe1n' ss8 = ss.encode('utf8') repr(ss), repr(ss8) </code></pre> <blockquote> <p>("u'Capit\xe1n'", "'Capit\xc3\xa1n'")</p> </blockquote> <pre><code...
[ { "answer_id": 491956, "author": "ʞɔıu", "author_id": 41613, "author_profile": "https://Stackoverflow.com/users/41613", "pm_score": 2, "selected": false, "text": "<p>The \\x.. sequence is something that's specific to Python. It's not a universal byte escape sequence. </p>\n\n<p>How you a...
2009/01/29
[ "https://Stackoverflow.com/questions/491921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15842/" ]
I'm having some brain failure in understanding reading and writing text to a file (Python 2.4). ``` # The string, which has an a-acute in it. ss = u'Capit\xe1n' ss8 = ss.encode('utf8') repr(ss), repr(ss8) ``` > > ("u'Capit\xe1n'", "'Capit\xc3\xa1n'") > > > ``` print ss, ss8 print >> open('f1','w'), ss8 >>> fil...
In the notation `u'Capit\xe1n\n'` (should be just `'Capit\xe1n\n'` in 3.x, and *must* be in 3.0 and 3.1), the `\xe1` represents just one character. `\x` is an escape sequence, indicating that `e1` is in hexadecimal. Writing `Capit\xc3\xa1n` into the file in a text editor means that it actually contains `\xc3\xa1`. Tho...
491,927
<p>It is painful to fish out things from apache error_log. Does anybody have pointers to some better error collection mechanism. Something like what is described in "<a href="http://www.fogcreek.com/FogBugz/docs/30/UsingFogBugztoGetCrashRep.html" rel="nofollow noreferrer">Using FogBUGZ to Get Crash Reports From Users -...
[ { "answer_id": 505749, "author": "Martijn Heemels", "author_id": 35434, "author_profile": "https://Stackoverflow.com/users/35434", "pm_score": 0, "selected": false, "text": "<p>We're using Zend Platform on our servers. It's not free but works very well and does most of what you ask.</p>\...
2009/01/29
[ "https://Stackoverflow.com/questions/491927", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48557/" ]
It is painful to fish out things from apache error\_log. Does anybody have pointers to some better error collection mechanism. Something like what is described in "[Using FogBUGZ to Get Crash Reports From Users - Automatically!](http://www.fogcreek.com/FogBugz/docs/30/UsingFogBugztoGetCrashRep.html)", but for a PHP/apa...
You can specify your own custom PHP error handler. Here is a simple example: ``` function log_error_handler($errno, $str, $file, $line) { switch($errno) { case E_USER_ERROR: add_log("PHP Error", "Error $errno on line $line in $file: $str", "fatal"); exit(1); break; ...
491,929
<p>I have a component with two Pie Charts that display percentages at two specific dates (think start and end values). But, I have three views: Start Value only, End Value only, or show Both. I am using a ToggleButtonBar to control the display. What is the best practice for changing this kind of view state? Right now (...
[ { "answer_id": 492050, "author": "James Hay", "author_id": 47339, "author_profile": "https://Stackoverflow.com/users/47339", "pm_score": 1, "selected": false, "text": "<p>The simplest way to do this would be to use the ViewStack component. That way you just select the selectedIndex and a...
2009/01/29
[ "https://Stackoverflow.com/questions/491929", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31298/" ]
I have a component with two Pie Charts that display percentages at two specific dates (think start and end values). But, I have three views: Start Value only, End Value only, or show Both. I am using a ToggleButtonBar to control the display. What is the best practice for changing this kind of view state? Right now (sin...
Since the currentState property takes a String, which maps to the name property of a state, then it sounds like using `<mx:states>` would work well in your case. In fact I use states often for toggling between views in just the way you describe -- setting visible and includeInLayout properties of components (usually Ca...
491,971
<p>I got the idea for this question from numerous situations where I don't understand what the person is talking about and when others don't understand me.</p> <p>So, a "smart" solution would be to speak a computer language. :)</p> <p>I am interested how far a programming language can go to get near to (English) natu...
[ { "answer_id": 491984, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 5, "selected": false, "text": "<p>Depends on what circles you roll in, but <a href=\"http://lolcode.com/\" rel=\"noreferrer\">LOLCODE</a> could be cons...
2009/01/29
[ "https://Stackoverflow.com/questions/491971", "https://Stackoverflow.com", "https://Stackoverflow.com/users/59744/" ]
I got the idea for this question from numerous situations where I don't understand what the person is talking about and when others don't understand me. So, a "smart" solution would be to speak a computer language. :) I am interested how far a programming language can go to get near to (English) natural language. Whe...
There is a programming language called Inform that, in its most recent incarnation, Inform 7, looks a *lot* like natural language...in particular, written language. Inform is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms. ...
491,972
<p>C++ newbie question. Please, verify I'm doing it right.</p> <p>I have a global application class spawning it's little kids and I need to give the kids access to some of the application facilities. So I decided to pass them to children by reference.</p> <p>I tested the idea as show below. It seems to work fine. I j...
[ { "answer_id": 491984, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 5, "selected": false, "text": "<p>Depends on what circles you roll in, but <a href=\"http://lolcode.com/\" rel=\"noreferrer\">LOLCODE</a> could be cons...
2009/01/29
[ "https://Stackoverflow.com/questions/491972", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48461/" ]
C++ newbie question. Please, verify I'm doing it right. I have a global application class spawning it's little kids and I need to give the kids access to some of the application facilities. So I decided to pass them to children by reference. I tested the idea as show below. It seems to work fine. I just wanted to mak...
There is a programming language called Inform that, in its most recent incarnation, Inform 7, looks a *lot* like natural language...in particular, written language. Inform is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms. ...
491,973
<p>I can import a type library via tlibimp.exe, but when I open up the IDE, the libraries are not in the activex pallete. I can't seem to figure how to get it to install to a particular package either. In the IDE there is an install button in the Import Type Library dialog. How do I do this in the command line?</p> <...
[ { "answer_id": 491984, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 5, "selected": false, "text": "<p>Depends on what circles you roll in, but <a href=\"http://lolcode.com/\" rel=\"noreferrer\">LOLCODE</a> could be cons...
2009/01/29
[ "https://Stackoverflow.com/questions/491973", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54790/" ]
I can import a type library via tlibimp.exe, but when I open up the IDE, the libraries are not in the activex pallete. I can't seem to figure how to get it to install to a particular package either. In the IDE there is an install button in the Import Type Library dialog. How do I do this in the command line? When I lo...
There is a programming language called Inform that, in its most recent incarnation, Inform 7, looks a *lot* like natural language...in particular, written language. Inform is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms. ...
491,990
<p>Is it possible in hibernate to have an entity where some IDs are assigned and some are generated?</p> <p>For instance:</p> <p>Some objects have an ID between 1-10000 that are generated outside of the database; while some entities come in with no ID and need an ID generated by the database.</p>
[ { "answer_id": 491984, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 5, "selected": false, "text": "<p>Depends on what circles you roll in, but <a href=\"http://lolcode.com/\" rel=\"noreferrer\">LOLCODE</a> could be cons...
2009/01/29
[ "https://Stackoverflow.com/questions/491990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33863/" ]
Is it possible in hibernate to have an entity where some IDs are assigned and some are generated? For instance: Some objects have an ID between 1-10000 that are generated outside of the database; while some entities come in with no ID and need an ID generated by the database.
There is a programming language called Inform that, in its most recent incarnation, Inform 7, looks a *lot* like natural language...in particular, written language. Inform is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms. ...
491,994
<p>Suppose I have </p> <pre><code> template&lt; unsigned int num &gt; class SomeFunctionality { static unsigned int DoSomething() { //... } static void DoSomethingElse() { } }; typedef SomeFunctionality&lt;6&gt; SomeFunctionalityFor6; </code></pre> <p>Semantically, "SomeFu...
[ { "answer_id": 491984, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 5, "selected": false, "text": "<p>Depends on what circles you roll in, but <a href=\"http://lolcode.com/\" rel=\"noreferrer\">LOLCODE</a> could be cons...
2009/01/29
[ "https://Stackoverflow.com/questions/491994", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8123/" ]
Suppose I have ``` template< unsigned int num > class SomeFunctionality { static unsigned int DoSomething() { //... } static void DoSomethingElse() { } }; typedef SomeFunctionality<6> SomeFunctionalityFor6; ``` Semantically, "SomeFunctionalityFor6" is essentially a name...
There is a programming language called Inform that, in its most recent incarnation, Inform 7, looks a *lot* like natural language...in particular, written language. Inform is very specifically for creating text adventure games, but there is no inherent reason that the concepts couldn't be extended into other realms. ...
491,997
<p><strong><code>Leaks:</code></strong></p> <pre><code>None </code></pre> <p><strong><code>ObjectAlloc:</code></strong></p> <pre><code>Net Bytes: 4,332,512 # Net: 26,696 Overall Bytes: 103,769,552 # Overall: 738,987 </code></pre> <p><strong><code>Activity Monitor (MyApp):</code></strong></p> <pre><code># Thread: 6...
[ { "answer_id": 492029, "author": "zoul", "author_id": 17279, "author_profile": "https://Stackoverflow.com/users/17279", "pm_score": 3, "selected": true, "text": "<p>Memory usage as reported by Object Allocation is not very autoritative, at least according to my experience. The real deal ...
2009/01/29
[ "https://Stackoverflow.com/questions/491997", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
**`Leaks:`** ``` None ``` **`ObjectAlloc:`** ``` Net Bytes: 4,332,512 # Net: 26,696 Overall Bytes: 103,769,552 # Overall: 738,987 ``` **`Activity Monitor (MyApp):`** ``` # Thread: 6 Real Memory: 63.65 MB Virtual Memory: 209.45 MB ``` Memory monitor showed same readings as Activity Monitor. I don't know whether...
Memory usage as reported by Object Allocation is not very autoritative, at least according to my experience. The real deal is the real memory consumption as reported by Memory Monitor, see [my question on iPhone memory consumption](https://stackoverflow.com/questions/363493/understanding-the-memory-consumption-on-iphon...
492,005
<p>I am reading a list of assigned rights from an exchange mailbox, these values are returned via the AccessFlag property which returns 20001 in Hex, it looks like 2000 represents the READ permission and the 1 represents FULL permission.</p> <p>What I want to do is display that value as READ &amp; FULL permissions set...
[ { "answer_id": 492024, "author": "Bartek Tatkowski", "author_id": 60169, "author_profile": "https://Stackoverflow.com/users/60169", "pm_score": 0, "selected": false, "text": "<p>You could use the bitwise XOR operator to filter out the values you need and deduce the permission set from th...
2009/01/29
[ "https://Stackoverflow.com/questions/492005", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am reading a list of assigned rights from an exchange mailbox, these values are returned via the AccessFlag property which returns 20001 in Hex, it looks like 2000 represents the READ permission and the 1 represents FULL permission. What I want to do is display that value as READ & FULL permissions set.
If you want is as a string, you need an enum. So if you have something like this: ``` [Flags] enum Permissions { Read = 0x20000, Full = 0x00001 } ``` Then you can cast your return value and use ToString() ``` string val = ((Permissions )myValue).ToString(); ``` And it will come out something like this: ``` ...
492,014
<p>I'm writing a PHP5 extension, and while I could write it in C, it would be easier to use C++ and take advantage of the STL and Boost.</p> <p>Trouble is, the <a href="http://devzone.zend.com/node/view/id/1021" rel="noreferrer">tutorials</a> I've seen only deal with C, and I'm looking for a basic example which uses C...
[ { "answer_id": 492392, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 4, "selected": true, "text": "<p>After posting I came across <a href=\"http://php-baustelle.de/CodeGen_PECL/manual.html\" rel=\"noreferrer\">CodeGen_PEC...
2009/01/29
[ "https://Stackoverflow.com/questions/492014", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6521/" ]
I'm writing a PHP5 extension, and while I could write it in C, it would be easier to use C++ and take advantage of the STL and Boost. Trouble is, the [tutorials](http://devzone.zend.com/node/view/id/1021) I've seen only deal with C, and I'm looking for a basic example which uses C++ Here's what I've tried so far: ##...
After posting I came across [CodeGen\_PECL](http://php-baustelle.de/CodeGen_PECL/manual.html) which creates a skeleton extension from an XML based description of the extension. This includes a tag make it output C++ As well as making sure the header file used extern "C", the generated cpp file also ensured the ZEND\_G...
492,018
<p>Well... I have a web page that requires a digital certificate.</p> <p>When i first Load the page I get a dialogue window asking for the certificate. If I select it then everything work great :) However, if I press cancel and then re-enter the page I am not prompted for the certificate... The page is rendered and a ...
[ { "answer_id": 492392, "author": "Paul Dixon", "author_id": 6521, "author_profile": "https://Stackoverflow.com/users/6521", "pm_score": 4, "selected": true, "text": "<p>After posting I came across <a href=\"http://php-baustelle.de/CodeGen_PECL/manual.html\" rel=\"noreferrer\">CodeGen_PEC...
2009/01/29
[ "https://Stackoverflow.com/questions/492018", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32037/" ]
Well... I have a web page that requires a digital certificate. When i first Load the page I get a dialogue window asking for the certificate. If I select it then everything work great :) However, if I press cancel and then re-enter the page I am not prompted for the certificate... The page is rendered and a "The page ...
After posting I came across [CodeGen\_PECL](http://php-baustelle.de/CodeGen_PECL/manual.html) which creates a skeleton extension from an XML based description of the extension. This includes a tag make it output C++ As well as making sure the header file used extern "C", the generated cpp file also ensured the ZEND\_G...
492,020
<p>It sometimes want to block my thread while waiting for a event to occur.</p> <p>I usually do it something like this:</p> <pre><code>private AutoResetEvent _autoResetEvent = new AutoResetEvent(false); private void OnEvent(object sender, EventArgs e){ _autoResetEvent.Set(); } // ... button.Click += OnEvent; try{...
[ { "answer_id": 492047, "author": "Ricardo Villamil", "author_id": 19314, "author_profile": "https://Stackoverflow.com/users/19314", "pm_score": 2, "selected": false, "text": "<p>Don't pass the event, pass a delegate that matches the event handler signature. This actually sounds hacky to...
2009/01/29
[ "https://Stackoverflow.com/questions/492020", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5542/" ]
It sometimes want to block my thread while waiting for a event to occur. I usually do it something like this: ``` private AutoResetEvent _autoResetEvent = new AutoResetEvent(false); private void OnEvent(object sender, EventArgs e){ _autoResetEvent.Set(); } // ... button.Click += OnEvent; try{ _autoResetEvent.Wa...
I modified Dead.Rabit's class EventWaiter to handle `EventHandler<T>`. So you can use for waiting all events type of `EventHandler<T>`, that means your delegate is something like `delegate void SomeDelegate(object sender, T EventsArgs)`. ``` public class EventWaiter<T> { private AutoResetEvent _autoResetEvent = ...
492,042
<p>I'm having a little issue...I setup a rails application that is to serve a german website. To make use of Rails' internal pluralization features, I kept all my models in english (e.g. the model "<code>JobDescription</code>"). Now, if I call "<code>http://mysite.com/job_descriptions/</code>", I get all my <code>job_d...
[ { "answer_id": 492154, "author": "Scott Miller", "author_id": 43962, "author_profile": "https://Stackoverflow.com/users/43962", "pm_score": 0, "selected": false, "text": "<p>Rails only utilizes the </p>\n\n<pre><code>def to_params \nend\n</code></pre>\n\n<p>URL builder when you are using...
2009/01/29
[ "https://Stackoverflow.com/questions/492042", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29909/" ]
I'm having a little issue...I setup a rails application that is to serve a german website. To make use of Rails' internal pluralization features, I kept all my models in english (e.g. the model "`JobDescription`"). Now, if I call "`http://mysite.com/job_descriptions/`", I get all my `job_descriptions`....so far, so goo...
I think you're going to need to use the restful route helpers to get what you want. In that case, it wouldn't take much re-factoring (assuming you've mapped JobDescriptions as a resource). Leave your to\_param as is and change your JobDescriptions route to something like the following: ``` map.resources :job_descript...
492,060
<p>I need to extract tokens that are marked with curly brackets from a given string.</p> <p>I have tried using Expresso to construct something that will parse...</p> <pre><code>------------------------------------------------------------- "{Token1}asdasasd{Token2}asd asdacscadase dfb db {Token3}" --------------------...
[ { "answer_id": 492069, "author": "user7116", "author_id": 7116, "author_profile": "https://Stackoverflow.com/users/7116", "pm_score": 2, "selected": false, "text": "<p>Try:</p>\n\n<pre><code>\\{([^}]*)\\}\n</code></pre>\n\n<p>This will clamp the search inside of squiggly braces to stop o...
2009/01/29
[ "https://Stackoverflow.com/questions/492060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11356/" ]
I need to extract tokens that are marked with curly brackets from a given string. I have tried using Expresso to construct something that will parse... ``` ------------------------------------------------------------- "{Token1}asdasasd{Token2}asd asdacscadase dfb db {Token3}" -----------------------------------------...
Try ``` \{(.*?)\} ``` ``` The \{ will escape the "{" (which has meaning in a RegEx). The \} likewise escapes the closing } backet. The .*? will take minimal data, instead of just .* which is "greedy" and takes everything it can. ``` ``` If you have assurance that your tokens will (or need to) be of a specific ...
492,096
<p>Most projects have some sort of data that are essentially static between releases and well-suited for use as an enum, like statuses, transaction types, error codes, etc. For example's sake, I'll just use a common status enum:</p> <pre><code>public enum Status { ACTIVE(10, "Active"); EXPIRED(11, "Expired"); ...
[ { "answer_id": 492126, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 4, "selected": true, "text": "<p>We store enum values using some explicit string or character value in the database. Then to go from database value ba...
2009/01/29
[ "https://Stackoverflow.com/questions/492096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29995/" ]
Most projects have some sort of data that are essentially static between releases and well-suited for use as an enum, like statuses, transaction types, error codes, etc. For example's sake, I'll just use a common status enum: ``` public enum Status { ACTIVE(10, "Active"); EXPIRED(11, "Expired"); /* other s...
We store enum values using some explicit string or character value in the database. Then to go from database value back to enum we write a static method on the enum class to iterate and find the right one. If you expect a lot of enum values, you could create a static mapping `HashMap<String,MyEnum>` to translate quick...
492,106
<p>I have setup tab bar controller using interface builder, and each tab bar item is linked to a view controller (4 tabs, 4 view controllers). I want to know if Interface Builder uses an <code>-init</code> method to initialize the view controller because apparently this method does not get called:</p> <pre><code>- (id...
[ { "answer_id": 492279, "author": "Ryan Townshend", "author_id": 24707, "author_profile": "https://Stackoverflow.com/users/24707", "pm_score": 3, "selected": false, "text": "<p>Sounds like you want to implement <code>-(void) awakeFromNib</code>.</p>\n\n<p><a href=\"http://developer.apple....
2009/01/29
[ "https://Stackoverflow.com/questions/492106", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
I have setup tab bar controller using interface builder, and each tab bar item is linked to a view controller (4 tabs, 4 view controllers). I want to know if Interface Builder uses an `-init` method to initialize the view controller because apparently this method does not get called: ``` - (id)initWithNibName:(NSStrin...
Objects loaded from a `*.(nib|xib)` are inited with: ``` - (id)initWithCoder:(NSCoder *)inCoder; ``` So you could override that or if doing your setup after `-initWithCoder:` is called is not a problem you could use: ``` - (void)awakeFromNib; ``` from the NSNibAwaking protocol.
492,115
<p>Can you pass a standard c# enum as a parameter? </p> <p>For example:</p> <pre><code>enum e1 { //... } enum e2 { //... } public void test() { myFunc( e1 ); myFunc( e2 ); } public void myFunc( Enum e ) { // Iterate through all the values in e } </code></pre> <p>By doing this I hope to retriev...
[ { "answer_id": 492135, "author": "pezi_pink_squirrel", "author_id": 24757, "author_profile": "https://Stackoverflow.com/users/24757", "pm_score": 2, "selected": false, "text": "<p>Use the Enum.GetNames( typeof(e) ) method, this will return an array of strings with the names.</p>\n\n<p>Yo...
2009/01/29
[ "https://Stackoverflow.com/questions/492115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
Can you pass a standard c# enum as a parameter? For example: ``` enum e1 { //... } enum e2 { //... } public void test() { myFunc( e1 ); myFunc( e2 ); } public void myFunc( Enum e ) { // Iterate through all the values in e } ``` By doing this I hope to retrieve all the names within any given ...
This! ``` public void Foo(Enum e) { var names = Enum.GetNames(e.GetType()); foreach (var name in names) { // do something! } } ``` EDIT: My bad, you *did* say *iterate*. Note: I know I could just do the GetNames() call in my...