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
418,048
<p>I have a Console application hosting a WCF service:</p> <p><em>Updated this code to run off the app.config file instead of initialising it programatically</em></p> <pre><code>Uri baseAddress = new Uri("http://localhost:8000/ChatServer/Service"); ServiceHost myHost = new ServiceHost(typeof(ClientServerChat....
[ { "answer_id": 418169, "author": "Marcus Erickson", "author_id": 38373, "author_profile": "https://Stackoverflow.com/users/38373", "pm_score": 1, "selected": false, "text": "<p>The only performance counters available in Windows are at the process level. What do you mean by service DLL? T...
2009/01/06
[ "https://Stackoverflow.com/questions/418048", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5648/" ]
I have a Console application hosting a WCF service: *Updated this code to run off the app.config file instead of initialising it programatically* ``` Uri baseAddress = new Uri("http://localhost:8000/ChatServer/Service"); ServiceHost myHost = new ServiceHost(typeof(ClientServerChat.ChatServer), baseAddress); ...
Make a copy of svchost.exe and call it dbgsrvc.exe; then, go into the service entry in the registry (HKEY\_LOCAL\_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog for example), and change the ImagePath to use dbgsrvc instead of services. That way, you've isolated your service into its own process so you can get perf ...
418,056
<p>I would like to be able to send a stream of binary data to an asp .net website from a java applet hosted in the same website.</p> <p>I found <a href="http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html" rel="nofollow noreferrer">this link</a> which talks about this issue, but I am unsure how...
[ { "answer_id": 418095, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 0, "selected": false, "text": "<p>Well, if you want to do it in a standards-based way, you can mimic uploading a file to the site:</p>\n\n<p><a href=\"...
2009/01/06
[ "https://Stackoverflow.com/questions/418056", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5449/" ]
I would like to be able to send a stream of binary data to an asp .net website from a java applet hosted in the same website. I found [this link](http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html) which talks about this issue, but I am unsure how to actually receive the data on the website. ...
Carl, to answer your comment to casperOne, add a new web service to your ASP.NET site and do something like this... ``` using System; using System.IO; using System.Web.Services; [WebService(Namespace = "http://tempuri.org/")] [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)] public class Service : System....
418,064
<p>I have a few classes such that:</p> <pre><code>public class XMLStatusMessage extends XMLMessage {} public abstract class XMLMessage implements IMessage {} public interface IMessageListener { public void onMessage( IMessage message ); } public interface XMLMessageListener &lt;T extends XMLMessage&gt; extends ...
[ { "answer_id": 418084, "author": "Uri", "author_id": 23072, "author_profile": "https://Stackoverflow.com/users/23072", "pm_score": 0, "selected": false, "text": "<p>I've been in these situations before, but there isn't really a beautiful solution to this problem.</p>\n\n<p>In your case, ...
2009/01/06
[ "https://Stackoverflow.com/questions/418064", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7949/" ]
I have a few classes such that: ``` public class XMLStatusMessage extends XMLMessage {} public abstract class XMLMessage implements IMessage {} public interface IMessageListener { public void onMessage( IMessage message ); } public interface XMLMessageListener <T extends XMLMessage> extends IMessageListener...
As the other answers point out, you will only be able handle XMLStatusMessage messages in AStatusHandler, but my guess is that this is what you want? Redeclare your interfaces as follows and I believe you will get what you want; ``` public interface IMessageListener<T extends IMessage> { public void onMessage(T m...
418,066
<p>From the <a href="http://php.net/isset" rel="noreferrer"><code>isset()</code> docs</a>:</p> <pre><code>isset() will return FALSE if testing a variable that has been set to NULL. </code></pre> <p>Basically, <code>isset()</code> doesn't check for whether the variable is set at all, but whether it's set to anything b...
[ { "answer_id": 418143, "author": "Beau Simensen", "author_id": 50453, "author_profile": "https://Stackoverflow.com/users/50453", "pm_score": 1, "selected": false, "text": "<p>If I run the following:</p>\n\n<pre><code>echo '&lt;?php echo $foo; ?&gt;' | php\n</code></pre>\n\n<p>I get an er...
2009/01/06
[ "https://Stackoverflow.com/questions/418066", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30497/" ]
From the [`isset()` docs](http://php.net/isset): ``` isset() will return FALSE if testing a variable that has been set to NULL. ``` Basically, `isset()` doesn't check for whether the variable is set at all, but whether it's set to anything but `NULL`. Given that, what's the best way to actually check for the existe...
If the variable you are checking would be in the global scope you could do: ``` array_key_exists('v', $GLOBALS) ```
418,072
<p>Is there a way to execute script when an UpdatePanel process is finished.</p> <p>I have a page that allows "inserting", "copying", and "editing" of a record. This is all done on an UpdatePanel to prevent a page navigation. Somewhere else on the page I would like to print a "flash" message - like "You have successfu...
[ { "answer_id": 418136, "author": "Robert C. Barth", "author_id": 9209, "author_profile": "https://Stackoverflow.com/users/9209", "pm_score": 6, "selected": true, "text": "<p>Yes:</p>\n\n<pre><code>Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);\n</code></...
2009/01/06
[ "https://Stackoverflow.com/questions/418072", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36590/" ]
Is there a way to execute script when an UpdatePanel process is finished. I have a page that allows "inserting", "copying", and "editing" of a record. This is all done on an UpdatePanel to prevent a page navigation. Somewhere else on the page I would like to print a "flash" message - like "You have successfully entere...
Yes: ``` Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler); ``` And then: ``` function endRequestHandler(sender, args) { // Do stuff } ``` Documentation [here](http://msdn.microsoft.com/en-us/library/bb383810.aspx) and [here](http://msdn.microsoft.com/en-us/library/bb397499.aspx). ...
418,076
<p>I want to trigger the submit event of the form the current element is in. A method I know works sometimes is:</p> <pre><code>this.form.submit(); </code></pre> <p>I'm wondering if there is a better solution, possibly using jQuery, as I'm not 100% sure method works in every browser.</p> <p>Edit:</p> <p>The situati...
[ { "answer_id": 418101, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>In JQuery you can call</p>\n\n<pre><code>$(\"form:first\").trigger(\"submit\")\n</code></pre>\n\n<p>Don't know if that is m...
2009/01/06
[ "https://Stackoverflow.com/questions/418076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5441/" ]
I want to trigger the submit event of the form the current element is in. A method I know works sometimes is: ``` this.form.submit(); ``` I'm wondering if there is a better solution, possibly using jQuery, as I'm not 100% sure method works in every browser. Edit: The situation I have is, as follows: ``` <form met...
I think what you are looking for is something like this: ``` $(field).closest("form").submit(); ``` For example, to handle the onchange event, you would have this: ``` $(select your fields here).change(function() { $(this).closest("form").submit(); }); ``` If, for some reason you aren't using jQuery 1.3 or ab...
418,082
<p>I'm in the process of creating database scripts for an existing database. I'm trying to use SQL Server to generate the scripts for me, but the generated scripts are failing. I'm using the 'Script Table As'>'CREATE To'>'New Query Editor Window' option. I then change the table and constraint names and execute the s...
[ { "answer_id": 418104, "author": "Kyle B.", "author_id": 6158, "author_profile": "https://Stackoverflow.com/users/6158", "pm_score": 1, "selected": false, "text": "<p>I copied/pasted this exact SQL statement and it executed properly for me. The only thing I can think is that you have so...
2009/01/06
[ "https://Stackoverflow.com/questions/418082", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33178/" ]
I'm in the process of creating database scripts for an existing database. I'm trying to use SQL Server to generate the scripts for me, but the generated scripts are failing. I'm using the 'Script Table As'>'CREATE To'>'New Query Editor Window' option. I then change the table and constraint names and execute the script....
If your target DB is SQL 2000 then it complains about this line ``` WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY] ``` SQL 2000 only supports ``` WITH FILLFACTOR = 90 ``` So there is probably some compatibil...
418,098
<p>I'm new to VBA and have been throwing together a small macro application for the Office. We've got about 80 users on essentially identical PC setups, and it will be accessed by all but a few users. </p> <p>I've been playing around with some automation of accessing web pages using the Web Services references, and I'...
[ { "answer_id": 418148, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": false, "text": "<p>Instead of having the documents expose the functionality, make it an add-in for Office (the suite, or the individual ...
2009/01/06
[ "https://Stackoverflow.com/questions/418098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51498/" ]
I'm new to VBA and have been throwing together a small macro application for the Office. We've got about 80 users on essentially identical PC setups, and it will be accessed by all but a few users. I've been playing around with some automation of accessing web pages using the Web Services references, and I've also lo...
For the most part, late binding will solve problems with references in VBA, unless you have some unusual references. Most problems are caused by differences in library versions that can be overcome with late binding. With VBA, it is often recommended that you develop with early binding but release with late binding. Th...
418,105
<p>Is there any api for viewing html content from w/in your blackberry application? To be clear, I don't mean launching the browser on top of my app to view a page. But rather rendering the page w/in my app.</p>
[ { "answer_id": 418177, "author": "Richard Campbell", "author_id": 12254, "author_profile": "https://Stackoverflow.com/users/12254", "pm_score": 3, "selected": true, "text": "<p>Yes. Check out the net.rim.device.api.browser.field package or the Blackberry Browser section of application i...
2009/01/06
[ "https://Stackoverflow.com/questions/418105", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23071/" ]
Is there any api for viewing html content from w/in your blackberry application? To be clear, I don't mean launching the browser on top of my app to view a page. But rather rendering the page w/in my app.
Yes. Check out the net.rim.device.api.browser.field package or the Blackberry Browser section of application integration. Everything sort of finishes here: ``` Field field = browserContent.getDisplayableContent(); ``` See: [JDE 4.0.0 API for the package](http://www.blackberry.com/developers/docs/4.1api/net/rim/d...
418,119
<p>I am writing an application in C# that needs to run as a service but also have user interaction. I understand that services have no UI, etc, so I've divided up my program into a windows form application and a service that can communicate with each other.</p> <p>The problem I'm having is that I need the service to ...
[ { "answer_id": 418131, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": false, "text": "<p>In this case, you will have to have a third monitor process which detects if the program fails and restart it in that...
2009/01/06
[ "https://Stackoverflow.com/questions/418119", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20801/" ]
I am writing an application in C# that needs to run as a service but also have user interaction. I understand that services have no UI, etc, so I've divided up my program into a windows form application and a service that can communicate with each other. The problem I'm having is that I need the service to make sure t...
The general idea for this sort of thing is, if the user needs to interact with a service, they should launch a separate application. If you want to help them out, you can configure that separate application to start with windows by placing a shortcut in the start up menu. You can also build crash recovery into your app...
418,120
<p>In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse functio...
[ { "answer_id": 418138, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "<p>setup and execute</p>\n\n<p>example:</p>\n\n<pre><code>function whateverSetup() { ... }\nfunction whateverExecute(...
2009/01/06
[ "https://Stackoverflow.com/questions/418120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/32998/" ]
In functional programming, it's often important to optimize any "looping" code to be tail recursive. Tail recursive algorithms are usually split between two functions, however - one which sets up the base case, and another that implements the actual loop. A good (albeit academic) example would be the reverse function. ...
I tend to add "\_recurse" to the end. So "reverse\_recurse". Not sure where I got that from. I like leaving the base case function simple as you have in your example. It tends to be the "public" function and the fact that it uses a helper function to perform the iteration is irrelevant to the caller. In javascript I so...
418,121
<pre><code> #include "iostream" #include "vector" class ABC { private: bool m_b; public: ABC() : m_b(false) {} ABC&amp; setBool(bool b) { m_b = b; return *this; } bool getBool() const { return m_b; } }; void foo(const std::vector&lt;ABC&gt; ...
[ { "answer_id": 418155, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 4, "selected": true, "text": "<p>foo takes vec by reference-to-const, and you cannot change a const. So either remove the line that calls setBool, or if you ...
2009/01/06
[ "https://Stackoverflow.com/questions/418121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43756/" ]
``` #include "iostream" #include "vector" class ABC { private: bool m_b; public: ABC() : m_b(false) {} ABC& setBool(bool b) { m_b = b; return *this; } bool getBool() const { return m_b; } }; void foo(const std::vector<ABC> &vec) { vec...
foo takes vec by reference-to-const, and you cannot change a const. So either remove the line that calls setBool, or if you really want to set the bool, change the argument type to std::vector&. Or to be more strict about the implementation... You see, these two functions exist: ``` T& vector<T>::operator[](int); ...
418,176
<p>I have two String.printable mysteries in the one question.</p> <p>First, in Python 2.6:</p> <pre><code>&gt;&gt;&gt; string.printable '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&amp;\'()*+,-./:;&lt;=&gt;?@[\\]^_`{|}~ \t\n\r\x0b\x0c' </code></pre> <p>Look at the end of the string, and you'l...
[ { "answer_id": 418200, "author": "Sparr", "author_id": 13675, "author_profile": "https://Stackoverflow.com/users/13675", "pm_score": 6, "selected": true, "text": "<p>There is a difference in \"printable\" for \"can be displayed on your screen\". Your terminal displays the low ascii prin...
2009/01/06
[ "https://Stackoverflow.com/questions/418176", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8014/" ]
I have two String.printable mysteries in the one question. First, in Python 2.6: ``` >>> string.printable '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ \t\n\r\x0b\x0c' ``` Look at the end of the string, and you'll find '\x0b\x0c' sticking out like a sore-thumb. Wh...
There is a difference in "printable" for "can be displayed on your screen". Your terminal displays the low ascii printer control codes 0x0B and 0x0C as the male and female symbols because that is what those indices in your font contain. Those characters are more accurately described as the Vertical Tabulator and Form F...
418,183
<p>What is the trick in MySql (Version 4) to write from PHP thtree Inserts and to be sure that we can link tables properly.</p> <pre><code>[Table1]-[LinkTable]-[Table2] </code></pre> <p>In the PHP code I create an Insert that add 1 row in table 1 and an other Insert that add an other row in table 2. I get both rows P...
[ { "answer_id": 418238, "author": "Peter Bailey", "author_id": 8815, "author_profile": "https://Stackoverflow.com/users/8815", "pm_score": 2, "selected": false, "text": "<p>Well, if you have the ability to use InnoDB tables (instead of MyISAM) then you can use transactions. Here's some r...
2009/01/06
[ "https://Stackoverflow.com/questions/418183", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
What is the trick in MySql (Version 4) to write from PHP thtree Inserts and to be sure that we can link tables properly. ``` [Table1]-[LinkTable]-[Table2] ``` In the PHP code I create an Insert that add 1 row in table 1 and an other Insert that add an other row in table 2. I get both rows PK (primary key) with two S...
your problem is here: > > SELECTs that return me the last row of each tables. > > > if you did something like this: SELECT MAX(id) FROM `table` you can get a wrong id for your transaction. This is a common many-to-many relationship as BaileyP say you should use the function mysql\_insert\_id(). at <http://ar2...
418,186
<p>I have a database assignment which I have to create some relational algebra for two problems. I feel fairly all right with the majority of it, but I just get confused when trying to project attributes out of a table which is joined to another table.</p> <p>for example is this correct?</p> <p>Q1) List the details o...
[ { "answer_id": 418348, "author": "Federico A. Ramponi", "author_id": 18770, "author_profile": "https://Stackoverflow.com/users/18770", "pm_score": 2, "selected": true, "text": "<p>Your version seems correct, except for some typos like STAFF.INCIDENT.LastName. Here's my version:</p>\n\n<p...
2009/01/06
[ "https://Stackoverflow.com/questions/418186", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50913/" ]
I have a database assignment which I have to create some relational algebra for two problems. I feel fairly all right with the majority of it, but I just get confused when trying to project attributes out of a table which is joined to another table. for example is this correct? Q1) List the details of incidences with...
Your version seems correct, except for some typos like STAFF.INCIDENT.LastName. Here's my version: ``` RESULT <--- PROJECT <STUDENT.FirstName, STUDENT.LastName, STAFF.FirstName, STAFF.LastName, INCIDENT.DateTimeReported, INCIDENT.NatureOfIllness> (SELECT <INCIDENT.D...
418,187
<p>I would like to convert the below "foreach" statement to a LINQ query that returns a substring of the file name into a list:</p> <pre><code>IList&lt;string&gt; fileNameSubstringValues = new List&lt;string&gt;(); //Find all assemblies with mapping files. ICollection&lt;FileInfo&gt; files = codeToGetFileListGoesHere...
[ { "answer_id": 418205, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 2, "selected": false, "text": "<pre><code>IList&lt;string&gt; fileNameSubstringValues =\n (\n from \n file in codeToGetFileListGoesHere\n s...
2009/01/06
[ "https://Stackoverflow.com/questions/418187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52194/" ]
I would like to convert the below "foreach" statement to a LINQ query that returns a substring of the file name into a list: ``` IList<string> fileNameSubstringValues = new List<string>(); //Find all assemblies with mapping files. ICollection<FileInfo> files = codeToGetFileListGoesHere; //Parse the file name to get ...
Try something like this: ``` var fileList = files.Select(file => file.Name.Substring(0, file.Name.Length - (file.Name.Length - file.Name.IndexOf(".config.xml")))) .ToList(); ```
418,197
<p>Assuming I have a class A as follows:</p> <pre><code>class A{ int id; int getId(){}; void setId(int id){}; } </code></pre> <p>And a class B as follows:</p> <pre><code>@Entity @Table(name="B") class B extends A{ string name; @Column(length=20) string getName(){} void setName(){} } </code></pr...
[ { "answer_id": 418214, "author": "Dave L.", "author_id": 3093, "author_profile": "https://Stackoverflow.com/users/3093", "pm_score": 4, "selected": true, "text": "<p>Assuming you don't want the superclass itself to represent an entity, you can use <code>@MappedSuperclass</code> on the su...
2009/01/06
[ "https://Stackoverflow.com/questions/418197", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17337/" ]
Assuming I have a class A as follows: ``` class A{ int id; int getId(){}; void setId(int id){}; } ``` And a class B as follows: ``` @Entity @Table(name="B") class B extends A{ string name; @Column(length=20) string getName(){} void setName(){} } ``` How can I annotate the inherited id field ...
Assuming you don't want the superclass itself to represent an entity, you can use `@MappedSuperclass` on the super class to have subclasses inherit the properties for persistence: ``` @MappedSuperclass class A{ int id; @Id int getId(){}; void setId(int id){}; } ``` Consider making the superclass abstract...
418,204
<p>How to check with python if a path has the sticky bit set?</p>
[ { "answer_id": 418240, "author": "Zoredache", "author_id": 20267, "author_profile": "https://Stackoverflow.com/users/20267", "pm_score": 2, "selected": false, "text": "<p><a href=\"http://docs.python.org/library/os.html#os.stat\" rel=\"nofollow noreferrer\">os.stat()</a> will return a tu...
2009/01/06
[ "https://Stackoverflow.com/questions/418204", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36131/" ]
How to check with python if a path has the sticky bit set?
``` import os def is_sticky(path): return os.stat(path).st_mode & 01000 == 01000 ```
418,210
<p>What are the things I should be looking for when I produce a dependency graph?</p> <p>Or to put it another way, what are the characteristics of a good looking graph vs a bad one?</p> <p>Edit: The context here is my first look at my assemblies in NDepend.</p>
[ { "answer_id": 418241, "author": "Steven A. Lowe", "author_id": 9345, "author_profile": "https://Stackoverflow.com/users/9345", "pm_score": 1, "selected": false, "text": "<p>a dependency graph of what? classes? stored procedures?</p>\n\n<p>cycles are bad...</p>\n" }, { "answer_id...
2009/01/06
[ "https://Stackoverflow.com/questions/418210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
What are the things I should be looking for when I produce a dependency graph? Or to put it another way, what are the characteristics of a good looking graph vs a bad one? Edit: The context here is my first look at my assemblies in NDepend.
The biggest problem you can spot is definitely Dependencies Cycles. The tool NDepend proposes an interactive [dependency Matrix](http://www.ndepend.com/Doc_Matrix.aspx) and a [dependency Graph](http://www.ndepend.com/Doc_VS_Arch.aspx) that will help to spot [dependency cyles](http://www.ndepend.com/Doc_VS_Arch.aspx#Cyc...
418,218
<p>I have a really cool website that allows people to upload images. Sometimes there images are really large, as seen in the below div:</p> <p><code>![Overflow][1]</code></p> <p>Is there a style that can I add to my DIVs to fix this?</p> <p><a href="http://img242.imageshack.us/img242/6711/overflowds1.png" rel="nofo...
[ { "answer_id": 418233, "author": "Joe Phillips", "author_id": 20471, "author_profile": "https://Stackoverflow.com/users/20471", "pm_score": 4, "selected": true, "text": "<p>Set your <a href=\"http://www.w3.org/TR/CSS21/visufx.html#overflow\" rel=\"nofollow noreferrer\">CSS overflow prope...
2009/01/06
[ "https://Stackoverflow.com/questions/418218", "https://Stackoverflow.com", "https://Stackoverflow.com/users/245/" ]
I have a really cool website that allows people to upload images. Sometimes there images are really large, as seen in the below div: `![Overflow][1]` Is there a style that can I add to my DIVs to fix this? [Link](http://img242.imageshack.us/img242/6711/overflowds1.png)
Set your [CSS overflow property](http://www.w3.org/TR/CSS21/visufx.html#overflow) on the div to one of these: ``` overflow: auto; /* Adds scrollbars only when necessary */ overflow: scroll; /* Adds inactive scrollbars until needed, then activates */ overflow: visible; /* Causes the div to expand to fit the content...
418,223
<p>Is it possible to freeze a grid column in Dynamics Ax so that as the user scrolls to the right the first column or two continues to show and doesn't scroll out of view?</p>
[ { "answer_id": 418233, "author": "Joe Phillips", "author_id": 20471, "author_profile": "https://Stackoverflow.com/users/20471", "pm_score": 4, "selected": true, "text": "<p>Set your <a href=\"http://www.w3.org/TR/CSS21/visufx.html#overflow\" rel=\"nofollow noreferrer\">CSS overflow prope...
2009/01/06
[ "https://Stackoverflow.com/questions/418223", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2404/" ]
Is it possible to freeze a grid column in Dynamics Ax so that as the user scrolls to the right the first column or two continues to show and doesn't scroll out of view?
Set your [CSS overflow property](http://www.w3.org/TR/CSS21/visufx.html#overflow) on the div to one of these: ``` overflow: auto; /* Adds scrollbars only when necessary */ overflow: scroll; /* Adds inactive scrollbars until needed, then activates */ overflow: visible; /* Causes the div to expand to fit the content...
418,230
<p>I'm trying to implement <a href="http://msdn.microsoft.com/en-us/library/ms537079(VS.85).aspx" rel="nofollow noreferrer">IInternetZoneManager</a> in .NET with Webbrowser Control but I have no clue what to do.</p> <p>I couldn't find any managed code example about this implementation. I'm pretty bad about OLE stuff.<...
[ { "answer_id": 418259, "author": "Gunny", "author_id": 12830, "author_profile": "https://Stackoverflow.com/users/12830", "pm_score": 0, "selected": false, "text": "<p>I don't know if this helps, but he appears to be using the interface in a C++ app:</p>\n\n<p><a href=\"http://www.codegur...
2009/01/06
[ "https://Stackoverflow.com/questions/418230", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40322/" ]
I'm trying to implement [IInternetZoneManager](http://msdn.microsoft.com/en-us/library/ms537079(VS.85).aspx) in .NET with Webbrowser Control but I have no clue what to do. I couldn't find any managed code example about this implementation. I'm pretty bad about OLE stuff. Can anyone provide a sample on this? I spend a...
This is what I get when I convert it: ``` public class Constants { public const int MAX_PATH = 260; public const int MAX_ZONE_PATH = 260; public const int MAX_ZONE_DESCRIPTION = 200; } [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)] public struct ZONEATTRIBUTES { public uint cbSize; ...
418,265
<p>This pertains to C# &amp; the .NET Framework specifically.</p> <p>It's best practice not to initialize the following types in the .NET framework because the CLR initializes them for you:</p> <p>int, bool, etc.</p> <p>and same for setting an object to null (I believe).</p> <p>For example you do not need to do th...
[ { "answer_id": 418277, "author": "Rob Prouse", "author_id": 30827, "author_profile": "https://Stackoverflow.com/users/30827", "pm_score": 0, "selected": false, "text": "<p>Everything is basically zeroed out, so just take it from there. Int/Double/etc 0. String, or other structure, probab...
2009/01/06
[ "https://Stackoverflow.com/questions/418265", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
This pertains to C# & the .NET Framework specifically. It's best practice not to initialize the following types in the .NET framework because the CLR initializes them for you: int, bool, etc. and same for setting an object to null (I believe). For example you do not need to do this and in fact it's a performance h...
If you want a table, MSDN is your friend: [Default Values Table (C# Reference)](http://msdn.microsoft.com/en-us/library/83fhsxwc.aspx)
418,266
<p>I am running through a memory block of binary data byte-wise.</p> <p>Currently I am doing something like this:</p> <pre><code>for (i = 0; i &lt; data-&gt;Count; i++) { byte = &amp;data-&gt;Data[i]; ((*byte &amp; Masks[0]) == Masks[0]) ? Stats.FreqOf1++; // syntax incorrect but you get the point. ((*...
[ { "answer_id": 418281, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 4, "selected": false, "text": "<p>The fastest way is probably to build a lookup table of byte values versus the number of bits set in that byte. At l...
2009/01/06
[ "https://Stackoverflow.com/questions/418266", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51710/" ]
I am running through a memory block of binary data byte-wise. Currently I am doing something like this: ``` for (i = 0; i < data->Count; i++) { byte = &data->Data[i]; ((*byte & Masks[0]) == Masks[0]) ? Stats.FreqOf1++; // syntax incorrect but you get the point. ((*byte & Masks[1]) == Masks[1]) ? Stats....
I did not really understand what you're trying to do. But if you just want to get access to the bits of a bitmap, you can use these (untested!!!) functions: ``` #include <stddef.h> _Bool isbitset(unsigned char * bitmap, size_t idx) { return bitmap[idx / 8] & (1 << (idx % 8)) ? 1 : 0; } void setbit(unsigned char ...
418,270
<p>Dead code is easily recognised and eliminated by having code reviews, however, when it comes to images - unused images still get into our version control. Is there any clean way of organising graphic content so that a direct correlation exists between web pages and image files?</p> <p>In our current project, we use...
[ { "answer_id": 418310, "author": "BCS", "author_id": 1343, "author_profile": "https://Stackoverflow.com/users/1343", "pm_score": 0, "selected": false, "text": "<p>If you have a 1 step build and can test for dead links, then you should be able to write a script that would do a clean check...
2009/01/06
[ "https://Stackoverflow.com/questions/418270", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25210/" ]
Dead code is easily recognised and eliminated by having code reviews, however, when it comes to images - unused images still get into our version control. Is there any clean way of organising graphic content so that a direct correlation exists between web pages and image files? In our current project, we use create ma...
You could walk the website with a crawler (like wget) and remove any image not touched (i.e. not listed in your logs.) A quicker way would be to just dump all the image file names found in your code. ``` grep -o -e \w*?\.png (caution: untested regex) ```
418,280
<p>I'm writing a small shell script that needs to reverse the lines of a text file. Is there a standard filter command to do this sort of thing?</p> <p>My specific application is that I'm getting a list of Git commit identifiers, and I want to process them in reverse order:</p> <pre><code>git log --pretty=oneline wor...
[ { "answer_id": 418286, "author": "Hynek -Pichi- Vychodil", "author_id": 49197, "author_profile": "https://Stackoverflow.com/users/49197", "pm_score": 5, "selected": false, "text": "<p>Answer is not 42 but <strong><code>tac</code></strong>.</p>\n\n<p><strong>Edit:</strong> Slower but more...
2009/01/06
[ "https://Stackoverflow.com/questions/418280", "https://Stackoverflow.com", "https://Stackoverflow.com/users/893/" ]
I'm writing a small shell script that needs to reverse the lines of a text file. Is there a standard filter command to do this sort of thing? My specific application is that I'm getting a list of Git commit identifiers, and I want to process them in reverse order: ``` git log --pretty=oneline work...master | grep -v ...
In [GNU coreutils](http://www.gnu.org/software/coreutils/), there's [tac(1)](http://www.gnu.org/software/coreutils/manual/coreutils.html#tac-invocation)
418,284
<p>I was wondering the best practice for unit-testing controller actions that utilize model binding.</p> <pre><code>[AcceptVerbs(HttpVerbs.Get)] public ActionResult AddProduct(Product product) { } </code></pre> <p>I was wondering how you invoke the controller's method for unit testing. If you try something like this...
[ { "answer_id": 418404, "author": "Odd", "author_id": 11908, "author_profile": "https://Stackoverflow.com/users/11908", "pm_score": 3, "selected": true, "text": "<p>I'm not sure I understand the problem, why can't you just do this:</p>\n\n<pre><code>[TestMethod()]\npublic void AddProductT...
2009/01/06
[ "https://Stackoverflow.com/questions/418284", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25416/" ]
I was wondering the best practice for unit-testing controller actions that utilize model binding. ``` [AcceptVerbs(HttpVerbs.Get)] public ActionResult AddProduct(Product product) { } ``` I was wondering how you invoke the controller's method for unit testing. If you try something like this... ``` public void Catalo...
I'm not sure I understand the problem, why can't you just do this: ``` [TestMethod()] public void AddProductTest() { CatalogController target = new CatalogController(/*testing variables*/); target.AddProduct(new Product { /* product details for testing */ }); // Test the results } ``` Though I think per...
418,316
<p>I am working on a Word VBA macro app for 80 or so users. The office has high staff turnover, so training suffers, and so one of the self imposed requirements for this project is comprehensive, friendly documentation. However, to supplement this, and to save newbies having to open up a 100 page document when they wan...
[ { "answer_id": 418400, "author": "DJ.", "author_id": 10492, "author_profile": "https://Stackoverflow.com/users/10492", "pm_score": 3, "selected": true, "text": "<p>Is this data entry app or do they just click stuff? Because often the field with focus is different to the item the mouse is...
2009/01/06
[ "https://Stackoverflow.com/questions/418316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51498/" ]
I am working on a Word VBA macro app for 80 or so users. The office has high staff turnover, so training suffers, and so one of the self imposed requirements for this project is comprehensive, friendly documentation. However, to supplement this, and to save newbies having to open up a 100 page document when they want t...
Is this data entry app or do they just click stuff? Because often the field with focus is different to the item the mouse is hovering over, this can cause a lot of confusion. Constantly reading from a file is a huge waste of time and resources - it is much better to load them only once into an array or collection when...
418,318
<p>I have a SQL query that takes a date parameter (if I were to throw it into a function) and I need to run it on every day of the last year.</p> <p>How to generate a list of the last 365 days, so I can use straight-up SQL to do this?</p> <p>Obviously generating a list 0..364 would work, too, since I could always:</p...
[ { "answer_id": 418360, "author": "George Mauer", "author_id": 5056, "author_profile": "https://Stackoverflow.com/users/5056", "pm_score": 2, "selected": false, "text": "<p>Ahahaha, here's a funny way I just came up with to do this:</p>\n\n<pre><code>select SYSDATE - ROWNUM\nfrom shipment...
2009/01/06
[ "https://Stackoverflow.com/questions/418318", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
I have a SQL query that takes a date parameter (if I were to throw it into a function) and I need to run it on every day of the last year. How to generate a list of the last 365 days, so I can use straight-up SQL to do this? Obviously generating a list 0..364 would work, too, since I could always: ``` SELECT SYSDATE...
There's no need to use extra large tables or ALL\_OBJECTS table: ``` SELECT TRUNC (SYSDATE - ROWNUM) dt FROM DUAL CONNECT BY ROWNUM < 366 ``` will do the trick.
418,320
<p>I guess this could also be asked as to how long the created type name is attached to an anonymous type. Here's the issue:</p> <p>A blog had something like this:</p> <pre><code>var anonymousMagic = new {test.UserName}; lblShowText.Text = lblShowText .Text .Format("{UserNa...
[ { "answer_id": 418361, "author": "casperOne", "author_id": 50776, "author_profile": "https://Stackoverflow.com/users/50776", "pm_score": 3, "selected": true, "text": "<p>It never does. The type is generated at compile-time and you can consider it constant and unique throughout the life ...
2009/01/06
[ "https://Stackoverflow.com/questions/418320", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21691/" ]
I guess this could also be asked as to how long the created type name is attached to an anonymous type. Here's the issue: A blog had something like this: ``` var anonymousMagic = new {test.UserName}; lblShowText.Text = lblShowText .Text .Format("{UserName}", test); ``` As ...
It never does. The type is generated at compile-time and you can consider it constant and unique throughout the life of the app-domain. I question the value of this function though. The obvious first reason is because you don't have much of the functionality of the Format method on the String class (no escape for brac...
418,347
<p>On Perl 5.8.5 I am seeing the error listed in the question.</p> <p>I am running these version modules:</p> <ul> <li>Math::BigInt: 1.89</li> <li>Math::BigInt::FastCalc: 0.19</li> <li>Math::BigInt::GMP: 1.24</li> <li>Math::BigInt::Pari: 1.13</li> <li>Math::BigRat: 0.22</li> <li>bignum: 0.22 </li> </ul> <p>The modul...
[ { "answer_id": 419233, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 2, "selected": false, "text": "<p>The simplest solution would probably just to remove Math::BigInt::Pari. GMP should be able to do everything you need.</p>\n...
2009/01/06
[ "https://Stackoverflow.com/questions/418347", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26848/" ]
On Perl 5.8.5 I am seeing the error listed in the question. I am running these version modules: * Math::BigInt: 1.89 * Math::BigInt::FastCalc: 0.19 * Math::BigInt::GMP: 1.24 * Math::BigInt::Pari: 1.13 * Math::BigRat: 0.22 * bignum: 0.22 The module producing the error is Math::Pari. This is all in an attempt to get N...
The simplest solution would probably just to remove Math::BigInt::Pari. GMP should be able to do everything you need. You can also prepend your script with ``` use Math::BigInt only => "GMP"; ``` or something like that (see the Math::BigInt docs) to ensure that calc module is used instead of Math::Pari. Make sure ...
418,366
<p>Is it considered better practice to post back to the same controller that did the rendering and redirecting from original controller if necessary? Or is it just the same if one jumps to different controllers from the view?</p>
[ { "answer_id": 418387, "author": "Odd", "author_id": 11908, "author_profile": "https://Stackoverflow.com/users/11908", "pm_score": 2, "selected": false, "text": "<p>I think that the action that is being called should be contained within a relevant controller for that action. If the view...
2009/01/06
[ "https://Stackoverflow.com/questions/418366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/49632/" ]
Is it considered better practice to post back to the same controller that did the rendering and redirecting from original controller if necessary? Or is it just the same if one jumps to different controllers from the view?
I create two overloaded actions in the controller, one to render the input form using an HTTP GET and the other to process the form post using an HTTP POST. Something like this: ``` public ViewResult Foo() { return View(); } [AcceptVerbs(HttpVerbs.Post)] public ViewResult Foo( FormCollection form ) { ...
418,386
<p>Perl's <a href="http://search.cpan.org/dist/Data-Rmap" rel="nofollow noreferrer">Data::Rmap</a> allows you to recursively evaluate a BLOCK over a list of data structures (locally setting $_ to each element) and return the list composed of the results of such evaluations. $_ can be used to modify the elements.</p> <...
[ { "answer_id": 418397, "author": "Keltia", "author_id": 16143, "author_profile": "https://Stackoverflow.com/users/16143", "pm_score": 1, "selected": false, "text": "<p>Without really looking into details, I'm not sure you need a module for that in Ruby. Iterators and blocks are there to...
2009/01/06
[ "https://Stackoverflow.com/questions/418386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42223/" ]
Perl's [Data::Rmap](http://search.cpan.org/dist/Data-Rmap) allows you to recursively evaluate a BLOCK over a list of data structures (locally setting $\_ to each element) and return the list composed of the results of such evaluations. $\_ can be used to modify the elements. This is useful for iterating over things li...
Ruby's `Enumerable` does everything you want, I think. "... and return the list composed of the results of such evaluations" indicates you want `Enumerable#map`. My first go would be something like this: ``` [ {...}, {...}, {...}, ... ].map do |hash| hash.something do_other_stuff_with(hash) hash ...
418,428
<p>I'm not getting any errors as such just a minor performance issue.</p> <pre><code>EXPLAIN SELECT a.nid, a.title, a.uid, b.parent, b.weight, c.name, d.value FROM table1 AS a INNER JOIN table2 AS b ON a.vid = b.vid AND a.status = 1 INNER JOIN table3 AS c ON c.uid = a.uid INNER JOIN table4 AS d ON d.content_id = a.nid...
[ { "answer_id": 418435, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 4, "selected": true, "text": "<p><code>ALL</code> means all rows, not all columns. Since it says there are no possible keys, I'd guess that you don't have ...
2009/01/06
[ "https://Stackoverflow.com/questions/418428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52214/" ]
I'm not getting any errors as such just a minor performance issue. ``` EXPLAIN SELECT a.nid, a.title, a.uid, b.parent, b.weight, c.name, d.value FROM table1 AS a INNER JOIN table2 AS b ON a.vid = b.vid AND a.status = 1 INNER JOIN table3 AS c ON c.uid = a.uid INNER JOIN table4 AS d ON d.content_id = a.nid AND d.value_t...
`ALL` means all rows, not all columns. Since it says there are no possible keys, I'd guess that you don't have an index on d.content\_id or d.value\_type or d.function. If you wanted to be fancy, you could put an index across all 3 of those columns.
418,467
<p>Say I've got a bunch of files that are all >100 lines long. I'd like to trim off the top 14 lines and the bottom 9 lines, leaving only the lines in the middle. This command will trim off the top fourteen:</p> <pre><code>cat myfile.txt | tail -n +15 </code></pre> <p>Is there another command I can pipe through to ...
[ { "answer_id": 418473, "author": "Jeremy Bourque", "author_id": 2192597, "author_profile": "https://Stackoverflow.com/users/2192597", "pm_score": 0, "selected": false, "text": "<p>The <code>head</code> command should do what you want. It woks just like <code>tail</code> but from the oth...
2009/01/06
[ "https://Stackoverflow.com/questions/418467", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20021/" ]
Say I've got a bunch of files that are all >100 lines long. I'd like to trim off the top 14 lines and the bottom 9 lines, leaving only the lines in the middle. This command will trim off the top fourteen: ``` cat myfile.txt | tail -n +15 ``` Is there another command I can pipe through to trim off the bottom 9 withou...
This will work on OS X and might be a bit more easily understandable than the `sed` example: ``` < myfile.txt tail -n +15 | tail -r | tail -n +10 | tail -r ``` Of course, if you can get your hands on GNU's version of `head`, it can be done even more elegantly: ``` < myfile.txt tail -n +15 | head -n -9 ``` Be awar...
418,497
<p>I need to load an XML file and convert the contents into an object-oriented Python structure. I want to take this:</p> <pre><code>&lt;main&gt; &lt;object1 attr="name"&gt;content&lt;/object&gt; &lt;/main&gt; </code></pre> <p>And turn it into something like this:</p> <pre><code>main main.object1 = "content" mai...
[ { "answer_id": 418534, "author": "RoboDev", "author_id": 20183, "author_profile": "https://Stackoverflow.com/users/20183", "pm_score": 1, "selected": false, "text": "<p>How about this</p>\n\n<p><a href=\"http://evanjones.ca/software/simplexmlparse.html\" rel=\"nofollow noreferrer\">http:...
2009/01/06
[ "https://Stackoverflow.com/questions/418497", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46981/" ]
I need to load an XML file and convert the contents into an object-oriented Python structure. I want to take this: ``` <main> <object1 attr="name">content</object> </main> ``` And turn it into something like this: ``` main main.object1 = "content" main.object1.attr = "name" ``` The XML data will have a more c...
It's worth looking at [`lxml.objectify`](http://lxml.de/objectify.html). ``` xml = """<main> <object1 attr="name">content</object1> <object1 attr="foo">contenbar</object1> <test>me</test> </main>""" from lxml import objectify main = objectify.fromstring(xml) main.object1[0] # content main.object1[1] ...
418,521
<p>We need to poll a web page every 5 minutes and the web page is growing rather large. The web page is a directory listing and we need the last line (to get a file name). What is the best way to get just this last line?</p> <p>(If this was a local file I could position back a little relative to the end of file and ...
[ { "answer_id": 418523, "author": "NotMe", "author_id": 2424, "author_profile": "https://Stackoverflow.com/users/2424", "pm_score": 1, "selected": false, "text": "<p>You have two options:</p>\n\n<ol>\n<li><p>Use chunked encoding. See <a href=\"http://msdn.microsoft.com/en-us/library/aa28...
2009/01/06
[ "https://Stackoverflow.com/questions/418521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
We need to poll a web page every 5 minutes and the web page is growing rather large. The web page is a directory listing and we need the last line (to get a file name). What is the best way to get just this last line? (If this was a local file I could position back a little relative to the end of file and read).
HTTP 1.1 does support a set of headers to request only a particular range of bytes, including support for just the last n bytes of a file (using the "suffix" format). See [here](http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35). For instance, ``` Range: bytes=-1000 ``` for the last 1000 bytes. (Assumi...
418,529
<p>I've gotten to play a single sound in the iPhone app I've started, but I now desire to play multiple sounds based on a button. To create a separate set of .m and .h files for each audio sounds, and then including them all, doesn't seem the most efficient way to tackle this in terms of coding...then again, I'm just s...
[ { "answer_id": 418636, "author": "Dave Swersky", "author_id": 34796, "author_profile": "https://Stackoverflow.com/users/34796", "pm_score": 2, "selected": false, "text": "<p>I don't have any direct experience with iPhone development, but in theory could you create a single large sound fi...
2009/01/06
[ "https://Stackoverflow.com/questions/418529", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I've gotten to play a single sound in the iPhone app I've started, but I now desire to play multiple sounds based on a button. To create a separate set of .m and .h files for each audio sounds, and then including them all, doesn't seem the most efficient way to tackle this in terms of coding...then again, I'm just star...
If the files are MP3 or AAC format, then you can only play one at a time. This is a limitation of core audio on the iPhone. In terms of playing multiple sounds at once, that's easy, just create a new player instance for every one that you want to play (and remember to release them when you're done) ``` NSString *path...
418,545
<p>I'm in need of a C++ (pseudo, i don't care) random number generator that can get me different numbers every time I call the function. This could be simply the way I seed it, maybe there's a better method, but every random generator I've got doesn't generate a new number every time it's called. I've got a need to get...
[ { "answer_id": 418554, "author": "Eclipse", "author_id": 8701, "author_profile": "https://Stackoverflow.com/users/8701", "pm_score": 3, "selected": false, "text": "<p>You only need to seed the generator once with <code>srand()</code> when you start, after that just call the <code>rand()<...
2009/01/06
[ "https://Stackoverflow.com/questions/418545", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48957/" ]
I'm in need of a C++ (pseudo, i don't care) random number generator that can get me different numbers every time I call the function. This could be simply the way I seed it, maybe there's a better method, but every random generator I've got doesn't generate a new number every time it's called. I've got a need to get se...
Sounds like you do it like this: ``` int get_rand() { srand(time(0)); return rand(); } ``` Which would explain why you get the same number within one second. But you have to do it like this: ``` int get_rand() { return rand(); } ``` And call srand *once* at program startup.
418,591
<p>It's been a while since I used GTK+, and the last time I did was in C, not using gtkmm and C++ as I am now. Anyway, I have what I think should be an easy problem to solve:</p> <p>I have a pop-up menu consisting of a list of radio buttons, and when I click one of them I want some action to occur. The code goes lik...
[ { "answer_id": 430541, "author": "jonner", "author_id": 78437, "author_profile": "https://Stackoverflow.com/users/78437", "pm_score": 0, "selected": false, "text": "<p>I don't know exactly what you're trying to accomplish (or what MyClass is and what base classes it inherits from), but c...
2009/01/06
[ "https://Stackoverflow.com/questions/418591", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4323/" ]
It's been a while since I used GTK+, and the last time I did was in C, not using gtkmm and C++ as I am now. Anyway, I have what I think should be an easy problem to solve: I have a pop-up menu consisting of a list of radio buttons, and when I click one of them I want some action to occur. The code goes like this: ```...
You could use sigc::bind to supply the item as a argument to the callback function. ``` pItem->signal_activate().sigc::bind(sigc::mem_fun(*this,&MyClass::on_item_activated),pItem)); ``` Then you can use item->get\_active() in the callback to respond to activations only. ``` void MyClass::on_item_activated(Gtk...
418,596
<p>How do I increment a step value to be processed when the page loads? For example, in the code below the viewstate variable is not incremented until after Page_Load, due to the ASP.NET page lifecycle.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { switch ((int)ViewState["step"]) { ...
[ { "answer_id": 418634, "author": "jcollum", "author_id": 30946, "author_profile": "https://Stackoverflow.com/users/30946", "pm_score": 2, "selected": false, "text": "<p>There's no way around this. Page_Load event will always happen before any control events get fired. If you need to do s...
2009/01/06
[ "https://Stackoverflow.com/questions/418596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29426/" ]
How do I increment a step value to be processed when the page loads? For example, in the code below the viewstate variable is not incremented until after Page\_Load, due to the ASP.NET page lifecycle. ``` protected void Page_Load(object sender, EventArgs e) { switch ((int)ViewState["step"]) { //do some...
Just move the switch statement into an event that happens later. E.g. LoadComplete() or PreRender(). PreRender is probably a bit late, depending on what you want to do.
418,600
<p>How does the transaction scope work? How does it know when there is another context being used already and how might I implement another kind of scope in my code.</p> <p>I'm primarily a vb.net developer but I can read the c# if you write in that.</p> <p>In case the above was too vague:</p> <p>I understand what s...
[ { "answer_id": 418640, "author": "Kieveli", "author_id": 15852, "author_profile": "https://Stackoverflow.com/users/15852", "pm_score": 0, "selected": false, "text": "<p>I'll take a stab, but I'm not 100% sure of the question.</p>\n\n<p>Transactions, in terms of databases, tend to have sc...
2009/01/06
[ "https://Stackoverflow.com/questions/418600", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35331/" ]
How does the transaction scope work? How does it know when there is another context being used already and how might I implement another kind of scope in my code. I'm primarily a vb.net developer but I can read the c# if you write in that. In case the above was too vague: I understand what system.transactions does a...
I suggest the article [Introducing System.Transactions](http://msdn.microsoft.com/en-us/library/ms973865.aspx) by [Juval Lowy](http://www.idesign.net/idesign/DesktopDefault.aspx?tabindex=3&tabid=5)
418,609
<p>Here's an example of the query I'm trying to convert to LINQ:</p> <pre><code>SELECT * FROM Users WHERE Users.lastname LIKE '%fra%' AND Users.Id IN ( SELECT UserId FROM CompanyRolesToUsers WHERE CompanyRoleId in (2,3,4) ) </code></pre> <p>There is a FK relationship between <code>Com...
[ { "answer_id": 418638, "author": "Noah", "author_id": 47496, "author_profile": "https://Stackoverflow.com/users/47496", "pm_score": 3, "selected": false, "text": "<p>This is how I've been doing subqueries in LINQ, I think this should get what you want. You can replace the explicit Compan...
2009/01/06
[ "https://Stackoverflow.com/questions/418609", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52236/" ]
Here's an example of the query I'm trying to convert to LINQ: ``` SELECT * FROM Users WHERE Users.lastname LIKE '%fra%' AND Users.Id IN ( SELECT UserId FROM CompanyRolesToUsers WHERE CompanyRoleId in (2,3,4) ) ``` There is a FK relationship between `CompanyRolesToUsers` and `Users`, ...
Here's a subquery for you! ``` List<int> IdsToFind = new List<int>() {2, 3, 4}; db.Users .Where(u => SqlMethods.Like(u.LastName, "%fra%")) .Where(u => db.CompanyRolesToUsers .Where(crtu => IdsToFind.Contains(crtu.CompanyRoleId)) .Select(crtu => crtu.UserId) .Contains(u.Id) ) ``` --- Regarding this...
418,622
<p>For various reasons, I'm stuck in Access 97 and need to get only the path part of a full pathname.</p> <p>For example, the name</p> <pre><code>c:\whatever dir\another dir\stuff.mdb </code></pre> <p>should become</p> <pre><code>c:\whatever dir\another dir\ </code></pre> <p>This site has some suggestions on how t...
[ { "answer_id": 419224, "author": "John Mo", "author_id": 38988, "author_profile": "https://Stackoverflow.com/users/38988", "pm_score": 5, "selected": false, "text": "<p>I always used the <code>FileSystemObject</code> for this sort of thing. Here's a little wrapper function I used. Be sur...
2009/01/06
[ "https://Stackoverflow.com/questions/418622", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42219/" ]
For various reasons, I'm stuck in Access 97 and need to get only the path part of a full pathname. For example, the name ``` c:\whatever dir\another dir\stuff.mdb ``` should become ``` c:\whatever dir\another dir\ ``` This site has some suggestions on how to do it: <http://www.ammara.com/access_image_faq/parse_p...
You can do something simple like: `Left(path, InStrRev(path, "\"))` Example: ``` Function GetDirectory(path) GetDirectory = Left(path, InStrRev(path, Application.PathSeparator)) End Function ```
418,650
<p>In an oscommerce site I have the following:</p> <p>Server response = Content-type: text/html;charset=UTF-8</p> <p>and I want: Content-type: text/html;charset=ISO-8859-1</p> <p>How and where do I set this up. </p> <hr> <p>Html looks like this on the page:</p> <pre><code>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HT...
[ { "answer_id": 419224, "author": "John Mo", "author_id": 38988, "author_profile": "https://Stackoverflow.com/users/38988", "pm_score": 5, "selected": false, "text": "<p>I always used the <code>FileSystemObject</code> for this sort of thing. Here's a little wrapper function I used. Be sur...
2009/01/06
[ "https://Stackoverflow.com/questions/418650", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30600/" ]
In an oscommerce site I have the following: Server response = Content-type: text/html;charset=UTF-8 and I want: Content-type: text/html;charset=ISO-8859-1 How and where do I set this up. --- Html looks like this on the page: ``` <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html dir="LTR" lan...
You can do something simple like: `Left(path, InStrRev(path, "\"))` Example: ``` Function GetDirectory(path) GetDirectory = Left(path, InStrRev(path, Application.PathSeparator)) End Function ```
418,674
<p>In PHP you have the create_function() function which creates a unique named lambda function like this:</p> <pre><code>$myFunction = create_function('$foo', 'return $foo;'); $myFunction('bar'); //Returns bar </code></pre> <p>Is this actually any better (apart from being more easy) then just doing:</p> <pre><code>...
[ { "answer_id": 418685, "author": "Salty", "author_id": 50548, "author_profile": "https://Stackoverflow.com/users/50548", "pm_score": 2, "selected": false, "text": "<p>Personally, I've found that create_function() is extremely handy when sorting arrays.</p>\n\n<p>In fact, I just searched ...
2009/01/06
[ "https://Stackoverflow.com/questions/418674", "https://Stackoverflow.com", "https://Stackoverflow.com/users/35197/" ]
In PHP you have the create\_function() function which creates a unique named lambda function like this: ``` $myFunction = create_function('$foo', 'return $foo;'); $myFunction('bar'); //Returns bar ``` Is this actually any better (apart from being more easy) then just doing: ``` do{ $myFunction = 'createdFunction_'...
On my understanding of the relevant docs,[1] they both do the same thing, create\_function() just comes up with a unique function name for you. To address some other comments on this question: > > create\_function can be assigned to a variable making the function accessible to other parts of your code, whereas eval ...
418,740
<p>In a makefile, I have the following line:</p> <pre><code>helper.cpp: dtds.h </code></pre> <p>Which ensures that helper.cpp is rebuilt whenever dtds.h is changed. However, I want ALL files in the project to be rebuilt if either of two other header files change, kind like this:</p> <pre><code>*.cpp: h1.h h2.h </cod...
[ { "answer_id": 418723, "author": "BobbyShaftoe", "author_id": 38426, "author_profile": "https://Stackoverflow.com/users/38426", "pm_score": 3, "selected": false, "text": "<p>Well, going by the standard interpretation of TDD is that the tests <em>drive</em> your development. So, in essenc...
2009/01/07
[ "https://Stackoverflow.com/questions/418740", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13500/" ]
In a makefile, I have the following line: ``` helper.cpp: dtds.h ``` Which ensures that helper.cpp is rebuilt whenever dtds.h is changed. However, I want ALL files in the project to be rebuilt if either of two other header files change, kind like this: ``` *.cpp: h1.h h2.h ``` Obviously that won't work, but I don...
Test Case discovery is more of an art than a science. However simple guidelines include: * Code that you know to be frail / weak / likely to break * Follow the user scenario (what your user will be doing) and see how it will touch your code (often this means Debugging it, other times profiling, and other times it simp...
418,741
<p>I'm looking for details on the DEBUG HTTP verb.<br> It's clear to me that this is used for remote debugging - though I'm not even sure if it's for IIS or ASP.NET... </p> <p>If I want to access this interface directly - i.e. not through Visual Studio, but sending these commands manually - what do I need to know? Wh...
[ { "answer_id": 418875, "author": "Brian Schmitt", "author_id": 30492, "author_profile": "https://Stackoverflow.com/users/30492", "pm_score": 0, "selected": false, "text": "<p>If you want to do remote debugging, I would suggest utilizing debug.writeline and the tool from sysinternals <a h...
2009/01/07
[ "https://Stackoverflow.com/questions/418741", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10080/" ]
I'm looking for details on the DEBUG HTTP verb. It's clear to me that this is used for remote debugging - though I'm not even sure if it's for IIS or ASP.NET... If I want to access this interface directly - i.e. not through Visual Studio, but sending these commands manually - what do I need to know? What are the c...
Just for completeness, consolidating here the answers from [what-is-the-non-standard-http-verb-debug-used-for-in-asp-net-iis](https://stackoverflow.com/questions/2244293/what-is-the-non-standard-http-verb-debug-used-for-in-asp-net-iis/2278934): (thanks @Mark, @Jørn). <http://support.microsoft.com/kb/937523> > > Whe...
418,743
<p>I am working with legacy systems at the moment, and a lot of work involves breaking up delimited strings and testing against certain rules.</p> <p>With this string, how could I return "Active" in a back reference and search terms, stopping when it hits the first caret (^)?:<br /></p> <pre><code>Active^20080505^900...
[ { "answer_id": 418745, "author": "Gordon Wilson", "author_id": 23071, "author_profile": "https://Stackoverflow.com/users/23071", "pm_score": 4, "selected": true, "text": "<pre><code>(.+?)\\^\n</code></pre>\n\n<p>Should grab up to the first ^</p>\n\n<p>If you have to include <code>(.+)</c...
2009/01/07
[ "https://Stackoverflow.com/questions/418743", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41211/" ]
I am working with legacy systems at the moment, and a lot of work involves breaking up delimited strings and testing against certain rules. With this string, how could I return "Active" in a back reference and search terms, stopping when it hits the first caret (^)?: ``` Active^20080505^900^LT^100 ``` Can it be d...
``` (.+?)\^ ``` Should grab up to the first ^ If you have to include `(.+)` w/o modifications you could use this: ``` (.+?)\^(.+) ``` The first backreference will still be the correct one and you can ignore the second.
418,749
<p>I have an ASM script that displays date(day, month, year) and time(hours, minutes, seconds).</p> <p>This prints the current datetime on the DOS-box. Thing is, it's static. What I want to do is make it dynamic, meaning I have to write the new value in the exact place where the current value is standing on the screen...
[ { "answer_id": 418997, "author": "Sparr", "author_id": 13675, "author_profile": "https://Stackoverflow.com/users/13675", "pm_score": 0, "selected": false, "text": "<p>If your DOS-box is COMMAND.COM, or CMD.EXE prior to Windows 2000 (newer CMD.EXE do not offer ANSI support), then it will ...
2009/01/07
[ "https://Stackoverflow.com/questions/418749", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11795/" ]
I have an ASM script that displays date(day, month, year) and time(hours, minutes, seconds). This prints the current datetime on the DOS-box. Thing is, it's static. What I want to do is make it dynamic, meaning I have to write the new value in the exact place where the current value is standing on the screen. How do y...
Use the ASM code to position your cursor before printing your string. For example: ``` MOV DX,1629H ; (LINE 16H, COL 29H) MOV AH,2 ; Move cursor to DH,DL INT 10H ; now print your string ```
418,764
<p>Not entirely sure how to phrase the question, because it's a "why doesn't this work?" type of query.</p> <p>I've reduced my particular issue down to this code:</p> <pre><code>public interface IFoo { } public class Foo : IFoo { } public class Bar&lt;T&gt; where T : IFoo { public Bar(T t) { } publ...
[ { "answer_id": 418776, "author": "Timothy Carter", "author_id": 4660, "author_profile": "https://Stackoverflow.com/users/4660", "pm_score": 2, "selected": false, "text": "<p>If you create a class Baz and then the generic type Bar baz = new Bar(), new Foo() as defined by your constructor ...
2009/01/07
[ "https://Stackoverflow.com/questions/418764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615/" ]
Not entirely sure how to phrase the question, because it's a "why doesn't this work?" type of query. I've reduced my particular issue down to this code: ``` public interface IFoo { } public class Foo : IFoo { } public class Bar<T> where T : IFoo { public Bar(T t) { } public Bar() : this(new...
You could also have a Fiz that implements IFoo that is not related to Foo in any other way: ``` public interface IFoo { } public class Foo : IFoo { } public class Fiz : IFoo { } Foo foo = new Foo(); Fiz fiz = foo; // Not gonna compile. ``` What you want is probably more like: ``` public class Bar<T> where T : IF...
418,765
<p>I have rows of text data that can vary between 0 and 100, and all need to be visible on the screen at one time. The default behavior is fine for the grid until the rows * rowHeight > gridHeight.</p> <p>Basically I need a hook into the item height, or row height to calculate it based on the height of the grid. I'v...
[ { "answer_id": 419872, "author": "inferis", "author_id": 51998, "author_profile": "https://Stackoverflow.com/users/51998", "pm_score": 1, "selected": false, "text": "<p>You might want to look at the DataGrid.variableRowHeight property as, when this is set to false (the default) all rows ...
2009/01/07
[ "https://Stackoverflow.com/questions/418765", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have rows of text data that can vary between 0 and 100, and all need to be visible on the screen at one time. The default behavior is fine for the grid until the rows \* rowHeight > gridHeight. Basically I need a hook into the item height, or row height to calculate it based on the height of the grid. I've set paddi...
Thank you inferis, that helped me a lot. This is my final grid component. It's not really self contained because of a few call-outs, but if it helps someone else get theirs to work, great! ``` <?xml version="1.0" encoding="utf-8"?> <mx:DataGrid xmlns:mx="http://www.adobe.com/2006/mxml" paddingTop="-3" paddingBottom="-...
418,792
<pre><code>Mac OS 10.4 rspec (1.1.11, 1.1.4, 1.1.3, 0.5.15) rspec-rails (1.1.11) rspec_generator (0.5.15) rails 2.2.2 ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0] </code></pre> <p>Created a new project...</p> <pre><code>$ rails myproject </code></pre> <p>Installed rspec into the project...</p> <pre><c...
[ { "answer_id": 428132, "author": "Mihai A", "author_id": 4212, "author_profile": "https://Stackoverflow.com/users/4212", "pm_score": 4, "selected": true, "text": "<p>It seems to work for me.\nI have installed <em>rspec-rails</em>, runned the rspec generator and when I give </p>\n\n<pre><...
2009/01/07
[ "https://Stackoverflow.com/questions/418792", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42595/" ]
``` Mac OS 10.4 rspec (1.1.11, 1.1.4, 1.1.3, 0.5.15) rspec-rails (1.1.11) rspec_generator (0.5.15) rails 2.2.2 ruby 1.8.6 (2007-03-13 patchlevel 0) [universal-darwin8.0] ``` Created a new project... ``` $ rails myproject ``` Installed rspec into the project... ``` $ script/generate rspec ``` Generated a resourc...
It seems to work for me. I have installed *rspec-rails*, runned the rspec generator and when I give ``` $ script/generate ``` I get the list of generators: > > Installed Generators > Rubygems: rspec, rspec\_controller, rspec\_model, rspec\_scaffold > Builtin: controller, integration\_test, mailer, migration, mo...
418,799
<p>I'm learning JavaScript and while browsing through the jQuery library I see <code>:</code> (colon) being used a lot. What is this used for in JavaScript? </p> <pre><code>// Return an array of filtered elements (r) // and the modified expression string (t) return { r: r, t: t }; </code></pre>
[ { "answer_id": 418805, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": 9, "selected": true, "text": "<pre><code>var o = {\n r: 'some value',\n t: 'some other value'\n};\n</code></pre>\n\n<p>is functionally equivalent...
2009/01/07
[ "https://Stackoverflow.com/questions/418799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17744/" ]
I'm learning JavaScript and while browsing through the jQuery library I see `:` (colon) being used a lot. What is this used for in JavaScript? ``` // Return an array of filtered elements (r) // and the modified expression string (t) return { r: r, t: t }; ```
``` var o = { r: 'some value', t: 'some other value' }; ``` is functionally equivalent to ``` var o = new Object(); o.r = 'some value'; o.t = 'some other value'; ```
418,822
<p>My application is currently displaying negative numbers as -1. The users have changed the requirements (just for a change!) and now we will have to display the numbers as (1). Can I enable that for the whole application say changing the web.config or even the app's CultureInfo ? Is there any side effect of doing tha...
[ { "answer_id": 418826, "author": "Esteban Araya", "author_id": 781, "author_profile": "https://Stackoverflow.com/users/781", "pm_score": -1, "selected": false, "text": "<p>You could always write your own custom ToString() method as an extension method, but like you mention, using Culture...
2009/01/07
[ "https://Stackoverflow.com/questions/418822", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14401/" ]
My application is currently displaying negative numbers as -1. The users have changed the requirements (just for a change!) and now we will have to display the numbers as (1). Can I enable that for the whole application say changing the web.config or even the app's CultureInfo ? Is there any side effect of doing that s...
For currency it is really easy: ``` String.Format("{0:C}", value) ``` This will use the culture info for the system. For normal numbers being data bound, use [Mark Glorie's sample](https://stackoverflow.com/questions/418822/asp-net-negative-numbers-in-parenthesis#419012). [MSDN Article](http://msdn.microsoft.com/e...
418,842
<p>Is there a proper way yet to unit test views with the aspx view engine?</p> <p>I've been playing with various ways that will let me get a parseable string as a result like :</p> <pre><code>view.RenderView(viewContext); </code></pre> <p>But I'm not having any luck so far.</p> <p>Most of what I've read strays into...
[ { "answer_id": 418871, "author": "Mark Brittingham", "author_id": 15592, "author_profile": "https://Stackoverflow.com/users/15592", "pm_score": 0, "selected": false, "text": "<p>What I have done is to create objects to \"drive\" the user interface and placed them all into a \"BusinessObj...
2009/01/07
[ "https://Stackoverflow.com/questions/418842", "https://Stackoverflow.com", "https://Stackoverflow.com/users/407256/" ]
Is there a proper way yet to unit test views with the aspx view engine? I've been playing with various ways that will let me get a parseable string as a result like : ``` view.RenderView(viewContext); ``` But I'm not having any luck so far. Most of what I've read strays into integration test territory. Integration...
My advice is to not bother. Stick to testing the model and the controller. Checking for specific HTML is only going to lead to a fragile test base, that will break the moment you make the slightest change to the layout.
418,845
<p>I have a method that is meant to display output on a RichTextBox in a form.</p> <pre><code> public void LogTextEvent(RichTextBox TextEventLog, Color TextColor, string EventText) { string nDateTime = DateTime.Now.ToString("hh:mm:ss tt") + " - "; // color text. TextEventLog.SelectionSt...
[ { "answer_id": 418866, "author": "yfeldblum", "author_id": 12349, "author_profile": "https://Stackoverflow.com/users/12349", "pm_score": -1, "selected": false, "text": "<pre><code>new Thread(new ThreadStart(delegate {\n //do some worker-thread processing here\n ...\n //now updat...
2009/01/07
[ "https://Stackoverflow.com/questions/418845", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a method that is meant to display output on a RichTextBox in a form. ``` public void LogTextEvent(RichTextBox TextEventLog, Color TextColor, string EventText) { string nDateTime = DateTime.Now.ToString("hh:mm:ss tt") + " - "; // color text. TextEventLog.SelectionStart = TextEven...
Try something like this: ``` public void LogTextEvent(RichTextBox TextEventLog, Color TextColor, string EventText) { if (TextEventLog.InvokeRequired) { TextEventLog.BeginInvoke(new Action(delegate { LogTextEvent(TextEventLog, TextColor, EventText); })); return; } st...
418,878
<p><a href="https://stackoverflow.com/questions/417261/vbc-nant-error-compiling-winform">To an earlier question of mine, invovling VBC and NAnt with WinForms</a>, I have since come up with a better way of stating this.</p> <p>Within vbproj file, you have the following:</p> <pre><code>&lt;ItemGroup&gt; &lt;None Incl...
[ { "answer_id": 419074, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 3, "selected": true, "text": "<p>The problem with looking at the build string within visual studio is that it's not actually calling vbc.exe to build fr...
2009/01/07
[ "https://Stackoverflow.com/questions/418878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8505/" ]
[To an earlier question of mine, invovling VBC and NAnt with WinForms](https://stackoverflow.com/questions/417261/vbc-nant-error-compiling-winform), I have since come up with a better way of stating this. Within vbproj file, you have the following: ``` <ItemGroup> <None Include="My Project\Settings.settings"> <...
The problem with looking at the build string within visual studio is that it's not actually calling vbc.exe to build from visual studio. All builds in visual studio happen with the in-memory compiler instead of the command line compiler (true for C# as well). The command that looks like vbc.exe ... is a generated str...
418,887
<p>I have a pointer to pointer array. I am assigning each row in the while loop below and the printf inside the while loop shows each is assigned my id number 1-20.<br> After, out side of the while loop I iterate through the array and every element is written with id 20?<br> Any help is greatly appreciated. (FYI- I am ...
[ { "answer_id": 422615, "author": "PiNoYBoY82", "author_id": 13646, "author_profile": "https://Stackoverflow.com/users/13646", "pm_score": 1, "selected": false, "text": "<p>Well from what I can see right now, you're terminating your tableData at essentially r+2 from your last \"duple\" of...
2009/01/07
[ "https://Stackoverflow.com/questions/418887", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52256/" ]
I have a pointer to pointer array. I am assigning each row in the while loop below and the printf inside the while loop shows each is assigned my id number 1-20. After, out side of the while loop I iterate through the array and every element is written with id 20? Any help is greatly appreciated. (FYI- I am using...
You should create something that actually compiles and reproduces the problem. Not only will it help people help you, but in doing so you may very well find the problem yourself. In your code excerpts we have no idea: * What rc is, how its value is set, or how its value is ever going to change and therefore terminate...
418,894
<p>I'm learning how to write programs in C using the k&amp;r book (The C Programming Language) and I have a problem with one of the exercises. It's asking me to detect and remove a character in string s1, which matches any characters in the string s2.</p> <p>So, say s1 = "A";</p> <p>And s2 = "AABAACAADAAE"</p> <p>I ...
[ { "answer_id": 418917, "author": "PolyThinker", "author_id": 47707, "author_profile": "https://Stackoverflow.com/users/47707", "pm_score": 0, "selected": false, "text": "<p>You don't need a fancy binary search to do the job. What you need is a double for loop that check for occurrence of...
2009/01/07
[ "https://Stackoverflow.com/questions/418894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm learning how to write programs in C using the k&r book (The C Programming Language) and I have a problem with one of the exercises. It's asking me to detect and remove a character in string s1, which matches any characters in the string s2. So, say s1 = "A"; And s2 = "AABAACAADAAE" I want it to return "BCDE" I ...
Great book. If I were you, I would proceed exactly as for the squeeze() in section 2.8, but instead of a direct comparison (s[i] != c) I would write and exploit a function ``` int contains(char s[], int c) ``` which returns 1 if the string s contains c, 0 otherwise. Start with the simple approach; when it works you...
418,896
<p>In bash, calling <code>foo</code> would display any output from that command on the stdout.</p> <p>Calling <code>foo &gt; output</code> would redirect any output from that command to the file specified (in this case 'output').</p> <p>Is there a way to redirect output to a file <em>and</em> have it display on stdou...
[ { "answer_id": 418899, "author": "Zoredache", "author_id": 20267, "author_profile": "https://Stackoverflow.com/users/20267", "pm_score": 12, "selected": true, "text": "<p>The command you want is named <strong><a href=\"http://www.gnu.org/software/coreutils/manual/html_node/tee-invocation...
2009/01/07
[ "https://Stackoverflow.com/questions/418896", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1666/" ]
In bash, calling `foo` would display any output from that command on the stdout. Calling `foo > output` would redirect any output from that command to the file specified (in this case 'output'). Is there a way to redirect output to a file *and* have it display on stdout?
The command you want is named **[`tee`](http://www.gnu.org/software/coreutils/manual/html_node/tee-invocation.html)**: ``` foo | tee output.file ``` For example, if you only care about stdout: ``` ls -a | tee output.file ``` If you want to include stderr, do: ``` program [arguments...] 2>&1 | tee outfile ``` `...
418,898
<p><a href="http://en.wikipedia.org/wiki/Upsert" rel="noreferrer">http://en.wikipedia.org/wiki/Upsert</a></p> <p><a href="https://stackoverflow.com/questions/13540/insert-update-stored-proc-on-sql-server">Insert Update stored proc on SQL Server</a></p> <p>Is there some clever way to do this in SQLite that I have not th...
[ { "answer_id": 418920, "author": "JosephStyons", "author_id": 672, "author_profile": "https://Stackoverflow.com/users/672", "pm_score": 3, "selected": false, "text": "<p>The best approach I know is to do an update, followed by an insert.\nThe \"overhead of a select\" is necessary, but it...
2009/01/07
[ "https://Stackoverflow.com/questions/418898", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18749/" ]
<http://en.wikipedia.org/wiki/Upsert> [Insert Update stored proc on SQL Server](https://stackoverflow.com/questions/13540/insert-update-stored-proc-on-sql-server) Is there some clever way to do this in SQLite that I have not thought of? Basically I want to update three out of four columns if the record exists, If it...
Assuming three columns in the table: ID, NAME, ROLE --- **BAD:** This will insert or replace all columns with new values for ID=1: ``` INSERT OR REPLACE INTO Employee (id, name, role) VALUES (1, 'John Foo', 'CEO'); ``` --- **BAD:** This will insert or replace 2 of the columns... the NAME column will be set to ...
418,913
<p>I was reading the Platform SDK samples, and the examples are in VB.NET. I use C# so I was wondering, how can I replicate this line in C#?</p> <pre><code>Set Installer = CreateObject("WindowsInstaller.Installer") </code></pre> <p>Thank you.</p>
[ { "answer_id": 418930, "author": "OJ.", "author_id": 611, "author_profile": "https://Stackoverflow.com/users/611", "pm_score": 1, "selected": false, "text": "<p>That looks like VB6/VBScript, not VB.NET :) But I might be wrong.</p>\n\n<p>Options are:</p>\n\n<ol>\n<li>Look for the <a href=...
2009/01/07
[ "https://Stackoverflow.com/questions/418913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I was reading the Platform SDK samples, and the examples are in VB.NET. I use C# so I was wondering, how can I replicate this line in C#? ``` Set Installer = CreateObject("WindowsInstaller.Installer") ``` Thank you.
``` using System.Runtime.InteropServices; Type InstallerType; object Installer; InstallerType= Type.GetTypeFromProgID("WindowsInstaller.Installer"); Installer= Activator.CreateInstance(InstallerType); ```
418,915
<p>I'm learning Python, and I have a situation where I want to consume items from an iterator. The tricky part is that under certain conditions, I want to "un-iterate." That is, put an item back onto the front of the iterator before I loop.</p> <p>For example, suppose I'm picking apples from a tree. My fruit basket...
[ { "answer_id": 418946, "author": "Patrick", "author_id": 429, "author_profile": "https://Stackoverflow.com/users/429", "pm_score": 5, "selected": true, "text": "<p>Why bother with unshifting when the else clause should always occur?</p>\n\n<pre><code>for apple in tree:\n if (apple.wei...
2009/01/07
[ "https://Stackoverflow.com/questions/418915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20860/" ]
I'm learning Python, and I have a situation where I want to consume items from an iterator. The tricky part is that under certain conditions, I want to "un-iterate." That is, put an item back onto the front of the iterator before I loop. For example, suppose I'm picking apples from a tree. My fruit basket can only hol...
Why bother with unshifting when the else clause should always occur? ``` for apple in tree: if (apple.weight + basket.weight) > 10: send(basket) basket.clear() basket.add(apple) ``` Anyway, I'm fairly certain that Python doesn't have the sort of behavior you're looking for.
418,916
<p>I have a generated txt file. This file has certain lines that are superfluous, and need to be removed. Each line that requires removal has one of two string in the line; "ERROR" or "REFERENCE". These tokens may appear anywhere in the line. I would like to delete these lines, while retaining all other lines.</p> ...
[ { "answer_id": 418937, "author": "Rob", "author_id": 41908, "author_profile": "https://Stackoverflow.com/users/41908", "pm_score": 3, "selected": false, "text": "<p>If you have sed:</p>\n\n<pre><code>sed -e '/REFERENCE/d' -e '/ERROR/d' [FILENAME]\n</code></pre>\n\n<p>Where <code>FILENAME...
2009/01/07
[ "https://Stackoverflow.com/questions/418916", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51826/" ]
I have a generated txt file. This file has certain lines that are superfluous, and need to be removed. Each line that requires removal has one of two string in the line; "ERROR" or "REFERENCE". These tokens may appear anywhere in the line. I would like to delete these lines, while retaining all other lines. So, if the...
Use the following: ``` type file.txt | findstr /v ERROR | findstr /v REFERENCE ``` This has the advantage of using standard tools in the Windows OS, rather than having to find and install sed/awk/perl and such. See the following transcript for it in operation: ``` C:\>type file.txt Good Line of data bad line of C...
418,935
<p>I was screwing around in psql and renamed the template0 and template1 before realizing their usage. Now, I am getting a "permission denied to copy database 'template1'" from inside psql and form command-line when I try to recreate template1.</p> <p>To save time, is there anything else I need to know about template...
[ { "answer_id": 569590, "author": "Milen A. Radev", "author_id": 15785, "author_profile": "https://Stackoverflow.com/users/15785", "pm_score": 2, "selected": false, "text": "<p>How have you tried \"to recreate template1\"?</p>\n\n<p>The easiest would be to drop the \"template1\" schema an...
2009/01/07
[ "https://Stackoverflow.com/questions/418935", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I was screwing around in psql and renamed the template0 and template1 before realizing their usage. Now, I am getting a "permission denied to copy database 'template1'" from inside psql and form command-line when I try to recreate template1. To save time, is there anything else I need to know about template1 vis a vis...
You have to tell PostGreSQL that `template1` is a template. If you don't, you won't be allowed to copy it if you aren't the owner: ``` UPDATE pg_database SET datistemplate = TRUE WHERE datname = 'template1'; ``` I had to read the source code of `/src/backend/commands/dbcommands.c` (found by Google) to understand tha...
418,983
<p>I'm writing a program as follows:</p> <ul> <li>Find all files with the correct extension in a given directory</li> <li>Foreach, find all occurrences of a given string in those files</li> <li>Print each line</li> </ul> <p>I'd like to write this in a functional way, as a series of generator functions (things that ca...
[ { "answer_id": 419014, "author": "Jesse Pepper", "author_id": 43058, "author_profile": "https://Stackoverflow.com/users/43058", "pm_score": 0, "selected": false, "text": "<p>Assuming those functions are your own, the only thing I can think of is the Visitor pattern, passing in an abstrac...
2009/01/07
[ "https://Stackoverflow.com/questions/418983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/234/" ]
I'm writing a program as follows: * Find all files with the correct extension in a given directory * Foreach, find all occurrences of a given string in those files * Print each line I'd like to write this in a functional way, as a series of generator functions (things that call `yield return` and only return one item...
In a similar vein to other answers, but taking a slightly more generic approach ... ... why not create a *Decorator* class that can wrap an existing IEnumerable implementation and calculate the statistic as it passes other items through. Here's a `Counter` class I just threw together - but you could create variations...
418,984
<p>I am trying to automatically backup my SVN Repository. This is in a batch file I wrote:</p> <pre><code>svnadmin hotcopy C:/myRepository G:/myRepositoryBackup --clean-logs </code></pre> <p>It works great the first time. However, each time after that, I get this error:</p> <pre><code>svnadmin: 'G:/myRepositoryBac...
[ { "answer_id": 419005, "author": "Christian C. Salvadó", "author_id": 5445, "author_profile": "https://Stackoverflow.com/users/5445", "pm_score": 3, "selected": true, "text": "<p>You can use <code>svnadmin dump repo --incremental</code>.</p>\n\n<p>You can find more repository backup info...
2009/01/07
[ "https://Stackoverflow.com/questions/418984", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am trying to automatically backup my SVN Repository. This is in a batch file I wrote: ``` svnadmin hotcopy C:/myRepository G:/myRepositoryBackup --clean-logs ``` It works great the first time. However, each time after that, I get this error: ``` svnadmin: 'G:/myRepositoryBackup' exists and is non-empty ``` How ...
You can use `svnadmin dump repo --incremental`. You can find more repository backup info here: [SVNBook](http://svnbook.red-bean.com/en/1.1/) -> [Chapter 5. Repository Administration](http://svnbook.red-bean.com/en/1.1/ch05.html) -> [Repository Backup](http://svnbook.red-bean.com/en/1.1/ch05s03.html#svn-ch-5-sect-3.6...
419,010
<p>How can you raise an exception when you import a module that is less or greater than a given value for its __version__?</p> <p>There are a lot of different ways you could do it, but I feel like there must be some really simple way that eludes me at the moment. In this case the version number is of the format x.x.x<...
[ { "answer_id": 419035, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 1, "selected": false, "text": "<p>Like this?</p>\n\n<pre><code>assert tuple(map(int,module.__version__.split(\".\"))) &gt;= (1,2), \"Module not version 1....
2009/01/07
[ "https://Stackoverflow.com/questions/419010", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41613/" ]
How can you raise an exception when you import a module that is less or greater than a given value for its \_\_version\_\_? There are a lot of different ways you could do it, but I feel like there must be some really simple way that eludes me at the moment. In this case the version number is of the format x.x.x
Python comes with this inbuilt as part of distutils. The module is called `distutils.version` and is able to compare several different version number formats. ``` from distutils.version import StrictVersion print StrictVersion('1.2.2') > StrictVersion('1.2.1') ``` For way more information than you need, see the doc...
419,019
<p>Is there any way I can separate a <code>List&lt;SomeObject&gt;</code> into several separate lists of <code>SomeObject</code>, using the item index as the delimiter of each split?</p> <p>Let me exemplify:</p> <p>I have a <code>List&lt;SomeObject&gt;</code> and I need a <code>List&lt;List&lt;SomeObject&gt;&gt;</code...
[ { "answer_id": 419036, "author": "Jobo", "author_id": 51915, "author_profile": "https://Stackoverflow.com/users/51915", "pm_score": 2, "selected": false, "text": "<p>If the list is of type system.collections.generic you can use the \"CopyTo\" method available to copy elements of your arr...
2009/01/07
[ "https://Stackoverflow.com/questions/419019", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51500/" ]
Is there any way I can separate a `List<SomeObject>` into several separate lists of `SomeObject`, using the item index as the delimiter of each split? Let me exemplify: I have a `List<SomeObject>` and I need a `List<List<SomeObject>>` or `List<SomeObject>[]`, so that each of these resulting lists will contain a group...
Try the following code. ``` public static List<List<T>> Split<T>(IList<T> source) { return source .Select((x, i) => new { Index = i, Value = x }) .GroupBy(x => x.Index / 3) .Select(x => x.Select(v => v.Value).ToList()) .ToList(); } ``` The idea is to first group the elements by i...
419,021
<p>I am planning to replace repeatedly executed Statement objects with <code>PreparedStatement</code> objects to improve performance. I am using arguments like the MySQL function <code>now()</code>, and string variables. </p> <p>Most of the <code>PreparedStatement</code> queries I have seen contained constant values (...
[ { "answer_id": 419051, "author": "Mark", "author_id": 50262, "author_profile": "https://Stackoverflow.com/users/50262", "pm_score": 5, "selected": true, "text": "<p>If you have variables use the '?'</p>\n\n<pre><code>int temp = 75;\nPreparedStatement pstmt = con.prepareStatement(\n \"...
2009/01/07
[ "https://Stackoverflow.com/questions/419021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48725/" ]
I am planning to replace repeatedly executed Statement objects with `PreparedStatement` objects to improve performance. I am using arguments like the MySQL function `now()`, and string variables. Most of the `PreparedStatement` queries I have seen contained constant values (like `10`, and strings like `"New York"`) a...
If you have variables use the '?' ``` int temp = 75; PreparedStatement pstmt = con.prepareStatement( "UPDATE test SET num = ?, due = now() "); pstmt.setInt(1, temp); pstmt.executeUpdate(): ``` Produces an sql statment that looks like: ``` UPDATE test SET num = 75, due = now(); ```
419,022
<p>Someone here recently pointed out to me in a piece of code of mine I am using </p> <pre><code>char* name = malloc(256*sizeof(char)); // more code free(name); </code></pre> <p>I was under the impression that this way of setting up an array was identical to using </p> <pre><code>char name[256]; </code></pre> <p>an...
[ { "answer_id": 419024, "author": "Lawrence Dol", "author_id": 8946, "author_profile": "https://Stackoverflow.com/users/8946", "pm_score": 2, "selected": false, "text": "<p>This is incorrect - the array declaration does not require a free. Further, if this is within a function, it is all...
2009/01/07
[ "https://Stackoverflow.com/questions/419022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33911/" ]
Someone here recently pointed out to me in a piece of code of mine I am using ``` char* name = malloc(256*sizeof(char)); // more code free(name); ``` I was under the impression that this way of setting up an array was identical to using ``` char name[256]; ``` and that both ways would require the use of free()....
In the first code, the memory is dynamically allocated on the heap. That memory needs to be freed with free(). Its lifetime is arbitrary: it can cross function boundaries, etc. In the second code, the 256 bytes are allocated on the stack, and are automatically reclaimed when the function returns (or at program termina...
419,027
<p>I find myself often needing to use Integer.TryParse to test if a value is an integer. However, when you use TryParse, you have to pass a reference variable to the function, so I find myself always needing to create a blank integer to pass in. Usually it looks something like:</p> <pre><code>Dim tempInt as Integer ...
[ { "answer_id": 419052, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 2, "selected": false, "text": "<p>Try this code. </p>\n\n<pre><code>Module IntegerHelpers\n\n Function IsInteger(ByVal p1 as String) as Boolean\n D...
2009/01/07
[ "https://Stackoverflow.com/questions/419027", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10420/" ]
I find myself often needing to use Integer.TryParse to test if a value is an integer. However, when you use TryParse, you have to pass a reference variable to the function, so I find myself always needing to create a blank integer to pass in. Usually it looks something like: ``` Dim tempInt as Integer If Integer.TryPa...
No need to declare the integer. ``` If Integer.TryParse(intToCheck, 0) Then ``` or ``` If Integer.TryParse(intToCheck, Nothing) Then ``` --- If you have .Net 3.5 ability you can create an extension method for strings. ``` Public Module MyExtensions <System.Runtime.CompilerServices.Extension()> _ Public...
419,044
<p>I have 3 check boxes in each row of 8 total rows. I want to have the third checkbox in each row to get checked only when the first two checkboxes are unchecked. I do not want to write a checkRow() method for each row.</p> <p>What is the best way to go about it?</p> <pre><code>private void checkRow() { for (int...
[ { "answer_id": 419049, "author": "Ed S.", "author_id": 1053, "author_profile": "https://Stackoverflow.com/users/1053", "pm_score": 3, "selected": false, "text": "<p>You should use the same method as the handler for all three delegates.</p>\n\n<pre><code>chkbox.CheckedChanged += new Event...
2009/01/07
[ "https://Stackoverflow.com/questions/419044", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have 3 check boxes in each row of 8 total rows. I want to have the third checkbox in each row to get checked only when the first two checkboxes are unchecked. I do not want to write a checkRow() method for each row. What is the best way to go about it? ``` private void checkRow() { for (int i = 0; i < 8; i++) ...
Assuming you're not using a `DataGridView` or other way of organizing them into logical rows, why don't you do the following: Store the checkboxes in an array so you have easy access to them. ``` CheckBox[,] checkArray = new CheckBox[8,3]... ``` Store the row index in the `Tag` property of the first and second ch...
419,071
<p>I've just discovered, to my embarrassment, that feeding negative exponents to <code>mpz_pow_ui</code> doesn't work very well. ("The manual does say unsigned long, you know.") For the other <code>mpz_pow</code> functions, the manual uses concepts I don't understand. For example "<em>base</em>^<em>exp</em> mod <em>mod...
[ { "answer_id": 419083, "author": "paxdiablo", "author_id": 14860, "author_profile": "https://Stackoverflow.com/users/14860", "pm_score": 3, "selected": false, "text": "<p>I won't cut the code for you but I will make you aware that:</p>\n\n<p><code>2<sup>-n</sup> = <sup>1</sup>/<sub>2<sup...
2009/01/07
[ "https://Stackoverflow.com/questions/419071", "https://Stackoverflow.com", "https://Stackoverflow.com/users/426/" ]
I've just discovered, to my embarrassment, that feeding negative exponents to `mpz_pow_ui` doesn't work very well. ("The manual does say unsigned long, you know.") For the other `mpz_pow` functions, the manual uses concepts I don't understand. For example "*base*^*exp* mod *mod*" in the following: ``` void mpz_powm (m...
The `mpz_t` data type can only store integers, and 2-18 is not an integer. To calculate that, you'll have to use the floating-point type [`mpf_t`](http://gmplib.org/manual/Floating_002dpoint-Functions.html#Floating_002dpoint-Functions) or the rational number type [`mpq_t`](http://gmplib.org/manual/Rational-Number-Funct...
419,094
<p>I have a number of files which I combine and pack to produce a single, minified JS file. The problem is that when I minify the file (using <a href="http://dean.edwards.name/packer/" rel="nofollow noreferrer">packer</a>), IE6 gives one of its characteristic helpful error messages.</p> <pre><code>Line: 12 // of ...
[ { "answer_id": 419106, "author": "Jobo", "author_id": 51915, "author_profile": "https://Stackoverflow.com/users/51915", "pm_score": 1, "selected": false, "text": "<p>Microsoft have their way of doing it:</p>\n\n<p><a href=\"http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx\" rel=\"...
2009/01/07
[ "https://Stackoverflow.com/questions/419094", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9021/" ]
I have a number of files which I combine and pack to produce a single, minified JS file. The problem is that when I minify the file (using [packer](http://dean.edwards.name/packer/)), IE6 gives one of its characteristic helpful error messages. ``` Line: 12 // of course, line 12 is an empty line Char: 1 Error: Exp...
Microsoft have their way of doing it: <http://blogs.msdn.com/ie/archive/2004/10/26/247912.aspx> <http://www.jonathanboutelle.com/mt/archives/2006/01/howto_debug_jav.html>
419,095
<p>Have a gridview control and i want to display checkboxes for each row. The checkboxes should only appear if Session["DisplayBox"] == true.</p> <pre><code>&lt;asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" EnableSortingAndPagingCallbacks="True" AllowPaging="True" DataSourceID="JObjectDataS...
[ { "answer_id": 419162, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 0, "selected": false, "text": "<p>You want to set the Visible property based on the value of the session variable. Add something like the following (...
2009/01/07
[ "https://Stackoverflow.com/questions/419095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38230/" ]
Have a gridview control and i want to display checkboxes for each row. The checkboxes should only appear if Session["DisplayBox"] == true. ``` <asp:GridView ID="gridView" runat="server" AutoGenerateColumns="False" EnableSortingAndPagingCallbacks="True" AllowPaging="True" DataSourceID="JObjectDataSource" PageSize="...
Add a callback handler for the OnDataBind event of the GridView. Then on each row, determine whether or not to show the checkbox. The code will of course be in your *.cs* file.
419,117
<p>Refer to this post compile a Xcode project in command line <a href="https://stackoverflow.com/questions/377992/building-xcode-projects-from-the-command-line">Building Qt Xcode Projects From the Command Line</a> the QMAKESPEC variable was unable to set to macx-g++. </p> <p>I was doing like this in terminal <code>QMA...
[ { "answer_id": 419225, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 3, "selected": true, "text": "<p>You forgot to export that variable.</p>\n\n<p>Under bash:</p>\n\n<pre><code>export QMAKESPEC=macx-g++\n</code></pre>\n"...
2009/01/07
[ "https://Stackoverflow.com/questions/419117", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Refer to this post compile a Xcode project in command line [Building Qt Xcode Projects From the Command Line](https://stackoverflow.com/questions/377992/building-xcode-projects-from-the-command-line) the QMAKESPEC variable was unable to set to macx-g++. I was doing like this in terminal `QMAKESPEC=macx-g++` but this ...
You forgot to export that variable. Under bash: ``` export QMAKESPEC=macx-g++ ```
419,122
<p>I am the lead developer on a commercial Windows app (c#). A new requirement is to track customers who abuse the license.</p> <p>For example: Let's say a customer purchases a 10 user license agreement, i.e. 10 simultaneous users at any given time.</p> <p>I need to be able to report, looking back at history, all th...
[ { "answer_id": 419143, "author": "Bevan", "author_id": 30280, "author_profile": "https://Stackoverflow.com/users/30280", "pm_score": -1, "selected": false, "text": "<p>The problem with having a table structure of (LogId, UserId, LoginDateTime, LogoutDateTime) is that it becomes difficult...
2009/01/07
[ "https://Stackoverflow.com/questions/419122", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52212/" ]
I am the lead developer on a commercial Windows app (c#). A new requirement is to track customers who abuse the license. For example: Let's say a customer purchases a 10 user license agreement, i.e. 10 simultaneous users at any given time. I need to be able to report, looking back at history, all the times that custo...
Think about starting and ending sessions as events that need to be recorded. You create a single table to record these events. So, a session that starts and ends will have two entries in the table - one for the session start and one for the session end. You only ever add records to the table, never modifying previous ...
419,127
<p>Out of the box, System.Web.Security.Membership implements a couple of search methods:</p> <ul> <li>FindUsersByEmail</li> <li>FindUsersByName</li> </ul> <p>I'm using the <a href="http://www.codeplex.com/AspNetWSAT" rel="nofollow noreferrer">WSAT project from CodePlex</a> to administer my Membership database. The to...
[ { "answer_id": 422431, "author": "George Durzi", "author_id": 36057, "author_profile": "https://Stackoverflow.com/users/36057", "pm_score": 3, "selected": true, "text": "<p>Got some help from a colleague who's good with linq. The challenge here is that MembershipUserCollection doesn't im...
2009/01/07
[ "https://Stackoverflow.com/questions/419127", "https://Stackoverflow.com", "https://Stackoverflow.com/users/36057/" ]
Out of the box, System.Web.Security.Membership implements a couple of search methods: * FindUsersByEmail * FindUsersByName I'm using the [WSAT project from CodePlex](http://www.codeplex.com/AspNetWSAT) to administer my Membership database. The tool implements extra profile properties in a ProfileCommon class. Let's...
Got some help from a colleague who's good with linq. The challenge here is that MembershipUserCollection doesn't implement IEnumerable< T > (!). ``` List<MembershipUser> searchResults = allUsers.Where(user => Profile.GetProfile(user.UserName).Firm.ToLowerInvariant() .Contains(firmName.ToLower...
419,144
<p>In the following jQuery JavaScript code, what value does the parameter "e" take on within the function? I'm having difficulty understanding this because this function cannot be passed an argument elsewhere in the code so how would having a parameter work? And how would I use parameters in such functions that are not...
[ { "answer_id": 419148, "author": "Jeff M", "author_id": 49758, "author_profile": "https://Stackoverflow.com/users/49758", "pm_score": 4, "selected": true, "text": "<p><code>click</code> sets the event handler. The click handler gets called by the browser when the event occurs, and the <...
2009/01/07
[ "https://Stackoverflow.com/questions/419144", "https://Stackoverflow.com", "https://Stackoverflow.com/users/140378/" ]
In the following jQuery JavaScript code, what value does the parameter "e" take on within the function? I'm having difficulty understanding this because this function cannot be passed an argument elsewhere in the code so how would having a parameter work? And how would I use parameters in such functions that are not na...
`click` sets the event handler. The click handler gets called by the browser when the event occurs, and the `e` parameter contains information about that event. For keypress events, it contains which keys were pressed and what modifiers were pressed at that time (shift, control, etc.). For mouse events, it contains t...
419,163
<p>What does this do, and why should one include the <code>if</code> statement?</p> <pre class="lang-py prettyprint-override"><code>if __name__ == &quot;__main__&quot;: print(&quot;Hello, World!&quot;) </code></pre> <hr /> <p><sub>If you are trying to close a question where someone should be using this idiom and is...
[ { "answer_id": 419174, "author": "Harley Holcombe", "author_id": 1057, "author_profile": "https://Stackoverflow.com/users/1057", "pm_score": 7, "selected": false, "text": "<p><code>if __name__ == \"__main__\"</code> is the part that runs when the script is run from (say) the command line...
2009/01/07
[ "https://Stackoverflow.com/questions/419163", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51518/" ]
What does this do, and why should one include the `if` statement? ```py if __name__ == "__main__": print("Hello, World!") ``` --- If you are trying to close a question where someone should be using this idiom and isn't, consider closing as a duplicate of [Why is Python running my module when I import it, and ho...
Short Answer ============ It's boilerplate code that protects users from accidentally invoking the script when they didn't intend to. Here are some common problems when the guard is omitted from a script: * If you import the guardless script in another script (e.g. `import my_script_without_a_name_eq_main_guard`), th...
419,175
<p>Im creating a stored procedure/function in MS SQL which should return the missing series.</p> <p>Example:</p> <p>the table "orders" contain field name "ordNo".</p> <p>ordNo</p> <p>000001</p> <p>000003</p> <p>000005</p> <p>the functions should return these values:</p> <p>000002</p> <p>000004</p> <p>any idea...
[ { "answer_id": 419178, "author": "Jobo", "author_id": 51915, "author_profile": "https://Stackoverflow.com/users/51915", "pm_score": 0, "selected": false, "text": "<p>the pseudo code for it goes like this:</p>\n\n<p>1.start at 00001</p>\n\n<p>2.Increment by 1 and check if this exists in t...
2009/01/07
[ "https://Stackoverflow.com/questions/419175", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Im creating a stored procedure/function in MS SQL which should return the missing series. Example: the table "orders" contain field name "ordNo". ordNo 000001 000003 000005 the functions should return these values: 000002 000004 any idea? thank you very much.
What about something simple like: ``` SELECT ordNo - 1 FROM Orders o WHERE NOT EXISTS ( SELECT * FROM Orders n WHERE n.ordNo = o.OrdNo - 1 ) AND ordNo > 1 ``` **Edit:** Ah - this won't find missing "runs" in the series though. Only single missing numbers. Here's a version which I think will at l...
419,184
<p>On Android phones SMS messages registered to applications also get sent to the device's inbox. However to prevent clutter, it'd be nice to be able to remove application specific SMS messages from the inbox to reduce the potential overflow of those messages.</p> <p>Questions on other Google groups on getting a defi...
[ { "answer_id": 426021, "author": "Neil", "author_id": 52115, "author_profile": "https://Stackoverflow.com/users/52115", "pm_score": 3, "selected": false, "text": "<p>You'll need to find the <a href=\"http://groups.google.com/group/android-developers/browse_thread/thread/23068c27b99141b2/...
2009/01/07
[ "https://Stackoverflow.com/questions/419184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52302/" ]
On Android phones SMS messages registered to applications also get sent to the device's inbox. However to prevent clutter, it'd be nice to be able to remove application specific SMS messages from the inbox to reduce the potential overflow of those messages. Questions on other Google groups on getting a definitive answ...
"As of Android 1.6, incoming SMS message broadcasts (`android.provider.Telephony.SMS_RECEIVED`) are delivered as an "ordered broadcast" — meaning that you can tell the system which components should receive the broadcast first." This means that you can intercept incoming message and abort broadcasting of it further on...
419,222
<p>I updated my question "<a href="https://stackoverflow.com/questions/406212/sizing-a-uilabel-in-the-iphone-sdk-to-fit">Sizing a UILabel (in the iPhone SDK) to fit?</a>" with a description of my problem with a suggested solution, but didn't get an answer. Perhaps I'll have better results by asking a new question...</...
[ { "answer_id": 419242, "author": "Lily Ballard", "author_id": 582, "author_profile": "https://Stackoverflow.com/users/582", "pm_score": 6, "selected": true, "text": "<p>That height is in pixels. I expect it's truncating, i.e. giving you the metrics you'd see if you set this text on a UIL...
2009/01/07
[ "https://Stackoverflow.com/questions/419222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
I updated my question "[Sizing a UILabel (in the iPhone SDK) to fit?](https://stackoverflow.com/questions/406212/sizing-a-uilabel-in-the-iphone-sdk-to-fit)" with a description of my problem with a suggested solution, but didn't get an answer. Perhaps I'll have better results by asking a new question... I set a breakpo...
That height is in pixels. I expect it's truncating, i.e. giving you the metrics you'd see if you set this text on a UILabel with 1 line. Try using `sizeWithFont:constrainedToSize:` and just give it `MAXFLOAT` for the height component of the size.
419,240
<p>I am using PHP and JavaScript. My JavaScript code contains a function, get_data():</p> <pre><code>function get_Data(){ var name; var job; ..... return buffer; } </code></pre> <p>Now I have PHP code with the following.</p> <pre><code>&lt;?php $i=0; $buffer_data; /* Here I need to get ...
[ { "answer_id": 419248, "author": "Jobo", "author_id": 51915, "author_profile": "https://Stackoverflow.com/users/51915", "pm_score": 0, "selected": false, "text": "<p>You would have to use <a href=\"http://en.wikipedia.org/wiki/Ajax_%28programming%29\" rel=\"nofollow noreferrer\">Ajax</a>...
2009/01/07
[ "https://Stackoverflow.com/questions/419240", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44984/" ]
I am using PHP and JavaScript. My JavaScript code contains a function, get\_data(): ``` function get_Data(){ var name; var job; ..... return buffer; } ``` Now I have PHP code with the following. ``` <?php $i=0; $buffer_data; /* Here I need to get the value from JavaScript get_data() of...
Use jQuery to send a JavaScript variable to your PHP file: ``` $url = 'path/to/phpFile.php'; $.get($url, {name: get_name(), job: get_job()}); ``` In your PHP code, get your variables from `$_GET['name']` and `$_GET['job']` like this: ``` <?php $buffer_data['name'] = $_GET['name']; $buffer_data['job'] = $_...
419,244
<p>Using Perl, how can I combine or merge the sample PDF files into a single PDF file?</p>
[ { "answer_id": 419249, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 2, "selected": false, "text": "<p>You can use the <a href=\"http://www.ghostscript.com/\" rel=\"nofollow noreferrer\">GhostScript</a> utility <code...
2009/01/07
[ "https://Stackoverflow.com/questions/419244", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45284/" ]
Using Perl, how can I combine or merge the sample PDF files into a single PDF file?
[CAM::PDF](http://search.cpan.org/perldoc?appendpdf.pl) can do this quite easily, and has a simple command-line front end to help. Note: I'm the author of that library. Example: ``` appendpdf.pl file1.pdf file2.pdf outfile.pdf ``` --- From the SYNOPSIS section of the [perldoc](http://search.cpan.org/~cdolan/CAM-PDF...
419,295
<p>I'm having a problem with my work that hopefully reduces to the following: I have two <code>List&lt;int&gt;</code>s, and I want to see if any of the <code>int</code>s in <code>ListA</code> are equal to any <code>int</code> in <code>ListB</code>. (They can be arrays if that makes life easier, but I think <code>List&...
[ { "answer_id": 419309, "author": "shahkalpesh", "author_id": 23574, "author_profile": "https://Stackoverflow.com/users/23574", "pm_score": 0, "selected": false, "text": "<p>How about using BinarySearch method instead of iterating over all elements in the inner loop?</p>\n" }, { "...
2009/01/07
[ "https://Stackoverflow.com/questions/419295", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3248/" ]
I'm having a problem with my work that hopefully reduces to the following: I have two `List<int>`s, and I want to see if any of the `int`s in `ListA` are equal to any `int` in `ListB`. (They can be arrays if that makes life easier, but I think `List<>` has some built-in magic that might help.) And I'm sure this is a LI...
With [LINQ](http://msdn.microsoft.com/en-us/library/bb397926.aspx), this is trivial, as you can call the [`Intersect` extension method](http://msdn.microsoft.com/en-us/library/system.linq.enumerable.intersect.aspx) on the [`Enumerable` class](http://msdn.microsoft.com/en-us/library/system.linq.enumerable.aspx) to give ...
419,314
<p>When i use this cmd line : jar cmf arshad.mf ars.jar *.class i get this error :</p> <pre><code>invalid header field name:Manifest-version </code></pre> <p>This is my manifest file :</p> <pre><code>Manifest-Version: 1.0 Main-Class:t </code></pre> <p>i made the manifest file with notepad in UTF-8 encoding - is th...
[ { "answer_id": 419317, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 5, "selected": true, "text": "<p>Add a space after the colons:</p>\n\n<pre><code>Manifest-Version: 1.0\nMain-Class: t\n</code></pre>\n" }, { ...
2009/01/07
[ "https://Stackoverflow.com/questions/419314", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50940/" ]
When i use this cmd line : jar cmf arshad.mf ars.jar \*.class i get this error : ``` invalid header field name:Manifest-version ``` This is my manifest file : ``` Manifest-Version: 1.0 Main-Class:t ``` i made the manifest file with notepad in UTF-8 encoding - is there any problem with the manifest ?
Add a space after the colons: ``` Manifest-Version: 1.0 Main-Class: t ```
419,328
<p>Having setup C++ app originally using MS specific keyboard journaling hook (WH_JOURNALRECORD) we find that it does not work on Vista unless run as administrator with uiAccess enabled. <a href="http://social.msdn.microsoft.com/forums/en-US/windowssecurity/thread/3dc0a67e-c2f0-4e70-8990-3a6947f1155a/" rel="nofollow no...
[ { "answer_id": 424072, "author": "MSalters", "author_id": 15416, "author_profile": "https://Stackoverflow.com/users/15416", "pm_score": 1, "selected": false, "text": "<p>Even if you could, you'd probably would find Microsoft fixing that bug in the next patch. The change in Vista was inte...
2009/01/07
[ "https://Stackoverflow.com/questions/419328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37558/" ]
Having setup C++ app originally using MS specific keyboard journaling hook (WH\_JOURNALRECORD) we find that it does not work on Vista unless run as administrator with uiAccess enabled. [MSDN Question - Journaling hooks on Vista?](http://social.msdn.microsoft.com/forums/en-US/windowssecurity/thread/3dc0a67e-c2f0-4e70-89...
We have worked around the main issues by using SetWindowsHook instead. ``` const HMODULE hDLL = ::GetModuleHandle(DLL_NAME); ::SetWindowsHookEx(WH_KEYBOARD_LL, myKeyboardProcCallback, hDLL, 0); ``` The callback now has to manage the keystroke information and translating it into usable sequences - ie don't record mul...
419,344
<p>Alright I've spent a good three days trying this, here's the scenario:</p> <p>I want to download a '.csv' file from Google and then do stuff with the data from the file. It's for a Win32 Console Application. I have the latter down, I just cannot for the life of me figure out how to download the file. I've heard of ...
[ { "answer_id": 419366, "author": "Jesse Pepper", "author_id": 43058, "author_profile": "https://Stackoverflow.com/users/43058", "pm_score": 0, "selected": false, "text": "<p>C++ doesn't really have an API per se. To do a GET request, your program needs to open a TCP socket connection to...
2009/01/07
[ "https://Stackoverflow.com/questions/419344", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50391/" ]
Alright I've spent a good three days trying this, here's the scenario: I want to download a '.csv' file from Google and then do stuff with the data from the file. It's for a Win32 Console Application. I have the latter down, I just cannot for the life of me figure out how to download the file. I've heard of libcurl, c...
You should be able to [bend this](http://www.luckyspin.org/?p=28) to your will. Now that I have kinda answered your question. Why C++? Nothing against the language, but pick the best language for the job. Perl, PHP, and Python(and I am sure more) all have great documentation and support on this kind of operation. In ...
419,372
<p>I have a need to create a gross requirements report that takes how much supply and demand of a item in inventory from a start date onwards and 'buckets' it into different weeks of the year so that material planners know when they will need a item and if they have enough stock in inventory at that time.</p> <p>As an...
[ { "answer_id": 419373, "author": "Jaydel Gluckie", "author_id": 2019606, "author_profile": "https://Stackoverflow.com/users/2019606", "pm_score": 0, "selected": false, "text": "<p>--SQL sets the first day of the week as sunday and for our purposes we want it to be Monday.<br>\n--This com...
2009/01/07
[ "https://Stackoverflow.com/questions/419372", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2019606/" ]
I have a need to create a gross requirements report that takes how much supply and demand of a item in inventory from a start date onwards and 'buckets' it into different weeks of the year so that material planners know when they will need a item and if they have enough stock in inventory at that time. As an example, ...
You can get Monday for any given date in a week as: ``` DATEADD(d, 1 - DATEPART(dw, @date), @date) ``` and you can write a stored procedure with the following body ``` -- find Monday at that week DECLARE @currentDate SMALLDATETIME SELECT @currentDate = DATEADD(d, 1 - DATEPART(dw, @date), @date) -- create a table a...
419,379
<p>I have a function. Inside that I'm maintainfing a dictionary of values. I want that dictionary to be maintained between different function calls</p> <p>Suppose the dic is :</p> <pre><code>a = {'a':1,'b':2,'c':3} </code></pre> <p>At first call,say,I changed a[a] to 100 Dict becomes <code>a = {'a':100,'b':2,'c':3}<...
[ { "answer_id": 419389, "author": "too much php", "author_id": 28835, "author_profile": "https://Stackoverflow.com/users/28835", "pm_score": 4, "selected": false, "text": "<p>You could use a <a href=\"https://stackoverflow.com/questions/279561/what-is-the-python-equivalent-of-static-varia...
2009/01/07
[ "https://Stackoverflow.com/questions/419379", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46646/" ]
I have a function. Inside that I'm maintainfing a dictionary of values. I want that dictionary to be maintained between different function calls Suppose the dic is : ``` a = {'a':1,'b':2,'c':3} ``` At first call,say,I changed a[a] to 100 Dict becomes `a = {'a':100,'b':2,'c':3}` At another call,i changed a[b] to 20...
You could use a [static variable](https://stackoverflow.com/questions/279561/what-is-the-python-equivalent-of-static-variables-inside-a-function): ``` def foo(k, v): foo.a[k] = v foo.a = {'a': 1, 'b': 2, 'c': 3} foo('a', 100) foo('b', 200) print foo.a ```
419,402
<p>I had created a BHO application with the help of <a href="http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx?fid=447248&amp;df=90&amp;mpp=25&amp;noise=3&amp;sort=Position&amp;view=Quick&amp;fr=51&amp;select=2421069" rel="nofollow noreferrer">this link</a>.</p> <p><strong>If I Build the source code obtained in...
[ { "answer_id": 419389, "author": "too much php", "author_id": 28835, "author_profile": "https://Stackoverflow.com/users/28835", "pm_score": 4, "selected": false, "text": "<p>You could use a <a href=\"https://stackoverflow.com/questions/279561/what-is-the-python-equivalent-of-static-varia...
2009/01/07
[ "https://Stackoverflow.com/questions/419402", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I had created a BHO application with the help of [this link](http://www.codeproject.com/KB/cs/Attach_BHO_with_C_.aspx?fid=447248&df=90&mpp=25&noise=3&sort=Position&view=Quick&fr=51&select=2421069). **If I Build the source code obtained in above article, the CPU usage is increased to 70-80%.** **How can I reduce this?...
You could use a [static variable](https://stackoverflow.com/questions/279561/what-is-the-python-equivalent-of-static-variables-inside-a-function): ``` def foo(k, v): foo.a[k] = v foo.a = {'a': 1, 'b': 2, 'c': 3} foo('a', 100) foo('b', 200) print foo.a ```
419,412
<p>I am using a windows service and i want to print a .html page when the service will start. I am using this code and it's printing well. But a print dialog box come, how do i print without the print dialog box?</p> <pre><code>public void printdoc(string document) { Process printjob = new Process(); printjob...
[ { "answer_id": 419427, "author": "Jack B Nimble", "author_id": 3800, "author_profile": "https://Stackoverflow.com/users/3800", "pm_score": 1, "selected": false, "text": "<p>From this site <a href=\"http://www.ussbd.com/printhtm.html\" rel=\"nofollow noreferrer\">http://www.ussbd.com/prin...
2009/01/07
[ "https://Stackoverflow.com/questions/419412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am using a windows service and i want to print a .html page when the service will start. I am using this code and it's printing well. But a print dialog box come, how do i print without the print dialog box? ``` public void printdoc(string document) { Process printjob = new Process(); printjob.StartInfo.Fil...
First off, here's the code: ``` using System.Reflection; using System.Threading; using SHDocVw; namespace HTMLPrinting { public class HTMLPrinter { private bool documentLoaded; private bool documentPrinted; private void ie_DocumentComplete(object pDisp, ref object URL) { documentLoaded = tr...
419,415
<pre><code>function CaptureKeys (e,btn) { var c //= document.layers ? evt.which: document.all ? event.keyCode : evt.keyCode if(window.event) { c = e.keyCode; // IE } else if(e.which) { c = e.which; // Netscape/Firefox/Opera } if (c == 13) { //return /enter key if (btn=="go") { ...
[ { "answer_id": 419425, "author": "Sachin Gaur", "author_id": 2572740, "author_profile": "https://Stackoverflow.com/users/2572740", "pm_score": -1, "selected": false, "text": "<p>You can simply add the <strong>UseSubmitBehavior=\"true\"</strong> attribute value to your button that should ...
2009/01/07
[ "https://Stackoverflow.com/questions/419415", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` function CaptureKeys (e,btn) { var c //= document.layers ? evt.which: document.all ? event.keyCode : evt.keyCode if(window.event) { c = e.keyCode; // IE } else if(e.which) { c = e.which; // Netscape/Firefox/Opera } if (c == 13) { //return /enter key if (btn=="go") { ...
You can also try this code: ``` theButton.click(); ```
419,472
<p>I have a UITableView that has two modes. When we switch between the modes I have a different number of sections and cells per section. Ideally, it would do some cool animation when the table grows or shrinks.</p> <p>Here is the code I tried, but it doesn't do anything:</p> <pre><code>CGContextRef context = UIGra...
[ { "answer_id": 421132, "author": "iKenndac", "author_id": 29005, "author_profile": "https://Stackoverflow.com/users/29005", "pm_score": 4, "selected": false, "text": "<p>The way to approach this is to tell the tableView to remove and add rows and sections with the</p>\n\n<p><code>insertR...
2009/01/07
[ "https://Stackoverflow.com/questions/419472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a UITableView that has two modes. When we switch between the modes I have a different number of sections and cells per section. Ideally, it would do some cool animation when the table grows or shrinks. Here is the code I tried, but it doesn't do anything: ``` CGContextRef context = UIGraphicsGetCurrentContext(...
Actually, it's very simple: ``` [_tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade]; ``` From [the documentation](https://developer.apple.com/documentation/uikit/uitableview/1614954-reloadsections?language=objc#discussion): > > Calling this method causes the ta...
419,476
<p>I asked the opposite question <a href="https://stackoverflow.com/questions/361135/sql-query-advice-most-recent-item">here</a>, now I am faced with another problem. Assume I have the following tables (as per poster in previous post)</p> <pre> CustID LastName FirstName ------ -------- --------- 1 Woman Test ...
[ { "answer_id": 419569, "author": "Gnudiff", "author_id": 50003, "author_profile": "https://Stackoverflow.com/users/50003", "pm_score": 2, "selected": true, "text": "<p>Can IssueIDs be assumed to be ordered correctly, ie. every next issue has ID that is larger by 1?</p>\n\n<p>In that case...
2009/01/07
[ "https://Stackoverflow.com/questions/419476", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23667/" ]
I asked the opposite question [here](https://stackoverflow.com/questions/361135/sql-query-advice-most-recent-item), now I am faced with another problem. Assume I have the following tables (as per poster in previous post) ``` CustID LastName FirstName ------ -------- --------- 1 Woman Test 2 Man Test...
Can IssueIDs be assumed to be ordered correctly, ie. every next issue has ID that is larger by 1? In that case something like this should work: ``` SELECT Curr.ProdID, Curr.PublishDate As CurrentIssue, Prev.PublishDate AS PrevIssue FROM Issues Curr, Issues Prev WHERE ProdID=123 AND Curr.PublishDate='12/06/2008' AND P...
419,507
<p>In C# 3.0, I have a property which is suppose to contain the version of the class. The version number is simply the date and time of compilation. Right now, I have the following code:</p> <pre><code>public DateTime Version { get { return DateTime.UtcNow; } } </code></pre> <p>Obviously, this is wrong since this...
[ { "answer_id": 419512, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": true, "text": "<p>C# doesn't have the concept of macros; however, you can use other tools in your build script (csproj / NANT / etc) ...
2009/01/07
[ "https://Stackoverflow.com/questions/419507", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42024/" ]
In C# 3.0, I have a property which is suppose to contain the version of the class. The version number is simply the date and time of compilation. Right now, I have the following code: ``` public DateTime Version { get { return DateTime.UtcNow; } } ``` Obviously, this is wrong since this property returns me the c...
C# doesn't have the concept of macros; however, you can use other tools in your build script (csproj / NANT / etc) to manipulate the source before it compiles. I use this, for example, to set the revision number to the current SVN revision. A cheap option is a pre-build event (you can do this via the project propertie...
419,511
<p>I am running a SVN server on my Windows Server and want to schedule an automated backup procedure. I will always be the only one working on the repository. Should I bother with hotcopy or can I use a simple Windows backup application to backup the repositories? What about xcopy or robocopy?</p>
[ { "answer_id": 419514, "author": "JustinT", "author_id": 50786, "author_profile": "https://Stackoverflow.com/users/50786", "pm_score": 0, "selected": false, "text": "<p>I use <a href=\"http://mozy.com/home\" rel=\"nofollow noreferrer\">Mozy Home</a> to back up all of my personal developm...
2009/01/07
[ "https://Stackoverflow.com/questions/419511", "https://Stackoverflow.com", "https://Stackoverflow.com/users/51949/" ]
I am running a SVN server on my Windows Server and want to schedule an automated backup procedure. I will always be the only one working on the repository. Should I bother with hotcopy or can I use a simple Windows backup application to backup the repositories? What about xcopy or robocopy?
I find simply copy / pasting (XCopy) the repositories is the easiest solution. You may want to consider dumping the repository to a single file before you copy it as I find copying a single large file is much quicker than copying a bunch of smaller files. This probably isn't an issue if your repository is small, but so...