qid int64 4 8.14M | question stringlengths 20 48.3k | answers list | date stringlengths 10 10 | metadata list | input stringlengths 12 45k | output stringlengths 2 31.8k |
|---|---|---|---|---|---|---|
509,046 | <p>I have a database table <code>TravelRequest</code> that contains, amongst other things, the fields <code>SignOffName</code> and <code>SignOffDate</code>. I have a table adapter <code>TravelRequestTable</code> based on this table. I have a DetailsView control which uses this via an ObjectDataSource. Should be all fai... | [
{
"answer_id": 509127,
"author": "Robert Wagner",
"author_id": 10784,
"author_profile": "https://Stackoverflow.com/users/10784",
"pm_score": 6,
"selected": true,
"text": "<p>Check to make sure your model matches the DB. I've run across this if they are out of sync, in most cases the null... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509046",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62147/"
] | I have a database table `TravelRequest` that contains, amongst other things, the fields `SignOffName` and `SignOffDate`. I have a table adapter `TravelRequestTable` based on this table. I have a DetailsView control which uses this via an ObjectDataSource. Should be all fairly standard stuff.
What I want to do is add a... | Check to make sure your model matches the DB. I've run across this if they are out of sync, in most cases the nullable flag. Check out this [article](http://weblogs.asp.net/okloeten/archive/2008/04/28/6139181.aspx) for a possible cause.
I assume you are using the release version of .net 3.5 (Visual Studio 2008). |
509,076 | <p>Eclipse is giving me a warning of the following form:</p>
<blockquote>
<p>Type safety: Unchecked cast from Object to HashMap</p>
</blockquote>
<p>This is from a call to an API that I have no control over which returns Object:</p>
<pre><code>HashMap<String, String> getItems(javax.servlet.http.HttpSession s... | [
{
"answer_id": 509106,
"author": "Mark Davidson",
"author_id": 50866,
"author_profile": "https://Stackoverflow.com/users/50866",
"pm_score": 1,
"selected": false,
"text": "<p>A quick guess if you post your code can say for sure but you might have done something along the lines of</p>\n\n... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509076",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18103/"
] | Eclipse is giving me a warning of the following form:
>
> Type safety: Unchecked cast from Object to HashMap
>
>
>
This is from a call to an API that I have no control over which returns Object:
```
HashMap<String, String> getItems(javax.servlet.http.HttpSession session) {
HashMap<String, String> theHash = (Ha... | Wow; I think I figured out the answer to my own question. I'm just not sure it's worth it! :)
The problem is the cast isn't checked. So, you have to check it yourself. You can't just check a parameterized type with instanceof, because the parameterized type information is unavailable at runtime, having been erased at ... |
509,112 | <p>Whats the best way to dynamically add <strong>NEW</strong> dhtml content to a form that's generated via Zend_Form. Example, say the form is created like so:</p>
<pre><code>class formUser extends Zend_Form {
public function __construct( $options = null ) {
parent::__construct( $options );
$page1... | [
{
"answer_id": 509652,
"author": "Boris Guéry",
"author_id": 61337,
"author_profile": "https://Stackoverflow.com/users/61337",
"pm_score": 0,
"selected": false,
"text": "<p>An hint to accomplish your task could be to define an hidden input where you could increment your 'pageNb' when you... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509112",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Whats the best way to dynamically add **NEW** dhtml content to a form that's generated via Zend\_Form. Example, say the form is created like so:
```
class formUser extends Zend_Form {
public function __construct( $options = null ) {
parent::__construct( $options );
$page1 = new Zend_Form_Element_T... | I don't have time to go into the details of coding this right now, but here's how I would go about it:
Since you want the structure of your form (and not just it's data) to be editable, you will have to instantiate it and store it in your session.
Instead of just generating some additional HTML markup, you JavaScript... |
509,118 | <p>I'm trying to create a dialog window using JQuery. I'm making progress so far, but running into some issues w/ the iframe... I know that iframes are usually frowned upon, but they are the only things that will meet the requirements of the project.</p>
<p>Anyway, I can successfully implement the resizable and drag... | [
{
"answer_id": 509624,
"author": "aleemb",
"author_id": 50475,
"author_profile": "https://Stackoverflow.com/users/50475",
"pm_score": 2,
"selected": false,
"text": "<p>Ran into the same <a href=\"http://aleembawany.com/2009/01/25/jquery-resizable-draggable-bug-workaround/\" rel=\"nofollo... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509118",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23869/"
] | I'm trying to create a dialog window using JQuery. I'm making progress so far, but running into some issues w/ the iframe... I know that iframes are usually frowned upon, but they are the only things that will meet the requirements of the project.
Anyway, I can successfully implement the resizable and draggable plugin... | @aleemb: I don't believe that is what he's talking about. I believe the problem to be the Iframe and not the combination of the draggable and resizable.
@regex: I have this same issue and it also manifested itself with a prior implementation using the prototype toolkit.
My implementation uses an Iframe as a canvas on... |
509,141 | <p>I need a way to tell ASP.NET "Kill the current session and start over with a brand new one" before/after a redirect to a page.</p>
<p>Here's what I'm trying to do:</p>
<p>1) Detect when a session is expired in the master page (or Global.asax) of an ASP.NET application.</p>
<p>2) If the session is expired, redirec... | [
{
"answer_id": 509196,
"author": "Element",
"author_id": 50970,
"author_profile": "https://Stackoverflow.com/users/50970",
"pm_score": 5,
"selected": true,
"text": "<p>The problem you are describing happens because asp.net is reusing the sessionid, if the sessionid still exists in the au... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509141",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/104949/"
] | I need a way to tell ASP.NET "Kill the current session and start over with a brand new one" before/after a redirect to a page.
Here's what I'm trying to do:
1) Detect when a session is expired in the master page (or Global.asax) of an ASP.NET application.
2) If the session is expired, redirect the user to a page tel... | The problem you are describing happens because asp.net is reusing the sessionid, if the sessionid still exists in the auth cookie when you call abandon() it will just reuse it, you need to explicitly create a new sessionid afaik something like:
```
HttpCookie mycookie = new HttpCookie("ASP.NET_SessionId");
mycook... |
509,144 | <p>I have the pattern User/{domain}/{username} set up via Routing. Everything works except for one thing. I can't figure out how to get the domain and username variables passed to my redirected page. Below is my GetHttpHandler method from my IRouteHandler implementation.</p>
<pre><code> public IHttpHandler GetHttpH... | [
{
"answer_id": 509196,
"author": "Element",
"author_id": 50970,
"author_profile": "https://Stackoverflow.com/users/50970",
"pm_score": 5,
"selected": true,
"text": "<p>The problem you are describing happens because asp.net is reusing the sessionid, if the sessionid still exists in the au... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36590/"
] | I have the pattern User/{domain}/{username} set up via Routing. Everything works except for one thing. I can't figure out how to get the domain and username variables passed to my redirected page. Below is my GetHttpHandler method from my IRouteHandler implementation.
```
public IHttpHandler GetHttpHandler(Request... | The problem you are describing happens because asp.net is reusing the sessionid, if the sessionid still exists in the auth cookie when you call abandon() it will just reuse it, you need to explicitly create a new sessionid afaik something like:
```
HttpCookie mycookie = new HttpCookie("ASP.NET_SessionId");
mycook... |
509,189 | <p>Where I'm at we have a software package running on a mainframe system. The mainframe makes a nightly dump into sql server, such that each of our clients has it's own database in the server. There are a few other databases in the server instance as well, plus some older client dbs with no data.</p>
<p>We often ne... | [
{
"answer_id": 509216,
"author": "BradC",
"author_id": 21398,
"author_profile": "https://Stackoverflow.com/users/21398",
"pm_score": 0,
"selected": false,
"text": "<p>Each of our database servers contains a \"DBA\" database that contains tables full of meta-data like this.</p>\n\n<p>A \"... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509189",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3043/"
] | Where I'm at we have a software package running on a mainframe system. The mainframe makes a nightly dump into sql server, such that each of our clients has it's own database in the server. There are a few other databases in the server instance as well, plus some older client dbs with no data.
We often need to run rep... | Just wrap the statement you want to execute in an IF NOT IN:
```
EXEC sp_msforeachdb "
IF '?' NOT IN ('DBs','to','exclude') BEGIN
EXEC sp_whatever_you_want_to
END
"
``` |
509,193 | <p>I have a set of some classes which are all capable of being constructored with an argument being an instance of a particular interface. Since they all can be constructed by this same object (and the process during which this construction happens is largely the same in all cases), I figured perhaps templating would ... | [
{
"answer_id": 509199,
"author": "Joel Coehoorn",
"author_id": 3043,
"author_profile": "https://Stackoverflow.com/users/3043",
"pm_score": 0,
"selected": false,
"text": "<p>You want a <a href=\"http://en.wikipedia.org/wiki/Factory_method_pattern\" rel=\"nofollow noreferrer\">Factory</a> ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18192/"
] | I have a set of some classes which are all capable of being constructored with an argument being an instance of a particular interface. Since they all can be constructed by this same object (and the process during which this construction happens is largely the same in all cases), I figured perhaps templating would work... | Unfortunately while constraints will get you *some* of the way there, there's no way to specify that a type has a constructor which takes certain argument: the only constructor you can require is a parameterless one.
Personally I'd like to see that change using an idea of ["static interfaces"](http://msmvps.com/blogs/... |
509,195 | <p>Okay so, I have a form that is posting using ajax...</p>
<pre><code><% using(Ajax.BeginForm(new AjaxOptions() { OnBegin="onBegin", OnSuccess = "onSuccess", OnFailure="onFailure" })) { %>
</code></pre>
<p>On the server side I am passing back from the controller a Json object. Now, when the OnSuccess event fi... | [
{
"answer_id": 510203,
"author": "viren",
"author_id": 59205,
"author_profile": "https://Stackoverflow.com/users/59205",
"pm_score": 0,
"selected": false,
"text": "<p>create the user control for the list of items to be displayed and render it as partial by passing the json data to the UC... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55862/"
] | Okay so, I have a form that is posting using ajax...
```
<% using(Ajax.BeginForm(new AjaxOptions() { OnBegin="onBegin", OnSuccess = "onSuccess", OnFailure="onFailure" })) { %>
```
On the server side I am passing back from the controller a Json object. Now, when the OnSuccess event fires I can get to the Json object... | Use jQuery, and spin through the returned JSON object, building whatever you like.
Example:
```
$.each(json, function(i, item) {
//Add a dinner to the list on the right
$('#dinnerList').append($('<li/>')
.attr("class", "dinnerItem")
.appen... |
509,211 | <p>I need a good explanation (references are a plus) on Python slicing.</p>
| [
{
"answer_id": 509295,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 14,
"selected": true,
"text": "<p>The syntax is:</p>\n<pre><code>a[start:stop] # items start through stop-1\na[start:] # items start through the r... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509211",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24039/"
] | I need a good explanation (references are a plus) on Python slicing. | The syntax is:
```
a[start:stop] # items start through stop-1
a[start:] # items start through the rest of the array
a[:stop] # items from the beginning through stop-1
a[:] # a copy of the whole array
```
There is also the `step` value, which can be used with any of the above:
```
a[start:stop:... |
509,214 | <p>I've been using <a href="http://zentest.rubyforge.org/ZenTest/" rel="nofollow noreferrer">ZenTest</a> to run all the tests in my Rails project for years and it's always been quite nippy. However, on my Mac it has suddenly started taking 3 times as long to run all the tests. We have 1219 tests and for the past year... | [
{
"answer_id": 509428,
"author": "Morendil",
"author_id": 61168,
"author_profile": "https://Stackoverflow.com/users/61168",
"pm_score": 2,
"selected": false,
"text": "<p>When you have eliminated the impossible, whatever remains, however improbable, must be the explanation: if it's not th... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1174/"
] | I've been using [ZenTest](http://zentest.rubyforge.org/ZenTest/) to run all the tests in my Rails project for years and it's always been quite nippy. However, on my Mac it has suddenly started taking 3 times as long to run all the tests. We have 1219 tests and for the past year it would run all the tests in around 300 ... | So I finally solved this. Here's how in three easy steps:
1. Insert OSX Leopard CD
2. Completely reinstall Leopard from scratch
3. Reinstall Ruby, MySQL etc
After doing this the tests run in under 260 seconds.
I have no idea what happened but it certainly seems to have been a MySQL issue somewhere. |
509,219 | <p>I have a Flex file upload script that uses URLRequest to upload files to a server. I want to add support for http authentication (password protected directories on the server), but I don't know how to implement this - I assume I need to extend the class somehow, but on how to I'm a little lost. </p>
<p>I tried to m... | [
{
"answer_id": 509433,
"author": "Christian Nunciato",
"author_id": 32129,
"author_profile": "https://Stackoverflow.com/users/32129",
"pm_score": 5,
"selected": true,
"text": "<p>The syntax is a little different for URLRequest, but the idea's the same:</p>\n\n<pre><code>private function ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509219",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29538/"
] | I have a Flex file upload script that uses URLRequest to upload files to a server. I want to add support for http authentication (password protected directories on the server), but I don't know how to implement this - I assume I need to extend the class somehow, but on how to I'm a little lost.
I tried to modify the ... | The syntax is a little different for URLRequest, but the idea's the same:
```
private function doWork():void
{
var req:URLRequest = new URLRequest("http://yoursite.com/yourservice.ext");
req.method = URLRequestMethod.POST;
req.data = new URLVariables("name=John+Doe");
var encoder:Base64Encoder = new B... |
509,223 | <p>meaning is there a difference between </p>
<pre><code><WebService(Namespace:="http://theurl.com/")>
</code></pre>
<p>and</p>
<pre><code><WebService(Namespace:="http://www.theurl.com/")>
</code></pre>
<p>?</p>
| [
{
"answer_id": 509258,
"author": "Jeremy Boyd",
"author_id": 48943,
"author_profile": "https://Stackoverflow.com/users/48943",
"pm_score": 0,
"selected": false,
"text": "<p>Short answer: No.</p>\n\n<p>Long answer: Maybe.</p>\n\n<p>If you are going to use the SOAP protocol yourself. The ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509223",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18309/"
] | meaning is there a difference between
```
<WebService(Namespace:="http://theurl.com/")>
```
and
```
<WebService(Namespace:="http://www.theurl.com/")>
```
? | Don't know if you're asking one of two things so I'll mention both.
**1.** What's the namespace for?
The reasons all derive from the [W3C standards](http://www.w3.org/TR/REC-xml-names/).
Very short answer: If you're doing some simple ASP.NET web services, all connecting through .NET you'll probably never know any di... |
509,250 | <p>I'm trying to get console input in my Clojure program, but when it gives me this error when it gets to that part of the program.</p>
<pre><code>Exception in thread "main" java.lang.ClassCastException:
clojure.lang.LineNumberingPushbackReader cannot be cast to java.io.BufferedReader
</code></pre>
<p>the 'read' func... | [
{
"answer_id": 509279,
"author": "Chris Bunch",
"author_id": 422,
"author_profile": "https://Stackoverflow.com/users/422",
"pm_score": 3,
"selected": true,
"text": "<p>Hmm, it seems to work for me. What version of Clojure are you using and how are you calling prompt-read? Here's what I'm... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21734/"
] | I'm trying to get console input in my Clojure program, but when it gives me this error when it gets to that part of the program.
```
Exception in thread "main" java.lang.ClassCastException:
clojure.lang.LineNumberingPushbackReader cannot be cast to java.io.BufferedReader
```
the 'read' function works, but it's not w... | Hmm, it seems to work for me. What version of Clojure are you using and how are you calling prompt-read? Here's what I'm getting back (here `goo` is my response):
```
user=> (defn prompt-read [prompt]
(print (format "%s: " prompt))
(flush )
(read-line))
#'user/prompt-read
user=> (prompt-read "foo")
foo: goo
"goo"
``` |
509,265 | <p>We have a svnversion reported as 22625P.</p>
<p>What does the "P" mean?</p>
| [
{
"answer_id": 509289,
"author": "Doug Currie",
"author_id": 33252,
"author_profile": "https://Stackoverflow.com/users/33252",
"pm_score": 6,
"selected": true,
"text": "<p>Try <code>svnversion --help</code></p>\n\n<pre><code>4123:4168 mixed revision working copy\n4168M modifi... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19343/"
] | We have a svnversion reported as 22625P.
What does the "P" mean? | Try `svnversion --help`
```
4123:4168 mixed revision working copy
4168M modified working copy
4123S switched working copy
4123P partial working copy, from a sparse checkout
4123:4168MS mixed revision, modified, switched working copy
``` |
509,275 | <p>In a rails app, I using the :finder_sql option in a has_many declaration. The rails docs say that when I do this, "find_in_collection is not added." What does this mean?</p>
| [
{
"answer_id": 509289,
"author": "Doug Currie",
"author_id": 33252,
"author_profile": "https://Stackoverflow.com/users/33252",
"pm_score": 6,
"selected": true,
"text": "<p>Try <code>svnversion --help</code></p>\n\n<pre><code>4123:4168 mixed revision working copy\n4168M modifi... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509275",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62163/"
] | In a rails app, I using the :finder\_sql option in a has\_many declaration. The rails docs say that when I do this, "find\_in\_collection is not added." What does this mean? | Try `svnversion --help`
```
4123:4168 mixed revision working copy
4168M modified working copy
4123S switched working copy
4123P partial working copy, from a sparse checkout
4123:4168MS mixed revision, modified, switched working copy
``` |
509,287 | <p>I am trying to implement a master details solution using the jQuery Tabs. Two tabs, first tab contains Northwind Customers, selecting customer command should display tab2 with the orders for the customer.</p>
<p>So far, I have come to the conclusion that it cannot be done without using some sort of Ajax. <strong>Am... | [
{
"answer_id": 509366,
"author": "Soviut",
"author_id": 46914,
"author_profile": "https://Stackoverflow.com/users/46914",
"pm_score": 0,
"selected": false,
"text": "<p>You'll need AJAX since the JQuery tabs don't post back to the server. If you want tabbed behaviour that <em>does</em> p... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59941/"
] | I am trying to implement a master details solution using the jQuery Tabs. Two tabs, first tab contains Northwind Customers, selecting customer command should display tab2 with the orders for the customer.
So far, I have come to the conclusion that it cannot be done without using some sort of Ajax. **Am I correct?**
I... | Its definately doable using jQuery and AJAX and could be very nice, it will take some significant work, since you can't really use the GridView (unless you use an UpdatePanel). What you can do is set the selected tab after postback. There is an option on the tab control
```
$('#tabs').tabs({selected:1});
```
or
`... |
509,292 | <p>I would like to display some extra UI elements when the process is being run as Administrator as opposed to when it isn't, similar to how Visual Studio 2008 displays 'Administrator' in its title bar when running as admin. How can I tell?</p>
| [
{
"answer_id": 509400,
"author": "casperOne",
"author_id": 50776,
"author_profile": "https://Stackoverflow.com/users/50776",
"pm_score": 6,
"selected": true,
"text": "<p>Technically, if you want to see if the member is the local administrator <em>account</em>, then you can get the <a hre... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509292",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16942/"
] | I would like to display some extra UI elements when the process is being run as Administrator as opposed to when it isn't, similar to how Visual Studio 2008 displays 'Administrator' in its title bar when running as admin. How can I tell? | Technically, if you want to see if the member is the local administrator *account*, then you can get the [security identifier (SID)](http://en.wikipedia.org/wiki/Security_Identifier) of the current user through the [`User` property](http://msdn.microsoft.com/en-us/library/system.security.principal.windowsidentity.user.... |
509,304 | <p>I have a regex where the variable <code>$m_strFirstName</code> is next to other identifier characters that aren't part of the variable name:</p>
<pre><code>if($strWholeName =~ m/$m_strFirstName_(+)/)
....
</code></pre>
<p>I'm trying to extract something like:</p>
<ul>
<li>strWholeName is 'bob_jones' or 'bob_smit... | [
{
"answer_id": 509337,
"author": "Josh Kelley",
"author_id": 25507,
"author_profile": "https://Stackoverflow.com/users/25507",
"pm_score": 4,
"selected": true,
"text": "<p>Put braces around your variable name:</p>\n\n<pre><code>if($strname =~ m/${m_strName}_(.+)/)\n</code></pre>\n"
},
... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509304",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29505/"
] | I have a regex where the variable `$m_strFirstName` is next to other identifier characters that aren't part of the variable name:
```
if($strWholeName =~ m/$m_strFirstName_(+)/)
....
```
I'm trying to extract something like:
* strWholeName is 'bob\_jones' or 'bob\_smith'
* m\_strFirstName is 'bob'
* and I want the... | Put braces around your variable name:
```
if($strname =~ m/${m_strName}_(.+)/)
``` |
509,305 | <p>Is there a built in object that handles 3 linked values in a similar fashion to the hashtable? i.e. Key, Value1, Value2?</p>
| [
{
"answer_id": 509322,
"author": "Mike_G",
"author_id": 52051,
"author_profile": "https://Stackoverflow.com/users/52051",
"pm_score": 2,
"selected": false,
"text": "<p>You could easily make one using a generic dictionary. Something like <code>Dictionary<Key, KeyValuePair<Key, Valu... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40650/"
] | Is there a built in object that handles 3 linked values in a similar fashion to the hashtable? i.e. Key, Value1, Value2? | I would have said generic dictionary too.
If you didn't want to do anything extensive, just make a struct or some sort of tuple out of Value1, Value2 and make those the value of your dictionary's Key. Something like:
```
Dictionary<Key, ThatTinyStructYouHadToCreate>
```
Bad idea: If you didn't like that option, as... |
509,318 | <p>i use the command line in windows to compile and then execute my java programs. i've gone to <a href="http://java.sun.com/docs/books/tutorial/uiswing/start/compile.html" rel="noreferrer">http://java.sun.com/docs/books/tutorial/uiswing/start/compile.html</a> and tried compiling the HelloWorldSwing.java class. it work... | [
{
"answer_id": 509330,
"author": "OscarRyz",
"author_id": 20654,
"author_profile": "https://Stackoverflow.com/users/20654",
"pm_score": 2,
"selected": false,
"text": "<p>Try this:</p>\n\n<blockquote>\n <p><em>java HelloWorldSwing</em></p>\n</blockquote>\n\n<p>Rather than:</p>\n\n<blockq... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | i use the command line in windows to compile and then execute my java programs. i've gone to <http://java.sun.com/docs/books/tutorial/uiswing/start/compile.html> and tried compiling the HelloWorldSwing.java class. it worked, but when i try "java HelloWorldSwing" it gives me a bunch of erros and says something along the... | Yep. That page has a slight bug:
The class uses a package, but in the run instructions the package is not used
You can do two things:
a) Drop the package name (delete the line `pacakge start;`) and run as indicated
Or
b) Leave the `package start;` line in the code and append the `-d` option to `javac` and use the... |
509,352 | <p>I can't find the Html.Image method in new MVC RC version. Please somebody give me example how to render simple Image in ASP .NET MVC RC sites.</p>
| [
{
"answer_id": 509361,
"author": "Kevin Pang",
"author_id": 1574,
"author_profile": "https://Stackoverflow.com/users/1574",
"pm_score": 2,
"selected": false,
"text": "<p>What's wrong with pure HTML?</p>\n\n<pre><code><img src=\"\" alt=\"\" />\n</code></pre>\n\n<p>You could use the ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509352",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59528/"
] | I can't find the Html.Image method in new MVC RC version. Please somebody give me example how to render simple Image in ASP .NET MVC RC sites. | Need to write your own or use the Url.Content() method to set the source attribute. Or you can use mine. :-)
```
public static class HtmlHelperExtensions
{
public static string Image( this HtmlHelper helper,
string url,
string altText,
... |
509,360 | <p>I'm trying to test this out on my site but it doesn't quite work because I have to be logged in to go to this page.</p>
<p>Is there a configuration setting that I haven't set or set incorrectly? </p>
<p>EDIT: rm's answer led me to this <a href="http://msdn.microsoft.com/en-us/library/ms178335.aspx" rel="nofollow ... | [
{
"answer_id": 509370,
"author": "Arjan Einbu",
"author_id": 19594,
"author_profile": "https://Stackoverflow.com/users/19594",
"pm_score": 1,
"selected": false,
"text": "<p>I'm guessing that the page containing the PasswordRecovery control is in a accesscontrolled folder.</p>\n\n<p>So wh... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509360",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4068/"
] | I'm trying to test this out on my site but it doesn't quite work because I have to be logged in to go to this page.
Is there a configuration setting that I haven't set or set incorrectly?
EDIT: rm's answer led me to this [link from Microsoft](http://msdn.microsoft.com/en-us/library/ms178335.aspx). | adding to Arjan's answer, the settings for page permissions are in your web.config file.
you should do something like this:
```
<configuration>
<location path="YourPage.aspx">
<system.web>
<authorization>
<allow users="?"/>
</authorization>
</system.web>
</location>
</c... |
509,391 | <p>I just discovered, quite by accident, that this seems to work:</p>
<pre><code>Public Interface Ix
ReadOnly Property TestProp()
End Interface
Public Interface Iy
Property TestProp()
End Interface
Public Sub TestSub
Dim x As Ix = Me.InstantiationNotImportant()
Dim y As Iy = CType(x, Iy)
End Sub
</co... | [
{
"answer_id": 509497,
"author": "mati",
"author_id": 58128,
"author_profile": "https://Stackoverflow.com/users/58128",
"pm_score": 0,
"selected": false,
"text": "<p>You should check <a href=\"http://www.tecnick.com/public/code/cp_dpage.php?aiocp_dp=tcpdf\" rel=\"nofollow noreferrer\">TC... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509391",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16082/"
] | I just discovered, quite by accident, that this seems to work:
```
Public Interface Ix
ReadOnly Property TestProp()
End Interface
Public Interface Iy
Property TestProp()
End Interface
Public Sub TestSub
Dim x As Ix = Me.InstantiationNotImportant()
Dim y As Iy = CType(x, Iy)
End Sub
```
Maybe I've w... | That seems like something that would require nothing short of the Adobe PDF SDK / libraries. I have worked with them quite bit, but I have never attempted to change the resolution of an existing PDF. The libraries are pricey so it's likely that is not an option for you.
I want to say that Perl's PDF::API2 has an optim... |
509,393 | <pre><code>SELECT i.*, i.id IN (
SELECT id
FROM w
WHERE w.status='active') AS wish
FROM i
INNER JOIN r ON i.id=r.id
WHERE r.member_id=1 && r.status='active'
ORDER BY wish DESC
LIMIT 0,50
</code></pre>
<p>That's a query that I'm trying to run. It doesn't scale well, and I'm wondering if someone here ... | [
{
"answer_id": 509426,
"author": "dkretz",
"author_id": 31641,
"author_profile": "https://Stackoverflow.com/users/31641",
"pm_score": 1,
"selected": false,
"text": "<p>Please post the EXPLAIN listing. And explain what the tables and columns mean.</p>\n\n<p>wish appears to be a boolean - ... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509393",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20820/"
] | ```
SELECT i.*, i.id IN (
SELECT id
FROM w
WHERE w.status='active') AS wish
FROM i
INNER JOIN r ON i.id=r.id
WHERE r.member_id=1 && r.status='active'
ORDER BY wish DESC
LIMIT 0,50
```
That's a query that I'm trying to run. It doesn't scale well, and I'm wondering if someone here can tell me where I could im... | `WHERE x IN ()` is identical to an `INNER JOIN` to a `SELECT DISTINCT` subquery, and in general, a join to a subquery will typically perform better if the optimizer doesn't turn the `IN` into a `JOIN` - which it should:
```
SELECT i.*
FROM i
INNER JOIN (
SELECT DISTINCT id
FROM w
WHERE w.status = 'active'... |
509,421 | <p>What's the reason of passing a value for a self reference in class functions in python? For instance:</p>
<pre><code>class MyClass:
"""A simple example class"""
i = 12345
def f(**self**):
return 'hello world'
</code></pre>
<p>By doing this, aren't you doing the compiler's work?</p>
| [
{
"answer_id": 509442,
"author": "Hank Gay",
"author_id": 4203,
"author_profile": "https://Stackoverflow.com/users/4203",
"pm_score": 2,
"selected": false,
"text": "<p>Guido says: <a href=\"http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html\" rel=\"nofollow norefe... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509421",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51816/"
] | What's the reason of passing a value for a self reference in class functions in python? For instance:
```
class MyClass:
"""A simple example class"""
i = 12345
def f(**self**):
return 'hello world'
```
By doing this, aren't you doing the compiler's work? | Many electrons have given their lives to discussing this question over the years.
Guido (python's creator) weighs forth on the issue in his blog [here](http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html), in response to a [proposal](http://www.blueskyonmars.com/2008/10/28/python-without-explici... |
509,427 | <p><strong>Question:</strong> I have a question that is <a href="https://stackoverflow.com/questions/342969">apparently not answered by this already-asked Bash completion question</a> on Stack Overflow. The question is, how to get Bash alias completion (for any alias) on a partial substring.</p>
<p><strong>Example:</s... | [
{
"answer_id": 513202,
"author": "Davide",
"author_id": 25891,
"author_profile": "https://Stackoverflow.com/users/25891",
"pm_score": 1,
"selected": false,
"text": "<p>Probably you can achieve what you want with custom bash_completion settings, but I'm not going to do the job for you, ok... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509427",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42223/"
] | **Question:** I have a question that is [apparently not answered by this already-asked Bash completion question](https://stackoverflow.com/questions/342969) on Stack Overflow. The question is, how to get Bash alias completion (for any alias) on a partial substring.
**Example:**
For example, assume I have the following... | You can generate the matches for a specified substring with `compgen -c -X'!*substring*'`
To include this in bash autocompletion you can create a .bash\_completion file in your home directory containing something like this:
```
_comp() {
local cur
cur=${COMP_WORDS[$COMP_CWORD]}
COMPREPLY=( $( compgen -c... |
509,435 | <p>We're using Flex 3 to consume a .NET Web Service. The web service uses an enum and we use Flex Builder to automatically generate the web service objects. Here is the .NET web service enum definition:</p>
<pre><code> /// <summary>
/// User type
/// </summary>
public enum UserTypeEnum
{
... | [
{
"answer_id": 509453,
"author": "Scott Evernden",
"author_id": 11397,
"author_profile": "https://Stackoverflow.com/users/11397",
"pm_score": 0,
"selected": false,
"text": "<p><a href=\"http://www.google.com/search?hl=en&safe=off&rlz=1T4HPIA_en&q=+site:bugs.adobe.com+FLEX+wsd... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509435",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5592/"
] | We're using Flex 3 to consume a .NET Web Service. The web service uses an enum and we use Flex Builder to automatically generate the web service objects. Here is the .NET web service enum definition:
```
/// <summary>
/// User type
/// </summary>
public enum UserTypeEnum
{
Admin = 1,
User = ... | Be aware that there are issues with enumerations and web services.
See this [question](https://stackoverflow.com/questions/505617/flags-with-web-services/505628#505628).
* Should be using [Serializable,Flags] in web service.
* Flags should be multiples of two
* The enumeration definition should start from 1 rather th... |
509,446 | <p>Would this work on all platforms? i know windows does \r\n, and remember hearing mac does \r while linux did \n. I ran this code on windows so it seems fine, but do any of you know if its cross platform?</p>
<pre><code>while 1:
line = f.readline()
if line == "":
break
line = line[:-1]
print ... | [
{
"answer_id": 509482,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 5,
"selected": true,
"text": "<p>First of all, there is <a href=\"https://www.python.org/dev/peps/pep-0278/\" rel=\"nofollow noreferrer\">universal newline s... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509446",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Would this work on all platforms? i know windows does \r\n, and remember hearing mac does \r while linux did \n. I ran this code on windows so it seems fine, but do any of you know if its cross platform?
```
while 1:
line = f.readline()
if line == "":
break
line = line[:-1]
print "\"" + line + ... | First of all, there is [universal newline support](https://www.python.org/dev/peps/pep-0278/)
Second: just use `line.strip()`. Use `line.rstrip('\r\n')`, if you want to preserve any whitespace at the beginning or end of the line.
Oh, and
```
print '"%s"' % line
```
or at least
```
print '"' + line + '"'
```
mig... |
509,455 | <p>Suppose I define a configuration section in an ASP.NET web.config like:</p>
<pre><code><?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web">
<section name="MySettings" type="MyCompany.MyProject.Configuration.MySettings" allowLocation="true" al... | [
{
"answer_id": 511984,
"author": "Daniel",
"author_id": 47225,
"author_profile": "https://Stackoverflow.com/users/47225",
"pm_score": 4,
"selected": true,
"text": "<p>I'm pretty sure it is possible, since some built-in sections, like WCF and membership, do this with no error. Does OnDes... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509455",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61675/"
] | Suppose I define a configuration section in an ASP.NET web.config like:
```
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web">
<section name="MySettings" type="MyCompany.MyProject.Configuration.MySettings" allowLocation="true" allowDefinition="Everywhere" restartOnExter... | I'm pretty sure it is possible, since some built-in sections, like WCF and membership, do this with no error. Does OnDeserializeUnrecognizedAttribute do what you need?
```
protected override bool OnDeserializeUnrecognizedAttribute(string name, string value){
//don't call base to avoid error
}
``` |
509,463 | <p>I'm attempting to access member variables in a child class via the parent class without instantiation.</p>
<p>This is one of my attempts but <code>B::getStatic()</code> fails with <code>Access to undeclared static property</code>.</p>
<p>Is there another solution to this, possibly without static?</p>
<pre><code>c... | [
{
"answer_id": 509475,
"author": "mdm",
"author_id": 25318,
"author_profile": "https://Stackoverflow.com/users/25318",
"pm_score": -1,
"selected": false,
"text": "<p><code>$myStatic</code> must be declared static in class A: See <a href=\"http://de2.php.net/language.oop5.static\" rel=\"n... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509463",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11125/"
] | I'm attempting to access member variables in a child class via the parent class without instantiation.
This is one of my attempts but `B::getStatic()` fails with `Access to undeclared static property`.
Is there another solution to this, possibly without static?
```
class A {
static public function getStatic() {... | The concept you're running into is called "Late Static Binding." Until PHP 5.3.0, there was no support for this.
If you're running 5.3.0 or higher, update the getStatic() method:
>
> static public function getStatic() {
>
>
>
> ```
> return static::$myStatic;
>
> ```
>
> }
>
>
> |
509,493 | <p>I'm on Ubuntu Intrepid and I'm using jpeglib62 6b-14. I was working on some code, which only gave a black screen with some garbled output at the top when I tried to run it. After a few hours of debugging I got it down to pretty much the JPEG base, so I took the example code, wrote a little piece of code around it an... | [
{
"answer_id": 509540,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 3,
"selected": true,
"text": "<p>You're reading a JPEG file into memory (without decompressing it) and writing out that buffer as if it were uncompress... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509493",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13104/"
] | I'm on Ubuntu Intrepid and I'm using jpeglib62 6b-14. I was working on some code, which only gave a black screen with some garbled output at the top when I tried to run it. After a few hours of debugging I got it down to pretty much the JPEG base, so I took the example code, wrote a little piece of code around it and t... | You're reading a JPEG file into memory (without decompressing it) and writing out that buffer as if it were uncompressed, that's why you're getting garbage. You need to decompress the image first before you can feed it into the JPEG compressor.
In other words, the JPEG compressor assumes that its input is raw pixels.
... |
509,498 | <p>Is </p>
<pre><code>OutputDebugString(PAnsiChar(''));
</code></pre>
<p>thread safe?</p>
<p>I/we have been using it in threads for debugging, and it never occurred to me if I should be doing it a different way.</p>
<p>(Delphi 7)</p>
| [
{
"answer_id": 509502,
"author": "Lieven Keersmaekers",
"author_id": 52598,
"author_profile": "https://Stackoverflow.com/users/52598",
"pm_score": 5,
"selected": true,
"text": "<p>Don't worry, it is.</p>\n\n<blockquote>\n <p>When OutputDebugString() is called by an application, it takes... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509498",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11016/"
] | Is
```
OutputDebugString(PAnsiChar(''));
```
thread safe?
I/we have been using it in threads for debugging, and it never occurred to me if I should be doing it a different way.
(Delphi 7) | Don't worry, it is.
>
> When OutputDebugString() is called by an application, it takes these
> steps. Note that a failure at any point abandons the whole thing and
> treats the debugging request as a no-op (the string isn't sent
> anywhere).
>
>
> 1. Open DBWinMutex and wait until we have exclusive access to it.... |
509,504 | <p>I have a relation mapping table like this:</p>
<p>attributeid bigint<br>
productid bigint</p>
<p>To clean relations that are not used any more, I want to delete all recors where productid = x and attributeid not in (@includedIds), like the following example:</p>
<pre><code>@attributetypeid bigint,
@productid big... | [
{
"answer_id": 509513,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 1,
"selected": false,
"text": "<p>Joel Spolsky answered a very similar question here: <a href=\"https://stackoverflow.com/questions/337704/parameterizing-a-sql-i... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509504",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2972/"
] | I have a relation mapping table like this:
attributeid bigint
productid bigint
To clean relations that are not used any more, I want to delete all recors where productid = x and attributeid not in (@includedIds), like the following example:
```
@attributetypeid bigint,
@productid bigint,
@includedids varchar(MAX... | ```
SET QUOTED_IDENTIFIER ON
GO
CREATE FUNCTION [dbo].[ListToTable] (
/*
FUNCTION ListToTable
Usage: select entry from listtotable('abc,def,ghi') order by entry desc
PURPOSE: Takes a comma-delimited list as a parameter and returns the values of that list into a table variable.
*/
@mylist varchar(8000)... |
509,514 | <p>I'm not certain that this is the right venue for this question, but a programmer friend of mine said I should try this here.</p>
<p>My company's main application is hosted on a terminal server running Windows Server 2008. Since last Thursday we have seen this server crash and reboot 3 times, and we just went live ... | [
{
"answer_id": 509512,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 9,
"selected": true,
"text": "<p>Found it via MSDN forums almost immediately after posting :)</p>\n\n<p>You can use a <a href=\"http://msdn.microso... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509514",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62188/"
] | I'm not certain that this is the right venue for this question, but a programmer friend of mine said I should try this here.
My company's main application is hosted on a terminal server running Windows Server 2008. Since last Thursday we have seen this server crash and reboot 3 times, and we just went live with this s... | Found it via MSDN forums almost immediately after posting :)
You can use a [`ToolStripLabel`](http://msdn.microsoft.com/en-us/library/system.windows.forms.toolstripstatuslabel.aspx) to pseudo right align controls by setting the `Text` property to `string.Empty` and setting the `Spring` property to `true`. This will ca... |
509,529 | <p>I have attempted to use this CSS to set the width of my form elements:</p>
<pre><code>input[type="text"], textarea { width:250px; }
</code></pre>
<p>If you look at this Firefox screenshot you'll see that the fields are not the same width. I get a similar effect in Safari.</p>
<p><a href="http://screamingv.com/ss.... | [
{
"answer_id": 509558,
"author": "heeen",
"author_id": 38893,
"author_profile": "https://Stackoverflow.com/users/38893",
"pm_score": 1,
"selected": false,
"text": "<p>Maybe you have a user specific css overlay defined somewhere in your browser, because i just tested it and it works as ex... | 2009/02/03 | [
"https://Stackoverflow.com/questions/509529",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/74552/"
] | I have attempted to use this CSS to set the width of my form elements:
```
input[type="text"], textarea { width:250px; }
```
If you look at this Firefox screenshot you'll see that the fields are not the same width. I get a similar effect in Safari.
[alt text http://screamingv.com/ss.png](http://screamingv.com/ss.pn... | Try removing padding and borders. Or try making them the same for both elements
```
input[type="text"],
textarea {
width:250px;
padding: 3px;
border: none;
}
```
Or:
```
input[type="text"],
textarea {
width:250px;
padding: 0;
border: 1px solid #ccc;
}
```
INPUT and TEXTAREA element... |
509,541 | <p>I was refactoring some code, and part of it included moving it from VB.Net to C#.</p>
<p>The old code declared a member like this:</p>
<pre><code>Protected viewMode As New WebControl
</code></pre>
<p>The new code, I eventually got working, like this:</p>
<pre><code>protected WebControl _viewMode = new WebControl... | [
{
"answer_id": 509549,
"author": "Rex M",
"author_id": 67,
"author_profile": "https://Stackoverflow.com/users/67",
"pm_score": 2,
"selected": false,
"text": "<p>The default constructor for WebControl (implicit in the VB line) is to use a span. You can call that constructor in c# as well ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509541",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8435/"
] | I was refactoring some code, and part of it included moving it from VB.Net to C#.
The old code declared a member like this:
```
Protected viewMode As New WebControl
```
The new code, I eventually got working, like this:
```
protected WebControl _viewMode = new WebControl(HtmlTextWriterTag.Span);
```
I can presum... | The reason this worked in VB, and not in C#, had nothing to do with assemblies.
The default constructor for WebControl is protected.
VB and C# have different interpretations of what "protected" means.
In VB, you can access a protected member of a class from any method in any type that derives from the class.
That i... |
509,576 | <p>Suppose I have a filehandle <code>$fh</code>. I can check its existence with <code>-e $fh</code> or its file size with <code>-s $fh</code> or <a href="http://perldoc.perl.org/functions/-X.html" rel="noreferrer" title="Perl -X operands">a slew of additional information about the file</a>. How can I get its last mod... | [
{
"answer_id": 509600,
"author": "Michael Carman",
"author_id": 8233,
"author_profile": "https://Stackoverflow.com/users/8233",
"pm_score": 5,
"selected": false,
"text": "<p>Use the builtin <a href=\"http://perldoc.perl.org/functions/stat.html\" rel=\"noreferrer\">stat</a> function. Or m... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509576",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6406/"
] | Suppose I have a filehandle `$fh`. I can check its existence with `-e $fh` or its file size with `-s $fh` or [a slew of additional information about the file](http://perldoc.perl.org/functions/-X.html "Perl -X operands"). How can I get its last modified time stamp? | Calling the built-in function `stat($fh)` returns an array with the following information about the file handle passed in (from the [perlfunc man page for `stat`](http://www.perl.com/doc/manual/html/pod/perlfunc/stat.html)):
```
0 dev device number of filesystem
1 ino inode number
2 mode file mode ... |
509,578 | <p>I have a table with say 1640 items. I set</p>
<pre><code>bindingSource.Filter = "some filter query string";
</code></pre>
<p>and most of the rows disappear, leaving, say, 400 rows. I'd like to be able to tell the user "Showing 400 of 1640 items" as they click some textboxes which change the filter string and hence... | [
{
"answer_id": 509693,
"author": "Picflight",
"author_id": 59941,
"author_profile": "https://Stackoverflow.com/users/59941",
"pm_score": -1,
"selected": true,
"text": "<p>How about adding the filtered items in a separate DataTable and doing a count on that for the filtered items.</p>\n"
... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509578",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2543/"
] | I have a table with say 1640 items. I set
```
bindingSource.Filter = "some filter query string";
```
and most of the rows disappear, leaving, say, 400 rows. I'd like to be able to tell the user "Showing 400 of 1640 items" as they click some textboxes which change the filter string and hence which rows are visible in... | How about adding the filtered items in a separate DataTable and doing a count on that for the filtered items. |
509,579 | <p>So I was playing around the other day just to see exactly how mass assignment works in JavaScript.</p>
<p>First I tried this example in the console:</p>
<pre><code>a = b = {};
a.foo = 'bar';
console.log(b.foo);
</code></pre>
<p>The result was "bar" being displayed in an alert. That is fair enough, <code>a</code> ... | [
{
"answer_id": 509599,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 2,
"selected": false,
"text": "<p>You're more or less correct except that what you're referring to as a \"hash\" is actually just shorthand syntax for an O... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509579",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42413/"
] | So I was playing around the other day just to see exactly how mass assignment works in JavaScript.
First I tried this example in the console:
```
a = b = {};
a.foo = 'bar';
console.log(b.foo);
```
The result was "bar" being displayed in an alert. That is fair enough, `a` and `b` are really just aliases to the same ... | In the first example, you are setting a property of an existing object. In the second example, you are assigning a brand new object.
```
a = b = {};
```
`a` and `b` are now pointers to the same object. So when you do:
```
a.foo = 'bar';
```
It sets `b.foo` as well since `a` and `b` point to the same object.
*How... |
509,642 | <p>My compiler (VC++ 6.0 sp6) has apparently gone insane. In certain pieces of code I'm seeing that '<code>bool mybool = true;</code>' evalutes to and assigns false, and vice versa for true. Changing the true/false keywords to 1/0 makes it work fine. The same code compiles elsewhere fine without changing the true/fa... | [
{
"answer_id": 509650,
"author": "Logan Capaldo",
"author_id": 61289,
"author_profile": "https://Stackoverflow.com/users/61289",
"pm_score": 5,
"selected": true,
"text": "<p>A preprocessor macro could certainly do it, although that would be pretty surprising. One way to check if that is ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509642",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16161/"
] | My compiler (VC++ 6.0 sp6) has apparently gone insane. In certain pieces of code I'm seeing that '`bool mybool = true;`' evalutes to and assigns false, and vice versa for true. Changing the true/false keywords to 1/0 makes it work fine. The same code compiles elsewhere fine without changing the true/false keywords.
Wh... | A preprocessor macro could certainly do it, although that would be pretty surprising. One way to check if that is the case would be
```
#ifdef true
# error "true is defined as a macro"
#endif
#ifdef false
# error "false is defined as a macro"
#endif
```
Response to comments:
Find a non-header file where you see t... |
509,690 | <p>I would like to list the matches, when I hit:</p>
<pre><code>/example
</code></pre>
<p>so that I see where all matches are at once.</p>
| [
{
"answer_id": 509699,
"author": "Kevin",
"author_id": 26620,
"author_profile": "https://Stackoverflow.com/users/26620",
"pm_score": 3,
"selected": false,
"text": "<p>Using <code>:set hlsearch</code> will highlight all the matches in yellow allowing you to scan the file easily for matche... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509690",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54964/"
] | I would like to list the matches, when I hit:
```
/example
```
so that I see where all matches are at once. | ```
" put in your ~/.vimrc file
" START search related configs and helps
"
" ignore case when searching
set ignorecase
" search as characters are entered, as you type in more characters, the search is refined
set incsearch
" highlight matches, in normal mode try typing * or even g* whe... |
509,710 | <p>The python 2.6 docs state that <code>x % y</code> is defined as the remainder of x / y (<a href="http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex" rel="nofollow noreferrer">http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex</a>). I am not clear on what ... | [
{
"answer_id": 509721,
"author": "codelogic",
"author_id": 43427,
"author_profile": "https://Stackoverflow.com/users/43427",
"pm_score": 3,
"selected": false,
"text": "<p>Modulo is performed in the integer context, not fractional (remainders are integers). Therefore:</p>\n\n<pre><code>1 ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509710",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4593/"
] | The python 2.6 docs state that `x % y` is defined as the remainder of x / y (<http://docs.python.org/library/stdtypes.html#numeric-types-int-float-long-complex>). I am not clear on what is really occurring though, as:
```
for i in range(2, 11):
print 1.0 % i
```
prints "1.0" ten times, rather than "0.5, 0.333333... | I think you can get the result you want by doing something like this:
```
for i in range(2, 11):
print 1.0*(1 % i) / i
```
This computes the (integer) remainder as explained by others. Then you divide by the denominator again, to produce the fractional part of the quotient.
Note that I multiply the result of th... |
509,711 | <p>I've got a table cell that I would always like to be a particular width. However, it doesn't work with large strings of unspaced text. Here's a test case:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="false" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css l... | [
{
"answer_id": 509715,
"author": "cletus",
"author_id": 18393,
"author_profile": "https://Stackoverflow.com/users/18393",
"pm_score": 3,
"selected": false,
"text": "<p>Well here is a solution for you but I don't really understand why it works:</p>\n\n<pre><code><html><body>\n... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509711",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/91385/"
] | I've got a table cell that I would always like to be a particular width. However, it doesn't work with large strings of unspaced text. Here's a test case:
```css
td {
border: solid green 1px;
width: 200px;
overflow: hidden;
}
```
```html
<table>
<tbody>
<tr>
<td>
This_is_a_terrible_e... | Here is the [same problem](https://stackoverflow.com/questions/480722/how-can-i-set-a-td-width-to-visually-truncate-its-displayed-contents).
You need to set `table-layout:fixed` *and* a suitable width on the table element, as well as `overflow:hidden` and `white-space: nowrap` on the table cells.
---
Examples
------... |
509,723 | <p>Our ASP.NET/C# lets users edit and manage Word (OpenXML) documents that are hosted on a server. I am using client-side <code>VBScript</code> functions to handle some of the editing functions including saving the document to a folder on the server. For the save functionality, I am using the following function call :<... | [
{
"answer_id": 509765,
"author": "davogones",
"author_id": 59631,
"author_profile": "https://Stackoverflow.com/users/59631",
"pm_score": 0,
"selected": false,
"text": "<p>Just a guess... if the vbscript is running on the client, the code is probably running under the user's account, not ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509723",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | Our ASP.NET/C# lets users edit and manage Word (OpenXML) documents that are hosted on a server. I am using client-side `VBScript` functions to handle some of the editing functions including saving the document to a folder on the server. For the save functionality, I am using the following function call :
```
Document.... | In my case, that error 5096 with description "EOALPHABETICARABICARABICABJADARABICALPHABAHTTEXTCAPSCARDTEXTCHARFORMATCHI"
occurred when using VBA code in Access to drive a Word mail-merge. The cause was trying to save a document with the same name (including path) as an open document.
Error line:
```
objApp.ActiveDocu... |
509,726 | <p>diff fails as the assembly listing is filled with slightly different labels.</p>
| [
{
"answer_id": 509751,
"author": "SoapBox",
"author_id": 36384,
"author_profile": "https://Stackoverflow.com/users/36384",
"pm_score": 0,
"selected": false,
"text": "<p>You could strip out the labels with a simple sed and replace them all with \"label\" or with spaces (and use \"diff -w\... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509726",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61342/"
] | diff fails as the assembly listing is filled with slightly different labels. | Instead of directly comparing the assembly listings produced by the `-S` option, you could instead compile down to object files, disassemble the object files, and then compare those. (Or, you could just do a straight out diff of the hexdump of the compiled object code, but that's much more painful). This gets rid of mo... |
509,728 | <p>I have been able to find methods like <code>-[NSString stringWithCString:encoding:]</code> but they do not seem to play well when the cstring is a pointer.</p>
| [
{
"answer_id": 509735,
"author": "Chuck",
"author_id": 50742,
"author_profile": "https://Stackoverflow.com/users/50742",
"pm_score": 4,
"selected": false,
"text": "<p><code>stringWithCString:encoding:</code> creates an NSString from a given C string. To create a C string from an NSString... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509728",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26659/"
] | I have been able to find methods like `-[NSString stringWithCString:encoding:]` but they do not seem to play well when the cstring is a pointer. | First up, don't use `initWithCString`, it has been deprecated.
Couple of ways you can do this:
```
const *char cString = "Hello";
NSString *myNSString = [NSString stringWithUTF8String:cString];
```
If you need another encoding like ASCII:
```
const *char cString = "Hello";
NSString *myNSString = [NSString stringWi... |
509,741 | <p>I've got a legacy database with a bunch of idiotically named columns like:</p>
<pre>some_field_c
some_other_field_c
a_third_field_c</pre>
<p>I would very much like to make a Rails ActiveRecord sub-class that automatically aliases these attributes to their name minus the underscore and "c". However, when I tried:<... | [
{
"answer_id": 509798,
"author": "Chuck",
"author_id": 50742,
"author_profile": "https://Stackoverflow.com/users/50742",
"pm_score": 3,
"selected": true,
"text": "<p>Your problem is probably that <code>attributes</code> is an instance method and you're doing this in the context of the cl... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5921/"
] | I've got a legacy database with a bunch of idiotically named columns like:
```
some_field_c
some_other_field_c
a_third_field_c
```
I would very much like to make a Rails ActiveRecord sub-class that automatically aliases these attributes to their name minus the underscore and "c". However, when I tried:
```
attribute... | Your problem is probably that `attributes` is an instance method and you're doing this in the context of the class. The class method that's closest to what you want is `column_names`. |
509,742 | <p>How do I change directory to the directory with my Python script in? So far, I figured out I should use <code>os.chdir</code> and <code>sys.argv[0]</code>. I'm sure there is a better way then to write my own function to parse argv[0].</p>
| [
{
"answer_id": 509754,
"author": "ayrnieu",
"author_id": 60190,
"author_profile": "https://Stackoverflow.com/users/60190",
"pm_score": 6,
"selected": true,
"text": "<pre><code>os.chdir(os.path.dirname(__file__))\n</code></pre>\n"
},
{
"answer_id": 509987,
"author": "Community... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How do I change directory to the directory with my Python script in? So far, I figured out I should use `os.chdir` and `sys.argv[0]`. I'm sure there is a better way then to write my own function to parse argv[0]. | ```
os.chdir(os.path.dirname(__file__))
``` |
509,749 | <p>I want to load a column in excel into a selectable dropdown menu using c#. I have access to the file, and can load the file in C#, but am not sure how to implement what I want. Suggestions? (I'm using Visual Studio 2008)</p>
| [
{
"answer_id": 509847,
"author": "Jack Ukleja",
"author_id": 61714,
"author_profile": "https://Stackoverflow.com/users/61714",
"pm_score": 1,
"selected": false,
"text": "<p>As far as I know you only have a couple of options:</p>\n\n<ul>\n<li><a href=\"http://msdn.microsoft.com/en-us/libr... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509749",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36545/"
] | I want to load a column in excel into a selectable dropdown menu using c#. I have access to the file, and can load the file in C#, but am not sure how to implement what I want. Suggestions? (I'm using Visual Studio 2008) | You could implement a PIA solution something like this (assuming 5 items in column "A" of the first worksheet):
```
using Excel = Microsoft.Office.Interop.Excel;
...
worksheet = workbook.Worksheets[1] as Excel.Worksheet;
Excel.Range range;
range = worksheet.get_Range("A1", "A5") as Excel.Range;
foreach (Excel.Range... |
509,759 | <p>Suppose I have the following (rather common) model</p>
<p>Client invokes web service request -> request added to server queue -> server invokes 3rd party app via web service -> 3rd party app notifies server that event processing is finished -> server notifies client that request is completed</p>
<p>What I am wonde... | [
{
"answer_id": 509781,
"author": "Lee Harold",
"author_id": 56091,
"author_profile": "https://Stackoverflow.com/users/56091",
"pm_score": 0,
"selected": false,
"text": "<p>Maybe <a href=\"https://web.archive.org/web/1/http://articles.techrepublic%2ecom%2ecom/5100-10878_11-6127542.html?ta... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509759",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56564/"
] | Suppose I have the following (rather common) model
Client invokes web service request -> request added to server queue -> server invokes 3rd party app via web service -> 3rd party app notifies server that event processing is finished -> server notifies client that request is completed
What I am wondering about is the... | You can certainly do this via reflection:
```
MyClass o = new MyClass();
MethodInfo method = o.GetType().GetMethod("UnknownMethod",
BindingFlags.Instance | BindingFlags.Public);
MyRetValue retValue = (MyRetValue)
method.Invoke(o, new object[] { "Arg1", 2, "Arg3" });
``` |
509,778 | <p>I am feeling surprised by the difference between two seemingly identical scripts. </p>
<p>first.ps1:</p>
<pre><code>"A"
if ($true) { "B" }
"C"
</code></pre>
<p>second.ps1:</p>
<pre><code>"A"
if ($true) { "B"
}
"C"
</code></pre>
<p>Now open a CMD window, and run these scripts like this:</p>
<p><PRE>
powe... | [
{
"answer_id": 509871,
"author": "zdan",
"author_id": 4304,
"author_profile": "https://Stackoverflow.com/users/4304",
"pm_score": 2,
"selected": false,
"text": "<p>Not sure why the redirection to input doesn't work, but if you just specify the script as an input argument to powershell, i... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509778",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5453/"
] | I am feeling surprised by the difference between two seemingly identical scripts.
first.ps1:
```
"A"
if ($true) { "B" }
"C"
```
second.ps1:
```
"A"
if ($true) { "B"
}
"C"
```
Now open a CMD window, and run these scripts like this:
```
powershell - < first.ps1
powershell - < second.ps1
```
first p... | This has to be a bug.
In the redirection under cmd.exe case, the function completes normally and correctly if the if and else blocks are individually all on one line:
```
$candidate = '.\foo.txt'
$current= '.\bar.txt'
"Comparison starts"
if ($(diff $(get-content $current) $(get-content $candidate)).length -gt 0){"Th... |
509,790 | <p>In my iPhone project, I've got a UIView where I implement the drawRect method:</p>
<pre><code>- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
</code></pre>
<p>Inside the method I do a whole bunch of drawing of lines, images and texts using this context. The problem is that... | [
{
"answer_id": 509877,
"author": "Ben Gottlieb",
"author_id": 6694,
"author_profile": "https://Stackoverflow.com/users/6694",
"pm_score": 5,
"selected": true,
"text": "<p>You might want to check out CGContextSaveGState(context) and CGContextRestoreGState(context). They will let you push ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6044/"
] | In my iPhone project, I've got a UIView where I implement the drawRect method:
```
- (void)drawRect:(CGRect)rect {
CGContextRef context = UIGraphicsGetCurrentContext();
```
Inside the method I do a whole bunch of drawing of lines, images and texts using this context. The problem is that when I re-use this view, ... | You might want to check out CGContextSaveGState(context) and CGContextRestoreGState(context). They will let you push and pop the current state of the context.
If your view is getting 'mangled', check your view's contentMode setting. |
509,803 | <p>I am using a Generic Class as a Response Data Contract. All is good and this is streamlining the design of my WCF service significantly.</p>
<p>Each request is given a standard response object with the following signature:</p>
<ul>
<li>Status (Enum)</li>
<li>Message (String)</li>
<li>Result (T)</li>
</ul>
<p>Bel... | [
{
"answer_id": 509885,
"author": "Andrew Harry",
"author_id": 30576,
"author_profile": "https://Stackoverflow.com/users/30576",
"pm_score": 6,
"selected": true,
"text": "<p>Ok found the <a href=\"http://codeidol.com/csharp/wcf/Data-Contracts/Generics/\" rel=\"noreferrer\">Answer</a></p>\... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30576/"
] | I am using a Generic Class as a Response Data Contract. All is good and this is streamlining the design of my WCF service significantly.
Each request is given a standard response object with the following signature:
* Status (Enum)
* Message (String)
* Result (T)
Below is the Response Class:
```
[DataContract]
... | Ok found the [Answer](http://codeidol.com/csharp/wcf/Data-Contracts/Generics/)
You can specify the Serialised version using the following syntax:
>
> [DataContract(Name = "MyClassOf{0}{1}")]
>
>
> class MyClass { }
>
>
>
So if I had a Class called Response which takes a Generic T parameter
I would use
>
> [D... |
509,808 | <p>One of the assignments in my algorithms class is to design an exhaustive search algorithm to solve the clique problem. That is, given a graph of size <em>n</em>, the algorithm is supposed to determine if there is a complete sub-graph of size <em>k</em>. I think I've gotten the answer, but I can't help but think it... | [
{
"answer_id": 509822,
"author": "Jason Baker",
"author_id": 2147,
"author_profile": "https://Stackoverflow.com/users/2147",
"pm_score": 0,
"selected": false,
"text": "<p>It's amazing what typing things down as a question will show you about what you've just written. This line:</p>\n\n<... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509808",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2147/"
] | One of the assignments in my algorithms class is to design an exhaustive search algorithm to solve the clique problem. That is, given a graph of size *n*, the algorithm is supposed to determine if there is a complete sub-graph of size *k*. I think I've gotten the answer, but I can't help but think it could be improved.... | Some comments:
* You only need to consider n-choose-k combinations of vertices, not all k-tuples (n^k of them).
* `connected(tuple)` doesn't look right. Don't you need to reset `unconnected` inside the loop?
* As the others have suggested, there are better ways of brute-forcing this. Consider the following recursive r... |
509,826 | <p>I am working on a project using Castle Active Record. I stumbled across the "Insert = true" attribute argument on the AR association today, but I couldnt workout what it actually does.</p>
<pre><code>[BelongsTo("UserId",Insert = true)]
public ARUser User {
get { return mUser; }
set { mUser = value; }
}
</code>... | [
{
"answer_id": 509857,
"author": "RKitson",
"author_id": 16947,
"author_profile": "https://Stackoverflow.com/users/16947",
"pm_score": 0,
"selected": false,
"text": "<p>From the <a href=\"http://www.castleproject.org/ActiveRecord/documentation/v1rc1/manual/attributedocs/Generated_Belongs... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509826",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11194/"
] | I am working on a project using Castle Active Record. I stumbled across the "Insert = true" attribute argument on the AR association today, but I couldnt workout what it actually does.
```
[BelongsTo("UserId",Insert = true)]
public ARUser User {
get { return mUser; }
set { mUser = value; }
}
```
Can someone give... | Yep, you'll find the Insert and Update property on a few AR attributes..
I had to do a little testing to make sure I understood the documentation.
Having both Update and Insert set to false indicates that the property will be readonly to your database access (with a public setter this could get confusing.)
```
[Prop... |
509,853 | <p>I've just started doing some PowerShell scripting, and I'm running into a problem testing variables for a value. I try to run everything with all warnings enabled, especially while I'm learning, in order to catch dumb mistakes. So, I'm using CTPV3 and setting strict mode on with "set-strictmode -version latest". But... | [
{
"answer_id": 509865,
"author": "rivy",
"author_id": 43774,
"author_profile": "https://Stackoverflow.com/users/43774",
"pm_score": 7,
"selected": true,
"text": "<p>You're really testing for two things here, existence and value. And the existence test is the one causing the warnings unde... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509853",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62129/"
] | I've just started doing some PowerShell scripting, and I'm running into a problem testing variables for a value. I try to run everything with all warnings enabled, especially while I'm learning, in order to catch dumb mistakes. So, I'm using CTPV3 and setting strict mode on with "set-strictmode -version latest". But I'... | You're really testing for two things here, existence and value. And the existence test is the one causing the warnings under the strict mode operation. So, separate the tests. Remembering that PowerShell sees variables as just another provider (just like a file or registry provider) and that all PowerShell variables ex... |
509,859 | <p>In Subversion, it is easy to merge a range of changesets/diffs from a branch using "svn merge -r a:b mybranch". But in git, I found it is only possible to cherry-pick a single commit from a branch to apply that patch to my current working branch. So I am wondering if there is a fast way to apply all the commits in o... | [
{
"answer_id": 509878,
"author": "Eduard - Gabriel Munteanu",
"author_id": 59655,
"author_profile": "https://Stackoverflow.com/users/59655",
"pm_score": 2,
"selected": false,
"text": "<p>As far as I know, you can't <em>git merge</em> this way. Merge is intended to join two branches which... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509859",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/54060/"
] | In Subversion, it is easy to merge a range of changesets/diffs from a branch using "svn merge -r a:b mybranch". But in git, I found it is only possible to cherry-pick a single commit from a branch to apply that patch to my current working branch. So I am wondering if there is a fast way to apply all the commits in one ... | The easiest way to perform the action that you are looking for is with `git rebase`. Here's a recipe. Assume that tag A is the commit on top of which the patch series that you want to select is based and that tag B is the commit of the final patch in the series. Also, assume that br is the name of the current branch an... |
509,863 | <p>I have a C++ library app which talks to a C++ server and I am creating a vector of my custom class objects. But my Cpp/CLI console app(which interacts with native C++ ), throws a memory violation error when I try to return my custom class obj vector.</p>
<p>Code Sample -</p>
<p>In my native C++ class -</p>
<pre><cod... | [
{
"answer_id": 509888,
"author": "Frederick The Fool",
"author_id": 32688,
"author_profile": "https://Stackoverflow.com/users/32688",
"pm_score": 0,
"selected": false,
"text": "<p>I'm not sure, but this may work: instead of returning a vector, create the vector on the heap and return a p... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509863",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/60477/"
] | I have a C++ library app which talks to a C++ server and I am creating a vector of my custom class objects. But my Cpp/CLI console app(which interacts with native C++ ), throws a memory violation error when I try to return my custom class obj vector.
Code Sample -
In my native C++ class -
```
std::vector<a> GetStuff... | I'll assume that the native code is in a separately compiled unit, like a .dll. First thing the worry about is the native code using a different allocator (new/delete), you'll get that when it is compiled with /MT or linked to another version of the CRT.
Next thing to worry about is STL iterator debugging. You should ... |
509,868 | <p>Instead of using <code>$this->fetchAll('email = ?',$email)->current()</code> inside the model class, is there a way to do <code>$this->fetchByEmail($email)</code> or <code>$this->findByEmail($email)</code> ?</p>
<p>There's already a magic method like this for <code>Zend_Log</code>, where instead of <cod... | [
{
"answer_id": 509921,
"author": "Noah Goodrich",
"author_id": 20178,
"author_profile": "https://Stackoverflow.com/users/20178",
"pm_score": 4,
"selected": true,
"text": "<p>For the particular functionality that you want, you'll need to build a custom function. Honestly, the logic behind... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62225/"
] | Instead of using `$this->fetchAll('email = ?',$email)->current()` inside the model class, is there a way to do `$this->fetchByEmail($email)` or `$this->findByEmail($email)` ?
There's already a magic method like this for `Zend_Log`, where instead of `$myLogger->log("Something went wrong",Zend_Log::CRIT)` you just write... | For the particular functionality that you want, you'll need to build a custom function. Honestly, the logic behind the magic \_\_call() function isn't all that difficult.
Something like this should do the trick:
```
public function __call($function, $args)
{
// Expects findBy to be the first part of the function... |
509,870 | <p>Right now I have a table called Campaigns that has many Hits, if I call say:</p>
<pre>Campaign.find(30).hits</pre>
<p>Which takes 4 seconds, or 4213 ms.
<br /><br />
If I call this instead:</p>
<pre>
campaign = Campaign.find(30)
campaign.hits.count
</pre>
<p>Does it still load all of the hits, then count? Or doe... | [
{
"answer_id": 509880,
"author": "Logan Capaldo",
"author_id": 61289,
"author_profile": "https://Stackoverflow.com/users/61289",
"pm_score": 1,
"selected": false,
"text": "<p>My ActiveRecord might be a little rusty, so forgive me if so, but IIRC <code>Campaign.find(30).hits</code> is at ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/59220/"
] | Right now I have a table called Campaigns that has many Hits, if I call say:
```
Campaign.find(30).hits
```
Which takes 4 seconds, or 4213 ms.
If I call this instead:
```
campaign = Campaign.find(30)
campaign.hits.count
```
Does it still load all of the hits, then count? Or does it see I am counting and avoids l... | How about:
```
Campaign.find(30).hits.count
```
You might also consider adding the following in `hit.rb` (assuming a one-to-many relationship between campaigns and hits).
```
belongs_to :campaign, :counter_cache => true
```
You then need a column in the `campaigns` table called `hits_count`. This will avoid hitti... |
509,910 | <p>I have a method in my business logic layer that accepts a stream, which in the GUI comes from a user uploading a file, and I am interested in which is an appropriate way to test that the method appropriately uses this stream to make decisions.</p>
<pre><code>public Sub Initialize(ByVal uploadStream As Stream)
'... | [
{
"answer_id": 509923,
"author": "AwesomeTown",
"author_id": 59397,
"author_profile": "https://Stackoverflow.com/users/59397",
"pm_score": 3,
"selected": true,
"text": "<p>If you just want a way to pass in a \"fake\" upload, you could construct a <a href=\"http://msdn.microsoft.com/en-us... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509910",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27765/"
] | I have a method in my business logic layer that accepts a stream, which in the GUI comes from a user uploading a file, and I am interested in which is an appropriate way to test that the method appropriately uses this stream to make decisions.
```
public Sub Initialize(ByVal uploadStream As Stream)
''// Logic usin... | If you just want a way to pass in a "fake" upload, you could construct a [MemoryStream](http://msdn.microsoft.com/en-us/library/system.io.memorystream.aspx) in your test harness and pass that in. |
509,917 | <p>Any recommendations or best practices for mapping a subdomain to a Wordpress page:</p>
<pre><code>http://my-page.mydomain.com -> http://mydomain.com/my-page
</code></pre>
<p>I don't want to do a redirect either, just keep the original subdomain URL until a different link is click, and then the subdomain is remo... | [
{
"answer_id": 509925,
"author": "IEnumerator",
"author_id": 34819,
"author_profile": "https://Stackoverflow.com/users/34819",
"pm_score": 0,
"selected": false,
"text": "<p>URL Rewriting. I would start <a href=\"http://httpd.apache.org/docs/2.0/misc/rewriteguide.html\" rel=\"nofollow nor... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509917",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/47110/"
] | Any recommendations or best practices for mapping a subdomain to a Wordpress page:
```
http://my-page.mydomain.com -> http://mydomain.com/my-page
```
I don't want to do a redirect either, just keep the original subdomain URL until a different link is click, and then the subdomain is removed.
I'm using Apache 2 with... | As already mentioned I would use mod\_rewrite to get this done. Something like the following should work in the my-page.mydomain.com virtual host
```
RewriteEngine on
RewriteRule (.*) http://mydomain.com/my-page$1 [P,L]
```
This will require you to enable mod\_proxy. Please read the security implications of doi... |
509,963 | <p>i have an input element, and i want bind both change and keypress event with the input, but event handling code is same for both the events. is there any short way of doing this instead of writing the same code twice. well, i could write a method, but wanted to see if there is any easier way of doing this</p>
<pre>... | [
{
"answer_id": 509969,
"author": "sunsean",
"author_id": 60785,
"author_profile": "https://Stackoverflow.com/users/60785",
"pm_score": 3,
"selected": false,
"text": "<p>You can save the function and bind it to both:</p>\n\n<pre><code>var fn = function(){ /*some code*/ };\n$(\"#inpt\").ch... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509963",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53055/"
] | i have an input element, and i want bind both change and keypress event with the input, but event handling code is same for both the events. is there any short way of doing this instead of writing the same code twice. well, i could write a method, but wanted to see if there is any easier way of doing this
```
$("#inpt... | You can use the jQuery on method.
```
$("#inpt").on( "change keypress", function () {
code
});
``` |
509,967 | <p>Specifically (taking a deep breath): How would you go about finding all the XML name spaces within a C#/.NET <code>XmlDocument</code> for which there are no applicable schemas in the instance's <code>XmlSchemaSet</code> (<code>Schemas</code> property)?</p>
<p>My XPath magic is lacking the sophistication to do somet... | [
{
"answer_id": 1216450,
"author": "Richard",
"author_id": 67392,
"author_profile": "https://Stackoverflow.com/users/67392",
"pm_score": 2,
"selected": true,
"text": "<p>You need to get a list of all the distinct namespaces in the document, and then compare that with the distinct namespac... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509967",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9642/"
] | Specifically (taking a deep breath): How would you go about finding all the XML name spaces within a C#/.NET `XmlDocument` for which there are no applicable schemas in the instance's `XmlSchemaSet` (`Schemas` property)?
My XPath magic is lacking the sophistication to do something like this, but I will keep looking in ... | You need to get a list of all the distinct namespaces in the document, and then compare that with the distinct namespaces in the schema set.
But namespace declaration names are typically not exposed in the XPath document model. But given a node you can get its namespace:
```
// Match every element and attribute in th... |
509,975 | <p>What library can you recommend to capture image from a webcam in .Net?</p>
| [
{
"answer_id": 1216450,
"author": "Richard",
"author_id": 67392,
"author_profile": "https://Stackoverflow.com/users/67392",
"pm_score": 2,
"selected": true,
"text": "<p>You need to get a list of all the distinct namespaces in the document, and then compare that with the distinct namespac... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26087/"
] | What library can you recommend to capture image from a webcam in .Net? | You need to get a list of all the distinct namespaces in the document, and then compare that with the distinct namespaces in the schema set.
But namespace declaration names are typically not exposed in the XPath document model. But given a node you can get its namespace:
```
// Match every element and attribute in th... |
509,978 | <p>What is the fastest way to execute a method on an ASP.NET website?</p>
<p>The scenario is pretty simple: I have a method which should be executed when a web page is hit. Nothing else is happening on the page, the only rendered output is a "done" message. I want the processing to be as fast as possible.</p>
<p>Ever... | [
{
"answer_id": 510001,
"author": "Daniel Schaffer",
"author_id": 2596,
"author_profile": "https://Stackoverflow.com/users/2596",
"pm_score": 6,
"selected": true,
"text": "<p>Depending on what you're doing, I wouldn't expect to see a lot of improvement over just using an HttpHandler. I'd ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509978",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10932/"
] | What is the fastest way to execute a method on an ASP.NET website?
The scenario is pretty simple: I have a method which should be executed when a web page is hit. Nothing else is happening on the page, the only rendered output is a "done" message. I want the processing to be as fast as possible.
Every single hit is u... | Depending on what you're doing, I wouldn't expect to see a lot of improvement over just using an HttpHandler. I'd start by just writing the HttpHandler and seeing how it performs. If you need it to be faster, try looking more closely at the things you're actually doing while processing the request and seeing what can b... |
509,989 | <p>Say you have an app, that you want to provide users ability to browse the system32 directory and execute programs in (like telnet).</p>
<p>What is the best method for supporting this when you need to support XP onwards as a client and 2k onwards for server?</p>
<p><em>Having written all this up I wonder if it's ju... | [
{
"answer_id": 513442,
"author": "Cat Zimmermann",
"author_id": 3431,
"author_profile": "https://Stackoverflow.com/users/3431",
"pm_score": 0,
"selected": false,
"text": "<p>Are you getting redirected to Windows/SysWoW64? I can launch 64-bit apps from Windows/System32 from an OpenFile i... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509989",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37558/"
] | Say you have an app, that you want to provide users ability to browse the system32 directory and execute programs in (like telnet).
What is the best method for supporting this when you need to support XP onwards as a client and 2k onwards for server?
*Having written all this up I wonder if it's just too much time/eff... | I've gone with option 2,
For those who might be interested; here is my quick hack at a scoped version of managing the disabling of Wow64 redirection based on notes from MS. Will redirect if the API is available, expects that kernel32.dll is already available.
```
class Wow64RedirectOff {
typedef BOOL (WINAPI *FN_W... |
509,994 | <p>In attempting to use scipy's quad method to integrate a gaussian (lets say there's a gaussian method named gauss), I was having problems passing needed parameters to gauss and leaving quad to do the integration over the correct variable. Does anyone have a good example of how to use quad w/ a multidimensional functi... | [
{
"answer_id": 510014,
"author": "James Thompson",
"author_id": 57458,
"author_profile": "https://Stackoverflow.com/users/57458",
"pm_score": 2,
"selected": false,
"text": "<p>Why not just always do your integration from -infinity to +infinity, so that you always know the answer? (joking... | 2009/02/04 | [
"https://Stackoverflow.com/questions/509994",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/51532/"
] | In attempting to use scipy's quad method to integrate a gaussian (lets say there's a gaussian method named gauss), I was having problems passing needed parameters to gauss and leaving quad to do the integration over the correct variable. Does anyone have a good example of how to use quad w/ a multidimensional function?... | Okay, you appear to be pretty confused about several things. Let's start at the beginning: you mentioned a "multidimensional function", but then go on to discuss the usual one-variable Gaussian curve. This is *not* a multidimensional function: when you integrate it, you only integrate one variable (x). The distinction ... |
510,012 | <p>Using standard mysql functions is there a way to write a query that will return a list of days between two dates.</p>
<p>eg given 2009-01-01 and 2009-01-13 it would return a one column table with the values:</p>
<pre><code> 2009-01-01
2009-01-02
2009-01-03
2009-01-04
2009-01-05
2009-01-06
2009-01-07
2009... | [
{
"answer_id": 510099,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 0,
"selected": false,
"text": "<p>Create a stored procedure which takes two parameters a_begin and a_end.\nCreate a temporary table within it called ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510012",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22888/"
] | Using standard mysql functions is there a way to write a query that will return a list of days between two dates.
eg given 2009-01-01 and 2009-01-13 it would return a one column table with the values:
```
2009-01-01
2009-01-02
2009-01-03
2009-01-04
2009-01-05
2009-01-06
2009-01-07
2009-01-08
2009-01-09
... | I would use this stored procedure to generate the intervals you need into the temp table named **time\_intervals**, then JOIN and aggregate your data table with the temp **time\_intervals** table.
The procedure can generate intervals of all the different types you see specified in it:
```
call make_intervals('2009-0... |
510,031 | <p>Are 'boolean' variables thread-safe for reading and writing from any thread? I've seen some newsgroup references to say that they are. Are any other data types available? (Enumerated types, short ints perhaps?)</p>
<p>It would be nice to have a list of all data types that can be safely read from any thread and a... | [
{
"answer_id": 510284,
"author": "Eugene Yokota",
"author_id": 3827,
"author_profile": "https://Stackoverflow.com/users/3827",
"pm_score": 2,
"selected": false,
"text": "<p>On 32-bit architecture, only properly aligned 32-bit or less data types should be considered atomic. 32-bit values ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510031",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/35696/"
] | Are 'boolean' variables thread-safe for reading and writing from any thread? I've seen some newsgroup references to say that they are. Are any other data types available? (Enumerated types, short ints perhaps?)
It would be nice to have a list of all data types that can be safely read from any thread and another list t... | Please note that you can make essentially everything in delphi unthreadsafe. While others mention alignment problems on boolean this in a way hides the real problem.
Yes, you can read a boolean in any thread and write to a boolean in any thread if it's correctly aligned. But reading from a boolean you change is not ne... |
510,068 | <p>Does anyone know how to make text align top-to-bottom in a div.</p>
<p>SO won't even let me demonstrate it . . . I just want the letters to stack on top of each other in a vertical line down the page like the stories of a building. Was hoping I didn't need to do it with an image.</p>
| [
{
"answer_id": 510079,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": -1,
"selected": false,
"text": "<p>Depending on your font size, adjust accordingly:</p>\n\n<pre><code><div style='width:12px'>a ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510068",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/61637/"
] | Does anyone know how to make text align top-to-bottom in a div.
SO won't even let me demonstrate it . . . I just want the letters to stack on top of each other in a vertical line down the page like the stories of a building. Was hoping I didn't need to do it with an image. | Having your text run along vertical lines WITHOUT HACKS
=======================================================
### `writing-mode`
[CSS `writing-mode` attribute](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode) lets your text run vertically.
```css
.traditional-vertical-writing
{
writing-mode: vertic... |
510,069 | <p>I am using WMI to query some properties disk drive. Does WMI read this information from the Drive itself or does it query the registry? How do I read the properties directly from the drive?</p>
| [
{
"answer_id": 510079,
"author": "Diodeus - James MacFarlane",
"author_id": 12579,
"author_profile": "https://Stackoverflow.com/users/12579",
"pm_score": -1,
"selected": false,
"text": "<p>Depending on your font size, adjust accordingly:</p>\n\n<pre><code><div style='width:12px'>a ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510069",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45603/"
] | I am using WMI to query some properties disk drive. Does WMI read this information from the Drive itself or does it query the registry? How do I read the properties directly from the drive? | Having your text run along vertical lines WITHOUT HACKS
=======================================================
### `writing-mode`
[CSS `writing-mode` attribute](https://developer.mozilla.org/en-US/docs/Web/CSS/writing-mode) lets your text run vertically.
```css
.traditional-vertical-writing
{
writing-mode: vertic... |
510,071 | <p>I am <a href="https://stackoverflow.com/questions/505040/developing-a-robocode-type-game-with-net-for-a-school-assignment">currently developing an application</a> in where a user will dynamically choose dlls and the application will execute some of the methods in that dll. (<em>if you follow the first link, you wil... | [
{
"answer_id": 510146,
"author": "BFree",
"author_id": 15861,
"author_profile": "https://Stackoverflow.com/users/15861",
"pm_score": 2,
"selected": false,
"text": "<p>What you're looking to do is basically running Assemblies in a separate Application Domain. Check out this page on MSDN f... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44084/"
] | I am [currently developing an application](https://stackoverflow.com/questions/505040/developing-a-robocode-type-game-with-net-for-a-school-assignment) in where a user will dynamically choose dlls and the application will execute some of the methods in that dll. (*if you follow the first link, you will see that I am de... | Normally, you might just live with
```
AppDomain newDomain = AppDomain.CreateDomain(name);
Assembly asm = newDomain.Load(System.IO.File.ReadAllBytes(name));
```
But one interesting point is, the AppDomain.Load method will load the assembly to the new app domain, *as well as to the current domain.*
A more elegant so... |
510,085 | <p>I am developing a program that use DirectShow to grab audio data from
media files. DirectShow use thread to pass audio data to the callback
function in my program, and I let that callback function call another
function in Python.</p>
<p>I use Boost.Python to wrapper my library, the callback function :</p>
<pre><co... | [
{
"answer_id": 510094,
"author": "Mr Fooz",
"author_id": 25050,
"author_profile": "https://Stackoverflow.com/users/25050",
"pm_score": 1,
"selected": false,
"text": "<p>Have the c++ callback place the data in a queue. Have the python code poll the queue to extract the data.</p>\n"
},
... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25077/"
] | I am developing a program that use DirectShow to grab audio data from
media files. DirectShow use thread to pass audio data to the callback
function in my program, and I let that callback function call another
function in Python.
I use Boost.Python to wrapper my library, the callback function :
```
class PythonCallba... | Take a look at PyGILState\_Ensure()/PyGILState\_Release(), from PEP 311
<http://www.python.org/dev/peps/pep-0311/>
Here is an example taken from the PEP itself:
```
void SomeCFunction(void)
{
/* ensure we hold the lock */
PyGILState_STATE state = PyGILState_Ensure();
/* Use the Python API */
...
/... |
510,093 | <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/1928853/why-isnt-the-richtextbox-displaying-this-table-properly">Why isn’t the richtextbox displaying this table properly?</a> </p>
</blockquote>
<p>We are having problems with the Windows.Forms.RichTextBox con... | [
{
"answer_id": 510130,
"author": "Mark Ransom",
"author_id": 5987,
"author_profile": "https://Stackoverflow.com/users/5987",
"pm_score": 0,
"selected": false,
"text": "<p>Wordpad is generally a very thin wrapper over the rich edit control, so if it appears properly there then Windows sho... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510093",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11163/"
] | >
> **Possible Duplicate:**
>
> [Why isn’t the richtextbox displaying this table properly?](https://stackoverflow.com/questions/1928853/why-isnt-the-richtextbox-displaying-this-table-properly)
>
>
>
We are having problems with the Windows.Forms.RichTextBox control in Visual Studio 2008.
We are trying to disp... | The Rich Text box from .NET is extremely buggy.
In RTF, the way a table is defined is actually quite different from what you could expect if you are used to HTML.
HTML:
```
<table>
<tr>
<td>Mycell</td>
</tr>
</table>
```
In RTF, a table is simply a series of paragraphs with control words defining rows, cells,... |
510,097 | <p>Anyone coming from ASP.NET (pre-MVC) has become accustomed to being able to give their controls whatever IDs they want. You can create a field called <code>Email</code> in an <code>.asmx</code> file, a field called <code>Email</code> in your main page, a field called <code>Email</code> in your master page, place mul... | [
{
"answer_id": 510105,
"author": "John Sheehan",
"author_id": 1786,
"author_profile": "https://Stackoverflow.com/users/1786",
"pm_score": 2,
"selected": false,
"text": "<p>I think you're over-thinking it. The simple answer is, they're not the same, so don't give them the same ID. If they... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | Anyone coming from ASP.NET (pre-MVC) has become accustomed to being able to give their controls whatever IDs they want. You can create a field called `Email` in an `.asmx` file, a field called `Email` in your main page, a field called `Email` in your master page, place multiple instances of your `.asmx` file on the pag... | I think you're over-thinking it. The simple answer is, they're not the same, so don't give them the same ID. If they share similarities, that's what classes are for. If one input is for a newsletter sign up, call it NewsletterEmail. If another is for a user sign in form, call it UserEmail. Using more descriptive IDs is... |
510,098 | <p>I'm trying to compile a simple program, with </p>
<pre><code>#include <gtkmm.h>
</code></pre>
<p>The path to <code>gtkmm.h</code> is <code>/usr/include/gtkmm-2.4/gtkmm.h</code>. g++ doesn't see this file unless I specifically tell it <code>-I /usr/include/gtkmm-2.4</code>.</p>
<p>My question is, how can I h... | [
{
"answer_id": 510109,
"author": "Adam Hawes",
"author_id": 54415,
"author_profile": "https://Stackoverflow.com/users/54415",
"pm_score": 0,
"selected": false,
"text": "<p>You can't. The whole point of include paths is so you can pick and choose what you want and what versions.</p>\n\n<... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510098",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/62264/"
] | I'm trying to compile a simple program, with
```
#include <gtkmm.h>
```
The path to `gtkmm.h` is `/usr/include/gtkmm-2.4/gtkmm.h`. g++ doesn't see this file unless I specifically tell it `-I /usr/include/gtkmm-2.4`.
My question is, how can I have g++ automatically look recursively through all the directories in `/... | In this case, the correct thing to do is to use `pkg-config` in your `Makefile` or buildscripts:
```
# Makefile
ifeq ($(shell pkg-config --modversion gtkmm-2.4),)
$(error Package gtkmm-2.4 needed to compile)
endif
CXXFLAGS += `pkg-config --cflags gtkmm-2.4`
LDLIBS += `pkg-config --libs gtkmm-2.4`
BINS = program
pr... |
510,121 | <p>I've deleted some records from a table in a SQL Server database.</p>
<p>The IDs in the table look like this:</p>
<blockquote>
<p>99
100
101
1200
1201...</p>
</blockquote>
<p>I want to delete the later records (IDs >1200), then I want to reset the auto increment so the next autogenerated ID will be 102. So my reco... | [
{
"answer_id": 510132,
"author": "Robert Wagner",
"author_id": 10784,
"author_profile": "https://Stackoverflow.com/users/10784",
"pm_score": 10,
"selected": true,
"text": "<p>Issue the following command to reseed mytable to start at 1:</p>\n\n<pre><code>DBCC CHECKIDENT (mytable, RESEED, ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510121",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/45429/"
] | I've deleted some records from a table in a SQL Server database.
The IDs in the table look like this:
>
> 99
> 100
> 101
> 1200
> 1201...
>
>
>
I want to delete the later records (IDs >1200), then I want to reset the auto increment so the next autogenerated ID will be 102. So my records are sequential, Is there ... | Issue the following command to reseed mytable to start at 1:
```
DBCC CHECKIDENT (mytable, RESEED, 0)
```
Read about it in the Books on Line (BOL, SQL help). Also be careful that you don't have records higher than the seed you are setting. |
510,138 | <p>I'm working on a program that will tell what level a programmer is at beginner, intermediate, or expert based on 32 subjects from a test in Code Complete 2nd Edition. I'm using 32 check boxes and one method to tell which ones are clicked. The problem is that when I check to see if the check boxes checked property is... | [
{
"answer_id": 510149,
"author": "NotDan",
"author_id": 3291,
"author_profile": "https://Stackoverflow.com/users/3291",
"pm_score": 1,
"selected": false,
"text": "<p>The CheckedChanged event should only fire after it has been checked, so I dont think that is your problem. However, maybe... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510138",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/56555/"
] | I'm working on a program that will tell what level a programmer is at beginner, intermediate, or expert based on 32 subjects from a test in Code Complete 2nd Edition. I'm using 32 check boxes and one method to tell which ones are clicked. The problem is that when I check to see if the check boxes checked property is eq... | I'm not sure what checkBoxVariant is exacty but...
I think the problem is that checkBoxVariant is just 1 of the 32 CheckBoxes. I'm assuming you wired all 32 CheckChanged events to the checkBoxVariant\_CheckedChanged method.
What it should look like is:
```
// If checkbox is checked then increment base score,
// othe... |
510,139 | <p>To do an insert with Class::DBI, you can simply do:</p>
<pre><code>my $object = Object::DB->insert({ a => 1, b => 2, c => 3, ...});
</code></pre>
<p>But there is no such thing for update. The best I could come up with is selecting the record first then updating it:</p>
<pre><code>my $object = Object::... | [
{
"answer_id": 511418,
"author": "John Siracusa",
"author_id": 164,
"author_profile": "https://Stackoverflow.com/users/164",
"pm_score": 4,
"selected": true,
"text": "<p>As far as I know, Class::DBI does not have a good way to do this, As you've noted, its <code>update()</code> method i... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510139",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/55111/"
] | To do an insert with Class::DBI, you can simply do:
```
my $object = Object::DB->insert({ a => 1, b => 2, c => 3, ...});
```
But there is no such thing for update. The best I could come up with is selecting the record first then updating it:
```
my $object = Object::DB->retrieve($id);
my $object->set( a => 1, b => ... | As far as I know, Class::DBI does not have a good way to do this, As you've noted, its `update()` method is meant to be called on an object that has been previously loaded from the database.
You may be able to convince Class::DBI to do what you want, however, with something like this:
```
# Make new "empty" object
my... |
510,156 | <p>I have a DOS batch script that invokes a java application which interacts with the user through the console UI. For the sake of argument, let's call it <code>runapp.bat</code> and its contents be</p>
<pre><code>java com.example.myApp
</code></pre>
<p>If the batch script is invoked in a console, everything works fi... | [
{
"answer_id": 511063,
"author": "Patrick Cuff",
"author_id": 7903,
"author_profile": "https://Stackoverflow.com/users/7903",
"pm_score": 5,
"selected": true,
"text": "<p>See this question: <a href=\"https://stackoverflow.com/questions/377407/detecting-how-a-batch-file-was-executed/37793... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510156",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10026/"
] | I have a DOS batch script that invokes a java application which interacts with the user through the console UI. For the sake of argument, let's call it `runapp.bat` and its contents be
```
java com.example.myApp
```
If the batch script is invoked in a console, everything works fine. However, if the script is invoked... | See this question: [Detecting how a batch file was executed](https://stackoverflow.com/questions/377407/detecting-how-a-batch-file-was-executed/377933#377933)
This script will not pause if run from the command console, but will if double-clicked in Explorer:
```
@echo off
setlocal enableextensions
set SCRIPT=%0
set ... |
510,165 | <p>Let say I have query like this:</p>
<pre><code>SELECT column1, column2, column3, column4, column5, Qty, Amount
FROM Source
</code></pre>
<p>I want to make this dynamic, so the user will be able to select <code>Column1</code> etc by using checkbox. If the user select <code>Column2, Column3</code> the query will be... | [
{
"answer_id": 511385,
"author": "Dustin Brooks",
"author_id": 54617,
"author_profile": "https://Stackoverflow.com/users/54617",
"pm_score": 1,
"selected": false,
"text": "<p>You can do this by not changing the query and hiding columns. You can prompt the user with the columns and have a... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510165",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53659/"
] | Let say I have query like this:
```
SELECT column1, column2, column3, column4, column5, Qty, Amount
FROM Source
```
I want to make this dynamic, so the user will be able to select `Column1` etc by using checkbox. If the user select `Column2, Column3` the query will be :
```
SELECT Column2, Column3, SUM(QTY), SUM(AM... | You can do this by not changing the query and hiding columns. You can prompt the user with the columns and have a Show/Hide or something similar.
[Here is an example of hiding columns I googled.](http://www.theruntime.com/blogs/thomasswilliams/archive/2008/09/29/hiding-and-showing-columns-based-on-a-parameter-in-repor... |
510,171 | <p>On a content type in a SharePoint (MOSS 2007) site I want to show an icon if the property is a certain value.</p>
<p>The column is a Yes/ No so the selected value should be fairly easy to determine.</p>
<p>So how can I, in the ASPX, show read the value? I know I need to modify the web.config to allow for in-page C... | [
{
"answer_id": 510482,
"author": "Jason",
"author_id": 10639,
"author_profile": "https://Stackoverflow.com/users/10639",
"pm_score": 1,
"selected": false,
"text": "<p>you'll need to get the value from an item in the list. off the top, i think this will work:</p>\n\n<pre><code>SPList lis... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11388/"
] | On a content type in a SharePoint (MOSS 2007) site I want to show an icon if the property is a certain value.
The column is a Yes/ No so the selected value should be fairly easy to determine.
So how can I, in the ASPX, show read the value? I know I need to modify the web.config to allow for in-page C#, but I'm just n... | Well I've found out how to do this:
```
var item = SPContext.Current.File.Item; //returns the SPListItem for the current context
var myField = item["SomeFieldName"]; //this will throw a NullReferenceException if there is no data for the field yet though
Response.Write(myField.ToString());
``` |
510,193 | <p>Here's my problem. I have a bunch of figures already written in a LaTeX document, and I'd like to reuse them for a poster. The code for the figure looks like:</p>
<pre><code>\begin{figure}[htp]
\begin{center}
\subfigure[Figure A]{\label{fig:Sample-a}\includegraphics[scale=5]{Image1.png}}
\subfigure[F... | [
{
"answer_id": 510235,
"author": "mattiast",
"author_id": 8272,
"author_profile": "https://Stackoverflow.com/users/8272",
"pm_score": 0,
"selected": false,
"text": "<p>One wisdom I have heard: you should just do your posters as A4-sized articles with one page, and then print them as A0. ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510193",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21981/"
] | Here's my problem. I have a bunch of figures already written in a LaTeX document, and I'd like to reuse them for a poster. The code for the figure looks like:
```
\begin{figure}[htp]
\begin{center}
\subfigure[Figure A]{\label{fig:Sample-a}\includegraphics[scale=5]{Image1.png}}
\subfigure[Figure B]{\label{... | I solved this problem by not using subfigure, but placing the figures explicitly and exactly. Kind of a dirty hack, but the poster went off well. |
510,195 | <p>I'm reading about Rails fixtures in this <a href="http://guides.rubyonrails.org/testing_rails_applications.html#_the_low_down_on_fixtures" rel="noreferrer">guide</a> (thanks, trevorturk). It appears you define classes in a Yaml file and they're automatically loaded into the <code>test</code> DB -- cool.</p>
<p>But ... | [
{
"answer_id": 510217,
"author": "Andrew Vit",
"author_id": 61439,
"author_profile": "https://Stackoverflow.com/users/61439",
"pm_score": 7,
"selected": true,
"text": "<p>You should use named fixtures, which automatically generate an id number for you where you don't provide one. These i... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510195",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42595/"
] | I'm reading about Rails fixtures in this [guide](http://guides.rubyonrails.org/testing_rails_applications.html#_the_low_down_on_fixtures) (thanks, trevorturk). It appears you define classes in a Yaml file and they're automatically loaded into the `test` DB -- cool.
But if you want to specify that this recipe belongs t... | You should use named fixtures, which automatically generate an id number for you where you don't provide one. These id numbers are essentially integer hashes of whatever string you use. Don't add the "\_id" if you're referencing the named version:
```
# recipes.yml
chicken_soup:
cookbook: my_recipes
# cookbooks.yml... |
510,202 | <p>I've been looking at some server logs using <code>tail -f</code> recently, and have thought that it'd be much easier to see some things if I could format the output. Really all I'm looking for is a way to perhaps colour certain words (determined by a regex), and perhaps remove certain words (again, determined by a r... | [
{
"answer_id": 510237,
"author": "Shalom Craimer",
"author_id": 54491,
"author_profile": "https://Stackoverflow.com/users/54491",
"pm_score": 3,
"selected": false,
"text": "<p>I think what you're looking for is some kind of <code>sed</code> script that will surround the words you choose ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510202",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] | I've been looking at some server logs using `tail -f` recently, and have thought that it'd be much easier to see some things if I could format the output. Really all I'm looking for is a way to perhaps colour certain words (determined by a regex), and perhaps remove certain words (again, determined by a regex).
I [kno... | Pipe the output of `tail -f` into `sed`, and add in some [ANSI escape codes](http://en.wikipedia.org/wiki/ANSI_escape_code). For example, the following will colorize all numbers in red (color 31) and all quoted strings in bright yellow (color 93):
```
RED=`echo -en '\e[31m'`
YELLOW=`echo -en '\e[93m'`
RESET=`echo -en ... |
510,207 | <p>I'd like to be able to run an already parameterized query from within the SSMS:</p>
<pre><code>select name
from aTable
where id = @id
</code></pre>
<p>I know that other IDEs (e.g. TOAD) allow for parameter binding - is this available in SSMS 2008?</p>
<p>Thanks!</p>
| [
{
"answer_id": 510212,
"author": "Brannon",
"author_id": 5745,
"author_profile": "https://Stackoverflow.com/users/5745",
"pm_score": 4,
"selected": true,
"text": "<p>I don't believe this is possible.</p>\n\n<p>What I usually do in this case is just add the following to the top of the win... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510207",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3/"
] | I'd like to be able to run an already parameterized query from within the SSMS:
```
select name
from aTable
where id = @id
```
I know that other IDEs (e.g. TOAD) allow for parameter binding - is this available in SSMS 2008?
Thanks! | I don't believe this is possible.
What I usually do in this case is just add the following to the top of the window:
```
declare @id int
set @id = 10
-- followed by the parameterized query
```
Actually, I think 2008 supports initialization now:
```
declare @id int = 10
``` |
510,214 | <p>In a SQL Server 2005 database I'm working on this query:</p>
<blockquote>
<p>select * <br/>
from foo <br/>
join bar on bar.x = foo.x <br/>
join baz on baz.y = foo.y <br/>
where foo.x = 1000</p>
</blockquote>
<p>has a vastly different and faster query plan than the following parameterized version.</p>
<b... | [
{
"answer_id": 510266,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 2,
"selected": false,
"text": "<p>Your starting point should be the SQL profiler. Run both through the profiler, and see what the query plan is in each... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18456/"
] | In a SQL Server 2005 database I'm working on this query:
>
> select \*
>
> from foo
>
> join bar on bar.x = foo.x
>
> join baz on baz.y = foo.y
>
> where foo.x = 1000
>
>
>
has a vastly different and faster query plan than the following parameterized version.
>
> declare @p0 int
>
> set... | It appears that the query planner has made a decision in the literal query which is based upon information that it already has. It would have statistics which it can query efficiently based on the spread of data given in your specific literal.
The parameterized query has chosen the query that it believes is fairest fo... |
510,216 | <p>I have an iPhone application with a settings.bundle that handles various settings for my application. I can set default values in my root.plist file (using the DefaultValue property), but these only get used the first time the user opens the settings app. Is there any way to get these values written out when your ap... | [
{
"answer_id": 510329,
"author": "PCheese",
"author_id": 61274,
"author_profile": "https://Stackoverflow.com/users/61274",
"pm_score": 8,
"selected": true,
"text": "<p>If I understood you correctly, you want to avoid having default values specified twice (once as \"DefaultValue\" keys in... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510216",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6044/"
] | I have an iPhone application with a settings.bundle that handles various settings for my application. I can set default values in my root.plist file (using the DefaultValue property), but these only get used the first time the user opens the settings app. Is there any way to get these values written out when your appli... | If I understood you correctly, you want to avoid having default values specified twice (once as "DefaultValue" keys in your Settings.bundle/Root.plist file, and once in your app initialization code) so you do not have to keep them in sync.
Since Settings.bundle is stored within the app bundle itself, you can just read... |
510,240 | <p>Given an absolute URI/URL, I want to get a URI/URL which doesn't contain the leaf portion. For example: given <a href="http://foo.com/bar/baz.html" rel="noreferrer">http://foo.com/bar/baz.html</a>, I should get <a href="http://foo.com/bar/" rel="noreferrer">http://foo.com/bar/</a>.</p>
<p>The code which I could com... | [
{
"answer_id": 510243,
"author": "Martin",
"author_id": 42024,
"author_profile": "https://Stackoverflow.com/users/42024",
"pm_score": 6,
"selected": true,
"text": "<p>This is the shortest I can come up with: </p>\n\n<pre><code>static string GetParentUriString(Uri uri)\n{\n return uri.... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510240",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/27928/"
] | Given an absolute URI/URL, I want to get a URI/URL which doesn't contain the leaf portion. For example: given <http://foo.com/bar/baz.html>, I should get <http://foo.com/bar/>.
The code which I could come up with seems a bit lengthy, so I'm wondering if there is a better way.
```
static string GetParentUriString(Uri ... | This is the shortest I can come up with:
```
static string GetParentUriString(Uri uri)
{
return uri.AbsoluteUri.Remove(uri.AbsoluteUri.Length - uri.Segments.Last().Length);
}
```
If you want to use the Last() method, you will have to include System.Linq. |
510,257 | <p>How can I use the <code>ReverseString</code> function in Delphi2009?</p>
| [
{
"answer_id": 510260,
"author": "moogs",
"author_id": 26374,
"author_profile": "https://Stackoverflow.com/users/26374",
"pm_score": 3,
"selected": false,
"text": "<p>I don't know anything about Delphi, but a <a href=\"http://www.google.com/search?q=ReverseString+Delphi+2009\" rel=\"nofo... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510257",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] | How can I use the `ReverseString` function in Delphi2009? | I don't know anything about Delphi, but a [simple google search for "ReverseString Delphi 2009"](http://www.google.com/search?q=ReverseString+Delphi+2009) would have led you to this answer:
```
var s : string;
s:='ABOUT DELPHI PROGRAMMING';
s:=ReverseString(s);
//s='GNIMMARGORP IHPLED TUOBA'
// this code is from abo... |
510,268 | <p>I have a simple HTML table with 2 columns containing text fields and headers for 'Name', 'Comments' and 'Email'.</p>
<p>I'm looking for the best strategy on styling this HTML fragment if it were to appear on multiple pages - requiring different dimensions on each page. I've been reading a lot about CSS recently but... | [
{
"answer_id": 510316,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 0,
"selected": false,
"text": "<p>1) Use common css and set some of the values like width in code behind.</p>\n\n<p>2) Create multiple css files for differen... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510268",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] | I have a simple HTML table with 2 columns containing text fields and headers for 'Name', 'Comments' and 'Email'.
I'm looking for the best strategy on styling this HTML fragment if it were to appear on multiple pages - requiring different dimensions on each page. I've been reading a lot about CSS recently but havent st... | Side comment: Maybe you shouldn't use tables to layout this form but fieldsets, it would leave you with more flexibility. For example if you decide to have the labels and input fields on top of each other in a more narrow column...
your example without tables (looks also much prettier):
```
<style type="text/css">
<!... |
510,269 | <p>Are there any shortcuts to (<code>stringByAppendingString:</code>) string concatenation in Objective-C, or shortcuts for working with <code>NSString</code> in general?</p>
<p>For example, I'd like to make:</p>
<pre><code>NSString *myString = @"This";
NSString *test = [myString stringByAppendingString:@" is just a ... | [
{
"answer_id": 510311,
"author": "Chris Blackwell",
"author_id": 1329401,
"author_profile": "https://Stackoverflow.com/users/1329401",
"pm_score": 10,
"selected": true,
"text": "<p>Two answers I can think of... neither is particularly as pleasant as just having a concatenation operator.<... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510269",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/53653/"
] | Are there any shortcuts to (`stringByAppendingString:`) string concatenation in Objective-C, or shortcuts for working with `NSString` in general?
For example, I'd like to make:
```
NSString *myString = @"This";
NSString *test = [myString stringByAppendingString:@" is just a test"];
```
something more like:
```
str... | Two answers I can think of... neither is particularly as pleasant as just having a concatenation operator.
First, use an `NSMutableString`, which has an `appendString` method, removing some of the need for extra temp strings.
Second, use an `NSArray` to concatenate via the `componentsJoinedByString` method. |
510,279 | <p>I am making a list with a heading and subheadings. My main list, Home1, is followed by a subheading. How can I exactly position the subheading content without affecting another list?</p>
<pre><code><div id="wrapper">
<ul id="testnav">
<li>
<a href="#">Home</a>
... | [
{
"answer_id": 510280,
"author": "Chris Blackwell",
"author_id": 1329401,
"author_profile": "https://Stackoverflow.com/users/1329401",
"pm_score": 1,
"selected": false,
"text": "<p>I don't purport to have done more than a web search, but the problem seems to be solved by several products... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510279",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/44984/"
] | I am making a list with a heading and subheadings. My main list, Home1, is followed by a subheading. How can I exactly position the subheading content without affecting another list?
```
<div id="wrapper">
<ul id="testnav">
<li>
<a href="#">Home</a>
<ul id="subnav">
... | If you own a Mac, you can download the iPhone SDK which comes with an iPhone simulator. It works not only for debugging a native app but also for browsing the web. |
510,289 | <p>Specifically, what am I supposed to do with the view that is now hidden after pushing on a new view controller?<br>
In my situation I have a view with animations going on, that continue to execute after the view is off screen.</p>
<p>Is there some accepted convention?
Do I remove the View Controller and View from m... | [
{
"answer_id": 510446,
"author": "Chris Lundie",
"author_id": 20685,
"author_profile": "https://Stackoverflow.com/users/20685",
"pm_score": 3,
"selected": true,
"text": "<p>Under low memory conditions, your controller's 'view' property will automatically be set to nil, if it's not on scr... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510289",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/48311/"
] | Specifically, what am I supposed to do with the view that is now hidden after pushing on a new view controller?
In my situation I have a view with animations going on, that continue to execute after the view is off screen.
Is there some accepted convention?
Do I remove the View Controller and View from memory?
D... | Under low memory conditions, your controller's 'view' property will automatically be set to nil, if it's not on screen. Then the view will automatically load again when it is needed - and viewDidLoad should get called at that time.
If your view controller is retaining any subviews of the top-level view, then you may w... |
510,295 | <p>This may not really sound hard to do but it is currently killing me. Currently i have a Visual Studio 2008 C# Project that i use in conjunction with a DAL generator , its nothing fancy at all besides generating files that i can use in the project to access the database.</p>
<p>The problem i am having is that after ... | [
{
"answer_id": 510310,
"author": "mqp",
"author_id": 55943,
"author_profile": "https://Stackoverflow.com/users/55943",
"pm_score": 2,
"selected": false,
"text": "<p>I suppose the easiest way would be to write a tool to automatically modify the .csproj file, which is just XML, so that it ... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510295",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/42069/"
] | This may not really sound hard to do but it is currently killing me. Currently i have a Visual Studio 2008 C# Project that i use in conjunction with a DAL generator , its nothing fancy at all besides generating files that i can use in the project to access the database.
The problem i am having is that after the genera... | In VS2008:
1) Right click on your project node.
2) Select "Unload project".
3) Right click on the project node.
4) Select "Edit foo.csproj"
5) In the element add a element that includes your DAL files using wildcards like:
```
<Compile Include="DAL_*.cs" />
```
or
```
<Compile Include="DataAccessLayer\*.cs... |
510,296 | <p>I've successfully done this for IE7. FF, no dice.</p>
<p>any ideas?
Thanks!</p>
| [
{
"answer_id": 511440,
"author": "bobince",
"author_id": 18936,
"author_profile": "https://Stackoverflow.com/users/18936",
"pm_score": 3,
"selected": true,
"text": "<pre><code>var range= window.getSelection().getRangeAt(0);\nalert('Current position: '+range.startOffset+' inside '+range.s... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510296",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2721/"
] | I've successfully done this for IE7. FF, no dice.
any ideas?
Thanks! | ```
var range= window.getSelection().getRangeAt(0);
alert('Current position: '+range.startOffset+' inside '+range.startContainer);
range.setStart(newParent, textOffset);
range.setEnd(newParent, textOffset);
``` |
510,305 | <p>Let's say I have this Class:</p>
<pre><code>
Class A {
int id;
int[] b;
// Other properties
}
Class B {
int id;
// Other properties
}
</code></pre>
<p>The Class A has one-to-many relation with class B. I already have a service which caches B objects and retu... | [
{
"answer_id": 510395,
"author": "Rahul",
"author_id": 24424,
"author_profile": "https://Stackoverflow.com/users/24424",
"pm_score": 0,
"selected": false,
"text": "<p>Not sure if I have understood your question correctly.</p>\n\n<p>Assuming you will query based on A's id, how about writi... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510305",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4406/"
] | Let's say I have this Class:
```
Class A {
int id;
int[] b;
// Other properties
}
Class B {
int id;
// Other properties
}
```
The Class A has one-to-many relation with class B. I already have a service which caches B objects and return them on id.
Table sche... | in mybatis 3 it's little bit different. You can do it by specify two select statement or you can use join then create resultMap with collection tag.
```
<resultMap id=”blogResult” type=”Blog”>
<collection property="posts" javaType=”ArrayList” column="blog_id"
ofType="Post" select=”selectPostsForBlog”/>
</resu... |
510,309 | <p>Can anyone explain how compilation works?</p>
<p>I can't seem to figure out how compilation works..</p>
<p>To be more specific, here's an example.. I'm trying to write some code in MSVC++ 6 to load a Lua state..</p>
<p>I've already:</p>
<ul>
<li>set the additional directories for the library and include files to the... | [
{
"answer_id": 510338,
"author": "vava",
"author_id": 6258,
"author_profile": "https://Stackoverflow.com/users/6258",
"pm_score": 1,
"selected": false,
"text": "<p>You have to go into project setting and add a directory where you have that LUA library *.lib files somewhere on the \"linke... | 2009/02/04 | [
"https://Stackoverflow.com/questions/510309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29482/"
] | Can anyone explain how compilation works?
I can't seem to figure out how compilation works..
To be more specific, here's an example.. I'm trying to write some code in MSVC++ 6 to load a Lua state..
I've already:
* set the additional directories for the library and include files to the right directories
* used exter... | From source to executable is generally a two stage process for C and associated languages, although the IDE probably presents this as a single process.
1/ You code up your source and run it through the compiler. The compiler at this stage needs your source and the header files of the other stuff that you're going to l... |