qid int64 4 19.1M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
390,802 | <p>Is there an easy way to add nodes to a WinForms .NET TreeView control where the new nodes being added are inserted at the correct index so the entire list of nodes is sorted alphabetically? Pretty much having the same result as <code>TreeView.Sort()</code>.</p>
<p>I have a TreeView that continually grows to a couple hundred nodes. The user can view this TreeView in real time as it grows. I'd prefer to just insert the nodes at the correct index, rather than calling TreeView.Sort() each time after a node is added.</p>
<p>Can this be done?</p>
| [
{
"answer_id": 390828,
"author": "lc.",
"author_id": 44853,
"author_profile": "https://Stackoverflow.com/users/44853",
"pm_score": 3,
"selected": false,
"text": "TreeView TreeNodeCollection TreeView TreeNodeCollection Add() TreeNodeCollection thisNode.value<=newNode.value<nextNode.value ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390802",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5473/"
] |
390,819 | <p>How would you refactor this, keeping in mind that you have dozens more of such measurements to represent? It's kind of like changing an int to short or long or byte. Generic <code>unit<T></code>? Implicit type conversion by via operator overloading? <code>ToType()</code> pattern? Abstract base class? <code>IConvertible</code>?</p>
<pre><code>public class lb
{
private readonly float lbs;
private readonly kg kgs;
public lb(float lbs)
{
this.lbs = lbs;
this.kgs = new kg(lbs * 0.45359237F);
}
public kg ToKg()
{
return this.kgs;
}
public float ToFloat()
{
return this.lbs;
}
}
public class kg
{
private readonly float kgs;
private readonly lb lbs;
public kg(float kgs)
{
this.kgs = kgs;
this.lbs = new lb(kgs * 2.20462262F);
}
public float ToFloat()
{
return this.kgs;
}
public lb ToLb()
{
return this.lbs;
}
}
</code></pre>
| [
{
"answer_id": 390827,
"author": "Jon Limjap",
"author_id": 372,
"author_profile": "https://Stackoverflow.com/users/372",
"pm_score": 0,
"selected": false,
"text": "struct"
},
{
"answer_id": 390898,
"author": "David Norman",
"author_id": 34502,
"author_profile": "http... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390819",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11574/"
] |
390,838 | <p>I started a new WPF project in VS2008 and then added some code to trap <code>DispatcherUnhandledException</code>. Then I added a throw exception to <code>Window1</code>
but the error is not trapped by the handler. Why?</p>
<pre><code> public App()
{
this.DispatcherUnhandledException += new DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
}
void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
System.Windows.MessageBox.Show(string.Format("An error occured: {0}", e.Exception.Message), "Error");
e.Handled = true;
}
void Window1_MouseDown(object sender, MouseButtonEventArgs e)
{
throw new NotImplementedException();
}
</code></pre>
| [
{
"answer_id": 35753915,
"author": "Joel",
"author_id": 6009199,
"author_profile": "https://Stackoverflow.com/users/6009199",
"pm_score": 2,
"selected": false,
"text": "protected override void OnStartup(StartupEventArgs e)\n {\n // define application exception handler\n ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390838",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40568/"
] |
390,847 | <p>Can anyone give a concise set of real-world considerations that would drive the choice of whether or not to use inetd to manage a program that acts as a network server?</p>
<p>(If inetd is used, I think it alters the requirements around networking code in the program, so I think it's definitely programming-related and not general IT)</p>
<p>The question is based around an implementation I've seen that uses a control program managed by inetd to start a network listener that then runs forever and takes constant and heavy load. It didn't seem like a good fit with the textbook inetd usage profile (on-demand, infrequently used, lightweight) and got me interested in the more general question.</p>
| [
{
"answer_id": 390909,
"author": "Kamil Kisiel",
"author_id": 15061,
"author_profile": "https://Stackoverflow.com/users/15061",
"pm_score": 3,
"selected": true,
"text": "init.d conf.d"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/390847",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2362/"
] |
390,852 | <p>For example, files, in Python, are iterable - they iterate over the lines in the file. I want to count the number of lines. </p>
<p>One quick way is to do this:</p>
<pre><code>lines = len(list(open(fname)))
</code></pre>
<p>However, this loads the whole file into memory (at once). This rather defeats the purpose of an iterator (which only needs to keep the current line in memory).</p>
<p>This doesn't work:</p>
<pre><code>lines = len(line for line in open(fname))
</code></pre>
<p>as generators don't have a length.</p>
<p>Is there any way to do this short of defining a count function?</p>
<pre><code>def count(i):
c = 0
for el in i: c += 1
return c
</code></pre>
<p>To clarify, I understand that the whole file will have to be read! I just don't want it in memory all at once</p>
| [
{
"answer_id": 390861,
"author": "mcrute",
"author_id": 33786,
"author_profile": "https://Stackoverflow.com/users/33786",
"pm_score": 5,
"selected": false,
"text": "line_count = sum(1 for line in open(\"yourfile.txt\"))\n"
},
{
"answer_id": 390885,
"author": "Kamil Kisiel",
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390852",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] |
390,889 | <p>What is the difference between a Function and a Procedure in SQL Server?</p>
| [
{
"answer_id": 390927,
"author": "Charles Graham",
"author_id": 7705,
"author_profile": "https://Stackoverflow.com/users/7705",
"pm_score": 1,
"selected": false,
"text": "SELECT dbo.MyFunc(myColumn) as [Column Alias Name] FROM MyTable\n SELECT * FROM dbo.MyTableVariableReturningFunc() as... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390889",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48581/"
] |
390,891 | <p>I use C# to make connection to a db and then a Ad hoc SQL to get data. This simple SQL query is very convenient to debug since I can log the SQL query string. If I use parametrized SQL query command, is there any way to log sql query string for debug purpose?</p>
| [
{
"answer_id": 391151,
"author": "bortzmeyer",
"author_id": 15625,
"author_profile": "https://Stackoverflow.com/users/15625",
"pm_score": 1,
"selected": false,
"text": "postgresql.conf log_statement = 'all' # none, ddl, mod, all\n log_connections = on\nlog_disconnection... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390891",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62776/"
] |
390,897 | <p>I don't want to rely on the one-click installer any more, and I want to learn how to install Ruby manually. Is there a resource for this?</p>
| [
{
"answer_id": 413759,
"author": "Lolindrath",
"author_id": 7985,
"author_profile": "https://Stackoverflow.com/users/7985",
"pm_score": 5,
"selected": true,
"text": "C:\\ruby C:\\ruby\\bin setup.rb gem install rails rails test_project"
},
{
"answer_id": 1639884,
"author": "ko... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48834/"
] |
390,900 | <p>According to the documentation of the <code>==</code> operator in <a href="http://msdn.microsoft.com/en-us/library/53k8ybth.aspx" rel="noreferrer">MSDN</a>, </p>
<blockquote>
<p>For predefined value types, the
equality operator (==) returns true if
the values of its operands are equal,
false otherwise. For reference types
other than string, == returns true if
its two operands refer to the same
object. For the string type, ==
compares the values of the strings.
User-defined value types can overload
the == operator (see operator). So can
user-defined reference types, although
<strong>by default == behaves as described
above for both predefined and
user-defined reference types.</strong></p>
</blockquote>
<p>So why does this code snippet fail to compile?</p>
<pre><code>bool Compare<T>(T x, T y) { return x == y; }
</code></pre>
<p>I get the error <em>Operator '==' cannot be applied to operands of type 'T' and 'T'</em>. I wonder why, since as far as I understand the <code>==</code> operator is predefined for all types?</p>
<p><strong>Edit:</strong> Thanks, everybody. I didn't notice at first that the statement was about reference types only. I also thought that bit-by-bit comparison is provided for all value types, which I now know is <em>not</em> correct.</p>
<p>But, in case I'm using a reference type, would the <code>==</code> operator use the predefined reference comparison, or would it use the overloaded version of the operator if a type defined one?</p>
<p><strong>Edit 2:</strong> Through trial and error, we learned that the <code>==</code> operator will use the predefined reference comparison when using an unrestricted generic type. Actually, the compiler will use the best method it can find for the restricted type argument, but will look no further. For example, the code below will always print <code>true</code>, even when <code>Test.test<B>(new B(), new B())</code> is called:</p>
<pre><code>class A { public static bool operator==(A x, A y) { return true; } }
class B : A { public static bool operator==(B x, B y) { return false; } }
class Test { void test<T>(T a, T b) where T : A { Console.WriteLine(a == b); } }
</code></pre>
| [
{
"answer_id": 390916,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": false,
"text": "bool Compare<T>(T x, T y) where T : class { return x == y; }\n x == y void CallFoo<T>(T x) { x.foo(); }\n"
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390900",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41283/"
] |
390,921 | <p>Just wondering if anyone has any ideas on how to test ones data access methods. I have found testing retrieval data access methods is much easier because i can just mock out the <code>ExecuteReader</code> and return a populated <code>dataTable.CreateDataReader()</code>. By doing this I can test to see if my object is populating correctly if a result set is returned.</p>
<p>But how do i translate this to my persist methods (i.e. add, update, delete, etc). What i want to test is whether it populates the command parameters correctly, etc.</p>
<p>Any ideas?
Cheers</p>
| [
{
"answer_id": 390916,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 4,
"selected": false,
"text": "bool Compare<T>(T x, T y) where T : class { return x == y; }\n x == y void CallFoo<T>(T x) { x.foo(); }\n"
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390921",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30572/"
] |
390,923 | <p>I want to self-draw the title bar of a window with MFC. So I override the OnNcPaint() method of CMainFrame. Everything seems alright, until I click the item in the control menu to make it minimize or maximize. During the minizing or maximizing process, I can see the original title bar appeared. I don't know why this happened. Maybe there are some messages I didn't handle in the process? Need your help. Thanks a lot! </p>
| [
{
"answer_id": 391592,
"author": "Aidan Ryan",
"author_id": 1042,
"author_profile": "https://Stackoverflow.com/users/1042",
"pm_score": 2,
"selected": false,
"text": "CMyDialog::OnSize(UINT nType, int cx, int cy)\n{\n switch (nType)\n {\n case SIZE_MAXIMIZED:\n //... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390923",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26404/"
] |
390,930 | <p>I'm creating an asp.net mvc application that has the concept of users. Each user is able to edit their own profile. For instance: </p>
<ul>
<li>PersonID=1 can edit their profile by going to <a href="http://localhost/person/edit/1" rel="noreferrer">http://localhost/person/edit/1</a></li>
<li>PersonID=2 can edit their profile by going to <a href="http://localhost/person/edit/2" rel="noreferrer">http://localhost/person/edit/2</a></li>
</ul>
<p>Nothing particularly exciting there...</p>
<p>However, I have run into a bit of trouble with the Authorization scheme. There are only two roles in the system right now, "Administrator" and "DefaultUser", but there will likely be more in the future.</p>
<p>I can't use the regular Authorize attribute to specify Authorization because both users are in the same role (i.e., "DefaultUser").</p>
<p>So, if I specify the Authorize Filter like so:</p>
<pre><code>[Authorize(Roles = "DefaultUser")]
</code></pre>
<p>then there is no effect. PersonID=1 can go in and edit their own profile (as they should be able to), but they can also just change the URL to <a href="http://localhost/person/edit/2" rel="noreferrer">http://localhost/person/edit/2</a> and they have full access to edit PersonID=2's profile as well (which they should not be able to do).</p>
<p>Does this mean that I have to create my own Authorization filter that checks if the action the user is requesting "belongs" to them before allowing them access? That is, if the edit action, with parameter = 1 is being requested by the currently logged in person, do I need to do a custom check to make sure that the currently logged in person is PersonID=1, and if so, authorize them, and if not, deny access?</p>
<p>Feels like I'm missing something obvious here, so any guidance would be appreciated.</p>
| [
{
"answer_id": 1044009,
"author": "Saajid Ismail",
"author_id": 127488,
"author_profile": "https://Stackoverflow.com/users/127488",
"pm_score": 4,
"selected": false,
"text": "public class AuthorizeOwnerAttribute: FilterAttribute, IAuthorizationFilter\n{\n #region IAuthorizationFilter ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390930",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29092/"
] |
390,932 | <p><a href="https://stackoverflow.com/questions/390192">I was trying to get my Netbeans to autocomplete with PHP</a>, and I learned that this code is valid in PHP:</p>
<pre><code>function blah(Bur $bur) {}
</code></pre>
<p>A couple of questions:</p>
<ol>
<li><strong>Does this actually impose any limits</strong> on what type of variable I can pass to the blah method?</li>
<li>If this is just to help the IDE, that's fine with me. <strong>How can I declare the type of a variable in PHP if I'm not in a function?</strong></li>
</ol>
| [
{
"answer_id": 390943,
"author": "Jim OHalloran",
"author_id": 38458,
"author_profile": "https://Stackoverflow.com/users/38458",
"pm_score": 5,
"selected": false,
"text": "\n/**\n * @var string\n */\npublic $variable = \"Blah\";\n public function hasFoo(?int $numFoos) :bool {\n"
},
{... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390932",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8047/"
] |
390,944 | <p>It's basically one app that is installed on multiple PC's, each install maintaining it's own database which is sync'd with other's as & when they are up (connected to the same network) at the same time.</p>
<p>I've tested this using simple socket connections and custom buffers, but want to make the comms between the apps conform to accepted standards and also to be secure/robust, and not try to re-invent the wheel.</p>
<p>What is the normal/standard way of doing this app-to-app comms & where do I find out more?</p>
<p>Also, what techniques are/can be used to announce and find the other apps on a network?</p>
<hr>
<p>edit:
(refining my problem)</p>
<p>The pub/sub model pointed to by gimel below seems to be along the lines of what I need. It however covers a lot of ground & I don't really know what to take away & use from all that.</p>
<p>It also looks like I need to establish a P2P connection once two or more apps found each other - how do I do that? </p>
<p>If there are examples/tutorials available, please point them out. Small open source projects/modules that implements something like what I need would also serve.</p>
<p>My platform of choice is Linux, but Windows-based examples would also be very usable.</p>
<hr>
<p>edit [09-01-06]:</p>
<p>I am currently looking at the following options:</p>
<ol>
<li><a href="http://tldp.org/HOWTO/Multicast-HOWTO.html" rel="nofollow noreferrer">multicasting</a> (TLDP-Howto) - this seems workable, but I need to study it some more. </li>
<li>using free dynamic DNS servers, although this seems a bit dicey... </li>
<li>using some free email facility, e.g. gmail/yahoo/..., and send/read mail from there to find other app's IP's (can work, but feels dirty) </li>
<li>webservices has been suggested, but I don't know how they work & will have to study it up</li>
</ol>
<p>I would appreciate your opinion on these options and if there are any examples out there. I unfortunately do NOT have the option of using a central server or website (unless it can be guaranteed to be free and permanent).</p>
<p>[Edit 2009-02-19]</p>
<p>(Wish I could accept two/three answers! The one I've accepted because it provides lines of thought and possibilities, while others came with fixed, but applicable, solutions. Thanks to all who answered, all of it helps.)</p>
<p>As & when I find/implement my solution, I will update this question, and should the solution be adequate I'll create a sourceforge project for it. (It is in any case a small problem within a far larger project.)</p>
| [
{
"answer_id": 554927,
"author": "Joe Soul-bringer",
"author_id": 56279,
"author_profile": "https://Stackoverflow.com/users/56279",
"pm_score": 3,
"selected": true,
"text": "void update_database(in_stream, out_stream) {\n Get_Index_Of_Other_Machines_Items(in_stream);\n Send_Index_Of_It... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390944",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15161/"
] |
390,945 | <p>I have a set of tables in Oracle and I would like to identify the table that contains the maximum number of rows.</p>
<p>So if, A has 200 rows, B has 345 rows and C has 120 rows I want to be able to identify table B.</p>
<p>Is there a simple query I can run to achieve this?</p>
<p>Edit: There are 100 + tables so I am looking for something generic.</p>
| [
{
"answer_id": 390949,
"author": "friol",
"author_id": 23034,
"author_profile": "https://Stackoverflow.com/users/23034",
"pm_score": 1,
"selected": false,
"text": "select max(select count(*) from A union select count(*) from B...)\n execute immediate 'select max('||subquery||')'\n"
},
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390945",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41766/"
] |
390,992 | <p>There is a JavaScript parser at least in C and Java (Mozilla), in JavaScript (Mozilla again) and Ruby. Is there any currently out there for Python?</p>
<p>I don't need a JavaScript interpreter, per se, just a parser that's up to ECMA-262 standards.</p>
<p>A quick google search revealed no immediate answers, so I'm asking the SO community.</p>
| [
{
"answer_id": 8752573,
"author": "David",
"author_id": 9908,
"author_profile": "https://Stackoverflow.com/users/9908",
"pm_score": 3,
"selected": false,
"text": "from pynarcissus import jsparser\nfrom collections import defaultdict\n\nclass Visitor(object):\n\n CHILD_ATTRS = ['thenPa... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390992",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15055/"
] |
390,993 | <p>I am building a rails app to test our flagship product (also web based). The problem is that part of the testing requires using the production app's web interface to upload files. So what i need to do is have the rails app upload these files to the production application (not rails). Is there a way to have rails post the file to the production application (like the browser posts the file to the production app)?</p>
| [
{
"answer_id": 392711,
"author": "August Lilleaas",
"author_id": 26051,
"author_profile": "https://Stackoverflow.com/users/26051",
"pm_score": 3,
"selected": false,
"text": "class Upload < ActiveRecord::Base\n before_create :set_filename\n after_create :store_file\n after_destroy :del... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390993",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5004/"
] |
390,997 | <p>I have a weird error in my C++ classes at the moment. I have an ActiveX wrapper class (as part of wxWidgets) that i added a new virtual function to. I have another class that inherits from the ActiveX one (wxIEHtmlWin) however the ActiveX class always calls its own function instead of the one in wxIEHtmlWin which overrides it.</p>
<p>I can't work out why this is happening. I made the function pure virtual and now the program crashes when it does the function call but compiles fine otherwise. Is there any way to disable virtual functions or have I found a bug in Visual Studio?</p>
<p>ActiveX class</p>
<pre><code>protected:
virtual FrameSite* getNewFrameSite()=0;
</code></pre>
<p>wxIEHtmlWin class</p>
<pre><code>class wxIEHtmlWin : public wxActiveX
{
protected:
FrameSite* getNewFrameSite();
}
FrameSite* wxIEHtmlWin::getNewFrameSite()
{
return new gcFrameSite(this);
}
</code></pre>
<p>Edit: I've added another test function (returns an int) and still screws up.</p>
<p>Link to code in question: <a href="http://lodle.net/public/iebrowser.rar" rel="nofollow noreferrer">http://lodle.net/public/iebrowser.rar</a></p>
<p>Edit:</p>
<p>OK thanks to the answer below i got it to work. What i did was create the activex class in two parts (like suggested) however in wxIEHtmlWin i called the second part in the constructor code. Like so:</p>
<pre><code>wxIEHtmlWin::wxIEHtmlWin(wxWindow * parent, wxWindowID id, const wxPoint& pos,const wxSize& size,long style, const wxString& name) : wxActiveX()
{
wxActiveX::Create(parent, PROGID, id, pos, size, style, name);
SetupBrowser();
}
</code></pre>
<p>Now i know why wxWidgets supports two part construction.</p>
| [
{
"answer_id": 391015,
"author": "richq",
"author_id": 4596,
"author_profile": "https://Stackoverflow.com/users/4596",
"pm_score": 4,
"selected": true,
"text": "class wxActivex {\n wxActivex() {}\n virtual void init() {\n getNewFrame();\n }\n};\n\n // in the code that uses these c... | 2008/12/24 | [
"https://Stackoverflow.com/questions/390997",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23339/"
] |
391,000 | <p>I have a date variable as <code>24-dec-08</code>.
I want only the <code>08</code> component from it.</p>
<p>How do I do it in a select statement?</p>
<p>e.g.:</p>
<pre><code>select db||sysdate
--(this is the component where I want only 08 from the date)
from gct;
</code></pre>
| [
{
"answer_id": 391009,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 4,
"selected": true,
"text": "to_char to_char(sysdate, 'YY')\n extract extract extract(YEAR FROM DATE '2008-12-24') \n MOD mod(extract(YEAR FROM DATE '... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,005 | <p>I have an HTML (not XHTML) document that renders fine in Firefox 3 and IE 7. It uses fairly basic CSS to style it and renders fine in HTML.</p>
<p>I'm now after a way of converting it to PDF. I have tried:</p>
<ul>
<li><a href="https://github.com/dompdf/dompdf" rel="noreferrer">DOMPDF</a>: it had huge problems with tables. I factored out my large nested tables and it helped (before it was just consuming up to 128M of memory then dying--thats my limit on memory in php.ini) but it makes a complete mess of tables and doesn't seem to get images. The tables were just basic stuff with some border styles to add some lines at various points;</li>
<li><a href="https://github.com/spipu/html2pdf" rel="noreferrer">HTML2PDF and HTML2PS</a>: I actually had better luck with this. It rendered some of the images (all the images are Google Chart URLs) and the table formatting was much better but it seemed to have some complexity problem I haven't figured out yet and kept dying with unknown node_type() errors. Not sure where to go from here; and</li>
<li><a href="http://www.msweet.org/projects.php?Z1" rel="noreferrer">Htmldoc</a>: this seems to work fine on basic HTML but has almost no support for CSS whatsoever so you have to do everything in HTML (I didn't realize it was still 2001 in Htmldoc-land...) so it's useless to me.</li>
</ul>
<p>I tried a Windows app called Html2Pdf Pilot that actually did a pretty decent job but I need something that at a minimum runs on Linux and ideally runs on-demand via PHP on the Webserver.</p>
<p>What am I missing, or how can I resolve this issue?</p>
| [
{
"answer_id": 467507,
"author": "Filip Dupanović",
"author_id": 44041,
"author_profile": "https://Stackoverflow.com/users/44041",
"pm_score": 5,
"selected": false,
"text": "DIV"
},
{
"answer_id": 1357499,
"author": "Mic",
"author_id": 166491,
"author_profile": "https... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391005",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18393/"
] |
391,006 | <p>Have a use case where </p>
<pre><code>Class foo {
public:
static std::string make(std::string a) { .. }
}
</code></pre>
<p>I want to make foo an abstract base class but obviously make cannot be in this abstract base since virtual functions cannot be static. </p>
<p>Like this</p>
<pre><code>Class foo {
public:
static virtual std::string make (std::string) = 0; //error this cannot be done
}
Class fooImpl: foo{
public:
std::string make(std::string a) { ..}
}
</code></pre>
<p>Is making the method non static in the abstract class or have derived classes have static methods a good approach from a design perspective.</p>
| [
{
"answer_id": 391138,
"author": "David Rodríguez - dribeas",
"author_id": 36565,
"author_profile": "https://Stackoverflow.com/users/36565",
"pm_score": 1,
"selected": false,
"text": "base& somefunction(); // may return base or derived objects\nbase &b = somefunction();\nb.method();\n"
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391006",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43756/"
] |
391,022 | <p>In C++Builder, I wrote the following code (in Button1Click handler), When I run in debug mode, I get the "Int3 DbgBreakPoint" (Stack corrupted?). This doesn't happen for AnsiSting (Maybe reference counting).</p>
<pre><code>WideString boshluq;
boshluq=L" ";
</code></pre>
<p>Is this normal? What do you suggest me to fix this code?</p>
| [
{
"answer_id": 391138,
"author": "David Rodríguez - dribeas",
"author_id": 36565,
"author_profile": "https://Stackoverflow.com/users/36565",
"pm_score": 1,
"selected": false,
"text": "base& somefunction(); // may return base or derived objects\nbase &b = somefunction();\nb.method();\n"
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391022",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38856/"
] |
391,023 | <p>How to make <code>NameValueCollection</code> accessible to LINQ query operator such as where, join, groupby?</p>
<p>I tried the below:</p>
<pre><code>private NameValueCollection RequestFields()
{
NameValueCollection nvc = new NameValueCollection()
{
{"emailOption: blah Blah", "true"},
{"emailOption: blah Blah2", "false"},
{"nothing", "false"},
{"nothinger", "true"}
};
return nvc;
}
public void GetSelectedEmail()
{
NameValueCollection nvc = RequestFields();
IQueryable queryable = nvc.AsQueryable();
}
</code></pre>
<p>But I got an <em>ArgumentException</em> telling me that the <strong>source is not IEnumerable<></strong>. </p>
| [
{
"answer_id": 391028,
"author": "Frans Bouma",
"author_id": 44991,
"author_profile": "https://Stackoverflow.com/users/44991",
"pm_score": 2,
"selected": false,
"text": "IEnumerable IEnumerable<T> Dictionary<string, string>"
},
{
"answer_id": 391639,
"author": "Amy B",
"a... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391023",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3834/"
] |
391,033 | <p>I have worked a bit with Django and I quite like its project/applications model : you can build a Django project by assembling one or more Django applications. These applications can be autonomous, or some applications can be built on top of other applications. An application can easily rely on another application's models, as well as its controllers (Django dudes call them "views") and even its views ("templates" in Django-speak).</p>
<p>I am now working on a relatively large scale Ruby on Rails project, and I am surprised to see that there is apparently no easy way to do the same thing in Rails. Basically, in Rails, one project = one application. Our project has started off as a huge monolithic app, and we are now trying to figure out how to split it into smaller chunks.</p>
<p>For example, our current application allows us to manage partners and contracts (among other things). I would like to have a "Partners" application which would manage our partners (address, contacts, etc.) and a "Contracts" application which would manage our contracts with our partners. The "Contracts" application would rely on the "Partners" application (but to avoid a circular dependency, I would like the "Partners" app to have no knowledge of the "Contracts" app).</p>
<p>For now, I see the following as the main options:</p>
<ol>
<li>make these applications communicate through REST requests (each app would act as a Webservice): this is nice, but it seems to prohibit reusing other applications' views. For example, if the "Partners" app has a nice page to show the details of a partner, and if I want to display that page, slightly modified, in the middle of the contract-details page, I see no other way to do this than to have the "Contracts" app ask the "Partners" app for the partner details through a REST request (it will get an object representation, not a view), then copy/paste the partner-details page's source code from the "Partners" app to the "Contracts" app.</li>
<li>turn these applications into plugins : not as nice, and a bit more difficult, but seems to allow model & views reuse</li>
<li>use svn external to share some models from application to application: simple but ugly.</li>
</ol>
<p>Thanks for your advices.</p>
| [
{
"answer_id": 391086,
"author": "Mike Woodhouse",
"author_id": 1060,
"author_profile": "https://Stackoverflow.com/users/1060",
"pm_score": 4,
"selected": true,
"text": "app app"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391033",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38626/"
] |
391,038 | <p>I need to what is meant by authoring in workflow foundation and what are it's types.</p>
| [
{
"answer_id": 391086,
"author": "Mike Woodhouse",
"author_id": 1060,
"author_profile": "https://Stackoverflow.com/users/1060",
"pm_score": 4,
"selected": true,
"text": "app app"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391038",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22162/"
] |
391,057 | <p>I'm encrypting and Base64 a string. Everything works great, until I retrieve the encrypted string from the QueryString collection. The Encrypted text contains a plus symbol. When I retrieve the encrypted string, where a plus once was there is now a space. As you can imagine this doesn't decrypt.</p>
<p>I have tried both Server.HtmlEncode/HtmlDecode and Server.UrlEncode/Server.UrlDecode with no avail. Both methods confuse the plus symbol with the space.</p>
<p>Any idea's?</p>
<p>Here is a similar post: <a href="https://stackoverflow.com/questions/123994/querystring-malformed-after-urldecode">QueryString Malformed</a> </p>
<p><strong>Edit:</strong>
I found the solution: Server.UrlEncode does work, I was applying Server.UrlDecode and didn't need too.</p>
| [
{
"answer_id": 391082,
"author": "Funky81",
"author_id": 37509,
"author_profile": "https://Stackoverflow.com/users/37509",
"pm_score": 2,
"selected": true,
"text": " public static String DoDecryption(String Value)\n {\n Decryptor dec = new Decryptor(EncryptionAlgorithm.Tripl... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391057",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17360/"
] |
391,088 | <p>I saw this reply from Jon on <a href="https://stackoverflow.com/questions/386500/initialize-generic-object-with-unknown-type">Initialize generic object with unknown type</a>:</p>
<blockquote>
<p>If you want a single collection to
contain multiple unrelated types of
values, however, you will have to use
<code>List<object></code></p>
</blockquote>
<p>I'm not comparing <code>ArrayList</code> vs <code>List<></code>, but <code>ArrayList</code> vs <code>List<object></code>, as both will be exposing elements of type <code>object</code>. What would be the benefit of using either one in this case?</p>
<p>EDIT: It's no concern for type safety here, since both class is exposing <code>object</code> as its item. One still needs to cast from <code>object</code> to the desired type. I'm more interested in anything other than type safety.</p>
<p>EDIT: Thanks Marc Gravell and Sean for the answer. Sorry, I can only pick 1 as answer, so I'll up vote both.</p>
| [
{
"answer_id": 391185,
"author": "Sean",
"author_id": 26095,
"author_profile": "https://Stackoverflow.com/users/26095",
"pm_score": 6,
"selected": false,
"text": "List<object> IList<object> IList ArrayList IList<object>"
},
{
"answer_id": 391186,
"author": "Lasse V. Karlsen",... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391088",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20007/"
] |
391,107 | <p>I'm writing a C++ program (compiled with gcc and running on RedHat Linux). The program needs to know at runtime how much space is left on the stack and how much is left in the heap. I realize there may not be a definite answer to this question (about the heap), so alternatively, I could use the amount of memory already allocated from the heap instead. Is there a a library/system function call that will give me this data?</p>
<p>I'd like to add that I only need this for debugging purposes, and only need rough estimates, so quick-and-dirty solutions are perfectly acceptable. However, I need to query the memory usage very frequently, so shelling out to a Unix cmd-line utility and parsing its output is not acceptable.</p>
| [
{
"answer_id": 391169,
"author": "PW.",
"author_id": 927,
"author_profile": "https://Stackoverflow.com/users/927",
"pm_score": 1,
"selected": false,
"text": "pid"
},
{
"answer_id": 391408,
"author": "Jonathan Leffler",
"author_id": 15168,
"author_profile": "https://St... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391107",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,117 | <pre><code>Declare @BadDecimal varchar(5)
Set @BadDecimal = '4.5'
Declare @GoodDecimal Decimal
Set @GoodDecimal = @BadDecimal
Select @GoodDecimal
--Outputs 5
</code></pre>
<p>Why?</p>
| [
{
"answer_id": 391128,
"author": "user48864",
"author_id": 48864,
"author_profile": "https://Stackoverflow.com/users/48864",
"pm_score": 1,
"selected": false,
"text": "Set @BadDecimal = '4,5'"
},
{
"answer_id": 391132,
"author": "devio",
"author_id": 21336,
"author_pr... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5055/"
] |
391,125 | <p>I have a dialog in MFC with a CStatusBar. In a separate thread, I want to change the pane text of status bar. However MFC complains with asserts? How is it done? An example code would be great.</p>
| [
{
"answer_id": 391324,
"author": "Rob",
"author_id": 9236,
"author_profile": "https://Stackoverflow.com/users/9236",
"pm_score": 4,
"selected": true,
"text": "static UINT CMainFrame::UpdateStatusBarProc(LPVOID pParam);\n\nvoid CMainFrame::OnCreateTestThread()\n{\n // Create the thread... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391125",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36830/"
] |
391,130 | <p>What is an HttpHandler in ASP.NET? Why and how is it used?</p>
| [
{
"answer_id": 391136,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "HttpHandler IHttpHandler"
},
{
"answer_id": 391211,
"author": "splattne",
"author_id": 6461,
"aut... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391130",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32582/"
] |
391,139 | <p>I am currently working on a website that is an advertisement portal for businesses. Advertisers can create an account, select various options for listing (State, caregory, etc) and upload a graphic is measured in a multiples of an "unit". An "unit" is an image or a flash file that is <code>180px</code> wide and <code>120</code> high. An advertiser can choose multiple units that are horizontal or vertical, i.e, 2 single units aligned horizontally or 2 single units aligned vertically. </p>
<p>I have gone to the point where the the website is working fine. I am stuck at a point I am going to lay out the "units" and display them properly, without any empty space between them. As an example, if we had 4 advertisements, a horizontal 2 unit ad, a vertical 2 unit and 2 single unit ad, like so - </p>
<pre><code> |
|
2 unit ad | 2
------------------| unit
| | ad
1 unit | 1 unit |
| |
| |
</code></pre>
<p>I am currently storing the advertisements units in a database with attributes that are used in the web form to build a table (i.e., colspan, rowspan, etc). I am not sure if this is the right approach, I fear it is not. I shall be very grateful if I got some advice.</p>
<p>Thanks,
Indy</p>
| [
{
"answer_id": 430677,
"author": "Leah",
"author_id": 5506,
"author_profile": "https://Stackoverflow.com/users/5506",
"pm_score": 1,
"selected": false,
"text": "<table cellspacing=\"0\" cellpadding=\"0\">\n"
},
{
"answer_id": 430692,
"author": "DavGarcia",
"author_id": 40... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32649/"
] |
391,142 | <p>Is there a way to get the remote IP Address of a WCF connection?</p>
<p>I guess the reason why it's not built-in into the WCF framework is that WCF can work with non TCP/IP bindings, so the IP Address is not always meaningful.</p>
<p>However, the information would make sense for all the widely used bindings (As far as I know : BasicHttp, DualHttp, WSHttp and NetTcp).</p>
<p>The IP address is probably accessible using reflection, but I'd rather find a documented way to get it rather than hacking into the framework classes.</p>
<p>I've googled on the issue, and it seems a lot of people have run into it without finding a decent solution (The usual answer is <a href="http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/d6de4e3b-cbe1-4e7f-993f-573f57b0905f/" rel="nofollow noreferrer">to rely on the message headers</a>, but this implies trusting the client to provide its real IP Address, which is not an option if you want to log the IP Address for security reasons)</p>
| [
{
"answer_id": 22732095,
"author": "Cyrus",
"author_id": 2779173,
"author_profile": "https://Stackoverflow.com/users/2779173",
"pm_score": 3,
"selected": false,
"text": "OperationContext context = OperationContext.Current;\nMessageProperties properties = context.IncomingMessageProperties... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391142",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47341/"
] |
391,143 | <p>Is there any way to change style of text, format the text inside a Javascript Alert box. e.g. changing its colour, making it bold, etc.?</p>
<p>Also, if there an Alert avalaible with a 'Yes', 'No' button instead of an 'OK'/'Cancel' one?</p>
| [
{
"answer_id": 391158,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 6,
"selected": true,
"text": "alert prompt confirm"
},
{
"answer_id": 426778,
"author": "alex",
"author_id": 31671,
"author_pro... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391143",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18615/"
] |
391,157 | <p>I need to serialize/de-serialize some objects into/from string and transfer them as just opaque data. I can use XmlSerializer to do it, but generated string looks clumsy and long. So, is there any concise Serializer available in .NET?</p>
<p>The first thing coming to my mind is that perhaps .NET should have JSON Serializer, but I cannot find it. Is there any off-the-shelf approach in .NET to convert object to/from concise string?</p>
| [
{
"answer_id": 391221,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 6,
"selected": true,
"text": "DateTime new"
},
{
"answer_id": 3518861,
"author": "mythz",
"author_id": 85785,
"author_profile": ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26349/"
] |
391,195 | <p>Is there a way to call Static Classes / Methods by name?</p>
<p>Example:</p>
<pre><code>$name = 'StaticClass';
($name)::foo();
</code></pre>
<p>I have classes which I keep all static methods in and I'd like to call them this way.</p>
| [
{
"answer_id": 391218,
"author": "Anthony",
"author_id": 18641,
"author_profile": "https://Stackoverflow.com/users/18641",
"pm_score": 3,
"selected": false,
"text": "$name = 'staticClass';\ncall_user_func(array($name, 'foo'));\n"
},
{
"answer_id": 391220,
"author": "Kornel",
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26566/"
] |
391,199 | <p>I need to convert a flat file to DB using MS SSIS. I need a way to look into a particular folder to fetch the (only) flat file, filename is of the format "FileName-CCYYMMDD.txt".</p>
<p>Please help me if there is way to add a file from the folder
OR
Get a file name of the format "Filename-CCYYMMDD.txt" where is CCYYMMDD is the current date or maybe CurrentDate -1 according to requirements.</p>
<p>Any code examples or screenshots will be highly appreciated!</p>
| [
{
"answer_id": 443370,
"author": "Irawan Soetomo",
"author_id": 54908,
"author_profile": "https://Stackoverflow.com/users/54908",
"pm_score": 0,
"selected": false,
"text": "Imports System\nImports System.Data\nImports System.Math\nImports Microsoft.SqlServer.Dts.Runtime\nImports System.I... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391199",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48307/"
] |
391,200 | <p>Basically, is it possible to identify if some-one hooks up my program to SQL server Compact or Express Edition? I want to be able to restrict different versions of my product to different versions of SQL Server.</p>
| [
{
"answer_id": 391205,
"author": "Gareth",
"author_id": 47690,
"author_profile": "https://Stackoverflow.com/users/47690",
"pm_score": 2,
"selected": false,
"text": "SELECT @@VERSION\n"
},
{
"answer_id": 391216,
"author": "nick_alot",
"author_id": 46100,
"author_profil... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22712/"
] |
391,224 | <p>We have an application that uses a dual monitor setup - User A will work with Monitor 1, and user B will work with Monitor 2 simultaneously. Monitor 2 is a touch screen device.</p>
<p>Now, the problem is, when User A types something in his screen, if User B tries to do something, User A will end up in losing the focus from his window, which is disastrous. </p>
<p>What might be a good solution to preserve the focus on the window in Monitor 1, even if User B do something with Monitor 2?</p>
| [
{
"answer_id": 391510,
"author": "Hans Passant",
"author_id": 17034,
"author_profile": "https://Stackoverflow.com/users/17034",
"pm_score": 4,
"selected": true,
"text": "protected override CreateParams CreateParams {\n get {\n const int WS_EX_NOACTIVATE = 0x08000000;\n CreateParam... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391224",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45956/"
] |
391,227 | <p>Can somebody advise me what this code does and how can I convert it to Ruby in most simple way?</p>
<pre><code> #!perl
use Convert::ASN1;
my $asn1 = Convert::ASN1->new(encoding => 'DER');
$asn1->prepare(q<
Algorithm ::= SEQUENCE {
oid OBJECT IDENTIFIER,
opt ANY OPTIONAL
}
Signature ::= SEQUENCE {
alg Algorithm,
sig BIT STRING
}
>);
my $data = $asn1->encode(sig => $body,
alg => {oid => sha512WithRSAEncryption()});
</code></pre>
<p>It's a piece of a <a href="http://www.softlights.net/projects/mexumgen/" rel="nofollow noreferrer">mexumgen</a>, Perl library which sign update.rdf for Mozilla products with openssl.</p>
| [
{
"answer_id": 392906,
"author": "vava",
"author_id": 6258,
"author_profile": "https://Stackoverflow.com/users/6258",
"pm_score": 2,
"selected": true,
"text": "data = [\"308191300b06092a864886f70d01010d03818100\" + body.unpack(\"H*\")].pack(\"H*\")\n"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391227",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6258/"
] |
391,232 | <p>Using Multiple DataSource fill same GridView i.e I need to fill data in GridView using more than one DataSource. Please provide Code snippet if possible...</p>
<p><strong>More Details:-</strong>
Tables with same schema are present in two different Databases. I need to get the data from both and populate it inside one GirdView.</p>
| [
{
"answer_id": 1451276,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": " DataTable dt = new DataTable();\n using(SqlDataAdapter a1 = new SqlDataAdapter(\"SELECT * FROM [user1]\", \"Da... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391232",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47344/"
] |
391,237 | <p>Alright, I'll preface this with the fact that I'm a GTK <em>and</em> Python newb, but I haven't been able to dig up the information I needed. Basically what I have is a list of Radio Buttons, and based on which one is checked, I need to connect a button to a different function. I tried creating all my radio buttons, and then creating a disgusting if/else block checking for <code>sget_active()</code> on each button. The problem is the same button returns true every single time. Any ideas?</p>
<p>Here's the code in use:</p>
<pre><code> #Radio Buttons Center
self.updatePostRadioVBox = gtk.VBox(False, 0)
self.updatePageRadio = gtk.RadioButton(None, "Updating Page")
self.updatePostRadio = gtk.RadioButton(self.updatePageRadio, "Updating Blog Post")
self.pageRadio = gtk.RadioButton(self.updatePageRadio, "New Page")
self.blogRadio = gtk.RadioButton(self.updatePageRadio, "New Blog Post")
self.addSpaceRadio = gtk.RadioButton(self.updatePageRadio, "Add New Space")
self.removePageRadio = gtk.RadioButton(self.updatePageRadio, "Remove Page")
self.removePostRadio = gtk.RadioButton(self.updatePageRadio, "Remove Blog Post")
self.removeSpaceRadio = gtk.RadioButton(self.updatePageRadio, "Remove Space")
#Now the buttons to direct us from here
self.returnMainMenuButton = gtk.Button(" Main Menu ")
self.returnMainMenuButton.connect("clicked", self.transToMain)
self.contentManageHBoxBottom.pack_start(self.returnMainMenuButton, False, False, 30)
self.contentProceedButton = gtk.Button(" Proceed ")
self.contentManageHBoxBottom.pack_end(self.contentProceedButton, False, False, 30)
if self.updatePageRadio.get_active():
self.contentProceedButton.connect("clicked", self.updatePage)
elif self.updatePostRadio.get_active():
self.contentProceedButton.connect("clicked", self.updatePost)
elif self.pageRadio.get_active():
self.contentProceedButton.connect("clicked", self.newPage)
elif self.blogRadio.get_active():
self.contentProceedButton.connect("clicked", self.newBlogPost)
elif self.addSpaceRadio.get_active():
self.contentProceedButton.connect("clicked", self.newSpace)
elif self.removePageRadio.get_active():
self.contentProceedButton.connect("clicked", self.removePage)
elif self.removePostRadio.get_active():
self.contentProceedButton.connect("clicked", self.removeBlogPost)
elif self.removeSpaceRadio.get_active():
self.contentProceedButton.connect("clicked", self.removeSpace)
</code></pre>
| [
{
"answer_id": 391289,
"author": "Ali Afshar",
"author_id": 28380,
"author_profile": "https://Stackoverflow.com/users/28380",
"pm_score": 4,
"selected": true,
"text": "active = [r for r in self.updatePageRadio.get_group() if r.get_active()][0]\n my_actions[active]()\n r1 = gtk.RadioButto... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391237",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14838/"
] |
391,249 | <p>I'm interested to know what approach people are taking in developing automated unit tests that exercise the database</p>
<p>Do you Install a QA database (known-starting point) before the test suite is run.</p>
<p>OR</p>
<p>Do you build database stub that stand-in whenever a database call occurs? </p>
<p>EDIT: Related question, but not a duplicate, though quite important for the matter at hand: <a href="https://stackoverflow.com/questions/2046/how-do-i-unit-test-persistence">How do I unit-test persistence?</a></p>
| [
{
"answer_id": 391265,
"author": "Patrik Hägne",
"author_id": 46187,
"author_profile": "https://Stackoverflow.com/users/46187",
"pm_score": 2,
"selected": false,
"text": "return DataTableBuilder.Create()\n .DefineColumns(\"a, b\")\n .AddRow().SetValue(\"a\", 1).SetValue(\"b\", 2).D... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391249",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17560/"
] |
391,252 | <p>I want to model messages between users, here is the requirement:</p>
<ol>
<li><p>User has received and sent messages, and should be retrieved by <code>user.received_messages</code> and <code>user.sent_messages</code></p></li>
<li><p>Message has sender and receiver, and should be retrieved by <code>message.sender</code> and <code>message.receiver</code>.</p></li>
</ol>
<p>I have created the User model as:</p>
<pre><code>script/generate model User name:string
</code></pre>
<p>and Message model as:</p>
<pre><code>script/generate model Message content:text sender_id:integer receiver_id:integer
</code></pre>
<p>I have come up with the Message like below, and it works as wish</p>
<pre><code>class Message < ActiveRecord::Base
belongs_to :sender, :class_name=>'User', :foreign_key=>'sender_id'
belongs_to :receiver, :class_name=>'User', :foreign_key=>'receiver_id'
end
</code></pre>
<p>but I don't know how to model the User, any advise is appreciated.</p>
| [
{
"answer_id": 391318,
"author": "Milan Novota",
"author_id": 26123,
"author_profile": "https://Stackoverflow.com/users/26123",
"pm_score": 3,
"selected": true,
"text": "class User < ActiveRecord::Base\n has_many :sent_messages, :class_name => \"Message\", :foreign_key => \"sender_id\"\... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391252",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44512/"
] |
391,269 | <p>The customer wants us to "log" the "actions" that a user performs on our system: creation, deletion and update, mostly.
I already have an aspect that logs the trace, but that works at a pretty low level logging every method call.
So if a user clicked on the button "open medical file" the log would read:</p>
<ol>
<li>closePreviousFiles("patient zero")</li>
<li>createMedicalFile("patient zero") --> file #001</li>
<li>changeStatus("#001") --> open</li>
</ol>
<p>while the desired result is:</p>
<ol>
<li>opened medical file #001 for patient zero</li>
</ol>
<p>I'm thinking of instrumenting the Struts2 actions with log statements, but I'm wondering... is there another way to do that? I might use AspectJ again (or a filter) and keep the logic in just one place, so that I might configure the log easily, but then I'm afraid everything will become harder to understand (i.e. "the log for this action is wrong... where the heck should I look for the trouble?").</p>
| [
{
"answer_id": 391664,
"author": "Kent Lai",
"author_id": 2085392,
"author_profile": "https://Stackoverflow.com/users/2085392",
"pm_score": 3,
"selected": true,
"text": "enum Actions {\n OPEN_MEDICAL_FILE\n ...\n}\n\nvoid handleRequest(...) {\n String patient = ...;\n Audit audit = n... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4690/"
] |
391,284 | <p>we are using SharePoint Server (MOSS 2007) with Windows Integrated Security.</p>
<p>A few computers in the company (managers) are using Apple Macs.</p>
<p>These people can't run the application on their machines! I think the problem is due the windows integrated security. How can we solve this problem?</p>
<p>Thanks for your help.</p>
| [
{
"answer_id": 391414,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 3,
"selected": true,
"text": "Using Firefox on a non-Windows workstation (e.g. Linux):\nIn Firefox, type about:config in the URL address bar and press... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/247597/"
] |
391,292 | <p>how do i shrink datafiles in oracle 10G?</p>
| [
{
"answer_id": 391457,
"author": "kdgregory",
"author_id": 42126,
"author_profile": "https://Stackoverflow.com/users/42126",
"pm_score": 1,
"selected": false,
"text": "ALTER DATABASE\nDATAFILE 'diskb:tbs_f5.dat' RESIZE 10 M;\n"
},
{
"answer_id": 7919808,
"author": "kupa",
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,295 | <p>What is the most preferred format of unicode strings in memory when they are being processed? And why?</p>
<p>I am implementing a programming language by producing an executable file image for it. Obviously a working programming language implementation requires a protocol for processing strings.</p>
<p>I've thought about using dynamic arrays as the basis for strings because they are very simple to implement and very efficient for short strings. I just have no idea about the best possible format for characters when using strings in this manner.</p>
| [
{
"answer_id": 391457,
"author": "kdgregory",
"author_id": 42126,
"author_profile": "https://Stackoverflow.com/users/42126",
"pm_score": 1,
"selected": false,
"text": "ALTER DATABASE\nDATAFILE 'diskb:tbs_f5.dat' RESIZE 10 M;\n"
},
{
"answer_id": 7919808,
"author": "kupa",
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21711/"
] |
391,306 | <p>I have a JavaScript function, <code>pop_item</code>. I have to call this from PHP, so my PHP code is the following:</p>
<pre><code>echo '<a href="javascript:pop_item('.$_code.',1)">Link </a>';
</code></pre>
<p>It provides no error, but <code>pop_item</code> is not functioning,</p>
<p>The HTML output for the above is:</p>
<pre><code><a href="javascript:pop_item('ABC',1)">Link </a>
</code></pre>
| [
{
"answer_id": 391311,
"author": "Pim Jager",
"author_id": 35197,
"author_profile": "https://Stackoverflow.com/users/35197",
"pm_score": 4,
"selected": true,
"text": "echo \" <a href='#' onclick=\\\"pop_item(\".$_code.\"', 1)\\\">link</a>\";\n echo '<a href=\"javascript:alert('.$_code.')... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391306",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] |
391,314 | <p>I'm trying to insert an li element into a specific index on a ul element using jQuery. I only seem to be able to insert an element on the end of the list. I am very new to jQuery, so I may just not be thinking properly.</p>
| [
{
"answer_id": 391320,
"author": "Andreas Grech",
"author_id": 44084,
"author_profile": "https://Stackoverflow.com/users/44084",
"pm_score": 7,
"selected": true,
"text": "$(\"#thelist li\").eq(3).after(\"<li>A new item</li>\");\n eq"
},
{
"answer_id": 391331,
"author": "Arist... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48886/"
] |
391,316 | <p>I'm trying to delete several working copy directories, but I get an Access Denied on all the SVN files, running as admin or normal user. I've killed the Tortoise cache process, and cannot figure what is wrong. </p>
<p>Any suggestions?</p>
| [
{
"answer_id": 391330,
"author": "Gant",
"author_id": 12460,
"author_profile": "https://Stackoverflow.com/users/12460",
"pm_score": 1,
"selected": false,
"text": "* Cannot delete folder: It is being used by another person or\n"
},
{
"answer_id": 33694306,
"author": "Erkin Dji... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391316",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] |
391,323 | <p>According to MySQL manual, table comments are limited to 60 characters. I'm designing the schema in MySQL Workbench, which does not enforce this limit, so I end up with writing more than 60 symbols quite often, and this causes the SQL script to fail. To tell the truth I would be quite happy with table comments being internal to my schema (i.e. not exported to the actual database), but Workbench doesn't allow this either. Hence my question: is there a way to increase maximum length of table comment in MySQL to 255? </p>
| [
{
"answer_id": 37871050,
"author": "blueimpb",
"author_id": 2627992,
"author_profile": "https://Stackoverflow.com/users/2627992",
"pm_score": 2,
"selected": false,
"text": "COMMENT"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40548/"
] |
391,339 | <p>I want to check when the user double click on applictaion icon that no another instance of this application is already running.</p>
<p>I read about My.Application but i still don't know what to do.</p>
| [
{
"answer_id": 391366,
"author": "biozinc",
"author_id": 30698,
"author_profile": "https://Stackoverflow.com/users/30698",
"pm_score": 1,
"selected": false,
"text": "Mutex Mutex try\n{\nmutex = Mutex.OpenExisting(mutexName);\n//since it hasn’t thrown an exception, then we already have on... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391339",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42782/"
] |
391,346 | <p>Here's a simple question. </p>
<p>I've done plenty of work using both C & C# (2.0) but never anything in C++. What can I expect to be different when learning C++? Will there be any big gotcha's or hurdles I should pay attention too? Does anyone good crash course book/website recommendations for learning C++ for the experienced programmer?</p>
| [
{
"answer_id": 391364,
"author": "Gant",
"author_id": 12460,
"author_profile": "https://Stackoverflow.com/users/12460",
"pm_score": 3,
"selected": false,
"text": "HttpRequest Interface"
},
{
"answer_id": 391377,
"author": "tvanfosson",
"author_id": 12950,
"author_prof... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391346",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10352/"
] |
391,348 | <p>I have a query in Delphi using DBExpress TSQLQuery that looks like so </p>
<pre><code>ActiveSQL.sql.add('SELECT * FROM MYTABLE where MYFIELD=(:AMYFIELD) ');
ActiveSQL.ParamByName('AMYFIELD').AsString := 'Some random string that is to long for the field';
ActiveSQL.Open;
</code></pre>
<p>If I run it, when it executes the open command I get the following exception</p>
<blockquote>
<p>in class TDBXError with message
'arithmetic exception, numeric
overflow or string truncation'.</p>
</blockquote>
<p>This is caused by the string in AMYFIELD been longer then the tables field length, MYFIELD is Varchar(10), If I trim it down to a shorter string it works OK, and if I add the string directly into the SQL like so</p>
<pre><code> ActiveSQL.sql.add('SELECT * FROM MYTABLE where MYFIELD="Some random string that is to long for the field" ');
</code></pre>
<p>it works OK, i.e. does not complain about the truncation, now if this was an insert/update I would want to know about the truncation , but as its just been used for a search I would like to stop it.</p>
<p>Is there any way I can tell DBExpress that it is OK to truncate my strings? or is there a workable work around for this</p>
<p>I would like to avoid having to add something like</p>
<p>l_input := copy(l_input,0,fieldLength-1);</p>
<p>as looks messy and would make maintaining the code harder.</p>
<p>I am using Delphi 2007 with Firebird 2 via the interbase driver if that helps?</p>
<p>UPDATE:</p>
<p>@<a href="https://stackoverflow.com/questions/391348/string-truncation-error-in-delphi-dbexpress-paramatised-queries#393694">Erick Sasse</a> it looks like your right, I found the error message on the firebird FAQ site <a href="http://www.firebirdfaq.org/faq79/" rel="nofollow noreferrer">http://www.firebirdfaq.org/faq79/</a></p>
<p>@<a href="https://stackoverflow.com/questions/391348/string-truncation-error-in-delphi-dbexpress-paramatised-queries#392779">inzKulozik</a> the LeftStr works fine, although I cannot get ActiveSQL.ParamByName('AMYFIELD').Size to work , but this still seams messy to me, and harder to maintain. </p>
<p>I have also seen a method that adds substr to the SQL: something like</p>
<pre><code>select * from mytable where myname = substr(:MYNAME,0,10)
</code></pre>
<p>Again looks harder to maintain, Ideally I would like a Firebird/ DBExpress config setting that fixes this problem, but until I can find one I'll go with inzKulozik's solution and hope the table structure does not change to much. </p>
| [
{
"answer_id": 391364,
"author": "Gant",
"author_id": 12460,
"author_profile": "https://Stackoverflow.com/users/12460",
"pm_score": 3,
"selected": false,
"text": "HttpRequest Interface"
},
{
"answer_id": 391377,
"author": "tvanfosson",
"author_id": 12950,
"author_prof... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391348",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2098/"
] |
391,363 | <p>I started maintenance on some poorly written XAMLs. I am relatively new to XAML. </p>
<p>One thing I need is - grid columns should automatically adjust their width per the text contents.</p>
<p>The MSDN documentation on GridViewColumn.Width says - set it to Auto to enable auto-sizing behavior. However even though the code reads as follows, column widths remain the same irrespective of the content text. </p>
<pre><code><ListView.View>
<GridView>
<GridViewColumn x:Name="lstColName" Width="200">Name</GridViewColumn>
<GridViewColumn x:Name="lstColPath" Width="Auto">Path</GridViewColumn>
</GridView>
</ListView.View>
</code></pre>
| [
{
"answer_id": 391372,
"author": "Blounty",
"author_id": 33944,
"author_profile": "https://Stackoverflow.com/users/33944",
"pm_score": 0,
"selected": false,
"text": " <ListView>\n <ListView.View>\n <GridView>\n <GridViewColumn x:Name=\"Spoons\" Width=\... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,390 | <p>I use phpUnit on a integration server to run all tests and if I launch phpunit command from the command line, I receive:</p>
<pre><code>PHPUnit 3.2.18 by Sebastian Bergmann.
F..III..I......I.IIII...
Time: 6 seconds
There was 1 failure:
1) Warning(PHPUnit_Framework_Warning)
No tests found in class "TU".
FAILURES
Tests: 24, Failures: 1, Incomplete: 9.
</code></pre>
<p>Via apache, running the same test file:</p>
<pre><code>PHPUnit 3.2.18 by Sebastian Bergmann.
..III..I......I.IIII...
Time: 7 seconds
OK, but incomplete or skipped tests!
Tests: 23, Incomplete: 9.
</code></pre>
<p>My TU class just include all tests classes with a <code>$suite->addTestFile()</code>,
and which have two static functions: <code>main()</code> which run all the tests,
and <code>suite()</code> which return the tests suite.
But the TU class is not in the primary file given as parameter to
phpunit command, it's a generic class which scan files and list all test
class.</p>
<p>I have the same problem with a class which extends PHPUnit_Framework_TestCase to add <code>specific assert()</code>, which is not included via <code>$suite->addTestFile()</code> but only by a <code>require()</code>.</p>
<p>How can I correct this?</p>
| [
{
"answer_id": 391521,
"author": "phihag",
"author_id": 35070,
"author_profile": "https://Stackoverflow.com/users/35070",
"pm_score": 0,
"selected": false,
"text": "php.ini diff /etc/php*/*/php.ini\n php.ini"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391390",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8404/"
] |
391,391 | <p>I don't know if this is too specific a question, if that is possible, but I'm having to port an app that uses Castle Windsor to Unity so that there isn't a reliance on non-microsoft approved libraries. I know I know but what are you going to do.</p>
<p>Anyway I've managed it but I'm not happy with what I've got. In Windsor I had this:</p>
<pre><code>Register(
AllTypes.Of(typeof(AbstractPresenter<>)).FromAssemblyNamed("Links.Mvp"),
AllTypes.Of(typeof(IView)).FromAssemblyNamed("Links.WinForms").WithService.FromInterface());
</code></pre>
<p>which I've converted to this in unity</p>
<pre><code>RegisterType<IMainView, MainView>();
RegisterType<IConfigureLinkView, ConfigureLinkView>();
RegisterType<IConfigureSourceView, ConfigureSourceView>();
RegisterType<IConfigureSinkView, ConfigureSinkView>();
RegisterType<MainPresenter, MainPresenter>();
RegisterType<ConfigureLinkPresenter, ConfigureLinkPresenter>();
RegisterType<ConfigureSourcePresenter, ConfigureSourcePresenter>();
RegisterType<ConfigureSinkPresenter, ConfigureSinkPresenter>();
</code></pre>
<p>As you can see I'm having to register every single thing rather than be able to use some sort of auto-configuration. So my question is: is there a better way of doing this in unity?</p>
<p>Thanks,</p>
<p>Adam.</p>
| [
{
"answer_id": 392546,
"author": "smaclell",
"author_id": 22914,
"author_profile": "https://Stackoverflow.com/users/22914",
"pm_score": 1,
"selected": true,
"text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\n\nusing System.Reflection;\n\nna... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,411 | <p>The following test case fails in rhino mocks:</p>
<pre><code>[TestFixture]
public class EnumeratorTest
{
[Test]
public void Should_be_able_to_use_enumerator_more_than_once()
{
var numbers = MockRepository.GenerateStub<INumbers>();
numbers.Stub(x => x.GetEnumerator()).Return(new List<int>
{ 1, 2, 3 }.GetEnumerator());
var sut = new ObjectThatUsesEnumerator();
var correctResult = sut.DoSomethingOverEnumerator2Times
(numbers);
Assert.IsTrue(correctResult);
}
}
public class ObjectThatUsesEnumerator
{
public bool DoSomethingOverEnumerator2Times(INumbers numbers)
{
int sum1 = numbers.Sum(); // returns 6
int sum2 = numbers.Sum(); // returns 0 =[
return sum1 + sum2 == sum1 * 2;
}
}
public interface INumbers : IEnumerable<int> { }
</code></pre>
<p>I think there is something very subtle about this test case, and I
think it is from me not thinking through how Rhino Mocks stubbing
actually works. Typically, when you enumerate over an IEnumerable, you
are starting with a fresh IEnumerator. In the example above, it looks
like I could be re-using the same enumerator the second time I am
calling sum, and if the enumerator is already at the end of its
sequence, that would explain why the second call to Sum() returns 0.
If this is the case, how could I mock out the GetEnumerator() in such
a way that it behaves in the way that I am wanting it to (e.g. new
enumerator or same enumerator reset to position 0)?</p>
<p><strong>How would you modify the above test case so that the second .Sum() call actually returns 6 instead of 0?</strong></p>
| [
{
"answer_id": 391572,
"author": "Dror Helper",
"author_id": 11361,
"author_profile": "https://Stackoverflow.com/users/11361",
"pm_score": 1,
"selected": false,
"text": "[Test] \npublic void Should_be_able_to_use_enumerator_more_than_once() \n{\n var numbers = Isolate.Fake.Instance<INu... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5289/"
] |
391,413 | <p>I am preventing the user from resizing the form. How do I also remove the maximize button?</p>
| [
{
"answer_id": 392463,
"author": "nabiy",
"author_id": 48286,
"author_profile": "https://Stackoverflow.com/users/48286",
"pm_score": 0,
"selected": false,
"text": "hwnd = CreateWindow (szAppName, TEXT(\"Program Name\"),\n WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX,\n ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42782/"
] |
391,432 | <p>My day job includes working to develop a Pascal-like compiler. I've been working all along on optimizations and code generation. </p>
<p>I would also like to start learning to build a simple parser for the same language. I'm however, not really sure how to go about this. Flex and Bison seem to be the choice. But, isn't it possible to write a parser using C++ or C#? I'm a bit creepy with C.</p>
<p>Yacc++ supports C#, but it's a licensed one. I'm looking for all the help that I can find in this regard. Suggestions would be highly appreciated.</p>
| [
{
"answer_id": 391608,
"author": "Mike Dunlavey",
"author_id": 23771,
"author_profile": "https://Stackoverflow.com/users/23771",
"pm_score": 3,
"selected": false,
"text": " // routine to scan over whitespace/comments\nvoid ScanWhite(const char* &pc){\n while(true){\n if(0);\n else... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391432",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,438 | <p>I proposed what I think is a better syntax for ASP.NET MVC views in <a href="https://stackoverflow.com/questions/390693/does-anyone-beside-me-just-not-get-aspnet-mvc#391382">this question</a>. Since that question has been answered, I think my answer will generate little feedback, so I am posting it as its own question here.</p>
| [
{
"answer_id": 391903,
"author": "yfeldblum",
"author_id": 12349,
"author_profile": "https://Stackoverflow.com/users/12349",
"pm_score": 1,
"selected": false,
"text": "%h2= Model.CategoryName\n%ul\n - foreach (var product in Model.Products)\n %li\n = product.ProductName \n ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391438",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39430/"
] |
391,440 | <p>Is there a way to make a <code><div></code> container resizeable with drag & drop?</p>
| [
{
"answer_id": 391773,
"author": "Georg Schölly",
"author_id": 24587,
"author_profile": "https://Stackoverflow.com/users/24587",
"pm_score": 6,
"selected": false,
"text": "div.my_class {\n resize:both;\n overflow:auto; /* something other than visible */\n}\n"
},
{
"answer_i... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391440",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43960/"
] |
391,450 | <p>I have a DataBound GridView. However I have one column where the value comes from a calculation in the code behind - it is displayed within a TemplateField.</p>
<p>How can a sort my grid based on this calculated value ?</p>
| [
{
"answer_id": 391473,
"author": "Stephen Wrighton",
"author_id": 7516,
"author_profile": "https://Stackoverflow.com/users/7516",
"pm_score": 4,
"selected": true,
"text": "Dim DT as DataTable \nDT = GetDataTableFromDataBaseMethod()\nDT.Columns.Add(New DataColumn(\"CalculatedColumnName\")... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391450",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2839/"
] |
391,462 | <p>C# 3.0 introduced the <code>var</code> keyword. And when compiled, the compiler will insert the right types for you. This means that it will even work on a 2.0 runtime. So far so good. But the other day I found a case where, the <code>var</code> keyword would be replaced with just object and thus not specific enough. Say you have something like:</p>
<pre><code>var data = AdoMD.GetData(...); // GetData returns a DataTable
foreach (var row in data.Rows)
{
string blah = (string)row[0]; // it fails since it's of type object
}
</code></pre>
<p>When I try to use row both <a href="http://en.wikipedia.org/wiki/IntelliSense" rel="nofollow noreferrer">IntelliSense</a> and the compiler tells me that it is of type object. <code>data.Rows</code> is of type <code>System.Data.DataRowCollection</code>. The following works:</p>
<pre><code>var data = AdoMD.GetData(...); // GetData returns a DataTable
foreach (DataRow row in data.Rows)
{
string blah = (string)row[0]; // works since it now has the right type
}
</code></pre>
<p>This is not a question about the usage of var, there is a thread for that <a href="https://stackoverflow.com/questions/41479/use-of-var-keyword-in-c">here</a>.</p>
<p>I'm using Visual Studio 2008 SP1 btw.</p>
<p>Edit: correct code now attached.</p>
| [
{
"answer_id": 391475,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Stackoverflow.com/users/267",
"pm_score": 2,
"selected": false,
"text": "using System;\n\nnamespace Test\n{\n public class X\n {\n public String Bleh;\n }\n\n public class... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13995/"
] |
391,483 | <p>What is the difference between an abstract method and a virtual method? In which cases is it recommended to use abstract or virtual methods? Which one is the best approach?</p>
| [
{
"answer_id": 391505,
"author": "JoshBerke",
"author_id": 26160,
"author_profile": "https://Stackoverflow.com/users/26160",
"pm_score": 8,
"selected": false,
"text": "public abstract class myBase\n{\n //If you derive from this class you must implement this method. notice we have no m... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391483",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1409636/"
] |
391,486 | <p>I've been investigating what data layer to use for a new web-based project I'm designing and I'm very keen to look at incorporating LINQ to SQL. Its apparent simplicity, flexibility and designer support really appeals and the implicit tie-in to SQL Server is fine.</p>
<p>However, it has been announced recently that LINQ to SQL will be taking a back seat to the Entity Framework now that it's been passed to the ADO.NET team (<a href="http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/adonet/archive/2008/10/29/update-on-linq-to-sql-and-linq-to-entities-roadmap.aspx</a>). Sure, it will be supported in the future, but it's unlikely that it will see much more development work.</p>
<p>With this in mind, would you recommend me using this technology for my project or is it worth either selecting an alternative ORM (nHibernate?) or manually coding up a generic DAL?</p>
<p>The project itself is ASP.NET and SQL Server 2005/2008 based and will possibly use MVC, even though it's still in beta. It's a personal project, the database won't be overly complex and it will mainly be used as a prototype to look at .NET future tech. I would be basing future projects on what I learn from this one though, so the choices I make will affect larger solutions to come.</p>
<p>And yes, I realise that Microsoft will probably bring out a whole new data access technology tomorrow anyway! ;)</p>
| [
{
"answer_id": 826293,
"author": "Serapth",
"author_id": 101767,
"author_profile": "https://Stackoverflow.com/users/101767",
"pm_score": 2,
"selected": false,
"text": " public static void UpdateUser(UserLibrary.User user) {\n using (UserLibraryDataContext dc = new UserLibraryDa... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391486",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42841/"
] |
391,498 | <p>How to create a pragraph <p> tag in ASP.NET using the HtmlGenericControl class?</p>
| [
{
"answer_id": 391514,
"author": "gius",
"author_id": 19712,
"author_profile": "https://Stackoverflow.com/users/19712",
"pm_score": -1,
"selected": false,
"text": "new HtmlGenericControl(\"p\");\n"
},
{
"answer_id": 391515,
"author": "tvanfosson",
"author_id": 12950,
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32582/"
] |
391,503 | <p>I know this is a matter of style, hence the subjective tag. I have a small piece of code, with two nested conditions. I could code it in two ways, and I'd like to see how more experienced developers think it should look like.</p>
<p><em>Style 1</em>:</p>
<pre><code>while (!String.IsNullOrEmpty(msg = reader.readMsg()))
{
RaiseMessageReceived();
if (parseMsg)
{
ParsedMsg parsedMsg = parser.parseMsg(msg);
RaiseMessageParsed();
if (processMsg)
{
process(parsedMsg);
RaiseMessageProcessed();
}
}
}
</code></pre>
<p><em>Style 2:</em></p>
<pre><code>while (!String.IsNullOrEmpty(msg = reader.readMsg()))
{
RaiseMessageReceived();
if (!parseMsg) continue;
ParsedMsg parsedMsg = parser.parseMsg(msg);
RaiseMessageParsed();
if (!processMsg) continue;
process(parsedMsg);
RaiseMessageProcessed();
}
</code></pre>
<p>(Side question: how do I put empty lines in the source code sample?)</p>
| [
{
"answer_id": 391517,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 2,
"selected": false,
"text": "continue"
},
{
"answer_id": 391526,
"author": "matt b",
"author_id": 4249,
"author_profile": "https://... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41283/"
] |
391,506 | <p>When I move .xaml and .xaml.vb files to a new Silverlight project, the generated .g files no longer include members for the x:Name attributes defined in the xaml file. This means the code-behind files can't refer to those members and cannot build.</p>
| [
{
"answer_id": 391551,
"author": "Pete",
"author_id": 3059,
"author_profile": "https://Stackoverflow.com/users/3059",
"pm_score": 1,
"selected": false,
"text": "<Page Include=\"calculator.xaml\">\n <Generator>MSBuild:MarkupCompilePass1</Generator>\n <SubType>Page</SubType>\n</Page>... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3059/"
] |
391,529 | <p>What are the real differences between anonymous type(var) in c# 3.0 and dynamic type(dynamic) that is coming in c# 4.0?</p>
| [
{
"answer_id": 391546,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 4,
"selected": false,
"text": "dynamic object Option Strict Off dynamic dynamic"
},
{
"answer_id": 392163,
"author": "Jörg W Mittag",
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2137/"
] |
391,550 | <p>I'been doing some inheritance in js in order to understand it better, and I found something that confuses me.</p>
<p>I know that when you call an 'constructor function' with the new keyword, you get a new object with a reference to that function's prototype.</p>
<p>I also know that in order to make prototypal inheritance you must replace the prototype of the constructor function with an instance of the object you want to be the 'superclass'.</p>
<p>So I did this silly example to try these concepts:</p>
<pre><code>function Animal(){}
function Dog(){}
Animal.prototype.run = function(){alert("running...")};
Dog.prototype = new Animal();
Dog.prototype.bark = function(){alert("arf!")};
var fido = new Dog();
fido.bark() //ok
fido.run() //ok
console.log(Dog.prototype) // its an 'Object'
console.log(fido.prototype) // UNDEFINED
console.log(fido.constructor.prototype == Dog.prototype) //this is true
function KillerDog(){};
KillerDog.prototype.deathBite = function(){alert("AAARFFF! *bite*")}
fido.prototype = new KillerDog();
console.log(fido.prototype) // no longer UNDEFINED
fido.deathBite(); // but this doesn't work!
</code></pre>
<p>(This was done in Firebug's console)</p>
<p>1) Why if all new objects contain a reference to the creator function's prototype, fido.prototype is undefined?</p>
<p>2) Is the inheritance chain [obj] -> [constructor] -> [prototype] instead of [obj] -> [prototype] ?</p>
<p>3) is the 'prototype' property of our object (fido) ever checked? if so... why is 'deathBite' undefined (in the last part)?</p>
| [
{
"answer_id": 391626,
"author": "Kenan Banks",
"author_id": 43089,
"author_profile": "https://Stackoverflow.com/users/43089",
"pm_score": 3,
"selected": false,
"text": "new fido.prototype = new KillerDog();\n prototype fido KillerDog fido.foo = new KillerDog();\n // Doesn't work because... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391550",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7595/"
] |
391,557 | <p>I was looking at Stack Overflow question <em><a href="https://stackoverflow.com/questions/391483">What is the difference between abstract function and virtual function?</a></em>, and I was wondering whether every abstract function should be considered to be a virtual function in C# or in general?</p>
<p>I was a bit puzzled by the "you must override/you may override" responses to that question. Not being a C# programmer, I tend to think that abstract functions are a compile-time concept only, and that abstract functions are virtual functions by definition since you must provide at least one but can provide multiple implementations further down the hierarchy. </p>
<p>Virtual functions have a compile-time dimension too, in that you cannot override a non-virtual function, but they are mostly a runtime concept since it is "just" the selection of the correct method implementation based on the actual receiver.</p>
| [
{
"answer_id": 391563,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "abstract class A {\n public abstract void Foo();\n}\nclass B : A {\n public override void Foo()\n { /* must ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391557",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30316/"
] |
391,581 | <p>I’m using control that needs to be register to asynchronous events.
The events will be raised in the UI thread using the <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.isynchronizeinvoke.aspx" rel="nofollow noreferrer">ISynchronizeInvoke</a> interface implemented by WinForms controls</p>
<p>I can’t register to the event at the constructor because it will allow calling the event handler before the control is fully created. during which calls to ISynchronizeInvoke are not allowed.</p>
<p>Solution to that problem is to use the perform the asynchronous event registration from an event handler to the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.control.handlecreated.aspx" rel="nofollow noreferrer">HandleCreated</a> instead of registering from the constructor.</p>
<p>however, this poses another issue, in some scenations the HandleCreated event is raised multiple times as result of change at the control state.
For example, each changing of the “RightToLeft” property causes a WMCreate message that cause raising the “HandleCreated” event.</p>
<p>How can I prevent the multiply times of event rising?
Is there is another way to know when the control is created and display for the first time?</p>
<p>I can keep a boolean flag in the HandleCreated, however it feels like a hack and I am wondering if there is a better way to handle this issue.</p>
| [
{
"answer_id": 391563,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": false,
"text": "abstract class A {\n public abstract void Foo();\n}\nclass B : A {\n public override void Foo()\n { /* must ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391581",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38265/"
] |
391,621 | <p>I have a method which should be delayed from running for a specified amount of time.</p>
<p>Should I use</p>
<pre><code>Thread thread = new Thread(() => {
Thread.Sleep(millisecond);
action();
});
thread.IsBackground = true;
thread.Start();
</code></pre>
<p>Or</p>
<pre><code>Timer timer = new Timer(o => action(), null, millisecond, -1);
</code></pre>
<p>I had read some <a href="http://msmvps.com/blogs/peterritchie/archive/2007/04/26/thread-sleep-is-a-sign-of-a-poorly-designed-program.aspx" rel="nofollow noreferrer">articles</a> about how using <code>Thread.Sleep</code> is bad design. But I don't really understand why.</p>
<p>However, for using <code>Timer</code>, <code>Timer</code> has a dispose method. Since the execution is delayed, I don't know how to dispose the <code>Timer</code>. Do you have any suggestions?</p>
<p>Or, if you have an alternative suggestion for delaying code execution, that would also be appreciated.</p>
| [
{
"answer_id": 391737,
"author": "Eric Rosenberger",
"author_id": 41624,
"author_profile": "https://Stackoverflow.com/users/41624",
"pm_score": 7,
"selected": true,
"text": "System.Threading.Timer Timer Thread.Sleep Timer Thread.Sleep Timer Timer Timer class TimerState\n{\n public Tim... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2398110/"
] |
391,637 | <pre><code>select * from myTable where myInt
</code></pre>
<p>will not show any possible_keys when explaining the query even though there is an index on myInt field.</p>
<p><strong>Edit:</strong><br>
The index in question is not unique.</p>
| [
{
"answer_id": 391638,
"author": "Senseful",
"author_id": 35690,
"author_profile": "https://Stackoverflow.com/users/35690",
"pm_score": 4,
"selected": true,
"text": "select * from myTable where myInt = true\n"
},
{
"answer_id": 391679,
"author": "Kieveli",
"author_id": 15... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391637",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35690/"
] |
391,649 | <p>While browsing some code I found a call to <a href="http://msdn.microsoft.com/en-us/library/dd162751.aspx" rel="nofollow noreferrer">OpenPrinter()</a>. The code compiles and works fine. But, we are passing a <code>HANDLE</code> instead of <code>LPHANDLE</code> (as specified in MSDN). I found out that in <code>windef.h</code> the following declaration exists:</p>
<pre><code>typedef HANDLE FAR *LPHANDLE;
</code></pre>
<p>What does LP stand for? Should I use a <code>LPHANDLE</code>, or keep <code>HANDLE</code>?</p>
| [
{
"answer_id": 391670,
"author": "Kieveli",
"author_id": 15852,
"author_profile": "https://Stackoverflow.com/users/15852",
"pm_score": 4,
"selected": true,
"text": "HANDLE h = <winapi function>();\nLPHANDLE ph = &h;\n HANDLE anotherh = *ph;\nor\n<winapi function>(*ph, ...);\n"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391649",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43701/"
] |
391,710 | <p>I want to join all lines in a file into a single line. What is the simplest way of doing this? I've had poor luck trying to use substitution (<code>\r\n</code> or <code>\n</code> doesn't seem to get picked up correctly in the case of <code>s/\r\n//</code> on Windows). Using <code>J</code> in a range expression doesn't seem to work either (probably because the range is no longer in 'sync' after the first command is executed).</p>
<p>I tried <code>:1,$norm! J</code> but this only did half of the file - which makes sense because it just joins each line once.</p>
| [
{
"answer_id": 391719,
"author": "Jordan Parmer",
"author_id": 20133,
"author_profile": "https://Stackoverflow.com/users/20133",
"pm_score": 7,
"selected": true,
"text": ":1,$join\n :%join -or- :%j\n"
},
{
"answer_id": 391768,
"author": "orip",
"author_id": 37020,
... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20133/"
] |
391,718 | <p>How can I search if a file named <code>foo.txt</code> was ever committed to my svn repository (in any revision)?</p>
| [
{
"answer_id": 391741,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 4,
"selected": false,
"text": "svn log -r 0:HEAD -v $REPOSITORY_PATH | grep \"/foo.txt\"\n"
},
{
"answer_id": 25161300,
"author": "bahr... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391718",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2133/"
] |
391,725 | <p>I have an Auction model with several attributes, two of which are <strong>current_auction:boolean</strong> and <strong>scheduled_start:datetime</strong>. How can I make the boolean (false by default) become true when the scheduled_start becomes the current time? Please tell me if you need more information. I'm assuming that I will need to use script/runner, but have no experience with it. </p>
| [
{
"answer_id": 391741,
"author": "Adam Bellaire",
"author_id": 21632,
"author_profile": "https://Stackoverflow.com/users/21632",
"pm_score": 4,
"selected": false,
"text": "svn log -r 0:HEAD -v $REPOSITORY_PATH | grep \"/foo.txt\"\n"
},
{
"answer_id": 25161300,
"author": "bahr... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391725",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/33287/"
] |
391,744 | <p>We have a situation where our application calls some stored procedures on a sql 2000 server. Now we must get some of the data from another sql 2000 box connected by a vpn.</p>
<p>What would the syntax look like for performing CRUD operations from one sql server to another sql server?</p>
<p>Both database servers are SQL 2000 and running Windows 2003.</p>
| [
{
"answer_id": 391750,
"author": "splattne",
"author_id": 6461,
"author_profile": "https://Stackoverflow.com/users/6461",
"pm_score": 3,
"selected": true,
"text": " SELECT * FROM MyRemoteServer.MyDB.dbo.MyTable\n"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391744",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4096/"
] |
391,756 | <p>Is this allowed? :</p>
<pre><code>class A;
void foo()
{
static A();
}
</code></pre>
<p>I get signal 11 when I try to do it, but the following works fine:</p>
<pre><code>class A;
void foo()
{
static A a;
}
</code></pre>
<p>Thank you.</p>
| [
{
"answer_id": 391782,
"author": "Judge Maygarden",
"author_id": 1491,
"author_profile": "https://Stackoverflow.com/users/1491",
"pm_score": 2,
"selected": false,
"text": "class A;\nvoid foo()\n{\n A();\n}\n void foo()\n{\n new A();\n}\n\nvoid foo()\n{\n static char memory[sizeo... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391756",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44673/"
] |
391,757 | <p>Is it possible to determine styles in a CSS file through Javascript?</p>
<p>I am trying to detect CSS properties that will be applied to an element in a certain state, <code>:hover</code> in this case, but without those properties currently being active on the element. I had thought about cloning the element, appending the clone as a sibling with <code>display: none</code> and querying properties that way, but I don't know how to force the <code>:hover</code> style through Javascript. Any ideas?</p>
| [
{
"answer_id": 517495,
"author": "jasonkarns",
"author_id": 29729,
"author_profile": "https://Stackoverflow.com/users/29729",
"pm_score": 2,
"selected": false,
"text": "styleSheets document document.styleSheets cssRules rules var theRules = new Array();\nif (document.styleSheets[1].cssR... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391757",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/270/"
] |
391,759 | <p>I need to get text aligned right and left on the same line. This should be possible, but i can't seem to find a way. I'm using Apache FOP to convert xml to pdf.</p>
<p>Can someone help me to get this right?</p>
| [
{
"answer_id": 391775,
"author": "Martijn Laarman",
"author_id": 47020,
"author_profile": "https://Stackoverflow.com/users/47020",
"pm_score": -1,
"selected": false,
"text": "<fo:block-container>\n <fo:block text-align=\"left\">text</fo:block>\n <fo:block text-align=\"right\">text</f... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20261/"
] |
391,766 | <p>Our application allows the user to change the Culture that they run it under and that culture can be different than the underlying OS Culture. The only way that I have found of doing this is by setting Thread.CurrentThread.CurrentCulture and Thread.CurrentThread.CurrentUICulture for every thread.</p>
<p>The only problem with this is that we must set the culture for every thread and we need to remember to do this whenever we create a new thread. If you set a thread to another culture, then create a new thread, it gets the culture of the OS, not of the thread that created it.</p>
<p>I would like to find a better way of doing this. I can only think of two things, but I don't know if either are possible.</p>
<ol>
<li>Set the culture at the application level so that all threads default to that culture. Is this possible?</li>
<li>Is there a thread creation event anywhere that I can subscribe to? This way I can set up one handler to set the culture on thread creation.</li>
</ol>
<p>Any ideas or help would be welcome, even if I need to PInvoke down to the Win32 API. Thanks in advance.</p>
<p><strong>EDIT:</strong> I found <a href="https://stackoverflow.com/questions/93153/easy-way-to-set-currentculture-for-the-entire-application">this question</a> which is similar, but no answer was found.</p>
| [
{
"answer_id": 391790,
"author": "Gant",
"author_id": 12460,
"author_profile": "https://Stackoverflow.com/users/12460",
"pm_score": 1,
"selected": false,
"text": "class MyThreadFactory\n{\n public static Thread getThread()\n {\n Thread a = new Thread(..);\n a.CurrentC... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391766",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30827/"
] |
391,767 | <p>I get the error </p>
<blockquote>
<p>Access to the path
"C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\Temporary ASP.NET
Files\cbnonreg\fc933fca\bbf91eea" is denied.</p>
</blockquote>
<p>whenever I try to access my newly deployed site.<br>
I looked at the path and discovered that <code>/cbnonreg\fc933fca\bbf91eea</code> does not exist.<br>
please what can i do?</p>
| [
{
"answer_id": 20428082,
"author": "crabCRUSHERclamCOLLECTOR",
"author_id": 862011,
"author_profile": "https://Stackoverflow.com/users/862011",
"pm_score": 3,
"selected": false,
"text": "Microsoft (R) ASP.NET RegIIS version 4.0.30319.17929\nAdministration utility to install and uninstall... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391767",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,784 | <p>What is the best way to redirect to the login page when the session expires. I'm using </p>
<pre><code>sessionState mode="InProc"
</code></pre>
<p>Can I set this in the web.config file?</p>
| [
{
"answer_id": 391804,
"author": "Dillie-O",
"author_id": 71,
"author_profile": "https://Stackoverflow.com/users/71",
"pm_score": 3,
"selected": true,
"text": "Page.ClientScript.RegisterStartupScript(Me.GetType, \"TimeoutScript\", \n\"setTimeout(\"\"top.location.href = '~/Login.aspx'\"\"... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1688440/"
] |
391,821 | <p>I have a page for searching and the search result will be shown in gridview control. I have a button called Clear to clear out the search result in gridview and also the text box where user enter the search criteria. </p>
<p>At first, i did the Clearing by doing page refresh <code>print("Response.Redirect(~/blah/search.aspx");</code>but i'm not sure if that's the best way to clear a page. Would it be better to set the text box to string empty and set the gridview datasource to Nothing then bind it?</p>
| [
{
"answer_id": 391910,
"author": "HectorMac",
"author_id": 1400,
"author_profile": "https://Stackoverflow.com/users/1400",
"pm_score": 1,
"selected": false,
"text": "onFocus=\"this.select()\"\n"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391821",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28647/"
] |
391,857 | <p>Has anyone run into this problem? All I am doing in tabbing from one TextInput component to another.</p>
<p>I have reduced my TitleWindow (the container for the TextInputs) down to only these two components and I still get this error. I assumed that it had something to do with my flashplayer install, so I uninstalled and re-installed, but I still get the same behavior.</p>
<p>Any help/advice/best guess would be awesome, thanks.</p>
| [
{
"answer_id": 406001,
"author": "Feet",
"author_id": 18340,
"author_profile": "https://Stackoverflow.com/users/18340",
"pm_score": 1,
"selected": false,
"text": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<mx:Application xmlns:mx=\"http://www.adobe.com/2006/mxml\" layout=\"absolute\">\... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391857",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48934/"
] |
391,874 | <p>I need to update the comments field in a table for a large list of customer_ids. The comment needs to be updated to include the existing comment and appending some text and the password which is in another table. I'm not quite sure how to do this.</p>
<p>Here is some code that does this for a single customer id. How would I go about doing this for a list of over 100 customer id's? my first thought is to make a temp table and place all the customer id's in there, but i'm still not sure how to code it after that since the customer_id is used in the query twice.</p>
<pre><code>Update Contract
SET Contract_Comment= Contract_Comment || '; 12/29/2008 Password `' ||
(SELECT Password FROM WLogin WHERE default_customer_id='1234' ) ||'`'|| ' reinstated per Mickey Mouse;'
WHERE Customer_id='1234'
</code></pre>
| [
{
"answer_id": 391895,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 2,
"selected": true,
"text": "update contract c\nset contract_comment = contract_comment || '; 12/29/2008 Password ' ||\n(select password from WLogin w where... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
391,879 | <p>I'm starting a Python project and expect to have 20 or more classes in it. As is good practice I want to put them in a separate file each. However, the project directory quickly becomes swamped with files (or will when I do this).</p>
<p>If I put a file to import in a folder I can no longer import it. How do I import a file from another folder and will I need to reference to the class it contains differently now that it's in a folder?</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 391899,
"author": "Kenan Banks",
"author_id": 43089,
"author_profile": "https://Stackoverflow.com/users/43089",
"pm_score": 6,
"selected": true,
"text": "__init__.py from package import class\nimport package.class\n __init__.py __all__ from package import * # name1 and nam... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391879",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1384652/"
] |
391,888 | <p>If you set the Visible property of a Windows Forms control to true, that property still returns false if any of the control's parent windows are hidden. Is there a way to get the true, underlying visibility flag of the control in case the parent window is hidden?</p>
| [
{
"answer_id": 391908,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "GetState(2) // dodgy; not recommended\n Panel query;\n Form form = new Form\n {\n Controls = {\n ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391888",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22820/"
] |
391,897 | <p>I have a piece of fortran code, and I am not sure which standard it is - '77, '90 or '95. Is there a standard tool to identify which standard it subjects to?</p>
| [
{
"answer_id": 391932,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 2,
"selected": false,
"text": "--std"
},
{
"answer_id": 391960,
"author": "Tim Whitcomb",
"author_id": 24895,
"author_profile": "h... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391897",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27126/"
] |
391,913 | <p>Will the following code result in a deadlock using C# on .NET?</p>
<pre><code> class MyClass
{
private object lockObj = new object();
public void Foo()
{
lock(lockObj)
{
Bar();
}
}
public void Bar()
{
lock(lockObj)
{
// Do something
}
}
}
</code></pre>
| [
{
"answer_id": 391919,
"author": "Neil Barnwell",
"author_id": 26414,
"author_profile": "https://Stackoverflow.com/users/26414",
"pm_score": 8,
"selected": true,
"text": "lock(object) {...} Monitor Bar()"
},
{
"answer_id": 391921,
"author": "Marc Gravell",
"author_id": 23... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391913",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1463/"
] |
391,915 | <p>I have a ComboBox hosted in a ListView and I need changes in the CombBox to update the supporing class that the ListView is bound to. </p>
<p>Here is my DataTemplate</p>
<pre><code><DataTemplate x:Key="Category">
<ComboBox IsSynchronizedWithCurrentItem="False"
Style="{StaticResource DropDown}"
ItemsSource="{Binding Source={StaticResource Categories}}"
SelectedValuePath="Airport"
SelectedValue="{Binding Path=Category}"
/>
</DataTemplate>
</code></pre>
<p>This is the Listview. The ItemSource for the ListView is a collection of Airports and is set in code behind, and has a property called Category that I need the combobox to update.</p>
<pre><code><ListView.View>
<GridView>
<GridViewColumn DisplayMemberBinding="{Binding Path=Name}" Header="Airport" Width="100" />
<GridViewColumn Header="Category" Width="100" CellTemplate="{StaticResource Category}" />
</GridView>
</ListView.View>
</code></pre>
| [
{
"answer_id": 391981,
"author": "Kent Boogaart",
"author_id": 5380,
"author_profile": "https://Stackoverflow.com/users/5380",
"pm_score": 2,
"selected": true,
"text": "SelectedValuePath ComboBox"
},
{
"answer_id": 392049,
"author": "user38349",
"author_id": 38349,
"a... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391915",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38349/"
] |
391,917 | <p>I was recently trying to update <a href="http://kentb.blogspot.com/2008/12/kentis.html" rel="nofollow noreferrer">my game</a> to store graphics in compressed formats (JPEG and PNG).</p>
<p>Whilst I ended up settling on a different library, my initial attempt was to incorporate <a href="http://www.ijg.org/" rel="nofollow noreferrer">ijg</a> to do JPEG decompression. However, I was unable to get even the simplest console application to work and am wondering if anyone might be able to shed some light on the reasons why.</p>
<p>Here is my code, which is linked to the <em>jpeg.lib</em> that is part of the ijg packages:</p>
<pre><code>#include "stdafx.h"
#include <stdio.h>
#include <assert.h>
#include <jpeglib.h>
int _tmain(int argc, _TCHAR* argv[])
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
JSAMPARRAY buffer;
int row_stride;
//initialize error handling
cinfo.err = jpeg_std_error(&jerr);
//initialize the decompression
jpeg_create_decompress(&cinfo);
FILE* infile;
errno_t err = fopen_s(&infile, "..\\Sample.jpg", "rb");
assert(err == 0);
//specify the input
jpeg_stdio_src(&cinfo, infile);
//read headers
(void) jpeg_read_header(&cinfo, TRUE);
return 0;
}
</code></pre>
<p>The problem is that the call to <code>jpeg_read_header()</code> fails with an access violation:</p>
<blockquote>
<p>Unhandled exception at 0x7c91b1fa
(ntdll.dll) in JPEGTest.exe:
0xC0000005: Access violation writing
location 0x00000010.</p>
</blockquote>
<p>Does anyone have any ideas what I might be doing wrong?</p>
| [
{
"answer_id": 392714,
"author": "Matthew Flaschen",
"author_id": 47773,
"author_profile": "https://Stackoverflow.com/users/47773",
"pm_score": 3,
"selected": false,
"text": "#include <stdio.h>\n#include <assert.h>\n#include <jpeglib.h>\n\nint main(int argc, char* argv[])\n{\n struct ... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5380/"
] |
391,920 | <p>I've got a project that I started in Turbo Delphi, which I recently updated to D2009, and I've noticed a bit of a quirk in the form designer. All the old forms have a Win98 style applied to them. The buttons are gray with sharp square edges, for example. But any new form I've created since the upgrade displays its controls in WinXP style. If I copy a control from an old form and paste it to a new one, the style changes. At runtime, all controls from all forms are shown in XP style.</p>
<p>Any idea what's causing my old forms to show in an old style? I've looked through the properties list, but nothing jumps out at me. But there's obviously something, and it's persistent because saving and reloading doesn't change it. Anyone know where this property is and how I can fix it?</p>
| [
{
"answer_id": 392031,
"author": "Cesar Romero",
"author_id": 36875,
"author_profile": "https://Stackoverflow.com/users/36875",
"pm_score": 2,
"selected": false,
"text": "Project | Options | Application | [ ] Enable Run Time Themes\n"
},
{
"answer_id": 34825086,
"author": "... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391920",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32914/"
] |
391,948 | <p>What is the suggested pattern for providing realtime UI updates in a web application? For example, whilst answering a question on SO and another user submits an answer and a prompt appears. Also, if every page in your site provides this function, how do you avoid overloading the server with too many AJAX calls?</p>
| [
{
"answer_id": 391963,
"author": "Shog9",
"author_id": 811,
"author_profile": "https://Stackoverflow.com/users/811",
"pm_score": 2,
"selected": false,
"text": "XmlHttpRequest"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391948",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27805/"
] |
391,949 | <p>I am storing various articles in my lucene index.
When user searches for articles which contain a specific term or phrase,I need to show all th articles (could be anywhere between 1000 to 10000 articles) but with newest articles "bubbled up" in the search results.</p>
<p>I believe you can bubble up a search result in Lucene using "Date field Boosting".
Can someone please give me the details of how to go about this?</p>
<p>Thanks in advance!</p>
| [
{
"answer_id": 522832,
"author": "Sean Carpenter",
"author_id": 729,
"author_profile": "https://Stackoverflow.com/users/729",
"pm_score": 1,
"selected": false,
"text": "setBoost"
}
] | 2008/12/24 | [
"https://Stackoverflow.com/questions/391949",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41625/"
] |
391,955 | <p>I am knocking together a WPF demo for our department at work to show them the advantages of WPF whilst <em>trying</em> to adhere to our development standards (dependency injection and developing objects to an explicit interface).</p>
<p>I have come to a bit of a wall now. I am implementing the View using the MVVM design pattern and I need to update a TextBlocks Text property every time the property on the View Model (VM) is updated. For this I would define the VM property as a Dependency Property and bind the TextBlocks Text property in the View to it.</p>
<p>Now the MV property is on my interface and is (as per our development standards) explicitly defined. From the View I bind the Text property of the TextBlock in the View to the Dependency Properties property (not the static part) but this does not update my View when the dependency properties value changes (I know how to bind to an explicit interface so this is not the problem as far as I can see).</p>
<p>Any help would really be appreciated. Can I use Dependency Properties with Explicit Interfaces? If I can how, if not have you got any ideas on what I can do in this situation?</p>
<p>Thank you for reading and I look forward to your responses.</p>
<p>Adam</p>
| [
{
"answer_id": 392346,
"author": "Mark Heath",
"author_id": 7532,
"author_profile": "https://Stackoverflow.com/users/7532",
"pm_score": 4,
"selected": true,
"text": "INotifyPropertyChanged interface MyInterface : INotifyPropertyChanged\n{\n string Text { get; set; }\n}\n\nclass MyView... | 2008/12/24 | [
"https://Stackoverflow.com/questions/391955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21682/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.