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
222,827
<p>First, I know about this: <a href="https://stackoverflow.com/questions/51217/how-would-you-organize-a-subversion-repository-for-in-house-software-projects">How would you organize a Subversion repository for in house software projects?</a> Next, the actual question: My team is restructuring our repository and I'm loo...
[ { "answer_id": 222906, "author": "Fabio Gomes", "author_id": 727, "author_profile": "https://Stackoverflow.com/users/727", "pm_score": 2, "selected": false, "text": "<p>I believe that <a href=\"http://www.pragprog.com/titles/svn/pragmatic-version-control-using-subversion\" rel=\"nofollow...
2008/10/21
[ "https://Stackoverflow.com/questions/222827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13163/" ]
First, I know about this: [How would you organize a Subversion repository for in house software projects?](https://stackoverflow.com/questions/51217/how-would-you-organize-a-subversion-repository-for-in-house-software-projects) Next, the actual question: My team is restructuring our repository and I'm looking for hints...
If you follow my recommendations below (I have for years), you will be able to: -- put each project anywhere in source control, as long as you preserve the structure from the project root directory on down -- build each project anywhere on any machine, with minimum risk and minimum preparation -- build each project ...
222,833
<p>I currently use the following command, but it's a little unwieldy to type. What's a shorter alternative?</p> <pre><code>find . -name '*.txt' -exec grep 'sometext' '{}' \; -print </code></pre> <p>Here are my requirements:</p> <ul> <li>limit to a file extension (I use SVN and don't want to be searching through all...
[ { "answer_id": 222838, "author": "CesarB", "author_id": 28258, "author_profile": "https://Stackoverflow.com/users/28258", "pm_score": 4, "selected": true, "text": "<p>grep has -r (recursive) and --include (to search only in files and directories matching a pattern).</p>\n" }, { "...
2008/10/21
[ "https://Stackoverflow.com/questions/222833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29738/" ]
I currently use the following command, but it's a little unwieldy to type. What's a shorter alternative? ``` find . -name '*.txt' -exec grep 'sometext' '{}' \; -print ``` Here are my requirements: * limit to a file extension (I use SVN and don't want to be searching through all those .svn directories) * can default...
grep has -r (recursive) and --include (to search only in files and directories matching a pattern).
222,834
<p>I want to generate some formatted output of data retrieved from an MS-Access database and stored in a <em>DataTable</em> object/variable, myDataTable. However, some of the fields in myDataTable cotain <em>dbNull</em> data. So, the following VB.net code snippet will give errors if the value of any of the fields <em>l...
[ { "answer_id": 222849, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 8, "selected": true, "text": "<p>The only way that i know of is to test for it, you can do a combined if though to make it easy.</p>\n\n<pre><cod...
2008/10/21
[ "https://Stackoverflow.com/questions/222834", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4612/" ]
I want to generate some formatted output of data retrieved from an MS-Access database and stored in a *DataTable* object/variable, myDataTable. However, some of the fields in myDataTable cotain *dbNull* data. So, the following VB.net code snippet will give errors if the value of any of the fields *lastname*, *intials*,...
The only way that i know of is to test for it, you can do a combined if though to make it easy. ``` If NOT IsDbNull(myItem("sID")) AndAlso myItem("sID") = sId Then 'Do success ELSE 'Failure End If ``` I wrote in VB as that is what it looks like you need, even though you mixed languages. **Edit** Cleaned up t...
222,839
<p>I have a WPF window for editing database information, which is represented using an Entity Framework object. When the user closes the window, I'd like to notice in the Closing event whether the information has changed and show a message box offering to save the changes to the database.</p> <p>Unfortunately, change...
[ { "answer_id": 224287, "author": "Donnelle", "author_id": 28074, "author_profile": "https://Stackoverflow.com/users/28074", "pm_score": 4, "selected": true, "text": "<p>This should get you pretty close:</p>\n\n<pre><code>\n\nprivate void Window_Closing(object sender, System.ComponentMode...
2008/10/21
[ "https://Stackoverflow.com/questions/222839", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30002/" ]
I have a WPF window for editing database information, which is represented using an Entity Framework object. When the user closes the window, I'd like to notice in the Closing event whether the information has changed and show a message box offering to save the changes to the database. Unfortunately, changes to the cu...
This should get you pretty close: ``` private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { ForceDataValidation(); } private static void ForceDataValidation() { TextBox textBox = Keyboard.FocusedElement as TextBox; if (textBox != null) { BindingExpression be =...
222,841
<p>Is there a more efficient way to convert an HTMLCollection to an Array, other than iterating through the contents of said collection and manually pushing each item into an array?</p>
[ { "answer_id": 222847, "author": "harpo", "author_id": 4525, "author_profile": "https://Stackoverflow.com/users/4525", "pm_score": 11, "selected": true, "text": "<pre><code>var arr = Array.prototype.slice.call( htmlCollection )\n</code></pre>\n\n<p>will have the same effect using \"nativ...
2008/10/21
[ "https://Stackoverflow.com/questions/222841", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20/" ]
Is there a more efficient way to convert an HTMLCollection to an Array, other than iterating through the contents of said collection and manually pushing each item into an array?
``` var arr = Array.prototype.slice.call( htmlCollection ) ``` will have the same effect using "native" code. **Edit** Since this gets a lot of views, note (per @oriol's comment) that the following more concise expression is *effectively* equivalent: ``` var arr = [].slice.call(htmlCollection); ``` But note per ...
222,877
<p>What's the difference between:</p> <pre><code>class Child(SomeBaseClass): def __init__(self): super(Child, self).__init__() </code></pre> <p>and:</p> <pre><code>class Child(SomeBaseClass): def __init__(self): SomeBaseClass.__init__(self) </code></pre> <p>I've seen <code>super</code> being...
[ { "answer_id": 222922, "author": "John Millikin", "author_id": 3560, "author_profile": "https://Stackoverflow.com/users/3560", "pm_score": 9, "selected": true, "text": "<p>The benefits of <code>super()</code> in single-inheritance are minimal -- mostly, you don't have to hard-code the na...
2008/10/21
[ "https://Stackoverflow.com/questions/222877", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25785/" ]
What's the difference between: ``` class Child(SomeBaseClass): def __init__(self): super(Child, self).__init__() ``` and: ``` class Child(SomeBaseClass): def __init__(self): SomeBaseClass.__init__(self) ``` I've seen `super` being used quite a lot in classes with only single inheritance. I...
The benefits of `super()` in single-inheritance are minimal -- mostly, you don't have to hard-code the name of the base class into every method that uses its parent methods. However, it's almost impossible to use multiple-inheritance without `super()`. This includes common idioms like mixins, interfaces, abstract clas...
222,895
<p>I like LINQ to SQL, but it seems like the classes it generates are tightly coupled to the database they are stored in, which seems like a Bad Thing. </p> <p>For example, using ye olde Northwind database, if I create the dbml with the Products table, a <code>Product</code> class is generated. I can use this class in...
[ { "answer_id": 222919, "author": "Marcus King", "author_id": 19840, "author_profile": "https://Stackoverflow.com/users/19840", "pm_score": 1, "selected": false, "text": "<p>Scott Hanselman did a screen talking about asp.net DynamicData where he used Linq To Sql classes. Although he wasn...
2008/10/21
[ "https://Stackoverflow.com/questions/222895", "https://Stackoverflow.com", "https://Stackoverflow.com/users/736/" ]
I like LINQ to SQL, but it seems like the classes it generates are tightly coupled to the database they are stored in, which seems like a Bad Thing. For example, using ye olde Northwind database, if I create the dbml with the Products table, a `Product` class is generated. I can use this class in any other tier, whic...
All these answers and no links! Maybe I can help: [The attributes thing that damieng mentioned](http://msdn.microsoft.com/en-us/library/bb425822.aspx#linqtosql_topic3) [The partial class thing that Marcus King mentioned](http://msdn.microsoft.com/en-us/library/bb546176.aspx) I have languished through this difficulty...
222,897
<p>Is it possible to extend LINQ-to-SQL entity-classes with constructor-methods and in the same go; make that entity-class inherit from it's data-context class?--In essence converting the entity-class into a business object.</p> <p>This is the pattern I am currently using:</p> <pre><code>namespace Xxx { public cl...
[ { "answer_id": 222935, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 1, "selected": true, "text": "<p>It doesn't seem to make sense to make an entity a type of DataContext. It doesn't need to be a DataContext in order to...
2008/10/21
[ "https://Stackoverflow.com/questions/222897", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20946/" ]
Is it possible to extend LINQ-to-SQL entity-classes with constructor-methods and in the same go; make that entity-class inherit from it's data-context class?--In essence converting the entity-class into a business object. This is the pattern I am currently using: ``` namespace Xxx { public class User : Xxx.DataCo...
It doesn't seem to make sense to make an entity a type of DataContext. It doesn't need to be a DataContext in order to be considered a business object, nor do you necessarily need to create a type that contains the original entity. It might be better to just extend the entity class and contain a reference to a DataCont...
222,925
<p>In PHP, I want to read a file into a variable and process the PHP in the file at the same time without using output buffering. Is this possible?</p> <p>Essentially I want to be able to accomplish this without using <code>ob_start()</code>:</p> <pre><code>&lt;?php ob_start(); include 'myfile.php'; $xhtml = ob_get_c...
[ { "answer_id": 222944, "author": "KernelM", "author_id": 22328, "author_profile": "https://Stackoverflow.com/users/22328", "pm_score": 3, "selected": false, "text": "<p>From what I can tell in the PHP documentation, no. Why do you want to avoid output buffering?</p>\n\n<p>The only way to...
2008/10/21
[ "https://Stackoverflow.com/questions/222925", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18986/" ]
In PHP, I want to read a file into a variable and process the PHP in the file at the same time without using output buffering. Is this possible? Essentially I want to be able to accomplish this without using `ob_start()`: ``` <?php ob_start(); include 'myfile.php'; $xhtml = ob_get_clean(); ?> ``` Is this possible i...
A little known feature of PHP is being able to treat an included/required file like a function call, with a return value. For example: ``` // myinclude.php $value = 'foo'; $otherValue = 'bar'; return $value . $otherValue; // index.php $output = include './myinclude.php'; echo $output; // Will echo foobar ```
222,957
<p>Before I get into the details of this problem, I'd like to make the situation clear. Our web analytics company works as a consultant for large sites, and (other than adding a single SCRIPT tag) we have no control over the pages themselves.</p> <p>Our existing script installs handlers using "old" way (a fancy versio...
[ { "answer_id": 222966, "author": "Sergey Ilinsky", "author_id": 23815, "author_profile": "https://Stackoverflow.com/users/23815", "pm_score": 1, "selected": false, "text": "<p>addEventListener/attachEvent is safe in a sense you ask. They add a new event handler to a Node without altering...
2008/10/21
[ "https://Stackoverflow.com/questions/222957", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30050/" ]
Before I get into the details of this problem, I'd like to make the situation clear. Our web analytics company works as a consultant for large sites, and (other than adding a single SCRIPT tag) we have no control over the pages themselves. Our existing script installs handlers using "old" way (a fancy version of eleme...
Can you try your quick-and-dirty testing again? This doesn't happen for me in FF3. ``` elem.onclick = function() { alert("foo"); }; elem.addEventListener("click", function() { alert("bar"); }, false); ``` Both handlers fire for me when I click on the element. I'm guessing you forgot the final boolean argument in `a...
222,981
<p>I cannot correctly position the div <code>form</code> in my layout.</p> <p>By looking at my div placement and css below, does anyone have an idea what I could be doing wrong?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class...
[ { "answer_id": 222994, "author": "Dave Rutledge", "author_id": 2486915, "author_profile": "https://Stackoverflow.com/users/2486915", "pm_score": 1, "selected": false, "text": "<p>Because you have two blocks (FLOORPLANS and DEVELOPMENT INFO) each with a border, they're now too wide to sit...
2008/10/21
[ "https://Stackoverflow.com/questions/222981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30043/" ]
I cannot correctly position the div `form` in my layout. By looking at my div placement and css below, does anyone have an idea what I could be doing wrong? ```css #floorplans { float: left; height: 165px; width: 203px; border-right: 1px solid #FFFFFF; border-bottom: 1px solid #FFFFFF; position: rel...
The form `div`'s top is in line with the top of the `div` that precedes it. The `clear:left;` on `#projects` moves `#projects` to the next line (good), along with the following content (bad). Try a negative top margin, or consider restructuring your HTML to put `#form` before `#projects`. Adding the following should w...
222,988
<p>My code is in c# asp.net 3.5</p> <p>In the following code the "Msg" has many words with spaces and characters (eg:Failed to prepare Sync Favorites : Directory does not exist: \STL-FNP-02\ryounes$\Sync\Favorites). This "Msg" is pulled from database to a gridview. I am not able to create hyperlink for this "Msg" in g...
[ { "answer_id": 223001, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 0, "selected": false, "text": "<p>It doesn't create the link as it is not a valid URL, rather than using a hyperlink column most likely you are g...
2008/10/21
[ "https://Stackoverflow.com/questions/222988", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My code is in c# asp.net 3.5 In the following code the "Msg" has many words with spaces and characters (eg:Failed to prepare Sync Favorites : Directory does not exist: \STL-FNP-02\ryounes$\Sync\Favorites). This "Msg" is pulled from database to a gridview. I am not able to create hyperlink for this "Msg" in gridview. S...
The easiest way to get around it is to use something like ``` <asp:TemplateField HeaderText="Msg"> <asp:HyperLink runat="server" Text='<%# HttpUtility.UrlEncode(Eval("Msg")) %>' NavigateUrl='<%#Eval("Msg")%>' /> </asp:TemplateField> ``` Not 100% certain that the syntax is correct but you get the general idea
222,996
<p>I have the following class which uses BinaryReader internally and implements IDisposable.</p> <pre> class DisposableClass : IDisposable { private BinaryReader reader; public DisposableClass(Stream stream) { reader = new BinaryReader(stream); } protected virtu...
[ { "answer_id": 223020, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 4, "selected": true, "text": "<p>It won't work because the <code>Dispose</code> method on <code>BinaryReader</code> has been explicitly implemented.</...
2008/10/21
[ "https://Stackoverflow.com/questions/222996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1534/" ]
I have the following class which uses BinaryReader internally and implements IDisposable. ``` class DisposableClass : IDisposable { private BinaryReader reader; public DisposableClass(Stream stream) { reader = new BinaryReader(stream); } protected virtual void ...
It won't work because the `Dispose` method on `BinaryReader` has been explicitly implemented. Instead of being implicitly implemented, as in: ``` public void Dispose() { } ``` ...it has been explicitly implemented, as in: ``` void IDisposable.Dispose() { } ``` ...which means it can only be accessed via the `IDis...
222,999
<p>I created a single page (with code behind .vb) and created Public intFileID As Integer</p> <p>in the Page load I check for the querystring and assign it if available or set intFileID = 0.</p> <pre><code>Public intFileID As Integer = 0 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Ha...
[ { "answer_id": 223006, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<p>Store it in the Session.</p>\n\n<pre><code>Page.Session[\"MyPage_FileID\"] = intFileID\n</code></pre>\n\n<p>You'll n...
2008/10/21
[ "https://Stackoverflow.com/questions/222999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3747/" ]
I created a single page (with code behind .vb) and created Public intFileID As Integer in the Page load I check for the querystring and assign it if available or set intFileID = 0. ``` Public intFileID As Integer = 0 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If ...
As others have pointed out, you can store it in the Session or the ViewState. If it's page specific, I like to store it in the ViewState as opposed to the Session, but I don't know if one method is generally preferred over the other. In VB, you would store an item in the ViewState like: ``` ViewState(key) = value ``...
223,013
<p>I often need to run reduce (also called foldl / foldr, depending on your contexts) in java to aggregate elements of an Itterable. </p> <p>Reduce takes a collection/iterable/etc, a function of two parameters, and an optional start value (depending on the implementation details). The function is successively applie...
[ { "answer_id": 223055, "author": "sblundy", "author_id": 4893, "author_profile": "https://Stackoverflow.com/users/4893", "pm_score": 1, "selected": false, "text": "<p>Try the <a href=\"http://commons.apache.org/sandbox/functor/\" rel=\"nofollow noreferrer\">commons functor package</a>. I...
2008/10/21
[ "https://Stackoverflow.com/questions/223013", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3446/" ]
I often need to run reduce (also called foldl / foldr, depending on your contexts) in java to aggregate elements of an Itterable. Reduce takes a collection/iterable/etc, a function of two parameters, and an optional start value (depending on the implementation details). The function is successively applied to an elem...
you could probably roll your own generic pretty easily, based on your description: ``` public interface Reducer<A, T> { public A foldIn(A accum, T next); } ``` Then using the strategy pattern: ``` public class Reductor<A, T> { private Reducer<A, T> worker; public Reductor<A, T>(Reducer<A, T> worker) ...
223,021
<p>I'm using the 'using' declaration in C++ to add std::string and std::vector to the local namespace (to save typing unnecessary 'std::'s).</p> <pre><code>using std::string; using std::vector; class Foo { /*...*/ }; </code></pre> <p>What is the scope on this declaration? If I do this in a header, will it inject th...
[ { "answer_id": 223030, "author": "James Curran", "author_id": 12725, "author_profile": "https://Stackoverflow.com/users/12725", "pm_score": 3, "selected": false, "text": "<p>In the case cited, the file (\"translation unit\"), which means yes, every file that includes it.</p>\n\n<p>You ca...
2008/10/21
[ "https://Stackoverflow.com/questions/223021", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13300/" ]
I'm using the 'using' declaration in C++ to add std::string and std::vector to the local namespace (to save typing unnecessary 'std::'s). ``` using std::string; using std::vector; class Foo { /*...*/ }; ``` What is the scope on this declaration? If I do this in a header, will it inject these 'using' declarations in...
When you #include a header file in C++, it places the whole contents of the header file into the spot that you included it in the source file. So including a file that has a `using` declaration has the exact same effect of placing the `using` declaration at the top of each file that includes that header file.
223,040
<p>If two users edit the same wiki topic, what methods have been used in wikis (or in similar collaborative editing software) to merge the second user's edits with the first?</p> <p>I'd like a solution that:</p> <ul> <li>doesn't require locking</li> <li>doesn't lose any additions to the page.</li> <li>It may add extra ...
[ { "answer_id": 223060, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 0, "selected": false, "text": "<p>You can write a \"lock\" in an other database table with the id of the user and the time and delete the \"lo...
2008/10/21
[ "https://Stackoverflow.com/questions/223040", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2541/" ]
If two users edit the same wiki topic, what methods have been used in wikis (or in similar collaborative editing software) to merge the second user's edits with the first? I'd like a solution that: * doesn't require locking * doesn't lose any additions to the page. * It may add extra "boilerplate" text to indicate wh...
[TWiki](http://twiki.org) automatically merges [Simultaneous Edits](http://twiki.org/cgi-bin/view/TWiki.SimultaneousEdits). > > TWiki allows multiple simultaneous edits of the same topic, and then merges the different changes automatically. You probably won't even notice this happening unless there is a conflict that...
223,058
<p><strong><em>Imagine</em></strong> a base class with many constructors and a virtual method</p> <pre><code>public class Foo { ... public Foo() {...} public Foo(int i) {...} ... public virtual void SomethingElse() {...} ... } </code></pre> <p>and now i want to create a descendant class that overrid...
[ { "answer_id": 223068, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 8, "selected": true, "text": "<p>Yes, you will have to implement the constructors that make sense for each derivation and then use the <code>base</cod...
2008/10/21
[ "https://Stackoverflow.com/questions/223058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12597/" ]
***Imagine*** a base class with many constructors and a virtual method ``` public class Foo { ... public Foo() {...} public Foo(int i) {...} ... public virtual void SomethingElse() {...} ... } ``` and now i want to create a descendant class that overrides the virtual method: ``` public class Bar :...
Yes, you will have to implement the constructors that make sense for each derivation and then use the `base` keyword to direct that constructor to the appropriate base class or the `this` keyword to direct a constructor to another constructor in the same class. If the compiler made assumptions about inheriting constru...
223,063
<p>I would like to create an application that serves web pages internally and can be run in multiple instances on the same machine. To do so, I would like to create an <code>HttpListener</code> that listens on a port that is:</p> <ol> <li>Randomly selected </li> <li>Currently unused</li> </ol> <p>Essentially, what I...
[ { "answer_id": 223188, "author": "Snooganz", "author_id": 28224, "author_profile": "https://Stackoverflow.com/users/28224", "pm_score": 4, "selected": false, "text": "<p>How about something like this:</p>\n\n<pre><code> static List&lt;int&gt; usedPorts = new List&lt;int&gt;();\n st...
2008/10/21
[ "https://Stackoverflow.com/questions/223063", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I would like to create an application that serves web pages internally and can be run in multiple instances on the same machine. To do so, I would like to create an `HttpListener` that listens on a port that is: 1. Randomly selected 2. Currently unused Essentially, what I would like is something like: ``` mListener ...
TcpListener will find a random un-used port to listen on if you bind to port 0. ``` public static int GetRandomUnusedPort() { var listener = new TcpListener(IPAddress.Any, 0); listener.Start(); var port = ((IPEndPoint)listener.LocalEndpoint).Port; listener.Stop(); return port; } ```
223,070
<p>I'm looking for a database of commonly installed Windows software. At minimum I need the name of the software and the executable name, but it'd also be nice to have the publisher and the common installation path, etc. Basically, I'd like to be able to query it to find all the software by Adobe and the associated exe...
[ { "answer_id": 223140, "author": "Patrick Desjardins", "author_id": 13913, "author_profile": "https://Stackoverflow.com/users/13913", "pm_score": 0, "selected": false, "text": "<p>You can do some <strong>screen scraping</strong> with some website that contain <strong>list of software</st...
2008/10/21
[ "https://Stackoverflow.com/questions/223070", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28926/" ]
I'm looking for a database of commonly installed Windows software. At minimum I need the name of the software and the executable name, but it'd also be nice to have the publisher and the common installation path, etc. Basically, I'd like to be able to query it to find all the software by Adobe and the associated execut...
So, someone asked a question on reddit (<http://www.reddit.com/r/programming/comments/7civs/ask_prog_where_can_i_find_lists_of_data_in_useful/>) that contained the original website I was looking for. Anyone looking for a database of general information (including the database of software I was looking for) can find it...
223,096
<p>I'm running Oracle 10g and have columns with Type_Name </p> <pre>TIMESTAMP(6) WITH TIME ZONE</pre> <p>When inflated into java classes they come out as</p> <pre>oracle.sql.TIMESTAMPTZ </pre> <p>But DbUnit can't handle converting Oracle specific classes to Strings for writing to XML. I'm wondering if there's any ...
[ { "answer_id": 224229, "author": "Daniel Auger", "author_id": 1644, "author_profile": "https://Stackoverflow.com/users/1644", "pm_score": 2, "selected": false, "text": "<p>Try messing with the device information settings, in particular the HumanReadiblePdf attribute. \n<a href=\"http://m...
2008/10/21
[ "https://Stackoverflow.com/questions/223096", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25915/" ]
I'm running Oracle 10g and have columns with Type\_Name ``` TIMESTAMP(6) WITH TIME ZONE ``` When inflated into java classes they come out as ``` oracle.sql.TIMESTAMPTZ ``` But DbUnit can't handle converting Oracle specific classes to Strings for writing to XML. I'm wondering if there's any easy way for me to conv...
Try messing with the device information settings, in particular the HumanReadiblePdf attribute. <http://msdn.microsoft.com/en-us/library/ms154682.aspx> IIRC the setting is actually the opposite of what the documentation hints at compression wise. Also take a look here: <http://blogs.msdn.com/donovans/pages/report...
223,115
<p>Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and bar. foo has two fields of foo_id and total_count. bar has two fields, seconds and id.</p> <p>I need to aggregate the seconds in bar for each individual id and update the total_count in foo. id is a foreign key in...
[ { "answer_id": 223154, "author": "Christoph Schiessl", "author_id": 20467, "author_profile": "https://Stackoverflow.com/users/20467", "pm_score": 0, "selected": false, "text": "<p>I hope I understood your question right.</p>\n\n<p>You have the following tables:</p>\n\n<ul>\n<li>table <co...
2008/10/21
[ "https://Stackoverflow.com/questions/223115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Having difficulty articulating this correlated subquery. I have two tables fictitious tables, foo and bar. foo has two fields of foo\_id and total\_count. bar has two fields, seconds and id. I need to aggregate the seconds in bar for each individual id and update the total\_count in foo. id is a foreign key in bar for...
``` UPDATE foo f1 SET total_count = (SELECT SUM(seconds) FROM bar b1 WHERE b1.id = f1.foo_id) ``` You should have access to the appropriate foo id within the sub-query, so there is no need to join in the table.
223,126
<p>I'm new to Rails development, and I'm trying to figure out how to use an older version of Rails with Apatana's RadRails IDE. I'm trying to help out a friend who has a site built on older version than the one that automatically gets downloaded by RadRails, and I'm pretty sure the two versions wouldn't be compatible ...
[ { "answer_id": 226219, "author": "Otto", "author_id": 9594, "author_profile": "https://Stackoverflow.com/users/9594", "pm_score": 3, "selected": true, "text": "<p>Use the Rake task <code>rails:freeze:gems</code> in your rails project and give it the version you want to use. For example:...
2008/10/21
[ "https://Stackoverflow.com/questions/223126", "https://Stackoverflow.com", "https://Stackoverflow.com/users/767/" ]
I'm new to Rails development, and I'm trying to figure out how to use an older version of Rails with Apatana's RadRails IDE. I'm trying to help out a friend who has a site built on older version than the one that automatically gets downloaded by RadRails, and I'm pretty sure the two versions wouldn't be compatible (the...
Use the Rake task `rails:freeze:gems` in your rails project and give it the version you want to use. For example: ``` rake rails:freeze:gems VERSION=2.1.0 ``` That will put the right version of Rails into `vendor/rails`, which is loaded by default if it exists.
223,149
<p>Say you create a form using ASP.NET MVC that has a dynamic number of form elements.</p> <p>For instance, you need a checkbox for each product, and the number of products changes day by day.</p> <p>How would you handle that form data being posted back to the controller? You can't set up parameters on the action met...
[ { "answer_id": 223158, "author": "leppie", "author_id": 15541, "author_profile": "https://Stackoverflow.com/users/15541", "pm_score": 0, "selected": false, "text": "<p>Depending on your data, you could either output a 'CheckboxList' (which is not possible in the newer versions any more) ...
2008/10/21
[ "https://Stackoverflow.com/questions/223149", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7837/" ]
Say you create a form using ASP.NET MVC that has a dynamic number of form elements. For instance, you need a checkbox for each product, and the number of products changes day by day. How would you handle that form data being posted back to the controller? You can't set up parameters on the action method because you d...
Just give each checkbox a unique name value: ``` <input class="approveCheck" id="<%= "approveCheck" + recordId %>" name="<%= "approveCheck" + recordId %>" type="checkbox" /> ``` Then parse the list of form values in the Action, after submit: ``` foreach (var key in Request.Form.Keys) { string keyStrin...
223,153
<p>I am trying to call a COM object from PHP using the COM interop extension. One function requires an OLE_COLOR as an argument? Is there any way to pass this kind of value from PHP?</p> <p>I have tried passing a simple integer value with no success.</p> <pre><code>$this-&gt;oBuilder-&gt;Font-&gt;Color = 255; </code>...
[ { "answer_id": 230602, "author": "matt.mercieca", "author_id": 30407, "author_profile": "https://Stackoverflow.com/users/30407", "pm_score": 0, "selected": false, "text": "<p>When I've called COM functions from PHP, I just passed them in the call. So my old code has:</p>\n\n<pre>\n$myCo...
2008/10/21
[ "https://Stackoverflow.com/questions/223153", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1508/" ]
I am trying to call a COM object from PHP using the COM interop extension. One function requires an OLE\_COLOR as an argument? Is there any way to pass this kind of value from PHP? I have tried passing a simple integer value with no success. ``` $this->oBuilder->Font->Color = 255; ```
PHP can define the constants the COM exposes automatic. set\_ini('[com.autoregister-typelib](http://php.net/manual/en/com.configuration.php#ini.com.autoregister-typelib)', true); or by hand [com\_load\_typelib](http://php.net/manual/en/function.com-load-typelib.php)($typelib\_name); But if the OLE\_COLOR is a **ob...
223,162
<p>How do I pull out the filename from a full path using regular expressions in C#?</p> <p>Say I have the full path <code>C:\CoolDirectory\CoolSubdirectory\CoolFile.txt</code>.</p> <p>How do I get out CoolFile.txt using the .NET flavor of regular expressions? I'm not really good with regular expressions, and my RegEx...
[ { "answer_id": 223172, "author": "Dour High Arch", "author_id": 22437, "author_profile": "https://Stackoverflow.com/users/22437", "pm_score": 5, "selected": false, "text": "<p>Why must you use regular expressions? .NET has the built-in <code>Path.GetFileName()</code> method specifically ...
2008/10/21
[ "https://Stackoverflow.com/questions/223162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18927/" ]
How do I pull out the filename from a full path using regular expressions in C#? Say I have the full path `C:\CoolDirectory\CoolSubdirectory\CoolFile.txt`. How do I get out CoolFile.txt using the .NET flavor of regular expressions? I'm not really good with regular expressions, and my RegEx buddy and me couldn't figur...
``` // using System.Text.RegularExpressions; /// <summary> /// Regular expression built for C# on: Tue, Oct 21, 2008, 02:34:30 PM /// Using Expresso Version: 3.0.2766, http://www.ultrapico.com /// /// A description of the regular expression: /// /// Any character that is NOT in this class: [\\], any number of...
223,187
<pre><code>SqlConnection connection = new SqlConnection(FROM_CONFIGURATION) SqlCommand command = new SqlCommand("SomeSQL", connection); connection.Open(); command.ExecuteNonQuery(); command.Dispose(); connection.Dispose(); </code></pre> <p>It is recommended that the code above should include try/catch (or using) ...
[ { "answer_id": 223197, "author": "zappan", "author_id": 4723, "author_profile": "https://Stackoverflow.com/users/4723", "pm_score": 1, "selected": false, "text": "<p>the above-mentioned code releases acquired resources (although, i don't believe you should be calling the Dispose() method...
2008/10/21
[ "https://Stackoverflow.com/questions/223187", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` SqlConnection connection = new SqlConnection(FROM_CONFIGURATION) SqlCommand command = new SqlCommand("SomeSQL", connection); connection.Open(); command.ExecuteNonQuery(); command.Dispose(); connection.Dispose(); ``` It is recommended that the code above should include try/catch (or using) so that if an excep...
As other people here said the GC is non-deterministic, so you don't know when your object will be collected. What I want to clarify is that this is not a problem with the memory, but with the system resources (opened files, database connections) which are expensive and should be released asap. Dispose lets you do that ...
223,189
<p>How can I create a Delphi TSpeedButton or SpeedButton in C# 2.0?</p>
[ { "answer_id": 224188, "author": "JamesSugrue", "author_id": 1075, "author_profile": "https://Stackoverflow.com/users/1075", "pm_score": 0, "selected": false, "text": "<p>Does <a href=\"https://stackoverflow.com/questions/148729/how-to-setchangeremove-focus-style-on-a-button-in-c\">this<...
2008/10/21
[ "https://Stackoverflow.com/questions/223189", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How can I create a Delphi TSpeedButton or SpeedButton in C# 2.0?
Using a Button and setting the TabStop property to false only works when tapping through the form... If you need (as I did) a button that does not get selected when clicking on it, there is only one way I have found to do it. The way I did it, was to subclass the Button class and in the constructor calling the SetSty...
223,190
<p>I have a flat-file schema that has a header and detail records. It looks something like this:</p> <pre><code>HDR**2401*XX0062484*22750***20081006000000*000******* LIN**001*788-0538-001*4891-788538010*20000*EA**0000*** </code></pre> <p>I need to append two blank lines at the end of the message. Right now, if I have...
[ { "answer_id": 223827, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<p>For anybody who cares, I finally caved in and wrote a custom pipeline component to accomplish this.</p>\n" }, { "an...
2008/10/21
[ "https://Stackoverflow.com/questions/223190", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have a flat-file schema that has a header and detail records. It looks something like this: ``` HDR**2401*XX0062484*22750***20081006000000*000******* LIN**001*788-0538-001*4891-788538010*20000*EA**0000*** ``` I need to append two blank lines at the end of the message. Right now, if I have multiple records I get th...
You should be able to accomplish what you want by using the Delimiter properties of the flat file schema. Based on your example file I created a schema with the following record structure: ``` <Schema>   <Root>     <HDRGroup>       <HDR>       <LIN> ``` If you click on the root node of your sch...
223,215
<p>At a previous employer, we were writing binary messages that had to go "over the wire" to other computers. Each message had a standard header something like:</p> <pre><code>class Header { int type; int payloadLength; }; </code></pre> <p>All of the data was contiguous (header, immediately followed by data)...
[ { "answer_id": 223224, "author": "Menkboy", "author_id": 29539, "author_profile": "https://Stackoverflow.com/users/29539", "pm_score": 4, "selected": false, "text": "<p>Personally I think that if there's a crime, it's asking the header for the payload.</p>\n\n<p>But as long as you're goi...
2008/10/21
[ "https://Stackoverflow.com/questions/223215", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17975/" ]
At a previous employer, we were writing binary messages that had to go "over the wire" to other computers. Each message had a standard header something like: ``` class Header { int type; int payloadLength; }; ``` All of the data was contiguous (header, immediately followed by data). We wanted to get to the p...
I'd go for crime against coding. Both methods will generate the exact same object code. The first makes it's intention clear. The second is very confusing, with the only advantage that it saves a couple keystrokes. (Just learn to freakin' type). Also, note that NEITHER method is guaranteed to work. The sizeof() an ob...
223,219
<p>I want to do something like </p> <pre><code>insert into my table (select * from anothertable where id &lt; 5) </code></pre> <p>What is the correct MSSQL syntax?</p> <p>Thanks!</p>
[ { "answer_id": 223236, "author": "Ed Altorfer", "author_id": 26552, "author_profile": "https://Stackoverflow.com/users/26552", "pm_score": 4, "selected": true, "text": "<p>Is this what you're looking for?</p>\n\n<pre><code>INSERT INTO MyTable\nSELECT * FROM AnotherTable\nWHERE AnotherTab...
2008/10/21
[ "https://Stackoverflow.com/questions/223219", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
I want to do something like ``` insert into my table (select * from anothertable where id < 5) ``` What is the correct MSSQL syntax? Thanks!
Is this what you're looking for? ``` INSERT INTO MyTable SELECT * FROM AnotherTable WHERE AnotherTable.ID < 5 ```
223,249
<p>In Visual Studio, two files are created when you create a new Windows Form in your solution (e.g. if you create MyForm.cs, MyForm.Designer.cs and MyForm.resx are also created). These second two files are displayed as a subtree in the Solution Explorer.</p> <p><strong>Is there any way to add files to the sub-tree or...
[ { "answer_id": 223254, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 3, "selected": false, "text": "<p>You need to edit the csproj directly. There is a DependentUpon tag that you have to add as a child tag of the file y...
2008/10/21
[ "https://Stackoverflow.com/questions/223249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5692/" ]
In Visual Studio, two files are created when you create a new Windows Form in your solution (e.g. if you create MyForm.cs, MyForm.Designer.cs and MyForm.resx are also created). These second two files are displayed as a subtree in the Solution Explorer. **Is there any way to add files to the sub-tree or group for a Win...
Open .csproj in edit mode, look for the file you want to be under another one, and add the DependentUpon element, like this: ``` <Compile Include="AlertDialog.xaml.cs"> <DependentUpon>AlertDialog.xaml</DependentUpon> </Compile> ```
223,253
<p>I have a requirement to install multiple web setup projects (using VS2005 and ASP.Net/C#) into the same virtual folder. The projects share some assembly references (the file systems are all structured to use the same 'bin' folder), making deployment of changes to those assemblies problematic since the MS installer...
[ { "answer_id": 224116, "author": "David White", "author_id": 30183, "author_profile": "https://Stackoverflow.com/users/30183", "pm_score": 3, "selected": false, "text": "<p>I cannot answer all your questions, as I don't have experience with TFS.</p>\n\n<p>But I can recommend a better app...
2008/10/21
[ "https://Stackoverflow.com/questions/223253", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7388/" ]
I have a requirement to install multiple web setup projects (using VS2005 and ASP.Net/C#) into the same virtual folder. The projects share some assembly references (the file systems are all structured to use the same 'bin' folder), making deployment of changes to those assemblies problematic since the MS installer will...
I cannot answer all your questions, as I don't have experience with TFS. But I can recommend a better approach to use for updating your AssemblyInfo.cs files than using the AssemblyInfo task. That task appears to just recreate a standard AssemblyInfo file from scratch, and loses any custom portions you may have added....
223,268
<p>I know there is built-in Internet explorer, but what I'm looking for is to open Firefox/Mozilla window (run the application) with specified URL. Anyone can tell me how to do that in C# (.nET) ?</p>
[ { "answer_id": 223290, "author": "Austin Salonen", "author_id": 4068, "author_profile": "https://Stackoverflow.com/users/4068", "pm_score": 0, "selected": false, "text": "<p>Use the Process class (System.Diagnostics) using the URL as the process name. This will use the system default br...
2008/10/21
[ "https://Stackoverflow.com/questions/223268", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21209/" ]
I know there is built-in Internet explorer, but what I'm looking for is to open Firefox/Mozilla window (run the application) with specified URL. Anyone can tell me how to do that in C# (.nET) ?
This will launch the system defined default browser: ``` string url = "http://stackoverflow.com/"; System.Diagnostics.Process.Start(url); ``` Remember that Process.Start(url) might throw exceptions if the browser is not configured correctly.
223,272
<p>I have a simple query like this:</p> <pre><code>select * from mytable where id &gt; 8 </code></pre> <p>I want to make the 8 a variable. There's some syntax like </p> <pre><code>declare @myvar int myvar = 8 </code></pre> <p>but I don't know the exact syntax.</p> <p>What is it?</p> <p>Thanks!</p>
[ { "answer_id": 223280, "author": "Austin Salonen", "author_id": 4068, "author_profile": "https://Stackoverflow.com/users/4068", "pm_score": 1, "selected": false, "text": "<pre><code>declare @myvar int\n\nselect @myvar = 8\n</code></pre>\n" }, { "answer_id": 223281, "author": ...
2008/10/21
[ "https://Stackoverflow.com/questions/223272", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22471/" ]
I have a simple query like this: ``` select * from mytable where id > 8 ``` I want to make the 8 a variable. There's some syntax like ``` declare @myvar int myvar = 8 ``` but I don't know the exact syntax. What is it? Thanks!
It's: ``` DECLARE @MyVariable INT SET @MyVariable = 8 ```
223,283
<p>Even a simple <a href="http://en.wikipedia.org/wiki/Notepad_%28software%29" rel="noreferrer">Notepad</a> application in C# consumes megabytes of RAM as seen in the task manager. On minimizing the application the memory size in the task manager goes down considerably and is back up when the application is maximized.<...
[ { "answer_id": 223300, "author": "Ed Altorfer", "author_id": 26552, "author_profile": "https://Stackoverflow.com/users/26552", "pm_score": 6, "selected": true, "text": "<p>The reason for the large memory footprint is that the JIT compiler and <a href=\"http://en.wikipedia.org/wiki/Window...
2008/10/21
[ "https://Stackoverflow.com/questions/223283", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29443/" ]
Even a simple [Notepad](http://en.wikipedia.org/wiki/Notepad_%28software%29) application in C# consumes megabytes of RAM as seen in the task manager. On minimizing the application the memory size in the task manager goes down considerably and is back up when the application is maximized. I read somewhere that the .NET...
The reason for the large memory footprint is that the JIT compiler and [Windows Forms](http://en.wikipedia.org/wiki/Windows_Forms) engine are being loaded with your process. To reduce this, you can do the following: ``` [DllImport("psapi.dll")] static extern int EmptyWorkingSet(IntPtr hwProc); static void MinimizeFoo...
223,285
<p>I am using the following code:</p> <pre><code>&lt;?php $stock = $_GET[s]; //returns stock ticker symbol eg GOOG or YHOO $first = $stock[0]; $url = "http://biz.yahoo.com/research/earncal/".$first."/".$stock.".html"; $data = file_get_contents($url); $r_header = '/Prev. Week(.+?)Next Week/'; $r_date = '/\&lt;b\&gt;(...
[ { "answer_id": 223358, "author": "mohammedn", "author_id": 29268, "author_profile": "https://Stackoverflow.com/users/29268", "pm_score": 0, "selected": false, "text": "<p>I think this is because you're applying the values to the regex as if it's plain text. However, it's HTML. For exampl...
2008/10/21
[ "https://Stackoverflow.com/questions/223285", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30098/" ]
I am using the following code: ``` <?php $stock = $_GET[s]; //returns stock ticker symbol eg GOOG or YHOO $first = $stock[0]; $url = "http://biz.yahoo.com/research/earncal/".$first."/".$stock.".html"; $data = file_get_contents($url); $r_header = '/Prev. Week(.+?)Next Week/'; $r_date = '/\<b\>(.+?)\<\/b\>/'; preg_ma...
Problem is that the HTML has newlines in it, which you need to incorporate with the s regex modifier, as below ``` <?php $stock = "goog";//$_GET[s]; //returns stock ticker symbol eg GOOG or YHOO $first = $stock[0]; $url = "http://biz.yahoo.com/research/earncal/".$first."/".$stock.".html"; $data = file_get_contents($u...
223,308
<p>I am trying to use page methods in my asp.net page. I have enable page methods set to true on the script manager, the webmethod attribute defined on the method, the function is public static string, I know the function works because when I run it from my code behind it generates the expected result, but when I call...
[ { "answer_id": 223464, "author": "Chris Westbrook", "author_id": 16891, "author_profile": "https://Stackoverflow.com/users/16891", "pm_score": 0, "selected": false, "text": "<p>OK, stupid me. Here is some code. </p>\n\n<pre><code> function getName()\n {\n var ddlAdCodes=$get('&lt;%=d...
2008/10/21
[ "https://Stackoverflow.com/questions/223308", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16891/" ]
I am trying to use page methods in my asp.net page. I have enable page methods set to true on the script manager, the webmethod attribute defined on the method, the function is public static string, I know the function works because when I run it from my code behind it generates the expected result, but when I call it ...
In your PagesMethods call, remove the parentheses from the callback and error functions: ``` PageMethods.getAdCodeInfo(value, onSuccess, onError) ``` `onSuccess` and `onError` are basically variables that point to the functions. So you don't need parentheses for variable names.
223,312
<p>Quite simple really:</p> <pre><code>var req:URLRequest=new URLRequest(); req.url="http://somesite.com"; var header:URLRequestHeader=new URLRequestHeader("my-bespoke-header","1"); req.requestHeaders.push(header); req.method=URLRequestMethod.GET; stream.load(req); </code></pre> <p>Yet, if I inspect the traffic with ...
[ { "answer_id": 223464, "author": "Chris Westbrook", "author_id": 16891, "author_profile": "https://Stackoverflow.com/users/16891", "pm_score": 0, "selected": false, "text": "<p>OK, stupid me. Here is some code. </p>\n\n<pre><code> function getName()\n {\n var ddlAdCodes=$get('&lt;%=d...
2008/10/21
[ "https://Stackoverflow.com/questions/223312", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14357/" ]
Quite simple really: ``` var req:URLRequest=new URLRequest(); req.url="http://somesite.com"; var header:URLRequestHeader=new URLRequestHeader("my-bespoke-header","1"); req.requestHeaders.push(header); req.method=URLRequestMethod.GET; stream.load(req); ``` Yet, if I inspect the traffic with WireShark, the `my-bespoke...
In your PagesMethods call, remove the parentheses from the callback and error functions: ``` PageMethods.getAdCodeInfo(value, onSuccess, onError) ``` `onSuccess` and `onError` are basically variables that point to the functions. So you don't need parentheses for variable names.
223,313
<p>What is MySQL equivalent of the <code>Nz</code> Function in Microsoft Access? Is <code>Nz</code> a SQL standard?</p> <p>In Access, the <code>Nz</code> function lets you return a value when a variant is null. <a href="http://www.techonthenet.com/access/functions/advanced/nz.php" rel="nofollow noreferrer">Source</a><...
[ { "answer_id": 223329, "author": "Mike Wills", "author_id": 2535, "author_profile": "https://Stackoverflow.com/users/2535", "pm_score": 2, "selected": false, "text": "<p>You might want to look at <code>IFNULL</code> or <code>COALESCE</code>. If I recall correctly, <code>IFNULL</code> wor...
2008/10/21
[ "https://Stackoverflow.com/questions/223313", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30076/" ]
What is MySQL equivalent of the `Nz` Function in Microsoft Access? Is `Nz` a SQL standard? In Access, the `Nz` function lets you return a value when a variant is null. [Source](http://www.techonthenet.com/access/functions/advanced/nz.php) The syntax for the `Nz` function is: ``` Nz ( variant, [ value_if_null ] ) ``...
The [`COALESCE()`](https://dev.mysql.com/doc/refman/8.0/en/comparison-operators.html#function_coalesce) function does what you describe. It's standard SQL and it should be supported in all SQL databases. The [`IFNULL()`](https://dev.mysql.com/doc/refman/8.0/en/flow-control-functions.html#function_ifnull) function is n...
223,317
<p>This may not be the correct way to use controllers, but I did notice this problem and hadn't figured out a way to correct it. </p> <pre><code>public JsonResult SomeControllerAction() { //The current method has the HttpContext just fine bool currentIsNotNull = (this.HttpContext == null); //which is false ...
[ { "answer_id": 223334, "author": "mmacaulay", "author_id": 22152, "author_profile": "https://Stackoverflow.com/users/22152", "pm_score": 0, "selected": false, "text": "<p>Is it that you want to use some functionality from the controller? Or have the controller perform an action?</p>\n\n<...
2008/10/21
[ "https://Stackoverflow.com/questions/223317", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17091/" ]
This may not be the correct way to use controllers, but I did notice this problem and hadn't figured out a way to correct it. ``` public JsonResult SomeControllerAction() { //The current method has the HttpContext just fine bool currentIsNotNull = (this.HttpContext == null); //which is false //creat...
Controllers are not designed to be created manually like you're doing. It sounds like what you really should be doing is putting whatever reusable logic you have into a helper class instead.
223,322
<p>I'm trying to have a new layer appear above existing content on my site when a link/button is clicked. I am using jquery - but the code I have doesn't seem to work as expected.</p> <p>Here is what I have:</p> <pre><code> $(document).ready(function(){ $("#button").click(function () { $("#showme").insertAfter("...
[ { "answer_id": 223330, "author": "eyelidlessness", "author_id": 17964, "author_profile": "https://Stackoverflow.com/users/17964", "pm_score": 0, "selected": false, "text": "<p>Make sure <code>#showme</code> has a <code>position</code> other than <code>static</code>.</p>\n" }, { "...
2008/10/21
[ "https://Stackoverflow.com/questions/223322", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to have a new layer appear above existing content on my site when a link/button is clicked. I am using jquery - but the code I have doesn't seem to work as expected. Here is what I have: ``` $(document).ready(function(){ $("#button").click(function () { $("#showme").insertAfter("#bodytag") $("#showm...
It would appear to me that to get the desired effect, the div you are inserting #showme into needs to be position: relative, and #showme should be position: absolute. Absolute positioning will take the element out of the document flow, allowing it to sit above the content. Also, two tips - $() is a shortcut for $(docu...
223,324
<p><strong>Goal:</strong> Allow the user to delete a record by dragging a row from an AdvancedDataGrid, dropping it onto a trash-can icon and verify the user meant to do that via a popup alert with "OK" and "Cancel" buttons. </p> <p><strong>What is working:</strong> <ul> <li>Dragging/Dropping a row onto the tra...
[ { "answer_id": 223388, "author": "Simon", "author_id": 24039, "author_profile": "https://Stackoverflow.com/users/24039", "pm_score": 0, "selected": false, "text": "<p>Try refreshing the data bindings on the datagrid using executeBindings and/or invalidateDisplayList in the enclosing cont...
2008/10/21
[ "https://Stackoverflow.com/questions/223324", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30072/" ]
**Goal:** Allow the user to delete a record by dragging a row from an AdvancedDataGrid, dropping it onto a trash-can icon and verify the user meant to do that via a popup alert with "OK" and "Cancel" buttons. **What is working:** * Dragging/Dropping a row onto the trash icon. * If the user clicks the "OK" button, the...
Have you tried running the validateNow() method on the ADG after the cancel event? Here is some more information on the validateNow() method. [Why you need to know about validateNow...](http://www.judahfrangipane.com/blog/?p=220) I really do think this is what you're looking for! Please let us know if that is the c...
223,328
<p>I have been trying to strip out some data from HTML files. I have the logic coded to get the right cells. Now I am struggling to get the actual contents of the 'cell':</p> <p>here is my HTML snippet:</p> <p>headerRows[0][10].contents</p> <pre><code> [&lt;font size="+0"&gt;&lt;font face="serif" size="1"&gt;&lt;b...
[ { "answer_id": 223534, "author": "Jonny Buchanan", "author_id": 6760, "author_profile": "https://Stackoverflow.com/users/6760", "pm_score": 3, "selected": false, "text": "<p>The <a href=\"http://www.crummy.com/software/BeautifulSoup/documentation.html\" rel=\"nofollow noreferrer\">Beauti...
2008/10/21
[ "https://Stackoverflow.com/questions/223328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30105/" ]
I have been trying to strip out some data from HTML files. I have the logic coded to get the right cells. Now I am struggling to get the actual contents of the 'cell': here is my HTML snippet: headerRows[0][10].contents ``` [<font size="+0"><font face="serif" size="1"><b>Apples Produced</b><font size="3"> ...
``` headerRows[0][10].contents[0].find('b').string ```
223,352
<p>I'm trying to determine the reason for a stalled process on Linux. It's a telecom application, running under fairly heavy load. There is a separate process for each of 8 T1 spans. Every so often, one of the processes will get very unresponsive - up to maybe 50 seconds before an event is noted in the normally very...
[ { "answer_id": 223364, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 2, "selected": false, "text": "<p>You can strace the program in question and see what system calls it's making.</p>\n" }, { "answer_id": 22359...
2008/10/21
[ "https://Stackoverflow.com/questions/223352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm trying to determine the reason for a stalled process on Linux. It's a telecom application, running under fairly heavy load. There is a separate process for each of 8 T1 spans. Every so often, one of the processes will get very unresponsive - up to maybe 50 seconds before an event is noted in the normally very busy ...
If you are able to spot this "moment of unresponsiveness", then you might use strace to attach to the process in question during that time and try to figure out where it "sleeps": ``` strace -f -o LOG -p <pid> ``` More lightweight, but less reliable method: 1. When process hangs, use top/ps/gdp/strace/ltrace to fin...
223,354
<p>I've got a really simple rails question here but I can't seem to find the answer anywhere. I guess some of the problems stem from me following a tutorial for Rails 1.2 with Rails 2.1. Anyway..</p> <p>I'm writing a blog system and I'm implementing the comments bit. I have comments displaying fine once I've created t...
[ { "answer_id": 223515, "author": "Vitalie", "author_id": 27913, "author_profile": "https://Stackoverflow.com/users/27913", "pm_score": -1, "selected": false, "text": "<p>yes, you use old rails style.</p>\n\n<p>Something new: </p>\n\n<pre><code> form_for :comment, :url =&gt; { :post_id ...
2008/10/21
[ "https://Stackoverflow.com/questions/223354", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1912/" ]
I've got a really simple rails question here but I can't seem to find the answer anywhere. I guess some of the problems stem from me following a tutorial for Rails 1.2 with Rails 2.1. Anyway.. I'm writing a blog system and I'm implementing the comments bit. I have comments displaying fine once I've created them using ...
Does `redirect_to :action => 'show', :id => params[:id]` with quotes around show work?
223,355
<p>I had a problem with committing changes after merging two branches of my project using TortoiseSVN.</p> <p>Here are details:</p> <p>I did a merge branch to trunk of <em>project</em> which I am working on. </p> <p><em>Project</em> includes main repository and libraries joint to main repository as <em>svn external<...
[ { "answer_id": 223374, "author": "Josh Kodroff", "author_id": 549, "author_profile": "https://Stackoverflow.com/users/549", "pm_score": 2, "selected": false, "text": "<p>I think I remember reading about a bug relating to this in TortoiseSVN that's been fixed in the latest release. Check...
2008/10/21
[ "https://Stackoverflow.com/questions/223355", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1483/" ]
I had a problem with committing changes after merging two branches of my project using TortoiseSVN. Here are details: I did a merge branch to trunk of *project* which I am working on. *Project* includes main repository and libraries joint to main repository as *svn external* (libraries are also branched) as subdire...
***svn:external*** will cause Subversion to combine different repository paths on check-out, but ultimately those paths are still 'disjoint', so you have to do two commits to get the changes applied. Here's the relevant quote from [Version Control with Subversion](http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.a...
223,356
<pre><code>url = "http://example.com/file.xml" data = urllib2.urlopen(url) data.read() </code></pre> <p>The question is, when exactly will the file be downloaded from the internet? When i do urlopen or .read()? On my network interface I see high traffic both times. </p>
[ { "answer_id": 223374, "author": "Josh Kodroff", "author_id": 549, "author_profile": "https://Stackoverflow.com/users/549", "pm_score": 2, "selected": false, "text": "<p>I think I remember reading about a bug relating to this in TortoiseSVN that's been fixed in the latest release. Check...
2008/10/21
[ "https://Stackoverflow.com/questions/223356", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20955/" ]
``` url = "http://example.com/file.xml" data = urllib2.urlopen(url) data.read() ``` The question is, when exactly will the file be downloaded from the internet? When i do urlopen or .read()? On my network interface I see high traffic both times.
***svn:external*** will cause Subversion to combine different repository paths on check-out, but ultimately those paths are still 'disjoint', so you have to do two commits to get the changes applied. Here's the relevant quote from [Version Control with Subversion](http://svnbook.red-bean.com/en/1.5/svn-book.html#svn.a...
223,393
<p>What is the Perl equivalent of <code>strlen()</code>?</p>
[ { "answer_id": 223401, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 7, "selected": true, "text": "<p><code>length($string)</code></p>\n<pre>perldoc -f length\n\n length EXPR\n length Returns the length in characte...
2008/10/21
[ "https://Stackoverflow.com/questions/223393", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18511/" ]
What is the Perl equivalent of `strlen()`?
`length($string)` ``` perldoc -f length length EXPR length Returns the length in characters of the value of EXPR. If EXPR is omitted, returns length of $_. Note that this cannot be used on an entire array or hash to find out how many elements these have. For that, use "scala...
223,400
<p>I've just started learning linq and lambda expressions, and they seem to be a good fit for finding duplicates in a complex object collection, but I'm getting a little confused and hope someone can help put me back on the path to happy coding.</p> <p>My object is structured like list.list.uniqueCustomerIdentifier</p...
[ { "answer_id": 223414, "author": "smaclell", "author_id": 22914, "author_profile": "https://Stackoverflow.com/users/22914", "pm_score": 2, "selected": false, "text": "<p>There is a linq operator Distinct( ), that allows you to filter down to a distinct set of records if you only want the...
2008/10/21
[ "https://Stackoverflow.com/questions/223400", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22706/" ]
I've just started learning linq and lambda expressions, and they seem to be a good fit for finding duplicates in a complex object collection, but I'm getting a little confused and hope someone can help put me back on the path to happy coding. My object is structured like list.list.uniqueCustomerIdentifier I need to e...
* Unpack the hierarchy * Project each element to its uniqueID property * Group these ID's up * Filter the groups by groups that have more than 1 element * Project each group to the group's key (back to uniqueID) * Enumerate the query and store the result in a list. --- ``` var result = myList .SelectMany(x => ...
223,433
<p>I get to dust off my VBScript hat and write some classic ASP to query a SQL Server 2000 database.</p> <p>Here's the scenario:</p> <ul> <li>I have two <em>datetime</em> fields called <strong>fieldA</strong> and <strong>fieldB</strong>.</li> <li><strong>fieldB</strong> will never have a year value that's greater tha...
[ { "answer_id": 223446, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": false, "text": "<pre><code>select *\nfrom t\nwhere datepart(month,t.fieldA) &gt;= datepart(month,t.fieldB)\n or (datepart(month,t....
2008/10/21
[ "https://Stackoverflow.com/questions/223433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/305/" ]
I get to dust off my VBScript hat and write some classic ASP to query a SQL Server 2000 database. Here's the scenario: * I have two *datetime* fields called **fieldA** and **fieldB**. * **fieldB** will never have a year value that's greater than the year of **fieldA** * It **is** possible the that two fields will hav...
You may want to use the built in time functions such as DAY and MONTH. e.g. ``` SELECT * from table where MONTH(fieldA) > MONTH(fieldB) OR( MONTH(fieldA) = MONTH(fieldB) AND DAY(fieldA) >= DAY(fieldB)) ``` Selecting all rows where either the fieldA's month is greater or the months are the same and fieldA's day is gr...
223,436
<p>Consider the following SQL:</p> <pre> BEGIN TRAN SET TRANSACTION ISOLATION LEVEL READ COMMITTED INSERT Bands ( Name ) SELECT 'Depeche Mode' UNION SELECT 'Arcade Fire' -- I've indented the inner transaction to make it clearer. BEGIN TRAN SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED SELE...
[ { "answer_id": 223530, "author": "Bob Probst", "author_id": 12424, "author_profile": "https://Stackoverflow.com/users/12424", "pm_score": 4, "selected": true, "text": "<p>I don't think that is correct.</p>\n\n<p>Refer to the remarks here: <a href=\"http://msdn.microsoft.com/en-us/librar...
2008/10/21
[ "https://Stackoverflow.com/questions/223436", "https://Stackoverflow.com", "https://Stackoverflow.com/users/27779/" ]
Consider the following SQL: ``` BEGIN TRAN SET TRANSACTION ISOLATION LEVEL READ COMMITTED INSERT Bands ( Name ) SELECT 'Depeche Mode' UNION SELECT 'Arcade Fire' -- I've indented the inner transaction to make it clearer. BEGIN TRAN SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED SELECT * ...
I don't think that is correct. Refer to the remarks here: [Set Transaction](http://msdn.microsoft.com/en-us/library/ms173763(SQL.90).aspx) > > Only one of the isolation level > options can be set at a time, and it > remains set for that connection until > it is explicitly changed. > > >
223,468
<p>Question: </p> <pre><code>((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3)) </code></pre> <p>This was #1 on the midterm, I put "81 9" he thought I forgot to cross one out lawl, so I cross out 81, and he goes aww. Anyways, I dont understand why it's 81.</p> <p>I understand why <code>(lambda (x) (* x x)) (* 3 3) ...
[ { "answer_id": 223484, "author": "ddaa", "author_id": 11549, "author_profile": "https://Stackoverflow.com/users/11549", "pm_score": 4, "selected": true, "text": "<p>This needs some indentation to clarify</p>\n\n<pre><code>((lambda (x y) (x y))\n (lambda (x) (* x x))\n (* 3 3))\n</code></...
2008/10/21
[ "https://Stackoverflow.com/questions/223468", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18431/" ]
Question: ``` ((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3)) ``` This was #1 on the midterm, I put "81 9" he thought I forgot to cross one out lawl, so I cross out 81, and he goes aww. Anyways, I dont understand why it's 81. I understand why `(lambda (x) (* x x)) (* 3 3) = 81`, but the first lambda I dont und...
This needs some indentation to clarify ``` ((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3)) ``` * `(lambda (x y) (x y))`; call `x` with `y` as only parameter. * `(lambda (x) (* x x))`; evaluate to the square of its parameter. * `(* 3 3)`; evaluate to 9 So the whole thing means: "call the square function with t...
223,472
<p>Aspell-net is a port of the GNU Aspell for .Net Framework. The library itself is open source, and is under the LGPL license, but the english dictionary for aspell is mentioned as copyrighted on the sourceforge.net project home page at <a href="http://aspell-net.sourceforge.net/" rel="nofollow noreferrer">http://aspe...
[ { "answer_id": 223484, "author": "ddaa", "author_id": 11549, "author_profile": "https://Stackoverflow.com/users/11549", "pm_score": 4, "selected": true, "text": "<p>This needs some indentation to clarify</p>\n\n<pre><code>((lambda (x y) (x y))\n (lambda (x) (* x x))\n (* 3 3))\n</code></...
2008/10/21
[ "https://Stackoverflow.com/questions/223472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Aspell-net is a port of the GNU Aspell for .Net Framework. The library itself is open source, and is under the LGPL license, but the english dictionary for aspell is mentioned as copyrighted on the sourceforge.net project home page at <http://aspell-net.sourceforge.net/> Did any of you guys use aspell-net before? and ...
This needs some indentation to clarify ``` ((lambda (x y) (x y)) (lambda (x) (* x x)) (* 3 3)) ``` * `(lambda (x y) (x y))`; call `x` with `y` as only parameter. * `(lambda (x) (* x x))`; evaluate to the square of its parameter. * `(* 3 3)`; evaluate to 9 So the whole thing means: "call the square function with t...
223,480
<p>Simple question that keeps bugging me.</p> <p>Should I HTML encode user input right away and store the encoded contents in the database, or should I store the raw values and HTML encode when displaying?</p> <p>Storing encoded data greatly reduces the risk of a developer forgetting to encode the data when it's bein...
[ { "answer_id": 223494, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 6, "selected": true, "text": "<p>i'd strongly suggest encoding information on the way out. storing raw data in the database is useful if you wish to change th...
2008/10/21
[ "https://Stackoverflow.com/questions/223480", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12469/" ]
Simple question that keeps bugging me. Should I HTML encode user input right away and store the encoded contents in the database, or should I store the raw values and HTML encode when displaying? Storing encoded data greatly reduces the risk of a developer forgetting to encode the data when it's being displayed. Howe...
i'd strongly suggest encoding information on the way out. storing raw data in the database is useful if you wish to change the way it's viewed at a certain point. the flow should be something similar to: ``` sanitize user input -> protect against sql injection -> db -> encode for display ``` think about a situation ...
223,490
<p>My company requires me to use Outlook for my E-mail. Outlook does virtually nothing the way I want to do it and it frustrates me greatly. (I'm not trying to start a flame war here, it must do exactly what thousands of CEO's want it to do, but I'm not a CEO.)</p> <p>I would like to be able to automatically extract...
[ { "answer_id": 223542, "author": "StubbornMule", "author_id": 13341, "author_profile": "https://Stackoverflow.com/users/13341", "pm_score": 4, "selected": true, "text": "<p><a href=\"http://www.dimastr.com/redemption/\" rel=\"noreferrer\">Outlook Redemption</a> is the best thing currentl...
2008/10/21
[ "https://Stackoverflow.com/questions/223490", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10722/" ]
My company requires me to use Outlook for my E-mail. Outlook does virtually nothing the way I want to do it and it frustrates me greatly. (I'm not trying to start a flame war here, it must do exactly what thousands of CEO's want it to do, but I'm not a CEO.) I would like to be able to automatically extract the thousan...
[Outlook Redemption](http://www.dimastr.com/redemption/) is the best thing currently to use that I have found. It will allow you to get into the messages and extract the attachments and the message bodies. i am using it now to do just that. Here is some code I use in a class. I included the constructor and the process...
223,495
<p>Is there a way to Invoke an overloaded method using reflection in .NET (2.0). I have an application that dynamically instantiates classes that have been derived from a common base class. For compatibility purposes, this base class contains 2 methods of the same name, one with parameters, and one without. I need t...
[ { "answer_id": 223505, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 4, "selected": false, "text": "<p>Yes. When you invoke the method pass the parameters that match the overload that you want.</p>\n\n<p>For instance:</p>\n\n<pr...
2008/10/21
[ "https://Stackoverflow.com/questions/223495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13611/" ]
Is there a way to Invoke an overloaded method using reflection in .NET (2.0). I have an application that dynamically instantiates classes that have been derived from a common base class. For compatibility purposes, this base class contains 2 methods of the same name, one with parameters, and one without. I need to call...
You have to specify which method you want: ``` class SomeType { void Foo(int size, string bar) { } void Foo() { } } SomeType obj = new SomeType(); // call with int and string arguments obj.GetType() .GetMethod("Foo", new Type[] { typeof(int), typeof(string) }) .Invoke(obj, new object[] { 42, "Hello"...
223,526
<p>I'm writing a small application in VB.NET and I would like some of the classes to be able to write themselves out to XML to serve as a "save" feature. I have seen XSD files used to generate VB classes that can serialize themselves into and out of XML very easily. How would I do this if I do have any pre-existing X...
[ { "answer_id": 223543, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": 2, "selected": false, "text": "<p>Since you asked about making it 'easy', then there are three rules to follow that will help keeps things very simpl...
2008/10/21
[ "https://Stackoverflow.com/questions/223526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5904/" ]
I'm writing a small application in VB.NET and I would like some of the classes to be able to write themselves out to XML to serve as a "save" feature. I have seen XSD files used to generate VB classes that can serialize themselves into and out of XML very easily. How would I do this if I do have any pre-existing XML fo...
Use the System.Xml and System.Xml.Serialization namespaces. They describe classes that you can use to annotate your classes' members with the corresponding tag. For example (in C#): ``` [XmlRoot("foo")] public class Foo { [XmlAttribute("bar")] public string bar; [XmlAttribute("baz")] public doub...
223,533
<p>I am looking for a solution or recommendation to a problem I am having. I have a bunch of ASPX pages that will be localized and have a bunch of text that needs to be supported in 6 languages.</p> <p>The people doing the translation will not have access to Visual Studio and the likely easiest tool is Excel. If we ...
[ { "answer_id": 224214, "author": "Jared", "author_id": 7388, "author_profile": "https://Stackoverflow.com/users/7388", "pm_score": 2, "selected": false, "text": "<p>I'm not sure how comprehensive an answer you're looking for, but if you're really just using [string, string] pairs for you...
2008/10/21
[ "https://Stackoverflow.com/questions/223533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2305/" ]
I am looking for a solution or recommendation to a problem I am having. I have a bunch of ASPX pages that will be localized and have a bunch of text that needs to be supported in 6 languages. The people doing the translation will not have access to Visual Studio and the likely easiest tool is Excel. If we use Excel or...
I'm not sure how comprehensive an answer you're looking for, but if you're really just using [string, string] pairs for your localization, and you're just looking for a quick way to load resource (.resx) files with the results of your translations, then the following will work as a fairly quick, low-tech solution. The...
223,535
<p>Is there a way to manually increase / decrease the timeout of a specific aspx page?</p>
[ { "answer_id": 223551, "author": "mohammedn", "author_id": 29268, "author_profile": "https://Stackoverflow.com/users/29268", "pm_score": 4, "selected": true, "text": "<p>In the web.config:</p>\n\n<pre><code> &lt;configuration&gt;\n &lt;location path=\"~/Default.aspx\"&gt;\n ...
2008/10/21
[ "https://Stackoverflow.com/questions/223535", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1574/" ]
Is there a way to manually increase / decrease the timeout of a specific aspx page?
In the web.config: ``` <configuration> <location path="~/Default.aspx"> <system.web> <httpRuntime executionTimeout="1000"/> </system.web> </location> </configuration> ```
223,548
<p>I have been reading the <a href="http://msdn.microsoft.com/en-us/library/ms997565.aspx" rel="nofollow noreferrer">MSDN</a> documentation on subclassing and I have been successful in handling events in a subclass</p> <p>My issue is with passing messages back to the original WndProc.</p> <p>As an example, if I have...
[ { "answer_id": 223858, "author": "ChrisN", "author_id": 3853, "author_profile": "https://Stackoverflow.com/users/3853", "pm_score": 3, "selected": true, "text": "<p>The button notifications are sent to the button's parent, which is the group box. Because you've subclassed the group box, ...
2008/10/21
[ "https://Stackoverflow.com/questions/223548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2067/" ]
I have been reading the [MSDN](http://msdn.microsoft.com/en-us/library/ms997565.aspx) documentation on subclassing and I have been successful in handling events in a subclass My issue is with passing messages back to the original WndProc. As an example, if I have a window, with a sub-classed groupbox control and a bu...
The button notifications are sent to the button's parent, which is the group box. Because you've subclassed the group box, your `SubClassFunc` receives these messages, which then passes them to the group box's original window procedure using `CallWindowProc`. If you want the button notifications to go to the parent wi...
223,549
<p>We have a product but we are doing some rebranding so we need to be able to build and maintain two versions. I used resource files combined with some #if stuff to solve the strings, images, and whatever else, but the program icon is giving me trouble. I couldn't figure it out from msdn or a google search. Thanks!...
[ { "answer_id": 223590, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 1, "selected": false, "text": "<p>Set the icon in normal code, and you should be able to use the same techniques as you have elsewhere. You'll need bot...
2008/10/21
[ "https://Stackoverflow.com/questions/223549", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
We have a product but we are doing some rebranding so we need to be able to build and maintain two versions. I used resource files combined with some #if stuff to solve the strings, images, and whatever else, but the program icon is giving me trouble. I couldn't figure it out from msdn or a google search. Thanks!
Create icon files named after your config. (E.g. DebugOld.app.ico DebugBranded.app.ico, ReleaseBranded.app.ico) Create a pre-build step: ``` copy "$(ProjectDir)$(ConfigurationName).app.ico" "$(ProjectDir)app.ico" ```
223,556
<p>Say I need some very special multiplication operator. It may be implemented in following macro:</p> <pre><code>macro @&lt;&lt;!(op1, op2) { &lt;[ ( $op1 * $op2 ) ]&gt; } </code></pre> <p>And I can use it like</p> <pre><code>def val = 2 &lt;&lt;! 3 </code></pre> <p>And its work.</p> <p>But what I really want...
[ { "answer_id": 223626, "author": "ADEpt", "author_id": 10105, "author_profile": "https://Stackoverflow.com/users/10105", "pm_score": 4, "selected": true, "text": "<p>Straight from the compiler source code:</p>\n\n<pre><code>namespace Nemerle.English\n{\n [assembly: Nemerle.Internal.Oper...
2008/10/21
[ "https://Stackoverflow.com/questions/223556", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9198/" ]
Say I need some very special multiplication operator. It may be implemented in following macro: ``` macro @<<!(op1, op2) { <[ ( $op1 * $op2 ) ]> } ``` And I can use it like ``` def val = 2 <<! 3 ``` And its work. But what I really want is some 'english'-like operator for the DSL Im developing now: ``` macro...
Straight from the compiler source code: ``` namespace Nemerle.English { [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.English", "and", false, 160, 161)] [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.English", "or", false, 150, 151)] [assembly: Nemerle.Internal.OperatorAttribute ("Nemerle.Engl...
223,559
<p>I want to know how to use variables for objects and function names in Python. In PHP, you can do this:</p> <pre><code>$className = "MyClass"; $newObject = new $className(); </code></pre> <p>How do you do this sort of thing in Python? Or, am I totally not appreciating some fundamental difference with Python, and i...
[ { "answer_id": 223566, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 6, "selected": true, "text": "<p>In Python,</p>\n\n<pre><code>className = MyClass\nnewObject = className()\n</code></pre>\n\n<p>The first line makes the...
2008/10/21
[ "https://Stackoverflow.com/questions/223559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/577/" ]
I want to know how to use variables for objects and function names in Python. In PHP, you can do this: ``` $className = "MyClass"; $newObject = new $className(); ``` How do you do this sort of thing in Python? Or, am I totally not appreciating some fundamental difference with Python, and if so, what is it?
In Python, ``` className = MyClass newObject = className() ``` The first line makes the variable `className` refer to the same thing as `MyClass`. Then the next line calls the `MyClass` constructor through the `className` variable. As a concrete example: ``` >>> className = list >>> newObject = className() >>> new...
223,618
<p>First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built for MSWin32-x86-multi-thread).</p> <p>I've just emerged from a three hour long debugging session, trying to find the source of an error. I found there was simply no error, but for some reason ADO's connection object was getting the ...
[ { "answer_id": 223690, "author": "Richard Harrison", "author_id": 19624, "author_profile": "https://Stackoverflow.com/users/19624", "pm_score": 3, "selected": true, "text": "<p>This is to be expected as it's what ADO does and the Win32::ADO is quite a thin layer above it.</p>\n\n<p>ref:...
2008/10/21
[ "https://Stackoverflow.com/questions/223618", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21258/" ]
First of all (in case this is important) I'm using ActiveState's Perl (v5.8.7 built for MSWin32-x86-multi-thread). I've just emerged from a three hour long debugging session, trying to find the source of an error. I found there was simply no error, but for some reason ADO's connection object was getting the `Errors.Co...
This is to be expected as it's what ADO does and the Win32::ADO is quite a thin layer above it. ref: knowledge base [note that the RAISERROR and PRINT statements are returned through the ADO errors collection](http://support.microsoft.com/kb/194792)
223,627
<p>I'm trying to get a query working that takes the values (sometimes just the first part of a string) from a form control. The problem I have is that it only returns records when the full string is typed in.</p> <p>i.e. in the surname box, I should be able to type gr, and it brings up </p> <p>green grey graham</p> ...
[ { "answer_id": 223648, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 0, "selected": false, "text": "<p>My only thoguht is that maybe a () is needed to group the like</p>\n\n<p>For example a snippet on the first par...
2008/10/21
[ "https://Stackoverflow.com/questions/223627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30140/" ]
I'm trying to get a query working that takes the values (sometimes just the first part of a string) from a form control. The problem I have is that it only returns records when the full string is typed in. i.e. in the surname box, I should be able to type gr, and it brings up green grey graham but at present it's n...
There is an Access Method for that! ----------------------------------- If you have your "filter" controls on the form, why don't you use the Application.buildCriteria method, that will allow you to add your filtering criterias to a string, then make a filter out of this string, and build your WHERE clause on the fly?...
223,628
<p>I have derived a TabControl with the express purpose of enabling double buffering, except nothing is working as expected. Here is the TabControl code:</p> <pre><code>class DoubleBufferedTabControl : TabControl { public DoubleBufferedTabControl() : base() { this.DoubleBuffered = true; this.Se...
[ { "answer_id": 223676, "author": "C. Dragon 76", "author_id": 5682, "author_profile": "https://Stackoverflow.com/users/5682", "pm_score": 0, "selected": false, "text": "<p>Not sure, but you might try double-buffering the control that contains the tab control. </p>\n" }, { "answer...
2008/10/21
[ "https://Stackoverflow.com/questions/223628", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13227/" ]
I have derived a TabControl with the express purpose of enabling double buffering, except nothing is working as expected. Here is the TabControl code: ``` class DoubleBufferedTabControl : TabControl { public DoubleBufferedTabControl() : base() { this.DoubleBuffered = true; this.SetStyle ...
If you read the documentation, it says, "This member is not meaningful for this control." If you want the control to be drawn utilizing double-buffering, you'll have to implement it yourself. Besides the fact that if you owner-draw the control, you would have to implement double-buffering yourself anyhow.
223,640
<p>My class is implementing a super-class method which which returns <code>List&lt;JComponent&gt;</code>. The list being returned is read-only:</p> <pre><code>public abstract class SuperClass { public abstract List&lt;JComponent&gt; getComponents(); } </code></pre> <p>In my class, I want to return a field which ...
[ { "answer_id": 223653, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 3, "selected": false, "text": "<p>Declare <code>getComponents()</code> as:</p>\n\n<pre><code>public List&lt;? extends JComponent&gt; getComponents(...
2008/10/21
[ "https://Stackoverflow.com/questions/223640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My class is implementing a super-class method which which returns `List<JComponent>`. The list being returned is read-only: ``` public abstract class SuperClass { public abstract List<JComponent> getComponents(); } ``` In my class, I want to return a field which is declared as List - i.e. a sub-list: ``` public...
Declare `getComponents()` as: ``` public List<? extends JComponent> getComponents() ```
223,643
<p>I'm currently adding some new extended classes to this code:</p> <pre><code>foreach (BaseType b in CollectionOfExtendedTypes) { if (b is ExtendedType1) { ((ExtendedType1) b).foo = this; } else if (b is ExtendedType2) { ((ExtenedType2) b).foo = this; } else { b.foo = this; } } </code></pr...
[ { "answer_id": 223647, "author": "Ray Li", "author_id": 28952, "author_profile": "https://Stackoverflow.com/users/28952", "pm_score": -1, "selected": false, "text": "<p>In C#, I believe the switch statement only works with integers and strings.</p>\n" }, { "answer_id": 223650, ...
2008/10/21
[ "https://Stackoverflow.com/questions/223643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21387/" ]
I'm currently adding some new extended classes to this code: ``` foreach (BaseType b in CollectionOfExtendedTypes) { if (b is ExtendedType1) { ((ExtendedType1) b).foo = this; } else if (b is ExtendedType2) { ((ExtenedType2) b).foo = this; } else { b.foo = this; } } ``` and was curious if ...
This really looks like a situation for a good polymorphic implementation. If you override the appropriate methods in the derived classes, you may not need the checks in the loop at all.
223,652
<p>I was wondering if there is any way to escape a CDATA end token (<code>]]&gt;</code>) within a CDATA section in an xml document. Or, more generally, if there is some escape sequence for using within a CDATA (but if it exists, I guess it'd probably only make sense to escape begin or end tokens, anyway). </p> <p>Basi...
[ { "answer_id": 223773, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 7, "selected": false, "text": "<p>You have to break your data into pieces to conceal the <code>]]&gt;</code>.</p>\n\n<p>Here's the whole thing:</p>\n\n<p>...
2008/10/21
[ "https://Stackoverflow.com/questions/223652", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24170/" ]
I was wondering if there is any way to escape a CDATA end token (`]]>`) within a CDATA section in an xml document. Or, more generally, if there is some escape sequence for using within a CDATA (but if it exists, I guess it'd probably only make sense to escape begin or end tokens, anyway). Basically, can you have a be...
Clearly, this question is purely academic. Fortunately, it has a very definite answer. You cannot escape a CDATA end sequence. Production rule 20 of the XML [specification](http://www.w3.org/TR/REC-xml/#sec-cdata-sect) is quite clear: ``` [20] CData ::= (Char* - (Char* ']]>' Char*)) ``` EDIT: This prod...
223,666
<p>I am looking for the cleanest way. I am tempted to use delegates not sure though.</p>
[ { "answer_id": 223722, "author": "Ray", "author_id": 233, "author_profile": "https://Stackoverflow.com/users/233", "pm_score": 0, "selected": false, "text": "<p>You might need to add more details. Delegates are a good option option, as is reflection if you only have the method name, not ...
2008/10/21
[ "https://Stackoverflow.com/questions/223666", "https://Stackoverflow.com", "https://Stackoverflow.com/users/438/" ]
I am looking for the cleanest way. I am tempted to use delegates not sure though.
Are you after something like this? ``` class A { public int Value; public int Add(int a) { return a + Value; } public int Mul(int a) { return a * Value; } } class Program { static void Main( string[] args ) { A a = new A(); a.Value = 10; Func<int, int> f; f = a.Add;...
223,673
<p>Alright, I am going to state up front that this question may be too involved (amount of detail not complexity) for this medium. But I figured this was the best place to start.</p> <p>I am attempting to setup a proof of concept project and my BIND configuration is my first big hurdle. I want to setup 3 DNS servers...
[ { "answer_id": 223749, "author": "Richard Harrison", "author_id": 19624, "author_profile": "https://Stackoverflow.com/users/19624", "pm_score": 0, "selected": false, "text": "<p>Assuming that you've checked all of the obvious things - such as ensuring that the main bind configuration fil...
2008/10/21
[ "https://Stackoverflow.com/questions/223673", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30145/" ]
Alright, I am going to state up front that this question may be too involved (amount of detail not complexity) for this medium. But I figured this was the best place to start. I am attempting to setup a proof of concept project and my BIND configuration is my first big hurdle. I want to setup 3 DNS servers on 3 physic...
By using @, you're defining itchy.bogus. You can't then redefine it further down in the zone with the itchy.bogus line. Try this: ``` @ SOA ns1.itchy.bogus. hostmaster.itchy.bogus. ( 2008102201 ; serial 1H ; refresh 2H...
223,677
<p>I have a regexp I'm using with sed, but now I need to make it work in PHP also. I can't use system calls as they are disabled.</p> <pre> $ cat uglynumber.txt: Ticket number : 303905694, FOO:BAR:BAR: Some text Case ID:123,456,789:Foobar - Some other text 303867970;[FOOBAR] Some text goes here Case Ref: 303658850 - S...
[ { "answer_id": 223749, "author": "Richard Harrison", "author_id": 19624, "author_profile": "https://Stackoverflow.com/users/19624", "pm_score": 0, "selected": false, "text": "<p>Assuming that you've checked all of the obvious things - such as ensuring that the main bind configuration fil...
2008/10/21
[ "https://Stackoverflow.com/questions/223677", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30141/" ]
I have a regexp I'm using with sed, but now I need to make it work in PHP also. I can't use system calls as they are disabled. ``` $ cat uglynumber.txt: Ticket number : 303905694, FOO:BAR:BAR: Some text Case ID:123,456,789:Foobar - Some other text 303867970;[FOOBAR] Some text goes here Case Ref: 303658850 - Some rand...
By using @, you're defining itchy.bogus. You can't then redefine it further down in the zone with the itchy.bogus line. Try this: ``` @ SOA ns1.itchy.bogus. hostmaster.itchy.bogus. ( 2008102201 ; serial 1H ; refresh 2H...
223,678
<p>Given the hash of a blob, is there a way to get a list of commits that have this blob in their tree?</p>
[ { "answer_id": 223870, "author": "Greg Hewgill", "author_id": 893, "author_profile": "https://Stackoverflow.com/users/893", "pm_score": 3, "selected": false, "text": "<p>I thought this would be a generally useful thing to have, so I wrote up a little perl script to do it:</p>\n\n<pre cla...
2008/10/21
[ "https://Stackoverflow.com/questions/223678", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4883/" ]
Given the hash of a blob, is there a way to get a list of commits that have this blob in their tree?
Both of the following scripts take the blob’s SHA1 as the first argument, and after it, optionally, any arguments that [`git log`](http://git-scm.com/docs/git-log) will understand. E.g. `--all` to search in all branches instead of just the current one, or `-g` to search in the reflog, or whatever else you fancy. Here ...
223,700
<p>I have a class that I need to binary serialize. The class contains one field as below:</p> <pre><code>private T[,] m_data; </code></pre> <p>These multi-dimensional arrays can be fairly large (hundreds of thousands of elements) and of any primitive type. When I tried standard .net serialization on an object the fil...
[ { "answer_id": 223721, "author": "Shachar", "author_id": 13897, "author_profile": "https://Stackoverflow.com/users/13897", "pm_score": 0, "selected": false, "text": "<p>The best code length/output size ratio would be to encode your array using BitConverter, converting all elements into t...
2008/10/21
[ "https://Stackoverflow.com/questions/223700", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30132/" ]
I have a class that I need to binary serialize. The class contains one field as below: ``` private T[,] m_data; ``` These multi-dimensional arrays can be fairly large (hundreds of thousands of elements) and of any primitive type. When I tried standard .net serialization on an object the file written to disk was larg...
Here's what I came up with. The code below makes an int[1000][10000] and writes it out using the BinaryFormatter to 2 files - one zipped and one not. The zipped file is 1.19 MB (1,255,339 bytes) Unzipped is 38.2 MB (40,150,034 bytes) ``` int width = 1000; int height = 10000; List<int[]> list ...
223,713
<p>I've just started working with ASP.NET MVC now that it's in beta. In my code, I'm running a simple LINQ to SQL query to get a list of results and passing that to my view. This sort of thing:</p> <pre><code>var ords = from o in db.Orders where o.OrderDate == DateTime.Today select o; return Vie...
[ { "answer_id": 223811, "author": "John Boker", "author_id": 2847, "author_profile": "https://Stackoverflow.com/users/2847", "pm_score": 0, "selected": false, "text": "<p>you may be able to pass an Object and use reflection to get your desired results. Have a look at ObjectDumper.cs (inc...
2008/10/21
[ "https://Stackoverflow.com/questions/223713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/615/" ]
I've just started working with ASP.NET MVC now that it's in beta. In my code, I'm running a simple LINQ to SQL query to get a list of results and passing that to my view. This sort of thing: ``` var ords = from o in db.Orders where o.OrderDate == DateTime.Today select o; return View(ords); ``` ...
Can you pass it to the view? Yes, but your view won't be strongly typed. But the helpers will work. For example: ``` public ActionResult Foo() { return View(new {Something="Hey, it worked!"}); } //Using a normal ViewPage <%= Html.TextBox("Something") %> ``` That textbox should render "Hey, it worked!" as the val...
223,738
<p>I have a DataSet consisting of XML data, I can easily output this to a file:</p> <pre><code>DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Tables.Add(dt); ds.Load(reader, LoadOption.PreserveChanges, ds.Tables[0]); ds.WriteXml("C:\\test.xml"); </code></pre> <p>However what I want to do is compress t...
[ { "answer_id": 223764, "author": "Matt Hamilton", "author_id": 615, "author_profile": "https://Stackoverflow.com/users/615", "pm_score": 4, "selected": true, "text": "<p>I've managed to compress a DataSet's XML stream using .NET 2.0's gzip compression.</p>\n\n<p>Here's the blog post I ma...
2008/10/21
[ "https://Stackoverflow.com/questions/223738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15144/" ]
I have a DataSet consisting of XML data, I can easily output this to a file: ``` DataSet ds = new DataSet(); DataTable dt = new DataTable(); ds.Tables.Add(dt); ds.Load(reader, LoadOption.PreserveChanges, ds.Tables[0]); ds.WriteXml("C:\\test.xml"); ``` However what I want to do is compress the XML into a ZIP or other...
I've managed to compress a DataSet's XML stream using .NET 2.0's gzip compression. Here's the blog post I made a few years ago about it: [Saving DataSets Locally With Compression](http://www.madprops.org/blog/saving-datasets-locally-with-compression) ... and here's the code I added to my DataSet's partial class to w...
223,748
<p>I have a nice little file upload control I wrote for ASP.NET webforms that utilizes an IFrame and ASP.NET AJAX.</p> <p>However, on large uploads, the browser times out before it can finish posting the form.</p> <p>Is there a way I can increase this?</p> <p>I'm not really interesting in alternative solutions, so d...
[ { "answer_id": 223778, "author": "JasonS", "author_id": 1865, "author_profile": "https://Stackoverflow.com/users/1865", "pm_score": 2, "selected": false, "text": "<p>In Page_Load, set Server.ScriptTimeout to a value that works for you. Measured in seconds I believe.</p>\n" }, { ...
2008/10/21
[ "https://Stackoverflow.com/questions/223748", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1965/" ]
I have a nice little file upload control I wrote for ASP.NET webforms that utilizes an IFrame and ASP.NET AJAX. However, on large uploads, the browser times out before it can finish posting the form. Is there a way I can increase this? I'm not really interesting in alternative solutions, so don't suggest changing th...
You need to update a metabase setting on IIS6 and later. The key is " AspMaxRequestEntityAllowed" and is expressed in bytes. I highly recommend the Metabase Explorer to make the change, wading through the XML at %systemroot%\system32\inetserv\metabase.xml is possible though. Metabase Explorer: <http://support.microsof...
223,771
<p>So, no matter what I seem to do, I cannot seem to avoid having Dev C++ spew out numerous Multiple Definition errors as a result of me including the same header file in multiple source code files in the same project. I'd strongly prefer to avoid having to dump all my source code into one file and only include the he...
[ { "answer_id": 223785, "author": "Gerald", "author_id": 19404, "author_profile": "https://Stackoverflow.com/users/19404", "pm_score": 3, "selected": false, "text": "<p>You need to define your variables as extern in the header file, and then define them in a cpp file as well. i.e.:</p>\n\...
2008/10/21
[ "https://Stackoverflow.com/questions/223771", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
So, no matter what I seem to do, I cannot seem to avoid having Dev C++ spew out numerous Multiple Definition errors as a result of me including the same header file in multiple source code files in the same project. I'd strongly prefer to avoid having to dump all my source code into one file and only include the header...
Since you're declaring those variables in the header file, and including the header file in each C++ file, each C++ file has its own copy of them. The usual way around this is to *not* declare any variables within header files. Instead, declare them in a single C++ file, and declare them as `extern` in all the other f...
223,788
<p>In a previous question, I asked about various ORM libraries. It turns out Kohana looks very clean yet functional for the purposes of ORM. I already have an MVC framework that I am working in though. If I don't want to run it as a framework, what is the right fileset to include to just give me the DB and ORM base cla...
[ { "answer_id": 224341, "author": "Zak", "author_id": 2112692, "author_profile": "https://Stackoverflow.com/users/2112692", "pm_score": 2, "selected": false, "text": "<p>It turns out that Kohana uses magic class loading so that if a defined class with an _Core extention doesn't exist as a...
2008/10/21
[ "https://Stackoverflow.com/questions/223788", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2112692/" ]
In a previous question, I asked about various ORM libraries. It turns out Kohana looks very clean yet functional for the purposes of ORM. I already have an MVC framework that I am working in though. If I don't want to run it as a framework, what is the right fileset to include to just give me the DB and ORM base class ...
Why not just have a ``` class ORM extends ORM_Core {} ``` somewhere in your code? This removes the need to use any of the loader code. You'll also need Kohana\_Exception, the Database library (and appropraite driver), Kohana::config(), Kohana::auto\_load(), Kohana::log() methods (search Database.php for those). ...
223,800
<p><a href="http://www.php.net/features.safe-mode" rel="noreferrer">open_basedir</a> limits the files that can be opened by PHP within a directory-tree.</p> <p>I am storing several class libraries and configuration files outside of my web root directory. This way the web server does not make them publicly accessible....
[ { "answer_id": 223820, "author": "user27987", "author_id": 27987, "author_profile": "https://Stackoverflow.com/users/27987", "pm_score": 2, "selected": false, "text": "<p>add the paths you need to access to (/var/www/vhosts/domain.tld/zend) to your open_basedir directive (you can specify...
2008/10/21
[ "https://Stackoverflow.com/questions/223800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9290/" ]
[open\_basedir](http://www.php.net/features.safe-mode) limits the files that can be opened by PHP within a directory-tree. I am storing several class libraries and configuration files outside of my web root directory. This way the web server does not make them publicly accessible. However when I try to include them fr...
You can also do this easily on a per-directory basis using the Apache (assuming this is your web server) configuration file (e.g. httpd.conf) ``` <Directory /var/www/vhosts/domain.tld/httpdocs> php_admin_value open_basedir "/var/www/vhosts/domain.tld/httpdocs:/var/www/vhosts/domain.tld/zend" </Directory> ``` you can...
223,804
<p>Suppose you have two models, User and City, joined by a third model CityPermission:</p> <pre><code>class CityPermission &lt; ActiveRecord::Base belongs_to :city belongs_to :user end class City &lt; ActiveRecord::Base has_many :city_permissions has_many :users, :through =&gt; :city_permissions end class Us...
[ { "answer_id": 223812, "author": "madlep", "author_id": 14160, "author_profile": "https://Stackoverflow.com/users/14160", "pm_score": 3, "selected": true, "text": "<p>Looks good to me.</p>\n\n<p>The joins generated should just be on either the PK IDs of the entity tables, or on the FK ID...
2008/10/21
[ "https://Stackoverflow.com/questions/223804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4767/" ]
Suppose you have two models, User and City, joined by a third model CityPermission: ``` class CityPermission < ActiveRecord::Base belongs_to :city belongs_to :user end class City < ActiveRecord::Base has_many :city_permissions has_many :users, :through => :city_permissions end class User < ActiveRecord::Base...
Looks good to me. The joins generated should just be on either the PK IDs of the entity tables, or on the FK IDs in the join table - which are both indexes. Probably would be good to look at the generated ActiveRecord SQL and compare it against the indexes. Depending on what database you're on you could then run tha...
223,810
<p>Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it comes to Ajax. Unfortunately, there are a few problems that I often see with the JavaScript that it generates. </p> <ul> <li><p>Rails typically uses inline event handling.</p> <pre><code>&lt;a onclick="somejavascript(); return false;" /&g...
[ { "answer_id": 223849, "author": "madlep", "author_id": 14160, "author_profile": "https://Stackoverflow.com/users/14160", "pm_score": 0, "selected": false, "text": "<p>Let Rails do as much as possible. Then when you have problems, start rewriting it with hand coded versions.</p>\n" }, ...
2008/10/21
[ "https://Stackoverflow.com/questions/223810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22291/" ]
Ruby on Rails has a lot of ways to generate JavaScript. Particularly when it comes to Ajax. Unfortunately, there are a few problems that I often see with the JavaScript that it generates. * Rails typically uses inline event handling. ``` <a onclick="somejavascript(); return false;" /> ``` This is generally frowned...
If you prefer jQuery you can use the [jQuery on Rails Project](http://ennerchi.com/projects/jrails). A drop in to replace Prototype with jQuery. Some of what Rails does with Javascript generation is good and some is bad. In the bad instances, write it yourself and keep it unobtrusive. At any given time you're uncomfor...
223,832
<p>What is the most efficient way in C# 2.0 to check each character in a string and return true if they are all valid hexadecimal characters and false otherwise?</p> <h3>Example</h3> <pre><code>void Test() { OnlyHexInString(&quot;123ABC&quot;); // Returns true OnlyHexInString(&quot;123def&quot;); // Returns tru...
[ { "answer_id": 223843, "author": "itsmatt", "author_id": 7862, "author_profile": "https://Stackoverflow.com/users/7862", "pm_score": 3, "selected": false, "text": "<p>I use <code>Int32.TryParse()</code> to do this. <a href=\"http://msdn.microsoft.com/en-us/library/zf50za27(VS.80).aspx\"...
2008/10/21
[ "https://Stackoverflow.com/questions/223832", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1463/" ]
What is the most efficient way in C# 2.0 to check each character in a string and return true if they are all valid hexadecimal characters and false otherwise? ### Example ``` void Test() { OnlyHexInString("123ABC"); // Returns true OnlyHexInString("123def"); // Returns true OnlyHexInString("123g"); // Ret...
``` public bool OnlyHexInString(string test) { // For C-style hex notation (0xFF) you can use @"\A\b(0[xX])?[0-9a-fA-F]+\b\Z" return System.Text.RegularExpressions.Regex.IsMatch(test, @"\A\b[0-9a-fA-F]+\b\Z"); } ```
223,833
<p>This is what I have, which works in IE7, but not in Firefox:</p> <pre><code>@media screen { @import 'screen.css'; } </code></pre> <p>It works outside of the @media block in Firefox:</p> <pre><code>@import 'screen.css'; </code></pre> <p><strong>UPDATE:</strong> </p> <p>This works:</p> <pre><code>@media screen ...
[ { "answer_id": 223949, "author": "Peter Coulton", "author_id": 117, "author_profile": "https://Stackoverflow.com/users/117", "pm_score": 1, "selected": false, "text": "<p>Ok, so Firefox doesn't like the method I chose, favouring:</p>\n\n<pre><code>@import 'stylesheet.css' media_type;\n</...
2008/10/21
[ "https://Stackoverflow.com/questions/223833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/117/" ]
This is what I have, which works in IE7, but not in Firefox: ``` @media screen { @import 'screen.css'; } ``` It works outside of the @media block in Firefox: ``` @import 'screen.css'; ``` **UPDATE:** This works: ``` @media screen { .yui-d3f { border: 1px solid #999; height: 250px; ...
Firefox is following the CSS2 specification, while IE is playing fast and loose, as it were. The exact reason is that `@import` directives must be the first directives after the optional `@charset` directive. They cannot appear inside of any block. If you want an `@import` to apply to only one media type, specify that...
223,844
<p>I can't find a definitive answer. Since C# 2.0 you've been able to declare</p> <pre><code>int? i = 125; </code></pre> <p>as shorthand for</p> <pre><code>Nullable&lt;int&gt; i = Nullable&lt;int&gt;(123); </code></pre> <p>I recall reading somewhere that VB.NET did not allow this shortcut. But low and behold, I t...
[ { "answer_id": 223848, "author": "Nescio", "author_id": 14484, "author_profile": "https://Stackoverflow.com/users/14484", "pm_score": 0, "selected": false, "text": "<p>I don't know the history, but yes it was a VS 2008 enhancement.</p>\n" }, { "answer_id": 224110, "author": "...
2008/10/21
[ "https://Stackoverflow.com/questions/223844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/337/" ]
I can't find a definitive answer. Since C# 2.0 you've been able to declare ``` int? i = 125; ``` as shorthand for ``` Nullable<int> i = Nullable<int>(123); ``` I recall reading somewhere that VB.NET did not allow this shortcut. But low and behold, I tried it in VS 2008 today and it works. Does anyone know whethe...
System.Nullable was introduced in .Net 2.0 and is available to VB *as a generic type*. You just cannot use the nullable syntax. So in VS 2005 you can do: ``` Dim x as Nullable(of Integer) ``` I don't know if null equivalence and boxing works for nullables in VB 2005, but I would suspect that the answer is yes since ...
223,866
<p>I need to parse a transcript of a live chat conversation. My first thought on seeing the file was to throw regular expressions at the problem but I was wondering what other approaches people have used. </p> <p>I put elegant in the title as i've previously found that this type of task has a danger of getting hard to...
[ { "answer_id": 223904, "author": "dalyons", "author_id": 16925, "author_profile": "https://Stackoverflow.com/users/16925", "pm_score": 2, "selected": false, "text": "<p>Using multiline, commented regexs can mitigate the maintainance problem somewhat. Try and avoid the one line super rege...
2008/10/21
[ "https://Stackoverflow.com/questions/223866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2178/" ]
I need to parse a transcript of a live chat conversation. My first thought on seeing the file was to throw regular expressions at the problem but I was wondering what other approaches people have used. I put elegant in the title as i've previously found that this type of task has a danger of getting hard to maintain ...
No and in fact, for the specific type of task you describe, I doubt there's a "cleaner" way to do it than regular expressions. It looks like your files have embedded line breaks so typically what we'll do here is make the line your unit of decomposition, applying per-line regexes. Meanwhile, you create a small state ma...
223,875
<p>I am starting to develop an Eclipse plugin (technically, an OSGi plugin) and one of the first problems I've run into is that I can't seem to control the commons-logging output as I normally would.</p> <p>I've included the commons-logging package in the plugin dependencies, and indeed, when I log something (at INFO ...
[ { "answer_id": 224821, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 4, "selected": false, "text": "<p>This is not an actual answer to your question, but you might find some clues in this <a href=\"http://ekkescorner.wordpress....
2008/10/21
[ "https://Stackoverflow.com/questions/223875", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3446/" ]
I am starting to develop an Eclipse plugin (technically, an OSGi plugin) and one of the first problems I've run into is that I can't seem to control the commons-logging output as I normally would. I've included the commons-logging package in the plugin dependencies, and indeed, when I log something (at INFO or higher ...
3 days later... I found the problem! There were two things I needed to do, first off, there was a problem with one MANIFEST.MF file: I had the following in the MANIFEST.MF for one bundle: ``` Bundle-ClassPath: lib/jena.jar, ., org.apache.log4j-1.2.12.jar, lib/google-collect-snapshot.jar Import-Package: com.acme.c...
223,878
<p>In my question <a href="https://stackoverflow.com/questions/184729/as-a-mockist-tdd-practitioner-should-i-mock-other-methods-in-the-same-class-as">As a “mockist” TDD practitioner, should I mock other methods in the same class as the method under test?</a>, <a href="https://stackoverflow.com/users/20487/avdi">Avdi</a...
[ { "answer_id": 224821, "author": "VonC", "author_id": 6309, "author_profile": "https://Stackoverflow.com/users/6309", "pm_score": 4, "selected": false, "text": "<p>This is not an actual answer to your question, but you might find some clues in this <a href=\"http://ekkescorner.wordpress....
2008/10/21
[ "https://Stackoverflow.com/questions/223878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4766/" ]
In my question [As a “mockist” TDD practitioner, should I mock other methods in the same class as the method under test?](https://stackoverflow.com/questions/184729/as-a-mockist-tdd-practitioner-should-i-mock-other-methods-in-the-same-class-as), [Avdi](https://stackoverflow.com/users/20487/avdi) answered "Personally I ...
3 days later... I found the problem! There were two things I needed to do, first off, there was a problem with one MANIFEST.MF file: I had the following in the MANIFEST.MF for one bundle: ``` Bundle-ClassPath: lib/jena.jar, ., org.apache.log4j-1.2.12.jar, lib/google-collect-snapshot.jar Import-Package: com.acme.c...
223,902
<p>Take the following generics example</p> <pre><code>import java.util.List; import java.util.ArrayList; public class GenericsTest { private List&lt;Animal&gt; myList; public static void main(String args[]) { new GenericsTest(new ArrayList&lt;Animal&gt;()).add(new Dog()); } public GenericsTe...
[ { "answer_id": 223923, "author": "Greg Cottman", "author_id": 10496, "author_profile": "https://Stackoverflow.com/users/10496", "pm_score": 4, "selected": true, "text": "<p>If I understand what you're trying to do then you need to put the generic type at class level:</p>\n\n<pre><code>pu...
2008/10/21
[ "https://Stackoverflow.com/questions/223902", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25891/" ]
Take the following generics example ``` import java.util.List; import java.util.ArrayList; public class GenericsTest { private List<Animal> myList; public static void main(String args[]) { new GenericsTest(new ArrayList<Animal>()).add(new Dog()); } public GenericsTest(List<Animal> list) { ...
If I understand what you're trying to do then you need to put the generic type at class level: ``` public class GenericsTest<T extends Animal> { private List<T> myList; public static void main(String args[]) { new GenericsTest<Dog>(new ArrayList<Dog>()); } public GenericsTest(List<T> list) { myLi...
223,918
<p>We all know you can't do the following because of <code>ConcurrentModificationException</code>:</p> <pre><code>for (Object i : l) { if (condition(i)) { l.remove(i); } } </code></pre> <p>But this apparently works sometimes, but not always. Here's some specific code:</p> <pre class="lang-java pretty...
[ { "answer_id": 223927, "author": "Claudiu", "author_id": 15055, "author_profile": "https://Stackoverflow.com/users/15055", "pm_score": 8, "selected": false, "text": "<p>This works:</p>\n\n<pre><code>Iterator&lt;Integer&gt; iter = l.iterator();\nwhile (iter.hasNext()) {\n if (iter.next...
2008/10/21
[ "https://Stackoverflow.com/questions/223918", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15055/" ]
We all know you can't do the following because of `ConcurrentModificationException`: ``` for (Object i : l) { if (condition(i)) { l.remove(i); } } ``` But this apparently works sometimes, but not always. Here's some specific code: ```java public static void main(String[] args) { Collection<Integ...
[`Iterator.remove()`](https://docs.oracle.com/javase/9/docs/api/java/util/Iterator.html#remove--) is safe, you can use it like this: ``` List<String> list = new ArrayList<>(); // This is a clever way to create the iterator and call iterator.hasNext() like // you would do in a while-loop. It would be the same as doing...
223,919
<p>I've figured out how to set VC++ to compile code into a .lib file instead of a .exe, but I'm having trouble getting a lib to link together with my other .obj files.</p> <p>Here is how I have the library and application folders set up. (I'm not sure if this is right)</p> <pre><code>AppFolder App.sln App.ncb ...
[ { "answer_id": 223943, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 4, "selected": true, "text": "<p>On the project properties:</p>\n\n<p>Configuration Properties -> Linker -> Input -> Additional Dependancies</p>\n...
2008/10/21
[ "https://Stackoverflow.com/questions/223919", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2222/" ]
I've figured out how to set VC++ to compile code into a .lib file instead of a .exe, but I'm having trouble getting a lib to link together with my other .obj files. Here is how I have the library and application folders set up. (I'm not sure if this is right) ``` AppFolder App.sln App.ncb *.h *.cpp Debug ...
On the project properties: Configuration Properties -> Linker -> Input -> Additional Dependancies Add it in there. Or, in your .h file for the library, add: ``` #pragma comment(lib, "Library") ``` This will do it automatically for you.
223,921
<p>How do you get Pro*c to work within MSVC 6?</p> <p>In otherwords compile a .pc file into a .cpp file.</p>
[ { "answer_id": 223956, "author": "Michael Burr", "author_id": 12711, "author_profile": "https://Stackoverflow.com/users/12711", "pm_score": 0, "selected": false, "text": "<p>Visual C++/Visual Studio won't be a big help other than being an editor, but you should be able to get this to wor...
2008/10/21
[ "https://Stackoverflow.com/questions/223921", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7734/" ]
How do you get Pro\*c to work within MSVC 6? In otherwords compile a .pc file into a .cpp file.
In the **custom build tab** for the **.pc** file. I pop this in the **outputs**. The output of **proc**, is a cpp file ``` $(ProjDir)\$(InputName).cpp ``` There are 2 lines in the **commands** window. One to set the MSVC 6 environment. The other to invoke proc on the .pc file. ``` call vcvars32.bat proc sqlcheck...
223,931
<p>What are your favorite ways to encapsulate LINQ to SQL entity classes and data-context classes into business objects?</p> <p>What have you found to work in a given situation?</p> <p>Have you invented or taken to any specific patterns?</p>
[ { "answer_id": 224929, "author": "Sam", "author_id": 7021, "author_profile": "https://Stackoverflow.com/users/7021", "pm_score": 1, "selected": false, "text": "<p>Right now I'm trying to use LINQ to SQL entity classes as business objects, to pass them around between functions and service...
2008/10/21
[ "https://Stackoverflow.com/questions/223931", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20946/" ]
What are your favorite ways to encapsulate LINQ to SQL entity classes and data-context classes into business objects? What have you found to work in a given situation? Have you invented or taken to any specific patterns?
I've found a pattern which I think works best--In my case, at least. I extend entity classes using partial classes. I use partial classes so the signature of the entity does not change (see the `DeleteOnSubmit` call in the `Delete` method). I've cooked up a a small example. Here's an image of the database and LINQ to...
223,940
<p>I researched this a while ago and can't remember how to do it. I want to be able to prevent Firefox from running it's spell-checking functionality on certain input fields from within the page. I know it's possible but can't remember how to set it up.</p>
[ { "answer_id": 223948, "author": "Wilco", "author_id": 5291, "author_profile": "https://Stackoverflow.com/users/5291", "pm_score": 7, "selected": true, "text": "<p>Talk about having a big \"duh\" moment! I found the answer after some trial &amp; error:</p>\n\n<pre><code>&lt;textarea spel...
2008/10/21
[ "https://Stackoverflow.com/questions/223940", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5291/" ]
I researched this a while ago and can't remember how to do it. I want to be able to prevent Firefox from running it's spell-checking functionality on certain input fields from within the page. I know it's possible but can't remember how to set it up.
Talk about having a big "duh" moment! I found the answer after some trial & error: ``` <textarea spellcheck="false"></textarea> ```
223,946
<p>I have two LINQ objects which have exactly the same columns and I would like to be able to update one with the fields from the other. I first create a new object from some data in a file, then I query the database for an existing item with the same ID. What I would like to be able to do is update the existing obje...
[ { "answer_id": 223980, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 2, "selected": true, "text": "<p>I do this sort of thing when I create an instance of an object from a template. Basically I have a method that itera...
2008/10/21
[ "https://Stackoverflow.com/questions/223946", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6335/" ]
I have two LINQ objects which have exactly the same columns and I would like to be able to update one with the fields from the other. I first create a new object from some data in a file, then I query the database for an existing item with the same ID. What I would like to be able to do is update the existing objects d...
I do this sort of thing when I create an instance of an object from a template. Basically I have a method that iterates over the public properties of the template, finds the corresponding property in the object being created, and invokes the property setter on the new object, all via reflection.
223,964
<p>Note: I am just consuming webservice I have no control over webservice code.</p> <p>So in .net 2.0 I reference the webservice and see a class in the webservice namespace, say foobar. It's defined as:</p> <pre><code>public class foobar : System.Web.Services.Protocols.SoapHttpClientProtocol </code></pre> <p>but in ...
[ { "answer_id": 223979, "author": "Andrew Moore", "author_id": 26210, "author_profile": "https://Stackoverflow.com/users/26210", "pm_score": 1, "selected": false, "text": "<p>You can try using the <strong>Web Service Description Language Tool</strong> (<code>Wsdl.exe</code>) to generate a...
2008/10/21
[ "https://Stackoverflow.com/questions/223964", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Note: I am just consuming webservice I have no control over webservice code. So in .net 2.0 I reference the webservice and see a class in the webservice namespace, say foobar. It's defined as: ``` public class foobar : System.Web.Services.Protocols.SoapHttpClientProtocol ``` but in .net 3.5 when i add a reference t...
I had a similar problem when I upgraded from 2005 to 2008. I think what you are missing, when you click "Add Service Reference", a newer dialog comes up. click the Advanced button at the bottom, then on the next dialog that comes up, click the Add Web Reference button at the bottom, in the compatibility section. Then y...
223,990
<p>I need to perform a filtered query from within a django template, to get a set of objects equivalent to python code within a view:</p> <pre><code>queryset = Modelclass.objects.filter(somekey=foo) </code></pre> <p>In my template I would like to do</p> <pre><code>{% for object in data.somekey_set.FILTER %} </code><...
[ { "answer_id": 224003, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 8, "selected": true, "text": "<p>You can't do this, which is by design. The Django framework authors intended a strict separation of presentation ...
2008/10/21
[ "https://Stackoverflow.com/questions/223990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11527/" ]
I need to perform a filtered query from within a django template, to get a set of objects equivalent to python code within a view: ``` queryset = Modelclass.objects.filter(somekey=foo) ``` In my template I would like to do ``` {% for object in data.somekey_set.FILTER %} ``` but I just can't seem to find out how t...
You can't do this, which is by design. The Django framework authors intended a strict separation of presentation code from data logic. Filtering models is data logic, and outputting HTML is presentation logic. So you have several options. The easiest is to do the filtering, then pass the result to `render_to_response`...
223,991
<p>Because of several iframes, XUL browser elements, and so forth, I have a number of window objects in my XULRunner application. I'm looking for the best way to find the window object that a specified node belongs to using JavaScript.</p> <p>So, to be more specific, given node x, I need to find the specific window ob...
[ { "answer_id": 224002, "author": "keparo", "author_id": 19468, "author_profile": "https://Stackoverflow.com/users/19468", "pm_score": 2, "selected": false, "text": "<p>You may want to use <strong>self</strong>. self is a reference to the current document.</p>\n\n<p><strong>From within t...
2008/10/21
[ "https://Stackoverflow.com/questions/223991", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7441/" ]
Because of several iframes, XUL browser elements, and so forth, I have a number of window objects in my XULRunner application. I'm looking for the best way to find the window object that a specified node belongs to using JavaScript. So, to be more specific, given node x, I need to find the specific window object that ...
+1 to your question, it was exactly what I was looking for and thanks for the hint given directly by answering yourself. I Googled a bit and according to <http://www.quirksmode.org/dom/w3c_html.html> cross-browsers tables I think the right answer is: ``` function GetOwnerWindow(html_node) { /* ownerDocument is ...
223,993
<p>I'm in the process of trying to move our company from SalesForce to SugarCRM, but I've run in to a nasty bug (the moment I add a custom field to Accounts, all accounts stop showing up). We've paid for support from the SugarCRM people, but they only have take-forever-then-get-a-worthless-response-level tech support ...
[ { "answer_id": 231775, "author": "machineghost", "author_id": 5921, "author_profile": "https://Stackoverflow.com/users/5921", "pm_score": 3, "selected": true, "text": "<p>Although it's not a perfect answer to my question, this article:</p>\n\n<p><a href=\"http://developers.sugarcrm.com/w...
2008/10/21
[ "https://Stackoverflow.com/questions/223993", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5921/" ]
I'm in the process of trying to move our company from SalesForce to SugarCRM, but I've run in to a nasty bug (the moment I add a custom field to Accounts, all accounts stop showing up). We've paid for support from the SugarCRM people, but they only have take-forever-then-get-a-worthless-response-level tech support for ...
Although it's not a perfect answer to my question, this article: <http://developers.sugarcrm.com/wordpress/2008/09/26/where-is-the-code-for-x/> did help a bit. Also when I looked further through the official Sugar docs I found that the Developer Guide does contain some explanation of how Sugar works (although obvious...