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
474,315
<p>Has anyone ever seen an issue with an ASP.NET websuite blows up on initial login, complaining about a system.string type in the profile that is defined in the web.config.</p> <p>More Info:</p> <pre><code>Server Error in '/abc' Application. ---------------------------------------------------------------------------...
[ { "answer_id": 474329, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 2, "selected": false, "text": "<p>I haven't seen that, but the docs say that System.String is the default, so try just removing the type part.</p>\n" ...
2009/01/23
[ "https://Stackoverflow.com/questions/474315", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56132/" ]
Has anyone ever seen an issue with an ASP.NET websuite blows up on initial login, complaining about a system.string type in the profile that is defined in the web.config. More Info: ``` Server Error in '/abc' Application. -------------------------------------------------------------------------------- Configuration ...
I haven't seen that, but the docs say that System.String is the default, so try just removing the type part.
474,316
<p>HashTables/HashMaps are one of the most (if not <em>the</em> most) useful of data-structures in existence. As such, one of the first things I investigated when starting to learn programming in Cocoa was how to create, populate, and read data from a hashtable.</p> <p>To my surprise: all the documentation I've been ...
[ { "answer_id": 474366, "author": "Martin Gordon", "author_id": 2481, "author_profile": "https://Stackoverflow.com/users/2481", "pm_score": 7, "selected": true, "text": "<p><a href=\"https://developer.apple.com/documentation/foundation/nsdictionary?language=objc\" rel=\"nofollow noreferre...
2009/01/23
[ "https://Stackoverflow.com/questions/474316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9931/" ]
HashTables/HashMaps are one of the most (if not *the* most) useful of data-structures in existence. As such, one of the first things I investigated when starting to learn programming in Cocoa was how to create, populate, and read data from a hashtable. To my surprise: all the documentation I've been reading on Cocoa/O...
[NSDictionary](https://developer.apple.com/documentation/foundation/nsdictionary?language=objc) and [NSMutableDictionary](https://developer.apple.com/documentation/foundation/nsmutabledictionary?language=objc)? And here's a simple example: ``` NSMutableDictionary *dictionary = [[NSMutableDictionary alloc] init]; [dic...
474,327
<p>I have a html.actionlink that i wish to display a link to a members profile page like this: <a href="http://somesite.com/members/" rel="nofollow noreferrer">http://somesite.com/members/</a>{username}</p> <p>When use the following markup</p> <pre><code>&lt;%= Html.ActionLink(r.MemberName, "profile", new { MemberNam...
[ { "answer_id": 474346, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 3, "selected": true, "text": "<p>Assuming in your routes the username token is {username} like you show, try this:</p>\n\n<pre><code>&lt;%= Html.Actio...
2009/01/23
[ "https://Stackoverflow.com/questions/474327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/55201/" ]
I have a html.actionlink that i wish to display a link to a members profile page like this: <http://somesite.com/members/>{username} When use the following markup ``` <%= Html.ActionLink(r.MemberName, "profile", new { MemberName = r.MemberName } )%> ``` I get a link that looks like this: <http://somesite.com/member...
Assuming in your routes the username token is {username} like you show, try this: ``` <%= Html.ActionLink(r.MemberName, "profile", new { username = r.MemberName } )%> ```
474,335
<p>I'm just beginning to use Regex so bear with my terminology. I have a regex pattern that is working properly on a string. The string could be in the format "text [pattern] text". Therefore, I also have a regex pattern that negates the first pattern. If I print out the results from each of the matches everything is s...
[ { "answer_id": 474376, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": -1, "selected": false, "text": "<p>Keep a counter before the loop starts, and add the amount of characters you inserted every time. IE:</p>\n\n<pre><code> ...
2009/01/23
[ "https://Stackoverflow.com/questions/474335", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29941/" ]
I'm just beginning to use Regex so bear with my terminology. I have a regex pattern that is working properly on a string. The string could be in the format "text [pattern] text". Therefore, I also have a regex pattern that negates the first pattern. If I print out the results from each of the matches everything is show...
It can be as simple as:- ``` string newString = Regex.Replace("abc", "b", "<td>${0}</td>"); ``` Results in `a<td>b</td>c`. In your case:- ``` Regex r = new Regex(negRegexPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline); text = r.Replace(text, "<td>${0}</td>"); ``` Will replace all occurance of negRe...
474,337
<p>I am just starting to learn ADF and I am tasked with examining how ADF's gantt chart works.</p> <p>I have completed Oracle's tutorial of it, however I feel that all the tutorial teaches is how to use the tutorial.</p> <p>Basically I am looking for a good tutorial to show how from an empty project:</p> <p>create a...
[ { "answer_id": 474376, "author": "BFree", "author_id": 15861, "author_profile": "https://Stackoverflow.com/users/15861", "pm_score": -1, "selected": false, "text": "<p>Keep a counter before the loop starts, and add the amount of characters you inserted every time. IE:</p>\n\n<pre><code> ...
2009/01/23
[ "https://Stackoverflow.com/questions/474337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58353/" ]
I am just starting to learn ADF and I am tasked with examining how ADF's gantt chart works. I have completed Oracle's tutorial of it, however I feel that all the tutorial teaches is how to use the tutorial. Basically I am looking for a good tutorial to show how from an empty project: create a collection of dummy dat...
It can be as simple as:- ``` string newString = Regex.Replace("abc", "b", "<td>${0}</td>"); ``` Results in `a<td>b</td>c`. In your case:- ``` Regex r = new Regex(negRegexPattern, RegexOptions.IgnoreCase | RegexOptions.Singleline); text = r.Replace(text, "<td>${0}</td>"); ``` Will replace all occurance of negRe...
474,367
<p>I did follow the article <a href="http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/truly-understanding-viewstate.aspx" rel="noreferrer">TRULLY Understanding ViewState</a> (great article btw) and populating my drop down list is working great. I've even setup a OnSelectedIndexChange event which fires almost a...
[ { "answer_id": 474408, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 3, "selected": false, "text": "<p>The problem is that you are loading the data each time and this is resetting the selected index. Imagine this is yo...
2009/01/23
[ "https://Stackoverflow.com/questions/474367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45194/" ]
I did follow the article [TRULLY Understanding ViewState](http://weblogs.asp.net/infinitiesloop/archive/2006/08/03/truly-understanding-viewstate.aspx) (great article btw) and populating my drop down list is working great. I've even setup a OnSelectedIndexChange event which fires almost as great. The problem I've foun...
My goal with disabling the ViewState on this drop down list is to minimize the size of the ViewState for the page. The problem I had with only doing the if(!Page.IsPostBack){...DataBind()...}, is that when you select an item for the first time, and the page reloads, my drop down list becomes empty. What I ended up d...
474,403
<p>I'm hitting a weird issue with <a href="http://en.wikipedia.org/wiki/MSBuild" rel="nofollow noreferrer">MSBuild</a>, and I'm thinking it might just be an environment issue. We're using MSBuild to build a number of separate solutions, and it seems to work on my machine. But on a couple of other machines, it's not wor...
[ { "answer_id": 474426, "author": "Andrew Hare", "author_id": 34211, "author_profile": "https://Stackoverflow.com/users/34211", "pm_score": 1, "selected": false, "text": "<p>Make sure that all your build scripts have this section:</p>\n\n<pre><code>&lt;ConfigurationToBuild Include=\"Debug...
2009/01/23
[ "https://Stackoverflow.com/questions/474403", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11460/" ]
I'm hitting a weird issue with [MSBuild](http://en.wikipedia.org/wiki/MSBuild), and I'm thinking it might just be an environment issue. We're using MSBuild to build a number of separate solutions, and it seems to work on my machine. But on a couple of other machines, it's not working. I've tracked down the issue, and ...
Make sure that all your build scripts have this section: ``` <ConfigurationToBuild Include="Debug|Any CPU"> <FlavorToBuild>Debug</FlavorToBuild> <PlatformToBuild>Any CPU</PlatformToBuild> </ConfigurationToBuild> ``` and that it is set to "Debug".
474,432
<p>Ok this is a general question about how to solve this issue, not to find some work around for the example given.</p> <p>Lets say I have a <code>$(this)</code> object and it is a <code>select</code>, if I want to select the selected option and I had an <code>id</code> I could just bust a</p> <p><code>$('#id option:...
[ { "answer_id": 474444, "author": "Crescent Fresh", "author_id": 45433, "author_profile": "https://Stackoverflow.com/users/45433", "pm_score": 4, "selected": true, "text": "<p>By using <a href=\"http://docs.jquery.com/Core/jQuery#expressioncontext\" rel=\"nofollow noreferrer\">the optiona...
2009/01/23
[ "https://Stackoverflow.com/questions/474432", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Ok this is a general question about how to solve this issue, not to find some work around for the example given. Lets say I have a `$(this)` object and it is a `select`, if I want to select the selected option and I had an `id` I could just bust a `$('#id option:selected')` game over. but with a `this` I can't go `...
By using [the optional context parameter](http://docs.jquery.com/Core/jQuery#expressioncontext): ``` $('option:selected', this) ```
474,451
<p>I have an array in the form of '<code>int[][]</code>' that represents the co-ordinates of a small grid. Each co-ordinate has been assigned its own value. eg <code>array[0][4] = 28</code>......</p> <p>I have two questions. Firstly, how do I iterate through all the stored values. Secondly, I want to be able to input ...
[ { "answer_id": 474470, "author": "user54579", "author_id": 54579, "author_profile": "https://Stackoverflow.com/users/54579", "pm_score": 2, "selected": false, "text": "<p>to iterate over the values use loops:</p>\n\n<pre><code> int[][] matrix \n //...\n for(int row[] : matrix)\n fo...
2009/01/23
[ "https://Stackoverflow.com/questions/474451", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58433/" ]
I have an array in the form of '`int[][]`' that represents the co-ordinates of a small grid. Each co-ordinate has been assigned its own value. eg `array[0][4] = 28`...... I have two questions. Firstly, how do I iterate through all the stored values. Secondly, I want to be able to input a value and have its specific co...
You can iterate with either for loops or enhanced for loops: ``` for (int row=0; row < grid.length; row++) { for (int col=0; col < grid[row].length; col++) { int value = grid[row][col]; // Do stuff } } ``` or ``` // Note the different use of "row" as a variable name! This // is the *whol...
474,461
<p>So I have some models set up that can each have a comment. I have it set up using has_many_polymorphs, but I'm starting to run into some issues where it's not working how I think it should.</p> <p>For example:</p> <pre><code>class Project &lt; ActiveRecord::Base end class Message &lt; ActiveRecord::Base has_man...
[ { "answer_id": 645567, "author": "vladr", "author_id": 66516, "author_profile": "https://Stackoverflow.com/users/66516", "pm_score": 1, "selected": false, "text": "<p>When you say \"so that the children get removed when the parent is deleted?\", can you give an example? I.e. when a proj...
2009/01/23
[ "https://Stackoverflow.com/questions/474461", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14758/" ]
So I have some models set up that can each have a comment. I have it set up using has\_many\_polymorphs, but I'm starting to run into some issues where it's not working how I think it should. For example: ``` class Project < ActiveRecord::Base end class Message < ActiveRecord::Base has_many_polymorphs :consumers, ...
When you say "so that the children get removed when the parent is deleted?", can you give an example? I.e. when a project is deleted I want all its messages to be deleted too? What happens when you delete a message, do you want anything else (e.g. all corresponding message\_consumer entries) to be deleted as well? ---...
474,466
<p>I have used several different scripts that people have suggested for trying to parse RSS including Magpie and the SimpleXML feature in PHP. But none seem to handle RSS 2.0 well because they will not give me back the full content chunk. Does anyone have a suggestion for reading a feed like the one found at <a href="h...
[ { "answer_id": 474677, "author": "gnud", "author_id": 27204, "author_profile": "https://Stackoverflow.com/users/27204", "pm_score": 3, "selected": true, "text": "<p>Without reading any documentation of the rss \"content\" namespace and how it is to be used, here is a working SimpleXML sc...
2009/01/23
[ "https://Stackoverflow.com/questions/474466", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58088/" ]
I have used several different scripts that people have suggested for trying to parse RSS including Magpie and the SimpleXML feature in PHP. But none seem to handle RSS 2.0 well because they will not give me back the full content chunk. Does anyone have a suggestion for reading a feed like the one found at <http://chach...
Without reading any documentation of the rss "content" namespace and how it is to be used, here is a working SimpleXML script. The trick is using the namespace when retreiving the content. ``` /* the namespace of rss "content" */ $content_ns = "http://purl.org/rss/1.0/modules/content/"; /* load the file */ $rss = fil...
474,479
<p>I've used GetDate() in defaults for a long time.<br> What is the equivalent call, or logic in SQL 2005 for me to put in a default that will give me the current UTC time.</p>
[ { "answer_id": 474488, "author": "Cade Roux", "author_id": 18255, "author_profile": "https://Stackoverflow.com/users/18255", "pm_score": 3, "selected": true, "text": "<pre><code>GETUTCDATE() \n</code></pre>\n" }, { "answer_id": 474490, "author": "cgreeno", "author_id": 60...
2009/01/23
[ "https://Stackoverflow.com/questions/474479", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1220/" ]
I've used GetDate() in defaults for a long time. What is the equivalent call, or logic in SQL 2005 for me to put in a default that will give me the current UTC time.
``` GETUTCDATE() ```
474,498
<p>I am trying to return the physical file path of a database's mdf/ldf files.</p> <p>I have tried using the following code:</p> <pre><code>Server srv = new Server(connection); Database database = new Database(srv, dbName); string filePath = database.PrimaryFilePath; </code></pre> <p>However this throws an exceptio...
[ { "answer_id": 474607, "author": "Noah", "author_id": 12113, "author_profile": "https://Stackoverflow.com/users/12113", "pm_score": 4, "selected": true, "text": "<p>Usually the problem is with the DefaultFile property being null. The default data file is where the data files are stored ...
2009/01/23
[ "https://Stackoverflow.com/questions/474498", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23585/" ]
I am trying to return the physical file path of a database's mdf/ldf files. I have tried using the following code: ``` Server srv = new Server(connection); Database database = new Database(srv, dbName); string filePath = database.PrimaryFilePath; ``` However this throws an exception "'database.PrimaryFilePath' thr...
Usually the problem is with the DefaultFile property being null. The default data file is where the data files are stored on the instance of SQL Server unless otherwise specified in the FileName property. If no other default location has been specified the property will return an empty string. So, this property brings...
474,526
<p>I've got one long GridView control on ma website. It allows row selection. The problem is, when I scroll down this GridView and select some of the bottom rows the selection occurs, but whole GridView is scrolling back to top. Does enyone know how to avoid this?</p>
[ { "answer_id": 474558, "author": "Wookai", "author_id": 56761, "author_profile": "https://Stackoverflow.com/users/56761", "pm_score": 2, "selected": false, "text": "<p>Is it reloading the whole page after selecting the rows ? If so, try to put the GridView in an UpdatePanel, so that the ...
2009/01/23
[ "https://Stackoverflow.com/questions/474526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3182/" ]
I've got one long GridView control on ma website. It allows row selection. The problem is, when I scroll down this GridView and select some of the bottom rows the selection occurs, but whole GridView is scrolling back to top. Does enyone know how to avoid this?
If it's happening during a postback, then in your <%@ Page %> directive you can add the following: ``` MaintainScrollPositionOnPostback="true" ``` This was added in .NET 2.0, and adds some JavaScript to the page to ensure that the page scrolls back down to the control that caused the postback. Works a treat.
474,528
<p>I want to repeatedly execute a function in Python every 60 seconds forever (just like an <a href="http://web.archive.org/web/20090823012700/http://developer.apple.com:80/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html" rel="noreferrer">NSTimer</a> in Objective C or setTimeout in...
[ { "answer_id": 474543, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 10, "selected": true, "text": "<p>If your program doesn't have a event loop already, use the <a href=\"http://docs.python.org/library/sched.html\" rel=\"n...
2009/01/23
[ "https://Stackoverflow.com/questions/474528", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2183/" ]
I want to repeatedly execute a function in Python every 60 seconds forever (just like an [NSTimer](http://web.archive.org/web/20090823012700/http://developer.apple.com:80/DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSTimer_Class/Reference/NSTimer.html) in Objective C or setTimeout in JS). This code will run as a d...
If your program doesn't have a event loop already, use the [sched](http://docs.python.org/library/sched.html) module, which implements a general purpose event scheduler. ``` import sched, time s = sched.scheduler(time.time, time.sleep) def do_something(sc): print("Doing stuff...") # do your stuff sc.enter...
474,535
<p>I'm trying to work with <a href="http://en.wikipedia.org/wiki/Fraction_%28mathematics%29#Vulgar.2C_proper.2C_and_improper_fractions" rel="noreferrer">fractions</a> in Java. </p> <p>I want to implement arithmetic functions. For this, I will first require a way to normalize the functions. I know I can't add 1/6 and...
[ { "answer_id": 474551, "author": "Tim Frey", "author_id": 1471, "author_profile": "https://Stackoverflow.com/users/1471", "pm_score": 3, "selected": false, "text": "<p>Well, for one, I'd get rid of the setters and make Fractions immutable.</p>\n\n<p>You'll probably also want methods to a...
2009/01/23
[ "https://Stackoverflow.com/questions/474535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43263/" ]
I'm trying to work with [fractions](http://en.wikipedia.org/wiki/Fraction_%28mathematics%29#Vulgar.2C_proper.2C_and_improper_fractions) in Java. I want to implement arithmetic functions. For this, I will first require a way to normalize the functions. I know I can't add 1/6 and 1/2 until I have a common denominator. ...
It just so happens that I wrote a BigFraction class not too long ago, for [Project Euler problems](http://projecteuler.net). It keeps a BigInteger numerator and denominator, so it'll never overflow. But it'll be a tad slow for a lot of operations that you know will never overflow.. anyway, use it if you want it. I've b...
474,564
<p>Since I can't use Microsoft as an example for best practice since their exception messages are stored in resource files out of necessity, I am forced to ask where should exception messages be stored.</p> <p>I figure it's probably one of common locations I thought of</p> <ul> <li>Default resource file</li> <li>Loca...
[ { "answer_id": 474582, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 0, "selected": false, "text": "<p>Out of necessity? It's to ease localization. To localize error messages in your applications, it's a great way.</p>\n" },...
2009/01/23
[ "https://Stackoverflow.com/questions/474564", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7756/" ]
Since I can't use Microsoft as an example for best practice since their exception messages are stored in resource files out of necessity, I am forced to ask where should exception messages be stored. I figure it's probably one of common locations I thought of * Default resource file * Local constant * Class constant ...
I may get shot (well, downvoted) for this, but why not "where you create the exception"? ``` throw new InvalidDataException("A wurble can't follow a flurble"); ``` Unless you're going to internationalize the exception messages ([which I suggest you don't](https://stackoverflow.com/questions/474450/should-exception-m...
474,584
<p>i have a series of rows that are generated using an <strong>asp:repeater</strong>:</p> <pre><code>&lt;asp:repeater ID="itemsRepeater" OnItemDataBound="itemsRepeater_ItemDataBound" runat="Server"&gt; &lt;itemtemplate&gt; &lt;tr&gt; &lt;td&gt; &lt;asp:HyperLink ID="linkView...
[ { "answer_id": 474687, "author": "OdeToCode", "author_id": 17210, "author_profile": "https://Stackoverflow.com/users/17210", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://docs.jquery.com/\" rel=\"nofollow noreferrer\">jQuery</a> can dig out the tags for you:</p>\n\n<pre...
2009/01/23
[ "https://Stackoverflow.com/questions/474584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
i have a series of rows that are generated using an **asp:repeater**: ``` <asp:repeater ID="itemsRepeater" OnItemDataBound="itemsRepeater_ItemDataBound" runat="Server"> <itemtemplate> <tr> <td> <asp:HyperLink ID="linkView" runat="server" Text="<%# GetItemText(...
The other answerers found various bits related to different aspects of the question. i managed to cobble together a complete solution. i've copy/pasted the relavent snippits here. The first important change is the use of an **asp:LinkButton** which allows as **OnClientClick** event, which gives you direct access to th...
474,591
<p>Dealing with SQL shows us some limitations and gives us an opportunity to imagine what could be. </p> <p>Which improvements to SQL are you waiting for? Which would you put on top of the wish list?</p> <p>I think it can be nice if you post in your answer the database your feature request lacks.</p>
[ { "answer_id": 474604, "author": "cletus", "author_id": 18393, "author_profile": "https://Stackoverflow.com/users/18393", "pm_score": 3, "selected": false, "text": "<p>A decent way of walking a tree with hierarchical data. Oracle has <a href=\"http://www.adp-gmbh.ch/ora/sql/connect_by.h...
2009/01/23
[ "https://Stackoverflow.com/questions/474591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40441/" ]
Dealing with SQL shows us some limitations and gives us an opportunity to imagine what could be. Which improvements to SQL are you waiting for? Which would you put on top of the wish list? I think it can be nice if you post in your answer the database your feature request lacks.
T-SQL Specific: A decent way to select from a result set returned by a stored procedure that doesn't involve putting it into a temporary table or using some obscure function. ``` SELECT * FROM EXEC [master].[dbo].[xp_readerrorlog] ```
474,609
<p>I'm trying to create a self-signed wildcard SSL certificate for use on a number of development and test servers running IIS 6. Following various guides has led to a couple ways of generating the certificates, but I haven't had any luck getting it to work. The most successful ways I've had were following <a href="h...
[ { "answer_id": 474629, "author": "Kevin Le - Khnle", "author_id": 1244013, "author_profile": "https://Stackoverflow.com/users/1244013", "pm_score": 0, "selected": false, "text": "<p>Did you realize that you would need to change from \"example.com\" to some thing more appropriate to your ...
2009/01/23
[ "https://Stackoverflow.com/questions/474609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8507/" ]
I'm trying to create a self-signed wildcard SSL certificate for use on a number of development and test servers running IIS 6. Following various guides has led to a couple ways of generating the certificates, but I haven't had any luck getting it to work. The most successful ways I've had were following [this OpenSSL g...
You can use the IIS 6 Resource Kit provided by MS, an command line app called SelfSSL. It can generate the SSL key and import it into your IIS installation. [IIS 6 Resource Kit](http://www.microsoft.com/downloads/details.aspx?FamilyId=56FC92EE-A71A-4C73-B628-ADE629C89499&displaylang=en)
474,613
<p>I was confused when I first started to see anti-singleton commentary. I have used the singleton pattern in some recent projects, and it was working out beautifully. So much so, in fact, that I have used it many, many times.</p> <p>Now, after running into some problems, reading <a href="https://stackoverflow.com/que...
[ { "answer_id": 474645, "author": "David Schmitt", "author_id": 4918, "author_profile": "https://Stackoverflow.com/users/4918", "pm_score": 2, "selected": false, "text": "<p>My way to avoid singletons derives from the idea that \"application global\" doesn't mean \"VM global\" (i.e. <code...
2009/01/23
[ "https://Stackoverflow.com/questions/474613", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33686/" ]
I was confused when I first started to see anti-singleton commentary. I have used the singleton pattern in some recent projects, and it was working out beautifully. So much so, in fact, that I have used it many, many times. Now, after running into some problems, reading [this](https://stackoverflow.com/questions/13797...
[Dependency Injection](http://en.wikipedia.org/wiki/Dependency_injection) is your friend. Take a look at these posts on the [excellent Google Testing Blog](http://googletesting.blogspot.com/): * [Singletons are pathologic liars](http://misko.hevery.com/2008/08/17/singletons-are-pathological-liars/) (but you probably ...
474,659
<p>I have the following configuration file for <a href="http://en.wikipedia.org/wiki/NHibernate" rel="noreferrer">NHibernate</a>:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"&gt; &lt;session-factory&gt; &lt;property name="connec...
[ { "answer_id": 475260, "author": "Matt Hinze", "author_id": 2676, "author_profile": "https://Stackoverflow.com/users/2676", "pm_score": 3, "selected": false, "text": "<p><code>show_sql</code> outputs to <code>Console.Out</code> - it's most useful when running integration tests</p>\n" }...
2009/01/23
[ "https://Stackoverflow.com/questions/474659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29244/" ]
I have the following configuration file for [NHibernate](http://en.wikipedia.org/wiki/NHibernate): ``` <?xml version="1.0" encoding="utf-8" ?> <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.connection_string">Server=.\SQLEXPRESS;Database=mydb;Integ...
To show the SQL in the output window of Visual Studio, configure log4net to use TraceAppender in your log4net config. This: ``` <appender name="DebugSQL" type="log4net.Appender.TraceAppender"> <layout type="log4net.Layout.PatternLayout"> <conversionPattern value="%date [%thread] %-5level %logger [%property...
474,667
<p>I'm following <a href="http://guides.rails.info/getting_started_with_rails.html" rel="nofollow noreferrer">this tutorial</a> (seems good) for Rails. After I run</p> <pre><code>ruby script/generate scaffold Post </code></pre> <p>then this link works in one of the erb files:</p> <pre><code>&lt;%= link_to "My Blog",...
[ { "answer_id": 474701, "author": "Otto", "author_id": 9594, "author_profile": "https://Stackoverflow.com/users/9594", "pm_score": 5, "selected": true, "text": "<p><code>posts_path</code> is a named route you get for free from the route that was added by <code>script/generate scaffold</co...
2009/01/23
[ "https://Stackoverflow.com/questions/474667", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8047/" ]
I'm following [this tutorial](http://guides.rails.info/getting_started_with_rails.html) (seems good) for Rails. After I run ``` ruby script/generate scaffold Post ``` then this link works in one of the erb files: ``` <%= link_to "My Blog", posts_path %> ``` **WHY?** I've looked for "posts\_path" in the whole app ...
`posts_path` is a named route you get for free from the route that was added by `script/generate scaffold`. See `routes.rb` you should see something like this: ``` map.resources :posts ``` See the [API docs for information on what other named routes you get](http://api.rubyonrails.org/classes/ActionController/Resour...
474,679
<p>I have a console application that contains quite a lot of threads. There are threads that monitor certain conditions and terminate the program if they are true. This termination can happen at any time.</p> <p>I need an event that can be triggered when the program is closing so that I can cleanup all of the other ...
[ { "answer_id": 474697, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 2, "selected": false, "text": "<p>There is for WinForms apps;</p>\n\n<pre><code>Application.ApplicationExit += CleanupBeforeExit;\n</code></pre>\n\n<p...
2009/01/23
[ "https://Stackoverflow.com/questions/474679", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58444/" ]
I have a console application that contains quite a lot of threads. There are threads that monitor certain conditions and terminate the program if they are true. This termination can happen at any time. I need an event that can be triggered when the program is closing so that I can cleanup all of the other threads and ...
I am not sure where I found the code on the web, but I found it now in one of my old projects. This will allow you to do cleanup code in your console, e.g. when it is abruptly closed or due to a shutdown... ``` [DllImport("Kernel32")] private static extern bool SetConsoleCtrlHandler(EventHandler handler, bool add); p...
474,698
<p>I'm trying to create system users with a php script securely, In that, I'd like to be able to hash the password with the php script, so that their password shows up nowhere in the bash history.</p> <p>How to I take a string, and hash it so it is a unix password hash?</p> <pre><code>$UX_PW = some_function('my_passw...
[ { "answer_id": 474717, "author": "falstro", "author_id": 46991, "author_profile": "https://Stackoverflow.com/users/46991", "pm_score": 2, "selected": false, "text": "<p>Depending on your system, you're either looking for <code>crypt()</code> or <code>md5()</code>.</p>\n\n<p>Traditionally...
2009/01/23
[ "https://Stackoverflow.com/questions/474698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/144/" ]
I'm trying to create system users with a php script securely, In that, I'd like to be able to hash the password with the php script, so that their password shows up nowhere in the bash history. How to I take a string, and hash it so it is a unix password hash? ``` $UX_PW = some_function('my_password'); exec("useradd ...
It's `crypt()` that implements the UNIX password hashing. <http://us.php.net/manual/en/function.crypt.php>
474,733
<p>In another question, the <a href="https://stackoverflow.com/questions/174531/easiest-way-to-get-files-contents-in-c#174552">accepted answer</a> shows a method for reading the contents of a file into memory.</p> <p>I have been trying to use this method to read in the content of a text file and then copy it to a new ...
[ { "answer_id": 474748, "author": "falstro", "author_id": 46991, "author_profile": "https://Stackoverflow.com/users/46991", "pm_score": 2, "selected": false, "text": "<p>You haven't allocated enough space for the terminating null character in your buffer (and you also forget to actually s...
2009/01/23
[ "https://Stackoverflow.com/questions/474733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35767/" ]
In another question, the [accepted answer](https://stackoverflow.com/questions/174531/easiest-way-to-get-files-contents-in-c#174552) shows a method for reading the contents of a file into memory. I have been trying to use this method to read in the content of a text file and then copy it to a new file. When I write th...
You may be happier with ``` int numBytesRead = 0; if(inputBuffer) { numBytesRead = fread (inputBuffer, 1, inputFileLength, inputFile); } fclose(inputFile); if(inputBuffer) { fwrite( inputBuffer, 1, numBytesRead, outputFile ); } ``` It doesn't need a null-terminated string (and therefore will work properly on ...
474,803
<p>I'm building what could be called the DAL for a new app. Unfortunately, network connectivity to the database is a real problem.</p> <p>I'd like to be able to temporarily block network access within the scope of my test so that I can ensure my DAL behaves as expected under those circumstances.</p> <p>UPDATE: There...
[ { "answer_id": 474821, "author": "Mostlyharmless", "author_id": 12881, "author_profile": "https://Stackoverflow.com/users/12881", "pm_score": 3, "selected": false, "text": "<p>Try blocking the connection with a firewall midway through the session maybe?</p>\n\n<p>I like the wrapper idea ...
2009/01/23
[ "https://Stackoverflow.com/questions/474803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
I'm building what could be called the DAL for a new app. Unfortunately, network connectivity to the database is a real problem. I'd like to be able to temporarily block network access within the scope of my test so that I can ensure my DAL behaves as expected under those circumstances. UPDATE: There are many manual w...
For the time being, I'm just "disabling" the network by setting a bogus static IP as follows: ``` using System.Management; class NetworkController { public static void Disable() { SetIP("192.168.0.4", "255.255.255.0"); } public static void Enable() { SetDHCP(); } private...
474,810
<p>I am looking to convert pixes to inches and vice versa. I understand that I need DPI, but I am not sure how to get this information (e.g. I don't have the <code>Graphics</code> object, so that's not an option).</p> <p>Is there a way?</p>
[ { "answer_id": 474830, "author": "falstro", "author_id": 46991, "author_profile": "https://Stackoverflow.com/users/46991", "pm_score": 3, "selected": false, "text": "<p>There's, physically, no real way without knowing the DPI. Pixels are discrete, inches are not, if you're talking inches...
2009/01/23
[ "https://Stackoverflow.com/questions/474810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9382/" ]
I am looking to convert pixes to inches and vice versa. I understand that I need DPI, but I am not sure how to get this information (e.g. I don't have the `Graphics` object, so that's not an option). Is there a way?
On a video device, any answer to this question is typically not very accurate. The easiest example to use to see why this is the case is a projector. The output resolution is, say, 1024x768, but the DPI varies by how far away the screen is from the projector apeture. WPF, for example, always assumes 96 DPI on a video d...
474,817
<p>If I have a table with a title column and 3 bit columns (f1, f2, f3) that contain either 1 or NULL, how would I write the LINQ to return the title with the count of each bit column that contains 1? I'm looking for the equivalent of this SQL query:</p> <pre><code>SELECT title, COUNT(f1), COUNT(f2), COUNT(f3) FROM my...
[ { "answer_id": 475169, "author": "Cameron MacFarland", "author_id": 3820, "author_profile": "https://Stackoverflow.com/users/3820", "pm_score": 2, "selected": false, "text": "<p>I think this is where LINQ falls down. If you want efficient use the SQL, if you want nice code, use LINQ.</p>...
2009/01/23
[ "https://Stackoverflow.com/questions/474817", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23935/" ]
If I have a table with a title column and 3 bit columns (f1, f2, f3) that contain either 1 or NULL, how would I write the LINQ to return the title with the count of each bit column that contains 1? I'm looking for the equivalent of this SQL query: ``` SELECT title, COUNT(f1), COUNT(f2), COUNT(f3) FROM myTable GROUP BY...
Here's the solution I came up with. Note that it's close to the solution proposed by @OdeToCode (but in VB syntax), with one major difference: ``` Dim temp = _ (From t In context.MyTable _ Group t.f1, t.f2, t.f3 By t.title Into g = Group _ Select title, g).ToList Dim results = _ From t In temp _ ...
474,835
<p>Using the STL's <code>priority_queue</code> I get the error "invalid heap" as soon as I try to use <code>pop()</code>. I can push my values into the queue, the <code>top()</code> of the queue is what I would expect and accessible. <code>pop()</code>, when it goes to re-heap, seems to have a problem.</p> <p>I am sto...
[ { "answer_id": 474858, "author": "fmsf", "author_id": 26004, "author_profile": "https://Stackoverflow.com/users/26004", "pm_score": 0, "selected": false, "text": "<p>Where are you calling this function from?</p>\n\n<p>My guess is that the invalid heap is a pointer that you're passing int...
2009/01/23
[ "https://Stackoverflow.com/questions/474835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58458/" ]
Using the STL's `priority_queue` I get the error "invalid heap" as soon as I try to use `pop()`. I can push my values into the queue, the `top()` of the queue is what I would expect and accessible. `pop()`, when it goes to re-heap, seems to have a problem. I am storing pointers to a templated class in the queue. I hav...
It's probably your comparison function. To test, replace it with a simple version that just compares pointers: ``` bool operator()(...) { return leftVertex<rightVertex; } ``` If the problem no longer occurs then the problem was your comparison function was invalid. Your comparator must define a ["strict-weak order...
474,841
<h2>Question</h2> <p>I am trying to dynamically get the default for a type that is specified in a ParameterInfo. _methods[methodName] returns a MethodInfo object.</p> <p>Unfortunately, the compiler doesn't like the &quot;paramType&quot; bit inside the default(paramType). I'm stumped.</p> <h2>Error</h2> <blockquote> <p>...
[ { "answer_id": 474845, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 1, "selected": false, "text": "<p>I think default only works with the an actual type. It's a complier shortcut not an actual method. It works well with gen...
2009/01/23
[ "https://Stackoverflow.com/questions/474841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/448/" ]
Question -------- I am trying to dynamically get the default for a type that is specified in a ParameterInfo. \_methods[methodName] returns a MethodInfo object. Unfortunately, the compiler doesn't like the "paramType" bit inside the default(paramType). I'm stumped. Error ----- > > The type or namespace name 'param...
It's quite simple to implement: ``` public object GetDefault(Type type) { return type.IsValueType ? Activator.CreateInstance(type) : null; } ```
474,842
<p>I am trying to build a Google Maps-driven web application that can display a map of the whole world in one or all of the following configurations:</p> <ul> <li>A continent-outline map, only differentiating between land and water (like <a href="http://maps.google.com/?ie=UTF8&amp;ll=-0.703107,-1.40625&amp;spn=151.85...
[ { "answer_id": 474845, "author": "Micah", "author_id": 17744, "author_profile": "https://Stackoverflow.com/users/17744", "pm_score": 1, "selected": false, "text": "<p>I think default only works with the an actual type. It's a complier shortcut not an actual method. It works well with gen...
2009/01/23
[ "https://Stackoverflow.com/questions/474842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9640/" ]
I am trying to build a Google Maps-driven web application that can display a map of the whole world in one or all of the following configurations: * A continent-outline map, only differentiating between land and water (like [this](http://maps.google.com/?ie=UTF8&ll=-0.703107,-1.40625&spn=151.859736,305.859375&z=2), bu...
It's quite simple to implement: ``` public object GetDefault(Type type) { return type.IsValueType ? Activator.CreateInstance(type) : null; } ```
474,843
<p>What would be the best way to structure a friend "function". <br> This is what im thinking: Lets say I have a usertable with the following columns: user_id, username, password... and a table by the name of friends with columns: friend1, friend2, accepted.</p> <p>If user2 adds user1 I want user2 to be shown on user1...
[ { "answer_id": 474869, "author": "Quassnoi", "author_id": 55159, "author_profile": "https://Stackoverflow.com/users/55159", "pm_score": 2, "selected": false, "text": "<pre><code>CREATE TABLE (friend_id_a, friend_id_b, accepted)\n</code></pre>\n\n<p>Define a constraint: <code>friend_id_a ...
2009/01/23
[ "https://Stackoverflow.com/questions/474843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
What would be the best way to structure a friend "function". This is what im thinking: Lets say I have a usertable with the following columns: user\_id, username, password... and a table by the name of friends with columns: friend1, friend2, accepted. If user2 adds user1 I want user2 to be shown on user1's profile...
``` CREATE TABLE (friend_id_a, friend_id_b, accepted) ``` Define a constraint: `friend_id_a < friend_id_b`. Populate the table with your entities as follows: ``` INSERT INTO friend_friend(friend_id_a, friend_id_b) VALUES (LEAST(@id1, @id2), GREATEST(@id1, @id2)) ``` To select all friends of a person: ``` SELECT ...
474,867
<p>Is there a tool to count the number of methods defined in a header? This seems like something that people would want to do from time to time, but I've never heard of such a utility. I could roll my own (and it'd be quite easy to come up with something that works for me in <em>this</em> particular case), but I though...
[ { "answer_id": 474880, "author": "fmsf", "author_id": 26004, "author_profile": "https://Stackoverflow.com/users/26004", "pm_score": 0, "selected": false, "text": "<p>I dunno if doxygen --> <a href=\"http://www.doxygen.nl/\" rel=\"nofollow noreferrer\">http://www.doxygen.nl/</a> does it, ...
2009/01/23
[ "https://Stackoverflow.com/questions/474867", "https://Stackoverflow.com", "https://Stackoverflow.com/users/53941/" ]
Is there a tool to count the number of methods defined in a header? This seems like something that people would want to do from time to time, but I've never heard of such a utility. I could roll my own (and it'd be quite easy to come up with something that works for me in *this* particular case), but I thought I'd try ...
Try this: ``` ctags --c++-kinds=f -x myfile.h ``` To list all functions in the file myfile.h . To count the number of functions in `deque.tcc`: ``` $ ctags --c++-kinds=f --language-force=c++ -x deque.tcc | wc -l 24 ```
474,901
<p>I'm looking for a good way to do a vertical wrap. My goal is to fit a list of checkboxes into a div. I have the checkboxes sorted alphabetically, and I want the list to flow from the top of the div to the bottom and then begin again in a new column when they reach the bottom. Right now, I can do this by breaking ...
[ { "answer_id": 474918, "author": "fmsf", "author_id": 26004, "author_profile": "https://Stackoverflow.com/users/26004", "pm_score": 0, "selected": false, "text": "<p>I'll get downvoted to hell for saying this, but ... use a <strong>table</strong>!</p>\n\n<p>Well it's not the prettiest wa...
2009/01/23
[ "https://Stackoverflow.com/questions/474901", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50272/" ]
I'm looking for a good way to do a vertical wrap. My goal is to fit a list of checkboxes into a div. I have the checkboxes sorted alphabetically, and I want the list to flow from the top of the div to the bottom and then begin again in a new column when they reach the bottom. Right now, I can do this by breaking the li...
I ended up using a little server-side preprocessing. This site, and this particular page, ended up needing a fair amount of preprocessing anyway, and I don't expect the size of the data to get too huge.
474,949
<p>I have a 64 bit number comprised of various bit fields and I'm writing a simple python utility to parse the number. The problem I'm facing is that the lower 32 bits comprise of one field and using some combination of bit shifts or bit masking doesn't give just the 32 bits. </p> <pre><code>big_num = 0xFFFFFFFFFFFF...
[ { "answer_id": 474963, "author": "Serafina Brocious", "author_id": 4977, "author_profile": "https://Stackoverflow.com/users/4977", "pm_score": 2, "selected": false, "text": "<p>You need to use long integers.</p>\n\n<pre><code>foo = 0xDEADBEEFCAFEBABEL\nfooLow = foo &amp; 0xFFFFFFFFL\n</c...
2009/01/23
[ "https://Stackoverflow.com/questions/474949", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a 64 bit number comprised of various bit fields and I'm writing a simple python utility to parse the number. The problem I'm facing is that the lower 32 bits comprise of one field and using some combination of bit shifts or bit masking doesn't give just the 32 bits. ``` big_num = 0xFFFFFFFFFFFFFFFF some_field ...
You need to use long integers. ``` foo = 0xDEADBEEFCAFEBABEL fooLow = foo & 0xFFFFFFFFL ```
474,967
<p>ADDED: This question is now, I believe, subsumed by this one: <a href="https://stackoverflow.com/questions/1075947/can-i-use-gnu-screen">Using GNU Screen completely transparently and automatically</a></p> <p>See also this related question:<br> <a href="https://superuser.com/questions/147873/ssh-sessions-in-xterms...
[ { "answer_id": 475011, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 7, "selected": true, "text": "<p>Does the <code>-t</code> option do what you want?</p>\n\n<pre>\n -t Force pseudo-tty allocation. This can be ...
2009/01/23
[ "https://Stackoverflow.com/questions/474967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4234/" ]
ADDED: This question is now, I believe, subsumed by this one: [Using GNU Screen completely transparently and automatically](https://stackoverflow.com/questions/1075947/can-i-use-gnu-screen) See also this related question: <https://superuser.com/questions/147873/ssh-sessions-in-xterms-freeze-for-many-minutes-whenev...
Does the `-t` option do what you want? ``` -t Force pseudo-tty allocation. This can be used to execute arbi- trary screen-based programs on a remote machine, which can be very useful, e.g. when implementing menu services. Multiple -t options force tty allocation, eve...
475,003
<p>Using LINQ to SQL</p> <pre><code>db.Products.Where(c =&gt; c.ID == 1).Skip(1).Take(1).ToList(); </code></pre> <p>executes</p> <pre><code>SELECT [t1].[ID], [t1].[CategoryID], [t1].[Name], [t1].[Price], [t1].[Descripti n], [t1].[IsFeatured], [t1].[IsActive] FROM ( SELECT ROW_NUMBER() OVER (ORDER BY [t0].[ID], [...
[ { "answer_id": 475183, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 0, "selected": false, "text": "<p>have you tried: </p>\n\n<pre><code>var cat = db.Categories.Where(c =&gt; c.ID == 1);\nvar prod = cat.Products.Where(c ...
2009/01/23
[ "https://Stackoverflow.com/questions/475003", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25416/" ]
Using LINQ to SQL ``` db.Products.Where(c => c.ID == 1).Skip(1).Take(1).ToList(); ``` executes ``` SELECT [t1].[ID], [t1].[CategoryID], [t1].[Name], [t1].[Price], [t1].[Descripti n], [t1].[IsFeatured], [t1].[IsActive] FROM ( SELECT ROW_NUMBER() OVER (ORDER BY [t0].[ID], [t0].[CategoryID], [t0].[Name , [t0].[Pri...
I think its because the category is in memory. You are asking it, implicitly, to get the products of the category. This implicit request for data is for filled, and then in memory (where the category is at this point) the query is executed. I'm thinking its equivalent to : ``` var cat = db.Categories.Where(c => c.ID ...
475,007
<p>I'm using the windowsxp. The version of 'cat' that I'm using comes bundled with the <a href="http://arduino.cc" rel="nofollow noreferrer">arduino</a> download.</p> <p>The makefile runs cat. </p> <p>Here is the output:</p> <pre><code>cat \arduino-0012\hardware\cores\arduino\main.cxx &gt;&gt; applet\foo.cpp cat: ar...
[ { "answer_id": 475019, "author": "Dave Costa", "author_id": 6568, "author_profile": "https://Stackoverflow.com/users/6568", "pm_score": 3, "selected": true, "text": "<p>I'm not familiar with the tools, but it looks like you might need to escape (double up) the backslashes in the makefile...
2009/01/23
[ "https://Stackoverflow.com/questions/475007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29505/" ]
I'm using the windowsxp. The version of 'cat' that I'm using comes bundled with the [arduino](http://arduino.cc) download. The makefile runs cat. Here is the output: ``` cat \arduino-0012\hardware\cores\arduino\main.cxx >> applet\foo.cpp cat: arduino-0012hardwarecoresarduinomain.cxx: No such file or directory make:...
I'm not familiar with the tools, but it looks like you might need to escape (double up) the backslashes in the makefile, as the error message shows the path without any backslashes. Alternatively, it may be expecting a Unix-style path which would have forward slashes instead. **New info**: It looks like there were tw...
475,012
<p>There is a directory in the standard ASP.NET template "<code>Content</code>" where most people seem to be putting in images and css files etc.</p> <p>For instance stackoverflow's logo:</p> <p><a href="https://i.stack.imgur.com/rMcPF.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/rMcPF.png" alt=...
[ { "answer_id": 475099, "author": "Andrew Stanton-Nurse", "author_id": 29813, "author_profile": "https://Stackoverflow.com/users/29813", "pm_score": 3, "selected": true, "text": "<p>To be honest, I don't think its really something to worry about... \"/Content\" is going to make a pretty m...
2009/01/23
[ "https://Stackoverflow.com/questions/475012", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16940/" ]
There is a directory in the standard ASP.NET template "`Content`" where most people seem to be putting in images and css files etc. For instance stackoverflow's logo: [![alt text](https://i.stack.imgur.com/rMcPF.png)](https://i.stack.imgur.com/rMcPF.png) (source: [stackoverflow.com](http://www.stackoverflow.com/Co...
To be honest, I don't think its really something to worry about... "/Content" is going to make a pretty minimal contribution to your page size. If you still want to do it, here are some options: Option 1, if you are running on your own server, is to check out the IIS URL Rewrite module: <http://learn.iis.net/page.aspx...
475,025
<p>I have troubles to debug a beanshell script all I get all the time is:</p> <p>Exception invoking imported object method. : at Line: 194 : in file: inline evaluation of: ``import java.lang.reflect.InvocationTargetException; import java.util.Arrays; i . . . '' : migrateModels ( models , apiManager , isSAPRetailImpo...
[ { "answer_id": 475029, "author": "cgreeno", "author_id": 6088, "author_profile": "https://Stackoverflow.com/users/6088", "pm_score": 2, "selected": false, "text": "<p>Yes. You need to Reverse GeoCode them with a tool/service. In the past I have used <a href=\"http://world.maporama.com/\"...
2009/01/23
[ "https://Stackoverflow.com/questions/475025", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52472/" ]
I have troubles to debug a beanshell script all I get all the time is: Exception invoking imported object method. : at Line: 194 : in file: inline evaluation of: ``import java.lang.reflect.InvocationTargetException; import java.util.Arrays; i . . . '' : migrateModels ( models , apiManager , isSAPRetailImportCondition ...
Yes. You need to Reverse GeoCode them with a tool/service. In the past I have used [Maporamas](http://world.maporama.com/) service but it was quite expensive and that was before Google maps and virtual earth existed so I am sure there is something cheaper(free) out there now.... Googling around I have found [this](http...
475,033
<p>What would be the best way to detect what programming language is used in a snippet of code?</p>
[ { "answer_id": 475038, "author": "Yes - that Jake.", "author_id": 5287, "author_profile": "https://Stackoverflow.com/users/5287", "pm_score": 2, "selected": false, "text": "<p>It would depend on what type of snippet you have, but I would run it through a series of tokenizers and see whic...
2009/01/23
[ "https://Stackoverflow.com/questions/475033", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58479/" ]
What would be the best way to detect what programming language is used in a snippet of code?
I think that the method used in spam filters would work very well. You split the snippet into words. Then you compare the occurences of these words with known snippets, and compute the probability that this snippet is written in language X for every language you're interested in. <http://en.wikipedia.org/wiki/Bayesian...
475,034
<p>I'm doing some work in Actionscript 2.0 for the first time in a while (really simple stuff, just pulling content from a text file), and I can not fathom for the life of me why I'm getting such unpredictable output here.</p> <p>Sometimes when I test build a simple script like this, variables are listed as undefined,...
[ { "answer_id": 475661, "author": "DavGarcia", "author_id": 40161, "author_profile": "https://Stackoverflow.com/users/40161", "pm_score": 1, "selected": false, "text": "<p>You are likely having <a href=\"http://timotheegroleau.com/Flash/articles/scope_chain.htm\" rel=\"nofollow noreferrer...
2009/01/23
[ "https://Stackoverflow.com/questions/475034", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15479/" ]
I'm doing some work in Actionscript 2.0 for the first time in a while (really simple stuff, just pulling content from a text file), and I can not fathom for the life of me why I'm getting such unpredictable output here. Sometimes when I test build a simple script like this, variables are listed as undefined, and somet...
Thanks for the help guys - I didn't click before that LoadVars() was an asynchronous function, and that the rest of the script would continue without checking if it was loaded. I managed to fix this by checking it loadVar has completed on each frame, then executing the code after the loadVar was completed. I had com...
475,043
<p>Say I have this column returned in a command for Crystal:</p> <pre><code>deposit_no 123 130 125 124 126 127 128 129 </code></pre> <p>and I need to have this in the report title:</p> <blockquote> <p>Includes deposits between 123 - 130</p> </blockquote> <p>I've tried a running formula for minimum and maximum and...
[ { "answer_id": 475387, "author": "SqlACID", "author_id": 19797, "author_profile": "https://Stackoverflow.com/users/19797", "pm_score": 0, "selected": false, "text": "<p>Create a formula field using summary functions for minimum and maximum of the deposit_no field, then drag the formula f...
2009/01/23
[ "https://Stackoverflow.com/questions/475043", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38317/" ]
Say I have this column returned in a command for Crystal: ``` deposit_no 123 130 125 124 126 127 128 129 ``` and I need to have this in the report title: > > Includes deposits between 123 - 130 > > > I've tried a running formula for minimum and maximum and they aren't returning the correct values no matter how...
create a stored procedure or view that has the information you want. access the stored procedure or view through crystal reports. crystal reports is a hindrance to properly coding anything. the unexpected result you are getting may be because the column is not numeric. often, number values are stored as varchar/nvarc...
475,074
<p>Is it possible to use a RegEx to validate, or sanitize Base64 data? That's the simple question, but the factors that drive this question are what make it difficult.<p></p> <p>I have a Base64 decoder that can not fully rely on the input data to follow the RFC specs. So, the issues I face are issues like perhaps Bas...
[ { "answer_id": 475217, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 8, "selected": true, "text": "<p>From the <a href=\"http://www.ietf.org/rfc/rfc4648.txt\" rel=\"noreferrer\">RFC 4648</a>:</p>\n\n<blockquote>\n <p>Base e...
2009/01/23
[ "https://Stackoverflow.com/questions/475074", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18518/" ]
Is it possible to use a RegEx to validate, or sanitize Base64 data? That's the simple question, but the factors that drive this question are what make it difficult. I have a Base64 decoder that can not fully rely on the input data to follow the RFC specs. So, the issues I face are issues like perhaps Base64 data that m...
From the [RFC 4648](http://www.ietf.org/rfc/rfc4648.txt): > > Base encoding of data is used in many situations to store or transfer data in environments that, perhaps for legacy reasons, are restricted to US-ASCII data. > > > So it depends on the purpose of usage of the encoded data if the data should be consider...
475,076
<p><b>UPDATE 3:</b><br /> I created a Visual Studio 2008 test project and tried to create a service reference to shared site WCF service reference and received the following error:</p> <blockquote> <p>There was an error downloading '<a href="http://apps.mydomain/MyService.svc" rel="nofollow noreferrer">http://apps...
[ { "answer_id": 485731, "author": "Nick", "author_id": 51859, "author_profile": "https://Stackoverflow.com/users/51859", "pm_score": 1, "selected": false, "text": "<p>I've had an issue before with WCF and load balancing where the servers had multiple Network cards with different IP addres...
2009/01/23
[ "https://Stackoverflow.com/questions/475076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
**UPDATE 3:** I created a Visual Studio 2008 test project and tried to create a service reference to shared site WCF service reference and received the following error: > > There was an error downloading > '<http://apps.mydomain/MyService.svc>'. > The request failed with HTTP status > 400: Bad Request. Metadata...
After some experimenting with different configurations for my WCF service and consuming application. I created a service reference to one of the working service references (<http://apps1.mydomain> or <http://apps2.mydomain>) in the consuming application. Then I changed the endpoint reference in the client configuration...
475,150
<p>I'm trying to define a 1:1 association between two entities (one maps to a table and the other to a view - using DefinedQuery) in an Entity Framework model. When trying to define the mapping for this in the designer, it makes me choose the (1) table or view to map the association to. What am I supposed to choose? I...
[ { "answer_id": 476269, "author": "driAn", "author_id": 50430, "author_profile": "https://Stackoverflow.com/users/50430", "pm_score": 3, "selected": false, "text": "<p>You have to select the table, that cotains the foreign key. The next step is to remove that foreign key from the entity, ...
2009/01/24
[ "https://Stackoverflow.com/questions/475150", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13534/" ]
I'm trying to define a 1:1 association between two entities (one maps to a table and the other to a view - using DefinedQuery) in an Entity Framework model. When trying to define the mapping for this in the designer, it makes me choose the (1) table or view to map the association to. What am I supposed to choose? I ca...
You have to select the table, that cotains the foreign key. The next step is to remove that foreign key from the entity, as it is already expressed using the relation you just created. Example: ``` table A ------- A_ID int B_ID int table B ------- B_ID int ``` In this case, you would select the table A in the desi...
475,159
<p>I'm trying to strip all punctuation out of a string using a simple regular expression and the php preg_replace function, although I get the following error: </p> <blockquote> <p>Compilation failed: POSIX named classes are supported only within a class at offset 0 </p> </blockquote> <p>I guess this means I can'...
[ { "answer_id": 475170, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 7, "selected": true, "text": "<p>The <a href=\"http://docs.php.net/manual/en/ref.pcre.php\" rel=\"noreferrer\"><code>preg_*</code> functions</a> expect <a ...
2009/01/24
[ "https://Stackoverflow.com/questions/475159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to strip all punctuation out of a string using a simple regular expression and the php preg\_replace function, although I get the following error: > > Compilation failed: POSIX named classes are supported only within a class at offset 0 > > > I guess this means I can't use POSIX named classes outside...
The [`preg_*` functions](http://docs.php.net/manual/en/ref.pcre.php) expect [Perl compatible regular expressions](http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions) with delimiters. So try this: ``` preg_replace('/[[:punct:]]/', ' ', $string) ```
475,178
<p>This is for MySQL and PHP</p> <p>I have a table that contains the following columns:</p> <pre><code>navigation_id (unsigned int primary key) navigation_category (unsigned int) navigation_path (varchar (256)) navigation_is_active (bool) navigation_store_id (unsigned int index) </code></pre> <p>Data will be filled ...
[ { "answer_id": 475170, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 7, "selected": true, "text": "<p>The <a href=\"http://docs.php.net/manual/en/ref.pcre.php\" rel=\"noreferrer\"><code>preg_*</code> functions</a> expect <a ...
2009/01/24
[ "https://Stackoverflow.com/questions/475178", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This is for MySQL and PHP I have a table that contains the following columns: ``` navigation_id (unsigned int primary key) navigation_category (unsigned int) navigation_path (varchar (256)) navigation_is_active (bool) navigation_store_id (unsigned int index) ``` Data will be filled like: ``` 1, 32, "4/32/", 1, 32 ...
The [`preg_*` functions](http://docs.php.net/manual/en/ref.pcre.php) expect [Perl compatible regular expressions](http://en.wikipedia.org/wiki/Perl_Compatible_Regular_Expressions) with delimiters. So try this: ``` preg_replace('/[[:punct:]]/', ' ', $string) ```
475,189
<p>I'm using the [System.Web.Script.Services.ScriptService] tag to use web services callable from client side javascript. What I need is a way of globally logging any unhandled exceptions in those methods. On the client side, I get the error callback and can proceed from there, but I need a server-side catch to log t...
[ { "answer_id": 475823, "author": "John", "author_id": 33, "author_profile": "https://Stackoverflow.com/users/33", "pm_score": -1, "selected": false, "text": "<p>In ASP.Net it is possible to catch all run handled exceptions using a <a href=\"http://msdn.microsoft.com/en-us/library/ms99837...
2009/01/24
[ "https://Stackoverflow.com/questions/475189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/945/" ]
I'm using the [System.Web.Script.Services.ScriptService] tag to use web services callable from client side javascript. What I need is a way of globally logging any unhandled exceptions in those methods. On the client side, I get the error callback and can proceed from there, but I need a server-side catch to log the ex...
You can use an HTTP module to capture the exception message, stack trace and exception type that is thrown by the web service method. First some background... * If a web service method throws an exception the HTTP response has a status code of 500. * If custom errors are off then the web service will return the excep...
475,236
<p>the directory structure I'm trying to achieve would be this:</p> <pre><code>application/default/views/layouts/layout.phtml application/default/views/scripts/index/index.phtml application/admin/views/layouts/layout.phtml application/admin/views/scripts/index/index.phtml library/Zend config/config.ini public/index.php...
[ { "answer_id": 476259, "author": "Kenzal Hunter", "author_id": 1120343, "author_profile": "https://Stackoverflow.com/users/1120343", "pm_score": 3, "selected": true, "text": "<p>You should check out <a href=\"http://dustint.com/archives/28\" rel=\"nofollow noreferrer\">Per Module Zend_La...
2009/01/24
[ "https://Stackoverflow.com/questions/475236", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48523/" ]
the directory structure I'm trying to achieve would be this: ``` application/default/views/layouts/layout.phtml application/default/views/scripts/index/index.phtml application/admin/views/layouts/layout.phtml application/admin/views/scripts/index/index.phtml library/Zend config/config.ini public/index.php (bootstrap) ...
You should check out [Per Module Zend\_Layout](http://dustint.com/archives/28), in this article, the author covers exactly what you are trying to achieve. His methodology is to write a plugin for the front controller that handles layout registration.
475,265
<p>I have the following line:</p> <pre><code>$this-&gt;magicQuotes = (bool) get_magic_quotes_gpc(); </code></pre> <p>I am taking the <code>get_magic_quotes_gpc()</code> storing it in my object as it's used many times as I generate the SQL. I am also converting it to a bool.</p> <p>I'm wondering if it's worth while c...
[ { "answer_id": 475273, "author": "Paige Ruten", "author_id": 813, "author_profile": "https://Stackoverflow.com/users/813", "pm_score": 2, "selected": false, "text": "<p>If you don't convert to <code>bool</code>, PHP will have to convert to <code>bool</code> anyways when evaluating the ex...
2009/01/24
[ "https://Stackoverflow.com/questions/475265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
I have the following line: ``` $this->magicQuotes = (bool) get_magic_quotes_gpc(); ``` I am taking the `get_magic_quotes_gpc()` storing it in my object as it's used many times as I generate the SQL. I am also converting it to a bool. I'm wondering if it's worth while converting it to bool. The main reason I am is f...
If you don't convert to `bool`, PHP will have to convert to `bool` anyways when evaluating the expression in the if statement. So whether you convert it explicitly or not, it will get converted to `bool` at one time or another, and I'd prefer the way that lets you type less. Also, with this kind of tiny optimization, ...
475,278
<p>Is there a better way to do this? </p> <p>I have an HTML helper extension method that checks if the current tab menu is the the selected one and then chooses .selected css class or not. I put the html.IsSelected link in each li as </p> <pre><code>&lt;li class="&lt;%=Html.IsSelected(string a, string b)%&gt;" &gt; ...
[ { "answer_id": 475326, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 3, "selected": true, "text": "<p>If you can live with a javascript solution, look at how the <a href=\"http://api.jqueryui.com/accordion/\" rel=\"nofo...
2009/01/24
[ "https://Stackoverflow.com/questions/475278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49632/" ]
Is there a better way to do this? I have an HTML helper extension method that checks if the current tab menu is the the selected one and then chooses .selected css class or not. I put the html.IsSelected link in each li as ``` <li class="<%=Html.IsSelected(string a, string b)%>" > ``` where a is the tab name and ...
If you can live with a javascript solution, look at how the [jQuery UI Accordion](http://api.jqueryui.com/accordion/) plugin handles this. Essentially, you can choose the highlighted tab based on the controller by examining the request url when the page is loaded. Alternatively, you can set a ViewBag item for each tab...
475,283
<p>and I would like to know if there is any way to stop a program when is using a function from a certain file. Ideally what I am looking for is something like:</p> <pre><code>GDB Stop when use a function from file foo.cpp </code></pre> <p>The reason to do this is because I am debugging a code that is not mine and I ...
[ { "answer_id": 475294, "author": "Calyth", "author_id": 45144, "author_profile": "https://Stackoverflow.com/users/45144", "pm_score": 0, "selected": false, "text": "<p>gdb breakpoints have a couple of syntax... <a href=\"http://theory.uwinnipeg.ca/localfiles/infofiles/gdb/gdb_29.html#SEC...
2009/01/24
[ "https://Stackoverflow.com/questions/475283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39160/" ]
and I would like to know if there is any way to stop a program when is using a function from a certain file. Ideally what I am looking for is something like: ``` GDB Stop when use a function from file foo.cpp ``` The reason to do this is because I am debugging a code that is not mine and I do not know exactly what f...
Step 1: construct a list of all functions defined in `foo.cpp` The simplest way I can think of (assuming you have `binutils` and GNU `grep`): ``` nm a.out | grep ' T ' | addr2line -fe a.out | grep -B1 'foo\.cpp' | grep -v 'foo\.cpp' > funclist ``` Step 2: construct a GDB script which will set a break point on ...
475,293
<p>I have a huge bunch of XML files with the following structure:</p> <pre><code>&lt;Stuff1&gt; &lt;Content&gt;someContent&lt;/name&gt; &lt;type&gt;someType&lt;/type&gt; &lt;/Stuff1&gt; &lt;Stuff2&gt; &lt;Content&gt;someContent&lt;/name&gt; &lt;type&gt;someType&lt;/type&gt; &lt;/Stuff2&gt; &lt;Stuff3&gt; &lt...
[ { "answer_id": 475313, "author": "FlySwat", "author_id": 1965, "author_profile": "https://Stackoverflow.com/users/1965", "pm_score": -1, "selected": true, "text": "<p>The XML you have provided shows that someone completely misses the point of XML.</p>\n\n<p>Instead of having</p>\n\n<pre>...
2009/01/24
[ "https://Stackoverflow.com/questions/475293", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19731/" ]
I have a huge bunch of XML files with the following structure: ``` <Stuff1> <Content>someContent</name> <type>someType</type> </Stuff1> <Stuff2> <Content>someContent</name> <type>someType</type> </Stuff2> <Stuff3> <Content>someContent</name> <type>someType</type> </Stuff3> ... ... ``` I need to change th...
The XML you have provided shows that someone completely misses the point of XML. Instead of having ``` <stuff1> <content/> </stuff1> ``` You should have:/ ``` <stuff id="1"> <content/> </stuff> ``` Now you would be able to traverse the document using Xpath (ie, //stuff[id='1']/content/) The names of nodes...
475,348
<p>I'm writing my first Maven Mojo, in it I'm wanting to take a file set and process all the files it refers to.</p> <p>In pseudo code what I'd like to do...</p> <pre><code>void myCode(org.apache.maven.model.FileSet fileSet) { List&lt;java.io.File&gt; files = FileSetTransformer.toFileList(fileSet); for (File ...
[ { "answer_id": 476416, "author": "emeraldjava", "author_id": 55794, "author_profile": "https://Stackoverflow.com/users/55794", "pm_score": 3, "selected": true, "text": "<p>See the javadoc for Maven <a href=\"http://maven.apache.org/ref/current/maven-model/apidocs/org/apache/maven/model/F...
2009/01/24
[ "https://Stackoverflow.com/questions/475348", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8969/" ]
I'm writing my first Maven Mojo, in it I'm wanting to take a file set and process all the files it refers to. In pseudo code what I'd like to do... ``` void myCode(org.apache.maven.model.FileSet fileSet) { List<java.io.File> files = FileSetTransformer.toFileList(fileSet); for (File f : files) { doSome...
See the javadoc for Maven [FileSet](http://maven.apache.org/ref/current/maven-model/apidocs/org/apache/maven/model/FileSet.html) and use the getDirectory() and getIncludes() methods. This is an example of an [existing maven mojo](http://code.google.com/p/birt-maven-plugin/source/browse/trunk/birt-maven-plugin/src/main/...
475,355
<p>The below is an involved problem, I've done a great amount of research, but have been unable to solve it thus far. I'm happy to find either a solution or a workaround. Although the framework is old (1.0) I am not at this stage able to upgrade to 1.1 or later (the client isn't willing to pay for the conversion at pre...
[ { "answer_id": 475442, "author": "Jayden", "author_id": 44873, "author_profile": "https://Stackoverflow.com/users/44873", "pm_score": 2, "selected": false, "text": "<p><strong>Workaround :</strong></p>\n\n<p>I've found a workaround, that isn't particularly elegant, but currently seems to...
2009/01/24
[ "https://Stackoverflow.com/questions/475355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44873/" ]
The below is an involved problem, I've done a great amount of research, but have been unable to solve it thus far. I'm happy to find either a solution or a workaround. Although the framework is old (1.0) I am not at this stage able to upgrade to 1.1 or later (the client isn't willing to pay for the conversion at presen...
Are you attempting to merge menus as a part of the MDI child showing? If so you may be running into this issue <http://support.microsoft.com/kb/895579> The hotfix there will work around the problem if it's the one you're seeing.
475,367
<p>I've been experiencing very inconsistent results while developing an iPhone app and trying to save preferences via the standard NSUserDefaults mechanism. I am using code almost straight out of the iPhone Developer's Cookbook by Erica Sadun (fantastic book btw), it looks like this:</p> <pre> (void) updateDefaults {...
[ { "answer_id": 475442, "author": "Jayden", "author_id": 44873, "author_profile": "https://Stackoverflow.com/users/44873", "pm_score": 2, "selected": false, "text": "<p><strong>Workaround :</strong></p>\n\n<p>I've found a workaround, that isn't particularly elegant, but currently seems to...
2009/01/24
[ "https://Stackoverflow.com/questions/475367", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58516/" ]
I've been experiencing very inconsistent results while developing an iPhone app and trying to save preferences via the standard NSUserDefaults mechanism. I am using code almost straight out of the iPhone Developer's Cookbook by Erica Sadun (fantastic book btw), it looks like this: ``` (void) updateDefaults { NSMu...
Are you attempting to merge menus as a part of the MDI child showing? If so you may be running into this issue <http://support.microsoft.com/kb/895579> The hotfix there will work around the problem if it's the one you're seeing.
475,383
<p>How do you think is really necessary to provide <code>IFormatProvider</code> in method <code>String.Format(string, object)</code> ?</p> <p>Is it better to write full variant</p> <pre><code>String.Format(CultureInfo.CurrentCulture, "String is {0}", str); </code></pre> <p>or just</p> <pre><code>String.Format("Stri...
[ { "answer_id": 475388, "author": "Ian P", "author_id": 10853, "author_profile": "https://Stackoverflow.com/users/10853", "pm_score": 2, "selected": false, "text": "<p>It is especially useful if you care about localization (Globalization) in your application. That is, if you want your app...
2009/01/24
[ "https://Stackoverflow.com/questions/475383", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41956/" ]
How do you think is really necessary to provide `IFormatProvider` in method `String.Format(string, object)` ? Is it better to write full variant ``` String.Format(CultureInfo.CurrentCulture, "String is {0}", str); ``` or just ``` String.Format("String is {0}", str); ``` ?
In general, you will want to use InvariantCulture if the string you are generating is to be persisted in a way that is independent of the current user's culture (e.g. in the registry, or in a file). You will want to use CurrentCulture for strings that are to be presented in the UI to the current user (forms, reports)....
475,384
<p>Let's say I have the following:</p> <pre><code>&lt;style&gt; .myLabel { color: blue; } .myLabel:hover { color:red; } &lt;/style&gt; &lt;div&gt; &lt;img src='myimage.png' /&gt; &lt;span class='myLabel'&gt;Image Label&lt;/span&gt; &lt;/div&gt; </code></pre> <p>Is it possible to re...
[ { "answer_id": 475404, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 0, "selected": false, "text": "<p>one technique is to have a single image file have multiple images in it and you use css rules to change the offset w...
2009/01/24
[ "https://Stackoverflow.com/questions/475384", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2424/" ]
Let's say I have the following: ``` <style> .myLabel { color: blue; } .myLabel:hover { color:red; } </style> <div> <img src='myimage.png' /> <span class='myLabel'>Image Label</span> </div> ``` Is it possible to replace the image (also via css) when they hover over the span? If so,...
There don't seem to be any sibling selector for ***previous*** siblings. W3 defined [**adjacent siblings**](http://www.w3.org/TR/CSS2/selector.html#adjacent-selectors) and some browser support seems to be available for [**general siblings**](http://reference.sitepoint.com/css/generalsiblingselector) -- but, both are f...
475,401
<p>How do you pass parameters in a URL? I'm trying to design a login system similar to Twitter's. Notice how you can either login to the main page of www.twitter.com or you can go directly to customised pages such as www.twitter.com/lancearmstrong and www.twitter.com/rails . That's exactly what I need for my project. T...
[ { "answer_id": 475430, "author": "strager", "author_id": 39992, "author_profile": "https://Stackoverflow.com/users/39992", "pm_score": 0, "selected": false, "text": "<p>Look into <a href=\"http://httpd.apache.org/docs/1.3/mod/mod_rewrite.html\" rel=\"nofollow noreferrer\">Apache's mod_re...
2009/01/24
[ "https://Stackoverflow.com/questions/475401", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58521/" ]
How do you pass parameters in a URL? I'm trying to design a login system similar to Twitter's. Notice how you can either login to the main page of www.twitter.com or you can go directly to customised pages such as www.twitter.com/lancearmstrong and www.twitter.com/rails . That's exactly what I need for my project. Than...
in config/routes.rb create a rule like this: ``` map.connect '/:user_name', :controller => 'login', :action => 'custom' ``` or somethjing similar. then in your controller pick up the user name with params[:user\_name] This should go at the end of the file near the default rules. The system chooses the first rout...
475,407
<p>I get this warning from GCC:</p> <blockquote> <p>warning: cannot pass objects of non-POD type 'class Something' through '...'; call will abort at runtime</p> </blockquote> <p>It's pretty deadly, especially since it calls an abort. Why isn't this an error? I would like to make it an error, but:</p> <ol> <li>How do I ...
[ { "answer_id": 475412, "author": "Sean Bright", "author_id": 21926, "author_profile": "https://Stackoverflow.com/users/21926", "pm_score": 6, "selected": true, "text": "<p>I'm not sure what the correct warning is, but once you've found it, you can change its disposition with the followin...
2009/01/24
[ "https://Stackoverflow.com/questions/475407", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I get this warning from GCC: > > warning: cannot pass objects of non-POD type 'class Something' through '...'; call will abort at runtime > > > It's pretty deadly, especially since it calls an abort. Why isn't this an error? I would like to make it an error, but: 1. How do I make a specific warning an error? 2. ...
I'm not sure what the correct warning is, but once you've found it, you can change its disposition with the following (using 'format' as the example): ``` #pragma GCC diagnostic error "-Wformat" ``` Or as [*strager* points out](https://stackoverflow.com/questions/475407/make-one-gcc-warning-an-error/475414#475414): ...
475,518
<p>I have a field object and I create a list of fields:</p> <pre><code>class Field { string objectName; string objectType; string fieldName; string fieldValue; //constructor... } List&lt;Field&gt; fieldList = new List&lt;Field&gt;(); </code></pre> <p>Suppose I wanted to query this list to return a collection of...
[ { "answer_id": 475527, "author": "Adam Barney", "author_id": 42140, "author_profile": "https://Stackoverflow.com/users/42140", "pm_score": 0, "selected": false, "text": "<pre><code>var q = from Field f in fileldList select f.objectName;\n\nchkBoxList.DataSource = q.Distinct();\n</code></...
2009/01/24
[ "https://Stackoverflow.com/questions/475518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56564/" ]
I have a field object and I create a list of fields: ``` class Field { string objectName; string objectType; string fieldName; string fieldValue; //constructor... } List<Field> fieldList = new List<Field>(); ``` Suppose I wanted to query this list to return a collection of distinct object names (to then be inser...
The expression should return a List of distinct object names from the list as defined. I converted it to a list since the docs for the CheckedListBox DataSource property indicated that it needs to implement IList or IListSource, not merely IEnumerable. ``` ((ListControl)cbListBox).DataSource = fieldList.Select( f => f...
475,532
<p>I am writing a piece of code that to work would require an extensive amount of if/then statements. In order to eliminate the need for writing line upon line of if/then statements can I use a dictionary or a list? If so can someone direct me to a good web resource or show an instance where they have done it before? <...
[ { "answer_id": 475545, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<p>might want to give some idea of what you're doing with the if/the statements. If you're just obtaining a value fro...
2009/01/24
[ "https://Stackoverflow.com/questions/475532", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45151/" ]
I am writing a piece of code that to work would require an extensive amount of if/then statements. In order to eliminate the need for writing line upon line of if/then statements can I use a dictionary or a list? If so can someone direct me to a good web resource or show an instance where they have done it before? Ed...
It looks like you're trying to map each combination of the 6 inputs (12 \* 13 \* 2 \* 3 \* 2 \* 2 possibilities) to one of the (16 \* 8) outputs. If that's the case, you'll still have a lot of typing to do - but moving to a collection will allow you to easily externalize the mapping. I would guess that this would proba...
475,537
<p>I'm developing a business application, using Silverlight for the UI and a WCF webservice for the back-end. In the database I have a number of lookup tables. When the WCF service returns a business object, one of the properties contains the entire row out of the lookup table instead of just the foreign key, so in the...
[ { "answer_id": 475656, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 2, "selected": true, "text": "<p>I'm not sure I'm fully understanding the problem (it's early :)) But can't you just transfer all the items you ne...
2009/01/24
[ "https://Stackoverflow.com/questions/475537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20122/" ]
I'm developing a business application, using Silverlight for the UI and a WCF webservice for the back-end. In the database I have a number of lookup tables. When the WCF service returns a business object, one of the properties contains the entire row out of the lookup table instead of just the foreign key, so in the UI...
I'm not sure I'm fully understanding the problem (it's early :)) But can't you just transfer all the items you need in one call? (even if you have to wrap the 3 in a new DTO class), then you can just update the current session type using a complete event. It's still not perfect, but at least you don't have to keep any ...
475,539
<p>When I run my app with Leaks and view the Extended Details for any of the leaks, it takes me to a particular line in my code, but I don't know what to do after that!</p> <p>For instance, Leaks shows a malloc at this line</p> <pre><code>NSData *data = [NSURLConnection sendSynchronousRequest:request returningRespons...
[ { "answer_id": 475603, "author": "Colin Wheeler", "author_id": 2750, "author_profile": "https://Stackoverflow.com/users/2750", "pm_score": 2, "selected": false, "text": "<p>The Extended Detail pane will give you stack traces showing you the stack at the leak. Generally a good place to st...
2009/01/24
[ "https://Stackoverflow.com/questions/475539", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46297/" ]
When I run my app with Leaks and view the Extended Details for any of the leaks, it takes me to a particular line in my code, but I don't know what to do after that! For instance, Leaks shows a malloc at this line ``` NSData *data = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&er...
Found the answer. Fredrik's response got me thinking. I was creating an instance of NSURLResponse and NSError which I was then passing to the sendSynchronousRequest method. According to the memory management document of the iPhone, this should not be done. We just need to pass a reference to the NSURLResponse and NSErr...
475,552
<p>How can i create simple group by query in trunk version of django?</p> <p>I need something like</p> <pre><code>SELECT name FROM mytable GROUP BY name </code></pre> <p>actually what i want to do is simply get all entries with distinct names. </p>
[ { "answer_id": 475664, "author": "Parand", "author_id": 13055, "author_profile": "https://Stackoverflow.com/users/13055", "pm_score": 2, "selected": false, "text": "<p>Add .distinct to your queryset:</p>\n\n<pre><code>Entries.objects.filter(something='xxx').distinct()\n</code></pre>\n" ...
2009/01/24
[ "https://Stackoverflow.com/questions/475552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20955/" ]
How can i create simple group by query in trunk version of django? I need something like ``` SELECT name FROM mytable GROUP BY name ``` actually what i want to do is simply get all entries with distinct names.
If you need all the distinct names, just do this: ``` Foo.objects.values('name').distinct() ``` And you'll get a list of dictionaries, each one with a **name** key. If you need other data, just add more attribute names as parameters to the .values() call. Of course, if you add in attributes that may vary between row...
475,569
<p>I would like to get all the instances of an object of a certain class.</p> <p>For example:</p> <pre><code>class Foo { } $a = new Foo(); $b = new Foo(); $instances = get_instances_of_class('Foo'); </code></pre> <p><code>$instances</code> should be either <code>array($a, $b)</code> or <code>array($b, $a)</code> (...
[ { "answer_id": 475572, "author": "Cody Caughlan", "author_id": 25398, "author_profile": "https://Stackoverflow.com/users/25398", "pm_score": 2, "selected": false, "text": "<p>As far as I know, the PHP runtime does not expose the underlying object space, so it would not be possible to que...
2009/01/24
[ "https://Stackoverflow.com/questions/475569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39992/" ]
I would like to get all the instances of an object of a certain class. For example: ``` class Foo { } $a = new Foo(); $b = new Foo(); $instances = get_instances_of_class('Foo'); ``` `$instances` should be either `array($a, $b)` or `array($b, $a)` (order does not matter). A plus is if the function would return in...
If you derive all your objects from a TrackableObject class, this class could be set up to handle such things (just be sure you call `parent::__construct()` and `parent::__destruct()` when overloading those in subclasses. ``` class TrackableObject { protected static $_instances = array(); public function __co...
475,584
<p>I'm in the process of learning Java and my first project is a calculator, however I've run into a snag. I'm trying to get my calculator to let me enter a number then click an operator (+, -, x, /), enter another number then hit an operator again and have the display update and be able to keep this going.</p> <p>Ex...
[ { "answer_id": 475595, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 2, "selected": false, "text": "<p>Whenever you enter an operator, your code will execute this:</p>\n\n<pre><code>Double.valueOf(s.trim())\n</code></pre>...
2009/01/24
[ "https://Stackoverflow.com/questions/475584", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27025/" ]
I'm in the process of learning Java and my first project is a calculator, however I've run into a snag. I'm trying to get my calculator to let me enter a number then click an operator (+, -, x, /), enter another number then hit an operator again and have the display update and be able to keep this going. Example, I wo...
After searching high and low I finally determined that the problem didn't lie within the code I provided. I had had a "wait = false;" in my NumberListener class that was screwing up the execution. To solve this I created 2 separate wait variables and all is working fine so far. Thanks for the help and the tips guys, +...
475,585
<p>I was wondering if it which is faster when trying to, for example, check how many posts are in a particular thread on a forum. Should I...</p> <p>(a) Go through each post in the database with the particular thread ID, and count how many rows</p> <p>or</p> <p>(b) Add one to a separate column in the threads databas...
[ { "answer_id": 475588, "author": "Sophie Alpert", "author_id": 49485, "author_profile": "https://Stackoverflow.com/users/49485", "pm_score": 2, "selected": false, "text": "<p>Premature optimization is the root of all evil.</p>\n\n<p>Use solution (a) to start, and then, IF your site needs...
2009/01/24
[ "https://Stackoverflow.com/questions/475585", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29595/" ]
I was wondering if it which is faster when trying to, for example, check how many posts are in a particular thread on a forum. Should I... (a) Go through each post in the database with the particular thread ID, and count how many rows or (b) Add one to a separate column in the threads database every time a thread is...
What's wrong with having an index for the thread ID? Wouldn't a simple COUNT expression grouped by the thread ID field suffice? With any caching at all, this would be plenty fast from what I can tell. ``` --This will provide counts for all threads SELECT COUNT(threadID) FROM Posts GROUP BY threadID; --This will prov...
475,617
<p>I have a third party library containing a class which performs a function asynchronously. The class inherits from the Form. The function basically performs a calculation based on data stored in a database. Once it has finished, it calls a _Complete event in the calling form.</p> <p>What I would like to do is call t...
[ { "answer_id": 475631, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 0, "selected": false, "text": "<p>Do you have the source for the component? It sounds like it's relying on the fact it will be called from a WinFo...
2009/01/24
[ "https://Stackoverflow.com/questions/475617", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58541/" ]
I have a third party library containing a class which performs a function asynchronously. The class inherits from the Form. The function basically performs a calculation based on data stored in a database. Once it has finished, it calls a \_Complete event in the calling form. What I would like to do is call the functi...
At a stab it might be worth trying something like the following which uses a WaitHandle to block the current thread rather than spinning and checking a flag. ``` using System; using System.Threading; class Program { AutoResetEvent _autoEvent; static void Main() { Program p = new Program(); ...
475,633
<p>I have a table A</p> <pre><code>ID Term 10 A 10 B 10 C 20 A 20 B 20 E </code></pre> <p>what's the best way to write a sql to </p> <ul> <li>get ID 10, if I try to find (A,B,C)</li> <li>get NOTHING if I try to find (A,B)</li> <li>get ID 20, if I try to find NOT in (C,D)</li> </ul> <p>.</p> <p...
[ { "answer_id": 475678, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 3, "selected": false, "text": "<p>1.</p>\n\n<pre><code>SELECT ID \nFROM TableA\nWHERE Term IN ('A','B','C')\nGROUP BY ID\nHAVING COUNT(ID)=3\nLIMIT 1\n...
2009/01/24
[ "https://Stackoverflow.com/questions/475633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58544/" ]
I have a table A ``` ID Term 10 A 10 B 10 C 20 A 20 B 20 E ``` what's the best way to write a sql to * get ID 10, if I try to find (A,B,C) * get NOTHING if I try to find (A,B) * get ID 20, if I try to find NOT in (C,D) . ``` Select distinct ID from TableA where Term in (A,B,C) will return bo...
1. ``` SELECT ID FROM TableA WHERE Term IN ('A','B','C') GROUP BY ID HAVING COUNT(ID)=3 LIMIT 1 ``` Here 3 would be the length of the set (A,B,C in this case). 2 & 3 could probably be some variation of the above.
475,637
<p>I have a customer index page that displays customer lists. I have a search functionality within this page and I want the url to be <a href="http://mysite/search?id=434" rel="nofollow noreferrer">http://mysite/search?id=434</a> when i perform the search. The index page will also display the search result.</p> <p>Th...
[ { "answer_id": 475640, "author": "mmx", "author_id": 33708, "author_profile": "https://Stackoverflow.com/users/33708", "pm_score": 1, "selected": false, "text": "<p>No, you shouldn't have. Just use <code>View(\"ViewName\");</code> in the controller to show the appropriate view in other a...
2009/01/24
[ "https://Stackoverflow.com/questions/475637", "https://Stackoverflow.com", "https://Stackoverflow.com/users/54890/" ]
I have a customer index page that displays customer lists. I have a search functionality within this page and I want the url to be <http://mysite/search?id=434> when i perform the search. The index page will also display the search result. Thanks
``` public class CustomerController : Controller ... public ActionResult Search(int id) { ViewData["SearchResult"] = MySearchBLL.GetSearchResults(id); return View("Index"); } ... ``` Hope this helps
475,652
<p>Sometimes, when I open the a file like so:</p> <pre><code>FILE *file = fopen(fname, "wb"); if(!file) printf("Error code: %d\n",ferror(file)); </code></pre> <p>I get a result of 32. What does this mean? Specifically, for eMbedded Visual C++ 4.0</p> <p>Also, it seems like eVC does not support perror/errno :(</p>
[ { "answer_id": 475659, "author": "Evan Teran", "author_id": 13430, "author_profile": "https://Stackoverflow.com/users/13430", "pm_score": 2, "selected": false, "text": "<p>you should try to test what perror says the error message is. Use like this:</p>\n\n<pre><code>perror(\"fopen\");\n<...
2009/01/24
[ "https://Stackoverflow.com/questions/475652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/34910/" ]
Sometimes, when I open the a file like so: ``` FILE *file = fopen(fname, "wb"); if(!file) printf("Error code: %d\n",ferror(file)); ``` I get a result of 32. What does this mean? Specifically, for eMbedded Visual C++ 4.0 Also, it seems like eVC does not support perror/errno :(
You are using ferror() in a wrong way: it works only on a valid (non-null) file handle. Passing it NULL (in the case fopen() fails) causes UB, which manifests in your case by printing a random value (not trapping on NULL pointer access suggests that the underlying platform does not have memory protection).
475,655
<p>How can I read/write serializable object instances to a RandomAccessFile in Java? I want to be able to do this the same way you do it in c++ through structs. In java only ObjectInputStreams/ObjectOutputStreamscan can read/Write objects. I am amazed Java does not have something already implemented.</p>
[ { "answer_id": 475704, "author": "waqas", "author_id": 58008, "author_profile": "https://Stackoverflow.com/users/58008", "pm_score": 2, "selected": false, "text": "<p>There is a difference between serialized Java objects, and C structs you write out with fwrite: serialized java objects m...
2009/01/24
[ "https://Stackoverflow.com/questions/475655", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22769/" ]
How can I read/write serializable object instances to a RandomAccessFile in Java? I want to be able to do this the same way you do it in c++ through structs. In java only ObjectInputStreams/ObjectOutputStreamscan can read/Write objects. I am amazed Java does not have something already implemented.
I can see why you would want to do this to read legacy file formats. In that case, default Java serialization mechanisms are a hindrance, not a help. To a degree, you *can* read/write struct-like classes using reflection. Sample code: ``` public static class MyStruct { public int foo; public boolean bar = tru...
475,674
<p>I'm building a mobile web app targeting Android users. I need to know what DOM events are available to me. I have been able to make the following work, but not terribly reliably:</p> <ul> <li>click</li> <li>mouseover</li> <li>mousedown</li> <li>mouseup</li> <li>change</li> </ul> <p>I have not been able to get the ...
[ { "answer_id": 476718, "author": "Andrew Hedges", "author_id": 11577, "author_profile": "https://Stackoverflow.com/users/11577", "pm_score": 6, "selected": true, "text": "<p>OK, this is interesting. My use case is that I have a series of links (<code>A</code> tags) on a screen in a WebKi...
2009/01/24
[ "https://Stackoverflow.com/questions/475674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11577/" ]
I'm building a mobile web app targeting Android users. I need to know what DOM events are available to me. I have been able to make the following work, but not terribly reliably: * click * mouseover * mousedown * mouseup * change I have not been able to get the following to work: * keypress * keydown * keyup Does a...
OK, this is interesting. My use case is that I have a series of links (`A` tags) on a screen in a WebKit view. To test what events area available, using jQuery 1.3.1, I attached every event listed on [this page](http://www.quirksmode.org/dom/events/ "Event compatibility tables on QuirksMode.org") (even ones that don't ...
475,675
<p>35 lines, 55 lines, 100 lines, 300 lines? When you should start to break it apart? I'm asking because I have a function with 60 lines (including comments) and was thinking about breaking it apart.</p> <pre><code>long_function(){ ... } </code></pre> <p>into:</p> <pre><code>small_function_1(){...} small_function_2(...
[ { "answer_id": 475681, "author": "Andrew Hedges", "author_id": 11577, "author_profile": "https://Stackoverflow.com/users/11577", "pm_score": 1, "selected": false, "text": "<p>This is partly a matter of taste, but how I determine this is I try to keep my functions roughly only as long as ...
2009/01/24
[ "https://Stackoverflow.com/questions/475675", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
35 lines, 55 lines, 100 lines, 300 lines? When you should start to break it apart? I'm asking because I have a function with 60 lines (including comments) and was thinking about breaking it apart. ``` long_function(){ ... } ``` into: ``` small_function_1(){...} small_function_2(){...} small_function_3(){...} ``` ...
There aren't any real hard or fast rule for it. I generally like my methods to just **"do one thing"**. So if it's grabbing data, then doing something with that data, then writing it to disk then I'd split out the grabbing and writing into separate methods so my "main" method just contains that "doing something". That...
475,686
<p>I've written an API that requires a context to be initialized and thereafter passed into every API call. The caller allocates the memory for the context, and then passes it to the init function with other parameters that describe how they want later API calls to behave. The context is opaque, so the client can't rea...
[ { "answer_id": 475690, "author": "codelogic", "author_id": 43427, "author_profile": "https://Stackoverflow.com/users/43427", "pm_score": 0, "selected": false, "text": "<p>To sidestep the issue of a memory location of a previous context being reused, you could, in addition to freeing the ...
2009/01/24
[ "https://Stackoverflow.com/questions/475686", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46461/" ]
I've written an API that requires a context to be initialized and thereafter passed into every API call. The caller allocates the memory for the context, and then passes it to the init function with other parameters that describe how they want later API calls to behave. The context is opaque, so the client can't really...
Your context variable is probably at the moment some kind of pointer to allocated memory. Instead of this, make it a token or handle that can be explicitly verified. Every time a context is initialised, you return a new token (not the actual context object) and store that token in an internal list. Then, when a client ...
475,717
<p>I have a requirement to save an image file in various formats. The list of formats is subject to change quite often, so I wish the saving would be very extensible. Also, the saving can take place in many places (hard disk, ftp, http, etc). The list of saving <em>locations</em> is going to change very often too.</p> ...
[ { "answer_id": 475722, "author": "Spence", "author_id": 53771, "author_profile": "https://Stackoverflow.com/users/53771", "pm_score": 4, "selected": true, "text": "<p>Firstly I would implement streams on your Image. This way you can create a constructor from a stream, and a method to cr...
2009/01/24
[ "https://Stackoverflow.com/questions/475717", "https://Stackoverflow.com", "https://Stackoverflow.com/users/430254/" ]
I have a requirement to save an image file in various formats. The list of formats is subject to change quite often, so I wish the saving would be very extensible. Also, the saving can take place in many places (hard disk, ftp, http, etc). The list of saving *locations* is going to change very often too. I thought I w...
Firstly I would implement streams on your Image. This way you can create a constructor from a stream, and a method to create a stream to any of your "image" subclasses. Additionally, I would create your "saving" infrastructure to simply accept streams and write them down onto your appropriate techniques (ftp, file etc...
475,725
<p>I have the following class in my C# .NET 3.5 win forms app:</p> <pre><code>class Field { string objectName; string objectType; string fieldName; string fieldValue; } </code></pre> <p>and a List fieldList that is a datasource for a checkedlistbox. This listbox shows all the distinct objectNames from my fieldList...
[ { "answer_id": 475731, "author": "aku", "author_id": 1196, "author_profile": "https://Stackoverflow.com/users/1196", "pm_score": 2, "selected": true, "text": "<pre><code>var selectedNames = ... // List of selected names\nvar selectedFields = (from f in fieldList\n wh...
2009/01/24
[ "https://Stackoverflow.com/questions/475725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/56564/" ]
I have the following class in my C# .NET 3.5 win forms app: ``` class Field { string objectName; string objectType; string fieldName; string fieldValue; } ``` and a List fieldList that is a datasource for a checkedlistbox. This listbox shows all the distinct objectNames from my fieldList collection. I want to cr...
``` var selectedNames = ... // List of selected names var selectedFields = (from f in fieldList where selectedNames.Contains(f.objectName) select f.FieldName).Distinct().ToList(); ```
475,750
<pre><code>class test { public: test &amp;operator=(const test &amp; other){} // 1 const test &amp; operator+(const test&amp; other) const {} // 2 const test &amp; operator+(int m) {} //3 private: int n; }; int main() { test t1 , t2, t3; // this works fine t1 = t2.operator+(t3) , calls 2 and 1 t1 = ...
[ { "answer_id": 475757, "author": "Igor", "author_id": 44673, "author_profile": "https://Stackoverflow.com/users/44673", "pm_score": 4, "selected": true, "text": "<p>Because object returned by t2+t3 is const, and you cannot call its non-const function (3).</p>\n\n<p>It works fine in case ...
2009/01/24
[ "https://Stackoverflow.com/questions/475750", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33411/" ]
``` class test { public: test &operator=(const test & other){} // 1 const test & operator+(const test& other) const {} // 2 const test & operator+(int m) {} //3 private: int n; }; int main() { test t1 , t2, t3; // this works fine t1 = t2.operator+(t3) , calls 2 and 1 t1 = t2 + t3; // this works fi...
Because object returned by t2+t3 is const, and you cannot call its non-const function (3). It works fine in case of "t1 = t2 + 100 +t3;", because object returned by t2+100 is const too, but you are calling its const function (2), which is ok.
475,758
<p>Is there a (Qt) way to determine the platform a Qt application is running on at runtime?</p>
[ { "answer_id": 476450, "author": "Reed Hedges", "author_id": 39686, "author_profile": "https://Stackoverflow.com/users/39686", "pm_score": 6, "selected": true, "text": "<p>Note that the Q_WS_* macros are defined at compile time, but QSysInfo gives some run time details.</p>\n<p>To extend...
2009/01/24
[ "https://Stackoverflow.com/questions/475758", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19863/" ]
Is there a (Qt) way to determine the platform a Qt application is running on at runtime?
Note that the Q\_WS\_\* macros are defined at compile time, but QSysInfo gives some run time details. To extend gs's function to get the specific windows version at runtime, you can do ``` #ifdef Q_WS_WIN switch(QSysInfo::windowsVersion()) { case QSysInfo::WV_2000: return "Windows 2000"; case QSysInfo::WV_XP: ret...
475,763
<p>I am using System.Timers.Timer class in one of the classes in my application. I know that Timer class has Dispose method inherited from the parent Component class that implements IDisposable interface. Instances of the class below are created many times during my application lifecycle; each of them has an instance o...
[ { "answer_id": 475768, "author": "flesh", "author_id": 27805, "author_profile": "https://Stackoverflow.com/users/27805", "pm_score": 6, "selected": true, "text": "<p>Generally speaking you should always dispose of disposable resources. I certainly would be looking to in the case you outl...
2009/01/24
[ "https://Stackoverflow.com/questions/475763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50191/" ]
I am using System.Timers.Timer class in one of the classes in my application. I know that Timer class has Dispose method inherited from the parent Component class that implements IDisposable interface. Instances of the class below are created many times during my application lifecycle; each of them has an instance of T...
Generally speaking you should always dispose of disposable resources. I certainly would be looking to in the case you outline above. If you implement IDisposable on the class that implements the timer you can then use the class in a using statement, meaning resources will be explicitly released when your class is dispo...
475,776
<p>Hi im trying to write a lockless list i got the adding part working it think but the code that extracts objects from the list does not work to good :(</p> <p>Well the list is not a normal list.. i have the Interface IWorkItem</p> <pre><code>interface IWorkItem { DateTime ExecuteTime { get; } bool Cancelled...
[ { "answer_id": 476257, "author": "Rasmus Faber", "author_id": 5542, "author_profile": "https://Stackoverflow.com/users/5542", "pm_score": 0, "selected": false, "text": "<p>I am in no way an expert on the subject, but as far as I can see, you need to either make the ExecutionTime-field in...
2009/01/24
[ "https://Stackoverflow.com/questions/475776", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58553/" ]
Hi im trying to write a lockless list i got the adding part working it think but the code that extracts objects from the list does not work to good :( Well the list is not a normal list.. i have the Interface IWorkItem ``` interface IWorkItem { DateTime ExecuteTime { get; } bool Cancelled { get; } void Ex...
The problem is your algorithm: Consider this sequence of events: Thread 1 calls `list.Add(workItem1)`, which completes fully. Status is: ``` first=workItem1, workItem1.next = null ``` Then thread 1 calls `list.Add(workItem2)` and reaches the spot right before the second `Replace` (where you have the comment "//le...
475,801
<p>Is there an analog of the "-fdefault-real-8" gfortran (the GNU Fortran 95 compiler) option in g77 (the GNU Fortran 77 compiler)? This option sets the default real type to an 8-byte wide type.</p> <p>I currently have code where single-precision arithmetic is limiting my accuracy, and so I need double-precision. (I...
[ { "answer_id": 476073, "author": "Scottie T", "author_id": 6688, "author_profile": "https://Stackoverflow.com/users/6688", "pm_score": 2, "selected": true, "text": "<p>If you can't find a flag in the man pages, you might try a #define macro.</p>\n\n<pre><code>#define REAL DOUBLE PRECISIO...
2009/01/24
[ "https://Stackoverflow.com/questions/475801", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3508/" ]
Is there an analog of the "-fdefault-real-8" gfortran (the GNU Fortran 95 compiler) option in g77 (the GNU Fortran 77 compiler)? This option sets the default real type to an 8-byte wide type. I currently have code where single-precision arithmetic is limiting my accuracy, and so I need double-precision. (It's not just...
If you can't find a flag in the man pages, you might try a #define macro. ``` #define REAL DOUBLE PRECISION ```
475,803
<p>In order to populate a textbox in a page header I am setting up a parameter (as you cannot use Fields) and referencing this in the textbox. The parameter has the Default Value set to "From Query" and the Dataset and Value Field are set accordingly. This works a treat in developmentt in Visual Studio 2005. Once I hav...
[ { "answer_id": 476073, "author": "Scottie T", "author_id": 6688, "author_profile": "https://Stackoverflow.com/users/6688", "pm_score": 2, "selected": true, "text": "<p>If you can't find a flag in the man pages, you might try a #define macro.</p>\n\n<pre><code>#define REAL DOUBLE PRECISIO...
2009/01/24
[ "https://Stackoverflow.com/questions/475803", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52881/" ]
In order to populate a textbox in a page header I am setting up a parameter (as you cannot use Fields) and referencing this in the textbox. The parameter has the Default Value set to "From Query" and the Dataset and Value Field are set accordingly. This works a treat in developmentt in Visual Studio 2005. Once I have d...
If you can't find a flag in the man pages, you might try a #define macro. ``` #define REAL DOUBLE PRECISION ```
475,805
<p>I am programatically making some LinkButtons, and they worked fine for a while, but now the events aren't firing and I can't figure out why?</p> <p>This is what makes the button:</p> <pre><code>protected void MakeUploadButton(attachment a, PlaceHolder ph) { LinkButton lb = new LinkButton() { Text =...
[ { "answer_id": 475820, "author": "Alex", "author_id": 42707, "author_profile": "https://Stackoverflow.com/users/42707", "pm_score": 3, "selected": true, "text": "<p>It's because .NET nukes an elements event handlers on postback if they aren't set in viewstate. All you need to do is re-at...
2009/01/24
[ "https://Stackoverflow.com/questions/475805", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14777/" ]
I am programatically making some LinkButtons, and they worked fine for a while, but now the events aren't firing and I can't figure out why? This is what makes the button: ``` protected void MakeUploadButton(attachment a, PlaceHolder ph) { LinkButton lb = new LinkButton() { Text = "Upload New " + a.at...
It's because .NET nukes an elements event handlers on postback if they aren't set in viewstate. All you need to do is re-attach the eventhandler in the onload event. ``` Protected Sub Page_Load(sender As Object, e As EventArgs) Handles MyBase.Load If Page.IsPostBack Then Dim lb as ListButton = TryCast(Page.Fi...
475,825
<p>When I call a Linq (not Linq-for-SQL, just simple in-memory Linq) - what locale it uses to compare objects, and how can I affect it?</p> <p>E.g. </p> <pre><code>string[] a = { "a", "b", ... }; string max = a.Max(); </code></pre> <p>What locale is used here - current, invariant? How can I affect it? The comparisi...
[ { "answer_id": 475830, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 3, "selected": true, "text": "<p>It uses the implementation of <code>IComparable&lt;string&gt;</code> in string.</p>\n\n<p>You could fairly easily writ...
2009/01/24
[ "https://Stackoverflow.com/questions/475825", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19880/" ]
When I call a Linq (not Linq-for-SQL, just simple in-memory Linq) - what locale it uses to compare objects, and how can I affect it? E.g. ``` string[] a = { "a", "b", ... }; string max = a.Max(); ``` What locale is used here - current, invariant? How can I affect it? The comparision seems to be case-insensitive, ...
It uses the implementation of `IComparable<string>` in string. You could fairly easily write your own version of Max which *does* take an `IComparer<T>` for comparisons - I'm very surprised there isn't one already. Alternatively, you could use Aggregate in a somewhat cumbersome way to accomplish the same result.
475,840
<p>I'm having a problem with cookies. If the browser has cookies disabled, the cookie gets rejected. Is there a way to enable cookies on the client's browser that is compatible with Internet&nbsp;Explorer, Firefox, Opera and Chrome?</p>
[ { "answer_id": 475844, "author": "Gumbo", "author_id": 53114, "author_profile": "https://Stackoverflow.com/users/53114", "pm_score": 2, "selected": false, "text": "<p>If that would be possible, it’d be a security flaw. So no, it is not possible.</p>\n" }, { "answer_id": 475845, ...
2009/01/24
[ "https://Stackoverflow.com/questions/475840", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
I'm having a problem with cookies. If the browser has cookies disabled, the cookie gets rejected. Is there a way to enable cookies on the client's browser that is compatible with Internet Explorer, Firefox, Opera and Chrome?
I'm not aware of one and would be suprised if there was one - people turn cookies off for (among other things) security reasons, so allowing the site to re-enable them would be a security issue. What you could do is to write some logic into your app to check for cookies: First ``` set a cookie called 'test'; redirec...
475,842
<p>I have an object that I need to copy in Java. I need to create a copy and run some tests on it without changing the original object itself.</p> <p>I assumed that I needed to use the clone() method, but this is protected. Having done some research on the net, I can see that this can be overriden with a public method...
[ { "answer_id": 475852, "author": "Yoni Roit", "author_id": 34161, "author_profile": "https://Stackoverflow.com/users/34161", "pm_score": 4, "selected": false, "text": "<p>Some options:</p>\n\n<ul>\n<li>You can implement <code>Cloneable</code> for your object and put <code>clone()</code> ...
2009/01/24
[ "https://Stackoverflow.com/questions/475842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/58433/" ]
I have an object that I need to copy in Java. I need to create a copy and run some tests on it without changing the original object itself. I assumed that I needed to use the clone() method, but this is protected. Having done some research on the net, I can see that this can be overriden with a public method in my cla...
Another option by using Copy Constructor (from [Java Practices](http://www.javapractices.com/topic/TopicAction.do?Id=12)): ``` public final class Galaxy { public Galaxy (double aMass, String aName) { fMass = aMass; fName = aName; } /** * Copy constructor. */ public Galaxy(Gala...
475,843
<p>I'm creating an implementation that performs conversion from one form to another.</p> <p>The design problem I am facing now is whether the Encoder and Decoder API should be in one interface or in separate ones. e.g. Apache MINA uses <a href="http://mina.apache.org/report/1.1/apidocs/org/apache/mina/filter/codec/pac...
[ { "answer_id": 475849, "author": "Fredrik Jansson", "author_id": 58237, "author_profile": "https://Stackoverflow.com/users/58237", "pm_score": 2, "selected": false, "text": "<p>Only thing is that you usually have one code part that will use the decoder and a separate using the encoder. S...
2009/01/24
[ "https://Stackoverflow.com/questions/475843", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24457/" ]
I'm creating an implementation that performs conversion from one form to another. The design problem I am facing now is whether the Encoder and Decoder API should be in one interface or in separate ones. e.g. Apache MINA uses [separate interfaces](http://mina.apache.org/report/1.1/apidocs/org/apache/mina/filter/codec/...
Having separate interfaces doesn't mean you can't centralize the implementation. For example you could have one class implement both interfaces. Or each class could reference a common class which implements the protocol. So what I'd do is have separate interfaces, and at least to begin with, have one class implement b...
475,853
<p>Is there any way to take advantage of the file creation flags in the Win32 API such as <code>FILE_FLAG_DELETE_ON_CLOSE</code> or <code>FILE_FLAG_WRITE_THROUGH</code> as described here <a href="http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa363...
[ { "answer_id": 476014, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 6, "selected": true, "text": "<p>It is possible to attach a C++ <code>std::ofstream</code> to a Windows file handle. The following code works in VS2008:</p>...
2009/01/24
[ "https://Stackoverflow.com/questions/475853", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48659/" ]
Is there any way to take advantage of the file creation flags in the Win32 API such as `FILE_FLAG_DELETE_ON_CLOSE` or `FILE_FLAG_WRITE_THROUGH` as described here <http://msdn.microsoft.com/en-us/library/aa363858(VS.85).aspx> , but then force that handle into a std::ofstream? The interface to ofstream is obviously plat...
It is possible to attach a C++ `std::ofstream` to a Windows file handle. The following code works in VS2008: ``` HANDLE file_handle = CreateFile( file_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (file_handle != INVALID_HANDLE_VALUE) { int file_descriptor = _open_osfha...
475,858
<p>I'm attempting to deploy a WinForms app in a Citrix environment. It's been working reliably for some time on other physical and virtual machines, but it's failing, only when running the application on a Citrix desktop.</p> <p>The failures are typically where we have mixed-type data as strings in a general-purpose ...
[ { "answer_id": 475870, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 3, "selected": true, "text": "<p>It's a <a href=\"https://support.microsoft.com/en-us/kb/942460\" rel=\"nofollow noreferrer\">known bug</a>; hopef...
2009/01/24
[ "https://Stackoverflow.com/questions/475858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24867/" ]
I'm attempting to deploy a WinForms app in a Citrix environment. It's been working reliably for some time on other physical and virtual machines, but it's failing, only when running the application on a Citrix desktop. The failures are typically where we have mixed-type data as strings in a general-purpose settings ta...
It's a [known bug](https://support.microsoft.com/en-us/kb/942460); hopefully they will fix it.
475,860
<p>How can I simulate the mouse click in a directx application? mouse_event and PostMessage with WM_LBUTTONDOWN don't work...</p> <p>so it must be something to do with the DirectInput</p> <p>I haven't found out nothing useful with google, so you may be knowing the answer...</p> <p>thanks in advance</p> <p>//update<...
[ { "answer_id": 476418, "author": "Lucas Jones", "author_id": 41981, "author_profile": "https://Stackoverflow.com/users/41981", "pm_score": 0, "selected": false, "text": "<p>If it is your own application, could you refactor out the click event into something like (in psuedocode):</p>\n\n<...
2009/01/24
[ "https://Stackoverflow.com/questions/475860", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I simulate the mouse click in a directx application? mouse\_event and PostMessage with WM\_LBUTTONDOWN don't work... so it must be something to do with the DirectInput I haven't found out nothing useful with google, so you may be knowing the answer... thanks in advance //update I wrote the text wrongly, wh...
Try [AutoIt](http://www.autoitscript.com/) it is perfect for sending a click to a particular control. The ``` ControlClick ( "title", "text", controlID [, button [, clicks [, x [, y ]]]] ) ``` command can do exactly what you want. The directx control will detect the click.
475,871
<p>How do these 2 classes differ?</p> <pre><code>class A(): x=3 class B(): def __init__(self): self.x=3 </code></pre> <p>Is there any significant difference? </p>
[ { "answer_id": 475873, "author": "Douglas Leeder", "author_id": 3978, "author_profile": "https://Stackoverflow.com/users/3978", "pm_score": 8, "selected": true, "text": "<p><code>A.x</code> is a <em>class variable</em>.\n<code>B</code>'s <code>self.x</code> is an <em>instance variable</e...
2009/01/24
[ "https://Stackoverflow.com/questions/475871", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49018/" ]
How do these 2 classes differ? ``` class A(): x=3 class B(): def __init__(self): self.x=3 ``` Is there any significant difference?
`A.x` is a *class variable*. `B`'s `self.x` is an *instance variable*. i.e. `A`'s `x` is shared between instances. It would be easier to demonstrate the difference with something that can be modified like a list: ```py #!/usr/bin/env python class A: x = [] def add(self): self.x.append(1) class B: ...
475,888
<p>I have a C++ memory management doubt, that's (obviously) related to references and pointers. Suppose I have a class <code>Class</code> with a method <code>my_method</code>:</p> <pre><code>OtherClass&amp; Class::my_method( ... ) { OtherClass* other_object = new OtherClass( ... ); return *other_object; } </co...
[ { "answer_id": 475896, "author": "peterchen", "author_id": 31317, "author_profile": "https://Stackoverflow.com/users/31317", "pm_score": 3, "selected": false, "text": "<p>Calling the destructor and freeing the memory are two distinct things in C++. </p>\n\n<p><code>delete</code> does bot...
2009/01/24
[ "https://Stackoverflow.com/questions/475888", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25418/" ]
I have a C++ memory management doubt, that's (obviously) related to references and pointers. Suppose I have a class `Class` with a method `my_method`: ``` OtherClass& Class::my_method( ... ) { OtherClass* other_object = new OtherClass( ... ); return *other_object; } ``` Meanwhile in a nearby piece of code: ...
It's fairly obvious that you want to return a new object to the caller that you do not need to keep any reference to. For this purpose, the simplest thing to do is to return the object by value. ``` OtherClass Class::my_method( ... ) { return OtherClass( ... ); } ``` Then in the calling code you can construct th...
475,893
<p>I use Hibernate together with MySQL 5.1.30.</p> <p>I have the next libraries: </p> <ul> <li><strong>c3p0-0.0.1.2.jar</strong> </li> <li><strong>mysql-connector-java-5.0.3-bin.jar</strong></li> <li><strong>hibernate3.jar</strong></li> </ul> <p>I use a hibernate.cfg.xml for configuration: </p> <pre><code>&lt;!DO...
[ { "answer_id": 476022, "author": "duffymo", "author_id": 37213, "author_profile": "https://Stackoverflow.com/users/37213", "pm_score": 0, "selected": false, "text": "<p>Do the three applications share the same connection pool, or does each one get its own? I'd recommend the latter.</p>\...
2009/01/24
[ "https://Stackoverflow.com/questions/475893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2138/" ]
I use Hibernate together with MySQL 5.1.30. I have the next libraries: * **c3p0-0.0.1.2.jar** * **mysql-connector-java-5.0.3-bin.jar** * **hibernate3.jar** I use a hibernate.cfg.xml for configuration: ``` <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://h...
Actually this is probably too late, but the problem is quite simple: `hibernate.c3p0.idle_test_periods` must not be higher than `hibernate.c3p0.timeout` or connections closed by the database will not be properly detected. Moreover, the deadlock detection warnings look like some part of your code is not properly return...
475,911
<p>I'm bumping into this problem where my application gets <code>EXC_BAD_ACCESS</code> error and stucks/stops. I'm using "Rotate Left" &amp; "Rotate Right" options of simulator to simulate the orientation change behavior. What can be the possible reasons for this error? Since I'm not getting details about the error, I ...
[ { "answer_id": 476941, "author": "rpetrich", "author_id": 4007, "author_profile": "https://Stackoverflow.com/users/4007", "pm_score": 1, "selected": false, "text": "<p>Set a breakpoint on <code>-[UIDevice setOrientation:]</code> and step through your code in the debugger.</p>\n\n<p>To ma...
2009/01/24
[ "https://Stackoverflow.com/questions/475911", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49739/" ]
I'm bumping into this problem where my application gets `EXC_BAD_ACCESS` error and stucks/stops. I'm using "Rotate Left" & "Rotate Right" options of simulator to simulate the orientation change behavior. What can be the possible reasons for this error? Since I'm not getting details about the error, I can't trace it. ...
It's not uncommon to crash in system library code due to something you didn't set up quite right. This might be that your UIWindow or its content view or your view controller instance was not retained or got released somehow. That shouldrotate method won't help if your controller isn't still around. rpetrich's sugges...
475,923
<p><strong>Hi, this is the content of my XML file:</strong></p> <pre><code>&lt;?xml version="1.0" encoding="ISO-8859-1"?&gt; &lt;mainNode&gt; &lt;sub time="08:00"&gt; &lt;status id="2"&gt;On&lt;/status&gt; &lt;status id="3"&gt;Off&lt;/status&gt; &lt;/sub&gt; &lt;sub time="13:00"&gt; ...
[ { "answer_id": 475963, "author": "axel_c", "author_id": 20272, "author_profile": "https://Stackoverflow.com/users/20272", "pm_score": 0, "selected": false, "text": "<p>If you generate the xml yourself, you could change the way you store the time attribute using an integer value (ticks, f...
2009/01/24
[ "https://Stackoverflow.com/questions/475923", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
**Hi, this is the content of my XML file:** ``` <?xml version="1.0" encoding="ISO-8859-1"?> <mainNode> <sub time="08:00"> <status id="2">On</status> <status id="3">Off</status> </sub> <sub time="13:00"> <status id="4">On</status> <status id="7">On</status> </sub> <su...
Here are two solutions: I. XPath 1.0 ============ **This is one pair of [XPath 1.0](http://www.w3.org/TR/xpath) expressions** that select the required nodes: ``` /*/* [translate(@time, ':','') > translate('15:59',':','') ][1] ``` **selects the first `sub` node with time later than `15:59`.** ``...
475,970
<p>How can I specify a multiline commit message for mercurial on the command line?</p> <pre><code>hg commit -m "* add foo\n* fix bar" </code></pre> <p>does not work. The log shows:</p> <pre><code>changeset: 13:f2c6526e5911 tag: tip date: Fri Jan 23 23:22:36 2009 +0100 files: foobar.cpp descri...
[ { "answer_id": 475974, "author": "Aaron Maenpaa", "author_id": 2603, "author_profile": "https://Stackoverflow.com/users/2603", "pm_score": 7, "selected": true, "text": "<blockquote>\n <p>Mercurial: multiline commit message on\n the command line?</p>\n</blockquote>\n\n<p>Hit enter.</p>\...
2009/01/24
[ "https://Stackoverflow.com/questions/475970", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52986/" ]
How can I specify a multiline commit message for mercurial on the command line? ``` hg commit -m "* add foo\n* fix bar" ``` does not work. The log shows: ``` changeset: 13:f2c6526e5911 tag: tip date: Fri Jan 23 23:22:36 2009 +0100 files: foobar.cpp description: * add foo\n*fix bar ```
> > Mercurial: multiline commit message on > the command line? > > > Hit enter. ``` $ hg commit -m "Did some work > Now I'm done" ``` One of the things is that only the first line shows up in hg log: ``` $ hg log changeset: 0:d2dc019450a2 tag: tip user: Aaron Maenpaa <zacherates@gmail.com> da...