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
419,517
<p>I trying to build and compile my <code>xcodeproj</code> in command line and it is working now. </p> <p>So it is also possible to launch the <code>xcodeproject</code> from terminal instead from the Xcode?</p>
[ { "answer_id": 419552, "author": "Stephen Darlington", "author_id": 2998, "author_profile": "https://Stackoverflow.com/users/2998", "pm_score": 2, "selected": false, "text": "<p>Are you asking for the command to build from the command-line?</p>\n\n<p>It's just:</p>\n\n<pre><code>xcodebui...
2009/01/07
[ "https://Stackoverflow.com/questions/419517", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I trying to build and compile my `xcodeproj` in command line and it is working now. So it is also possible to launch the `xcodeproject` from terminal instead from the Xcode?
If you want to run an app from the command line, use ``` open /path/to/appname.app ``` "Build and Go" is really just equivalent to ``` xcodebuild [parameters] && open /path/to/appname.app ```
419,518
<p>I get the following error:</p> <pre><code>Unhandled Exception: System.IO.IOException: The parameter is incorrect. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.Console.set_OutputEncoding(Encoding value) at (my program) </code></pre> <p>when I...
[ { "answer_id": 419541, "author": "Fabrizio C.", "author_id": 49582, "author_profile": "https://Stackoverflow.com/users/49582", "pm_score": 0, "selected": false, "text": "<p>I think it has to do with the <code>CodePage</code> of the <code>Encoding</code> you are using. In particular see <...
2009/01/07
[ "https://Stackoverflow.com/questions/419518", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6583/" ]
I get the following error: ``` Unhandled Exception: System.IO.IOException: The parameter is incorrect. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.__Error.WinIOError() at System.Console.set_OutputEncoding(Encoding value) at (my program) ``` when I run the following line of...
Encoding.Unicode is UTF-16 which uses 2 bytes to encode all characters. The ASCII characters (English characters) are the same in UTF-8 (single bytes, same values), so that might be why it works. My guess is that the Windows Command Shell doesn't fully support Unicode. Funny that the Powershell 2 GUI does support UTF-...
419,521
<p>When importing numbers from a csv file, I need to convert them to floats with unit.</p> <p>Currently I do this with an inline function:</p> <pre><code>data |&gt; List.map float |&gt; List.map (fun n -&gt; n * 1.0&lt;m&gt;) </code></pre> <p>But I'm wondering if there is a more elegant way to do this - or do I have...
[ { "answer_id": 419789, "author": "Robert", "author_id": 17864, "author_profile": "https://Stackoverflow.com/users/17864", "pm_score": 3, "selected": true, "text": "<p>It looks like units of measure can't be type parameters for the moment (no idea if this will change). So the shortest way...
2009/01/07
[ "https://Stackoverflow.com/questions/419521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11410/" ]
When importing numbers from a csv file, I need to convert them to floats with unit. Currently I do this with an inline function: ``` data |> List.map float |> List.map (fun n -> n * 1.0<m>) ``` But I'm wondering if there is a more elegant way to do this - or do I have to create my own 'units' module with conversion...
It looks like units of measure can't be type parameters for the moment (no idea if this will change). So the shortest way to write this is: ``` data |> List.map float |> List.map ((*) 1.0<m>) ``` EDIT See also now `FloatWithMeasure` here <http://msdn.microsoft.com/en-us/library/ee806527(VS.100).aspx>
419,527
<p>I have a program which deliberately performs a divide by zero (and stores the result in a volatile variable) in order to halt in certain circumstances. However, I'd like to be able to disable this halting, without changing the macro that performs the division by zero.</p> <p>Is there any way to ignore it?</p> <p>I...
[ { "answer_id": 419535, "author": "lc.", "author_id": 44853, "author_profile": "https://Stackoverflow.com/users/44853", "pm_score": 3, "selected": true, "text": "<p>Why would you deliberately perform a divide by zero to halt? Couldn't you <code>exit(-1)</code> or some equivalent?</p>\n\n<...
2009/01/07
[ "https://Stackoverflow.com/questions/419527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41308/" ]
I have a program which deliberately performs a divide by zero (and stores the result in a volatile variable) in order to halt in certain circumstances. However, I'd like to be able to disable this halting, without changing the macro that performs the division by zero. Is there any way to ignore it? I've tried using ...
Why would you deliberately perform a divide by zero to halt? Couldn't you `exit(-1)` or some equivalent? Especially if you don't need the result of the divide by 0, this just doesn't make sense.
419,547
<p>I'm pointing the .Net command line WSDL utility that ships with Visual Studio 2005 at a web service implemented in Java (which I have no control over) and it spits out the following error:</p> <pre><code>WSDL : error WSDL1: Unable to cast object of type 'System.Xml.XmlElement' to type 'System.Web.Services.Descript...
[ { "answer_id": 484253, "author": "Klathzazt", "author_id": 35223, "author_profile": "https://Stackoverflow.com/users/35223", "pm_score": 0, "selected": false, "text": "<p>Is this an XSD File? files have dependencies. Download the dependency files and place them side/by/side with the XSD...
2009/01/07
[ "https://Stackoverflow.com/questions/419547", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20480/" ]
I'm pointing the .Net command line WSDL utility that ships with Visual Studio 2005 at a web service implemented in Java (which I have no control over) and it spits out the following error: ``` WSDL : error WSDL1: Unable to cast object of type 'System.Xml.XmlElement' to type 'System.Web.Services.Description.ServiceDes...
Try specifying the option **protocol [SOAP12](http://msdn.microsoft.com/en-us/library/microsoft.web.services3.soap12_properties.aspx)** /protocol:protocol ([as show on MSDN](http://msdn.microsoft.com/en-us/library/7h3ystb6.aspx)) Specifies the protocol to implement. You can specify SOAP (default), HttpGet, HttpPost,...
419,559
<p>Having implemented CLogClass to make decent logging I also defined macro, but it works only with one parameter...</p> <pre><code>class CLogClass { public: static void DoLog(LPCTSTR sMessage, ...); }; #define DebugLog(sMessage, x) ClogClass::DoLog(__FILE__, __LINE__, sMessage, x) </code></pre> <p>Well, it f...
[ { "answer_id": 419595, "author": "SmacL", "author_id": 22564, "author_profile": "https://Stackoverflow.com/users/22564", "pm_score": 0, "selected": false, "text": "<p>I would tend to use a globally visible extern function rather than a macro in this instance, and resolve the ellipsis in ...
2009/01/07
[ "https://Stackoverflow.com/questions/419559", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7003/" ]
Having implemented CLogClass to make decent logging I also defined macro, but it works only with one parameter... ``` class CLogClass { public: static void DoLog(LPCTSTR sMessage, ...); }; #define DebugLog(sMessage, x) ClogClass::DoLog(__FILE__, __LINE__, sMessage, x) ``` Well, it fails when called with more...
You could have a MYLOG macro returning a custom functor object which takes a variable number of arguments. ``` #include <string> #include <cstdarg> struct CLogObject { void operator()( const char* pFormat, ... ) const { printf( "[%s:%d] ", filename.c_str(), linenumber ); va_list args; va_start( args, p...
419,563
<pre><code>An error was discovered processing the &lt;wsse:Security&gt; header </code></pre> <p>This is a WS-Security question btw... </p> <p>I can't see anything wrong with my WS endpoint (apart from the fact that it's running in a TIBCO BW engine!). Does someone have any 'prior' with this kind of error? I realise t...
[ { "answer_id": 1554778, "author": "bethlakshmi", "author_id": 49962, "author_profile": "https://Stackoverflow.com/users/49962", "pm_score": 2, "selected": false, "text": "<p>Wow... if you're still having this problem, you have more patience than I... but just in case, here's my thoughts:...
2009/01/07
[ "https://Stackoverflow.com/questions/419563", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
``` An error was discovered processing the <wsse:Security> header ``` This is a WS-Security question btw... I can't see anything wrong with my WS endpoint (apart from the fact that it's running in a TIBCO BW engine!). Does someone have any 'prior' with this kind of error? I realise that the WS-Security Header could...
Wow... if you're still having this problem, you have more patience than I... but just in case, here's my thoughts: * <http://schemas.xmlsoap.org/specs/ws-security/ws-security.htm#ws-security__toc6201567> - suggests that this is a problem reading the tag. * One thing that sticks out to me is that I don't see a referenc...
419,577
<p>I have a simple sketch (in <a href="http://processing.org/" rel="nofollow noreferrer">Processing</a>), basically a bunch of dots wander around, if they come into contact with each other they fight (each has a strength value, increased each time they win, if it's equal the winner is randomly chosen)</p> <p>It works ...
[ { "answer_id": 419589, "author": "1800 INFORMATION", "author_id": 3146, "author_profile": "https://Stackoverflow.com/users/3146", "pm_score": 0, "selected": false, "text": "<p>Maybe you should split the playing field up into zones and only check for collisions between zombies that are in...
2009/01/07
[ "https://Stackoverflow.com/questions/419577", "https://Stackoverflow.com", "https://Stackoverflow.com/users/745/" ]
I have a simple sketch (in [Processing](http://processing.org/)), basically a bunch of dots wander around, if they come into contact with each other they fight (each has a strength value, increased each time they win, if it's equal the winner is randomly chosen) It works well with about 5000 12-pixel "zombies" (there'...
Like 1800 INFORMATION says, somehow you need to reduce the number of comparisons. Splitting the playing area into zones is a good idea. I would imagine the time it takes to compare current location against zone boundaries and add/remove zombies from the appropriate collections is worth it. Assuming they generally will...
419,596
<p>The basic idea behind a Cancel button is to enable closing your window with an Escape Keypress.</p> <blockquote> <p>You can set the IsCancel property on the Cancel button to true, causing the Cancel button to automatically close the dialog without handling the Click event.</p> </blockquote> <p>Source: Pr...
[ { "answer_id": 419615, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 6, "selected": true, "text": "<p>Yes, it only works on dialogs as a normal window has no concept of \"cancelling\", it's the same as DialogResult....
2009/01/07
[ "https://Stackoverflow.com/questions/419596", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1695/" ]
The basic idea behind a Cancel button is to enable closing your window with an Escape Keypress. > > You can set the IsCancel property on > the Cancel button to true, causing the > Cancel button to automatically close > the dialog without handling the Click > event. > > > Source: Programming WPF (Griffith, Sel...
Yes, it only works on dialogs as a normal window has no concept of "cancelling", it's the same as DialogResult.Cancel returning from ShowDialog in WinForms. If you wanted to close a Window with escape you could add a handler to PreviewKeyDown on the window, pickup on whether it is Key.Escape and close the form: ``` p...
419,598
<p>Do you consider this a code smell?</p> <pre><code>foreach((array)$foo as $bar) { $bar-&gt;doStuff(); } </code></pre> <p>Should i use that instead?</p> <pre><code>if (isset($foo) &amp;&amp; is_array($foo)) { foreach($foo as $bar) { $bar-&gt;doStuff(); } } </code></pre> <p>Any other good pr...
[ { "answer_id": 419634, "author": "BobbyShaftoe", "author_id": 38426, "author_profile": "https://Stackoverflow.com/users/38426", "pm_score": 1, "selected": false, "text": "<p>Personally, I would never do the first method and always opt for the second.</p>\n" }, { "answer_id": 4196...
2009/01/07
[ "https://Stackoverflow.com/questions/419598", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28144/" ]
Do you consider this a code smell? ``` foreach((array)$foo as $bar) { $bar->doStuff(); } ``` Should i use that instead? ``` if (isset($foo) && is_array($foo)) { foreach($foo as $bar) { $bar->doStuff(); } } ``` Any other good practices to cover not set variables and assert an array?
They're both code smells. The second one is just evading all the error messages, kind of like turning off the fire alarm before you set your kitchen on fire. Both of those tell you that you have no idea what's in the variable `$foo` or if it's even been defined in the code above. You need to go back up through the code...
419,604
<p>Okay so I have the following Code which appends a string to another in C#, note that this is Just an <strong>example</strong>, so giving alternative string concatination methods in C# is not nessesary, this is just to simplify the example.</p> <pre><code>string Data = ""; Data +="\n\nHTTP/1.1 " + Status_code; Data ...
[ { "answer_id": 419616, "author": "MSalters", "author_id": 15416, "author_profile": "https://Stackoverflow.com/users/15416", "pm_score": 2, "selected": false, "text": "<p>message points to a char const[] that you can't write to, yet that's exactly where strcat is writing. You need to mall...
2009/01/07
[ "https://Stackoverflow.com/questions/419604", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39106/" ]
Okay so I have the following Code which appends a string to another in C#, note that this is Just an **example**, so giving alternative string concatination methods in C# is not nessesary, this is just to simplify the example. ``` string Data = ""; Data +="\n\nHTTP/1.1 " + Status_code; Data += "\nContent-Type: " + Con...
Change ``` char *message = "\n\nHTTP/1.1 "; ``` to ``` char message[1024]; strcpy(message,"\n\nHTTP/1.1 "); ``` and you should be ok, up to a total message length of 1023. Edit: (as per mjy's comment). Using strcat in this fashion is a great way of getting buffer overflows. You could readily write a small func...
419,632
<p>So, this is what we want to do: We want to have a generic web part with a custom frame around it and then dynamically load other web parts (frameless) inside it. Would this at all be possible you think? A bit like <a href="http://www.codeplex.com/smartpart" rel="noreferrer">Jan Tielens SmartPart</a>, only not for AS...
[ { "answer_id": 419650, "author": "Steven Robbins", "author_id": 26507, "author_profile": "https://Stackoverflow.com/users/26507", "pm_score": 2, "selected": false, "text": "<p>I don't think so. I tried this a while back and it complained about only being able to add WebPartZone items in ...
2009/01/07
[ "https://Stackoverflow.com/questions/419632", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11220/" ]
So, this is what we want to do: We want to have a generic web part with a custom frame around it and then dynamically load other web parts (frameless) inside it. Would this at all be possible you think? A bit like [Jan Tielens SmartPart](http://www.codeplex.com/smartpart), only not for ASP.Net User Controls, but for ot...
``` public class WebPartWrapper : System.Web.UI.WebControls.WebParts.WebPart { protected override void CreateChildControls() { Panel pnl = new Panel(); this.Controls.Add(pnl); var factory = new WebPartFactory() WebPart dynamicPart = factory.CreateWebPart("RSSViewer", this.Guid); ...
419,638
<p>I recently gave a interview to one of the TOP software company. I was completely stuck with only one question asked by interviewer to me, which was </p> <p>Q. I have a machine with 512 mb / 1 GB RAM and I have to sort a file (XML, or any) of 4 GB size. How will I proceed? What will be the data structure, and which ...
[ { "answer_id": 419649, "author": "Fabrizio C.", "author_id": 49582, "author_profile": "https://Stackoverflow.com/users/49582", "pm_score": 2, "selected": false, "text": "<p>There is a nice post on the Guido van Rossum <a href=\"http://neopythonic.blogspot.com/2008/10/sorting-million-32-b...
2009/01/07
[ "https://Stackoverflow.com/questions/419638", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I recently gave a interview to one of the TOP software company. I was completely stuck with only one question asked by interviewer to me, which was Q. I have a machine with 512 mb / 1 GB RAM and I have to sort a file (XML, or any) of 4 GB size. How will I proceed? What will be the data structure, and which sorting al...
here's one example of simulating virtual memory on C# source: <http://msdn.microsoft.com/en-us/library/aa288465(VS.71).aspx> ``` // indexer.cs // arguments: indexer.txt using System; using System.IO; // Class to provide access to a large file // as if it were a byte array. public class FileByteArray { Stream str...
419,659
<p>I'm new to TDD and xUnit so I want to test my method that looks something like: </p> <pre><code>List&lt;T&gt; DeleteElements&lt;T&gt;(this List&lt;T&gt; a, List&lt;T&gt; b); </code></pre> <p>Is there any Assert method that I can use ? I think something like this would be nice</p> <pre><code>List&lt;int&gt; values...
[ { "answer_id": 419717, "author": "Konstantin Spirin", "author_id": 1423922, "author_profile": "https://Stackoverflow.com/users/1423922", "pm_score": 9, "selected": true, "text": "<h3>2021-Apr-01 update</h3>\n<p>I recommend using <a href=\"https://fluentassertions.com/\" rel=\"noreferrer\...
2009/01/07
[ "https://Stackoverflow.com/questions/419659", "https://Stackoverflow.com", "https://Stackoverflow.com/users/42377/" ]
I'm new to TDD and xUnit so I want to test my method that looks something like: ``` List<T> DeleteElements<T>(this List<T> a, List<T> b); ``` Is there any Assert method that I can use ? I think something like this would be nice ``` List<int> values = new List<int>() { 1, 2, 3 }; List<int> expected = new List<int>(...
### 2021-Apr-01 update I recommend using [FluentAssertions](https://fluentassertions.com/). It has a vast IntelliSense-friendly assertion library for many use cases including [collections](https://fluentassertions.com/collections/) ``` collection.Should().Equal(1, 2, 5, 8); collection.Should().NotEqual(8, 2, 3, 5); c...
419,660
<p>I am having table in the below format. I need mysql query to get the no of rows perday when i give date between 2008-10-12 and 2008-10-13</p> <pre> Name | KW | KV | I | Date | ------+--------+------+------+---------------------+ UPS1 | 353.50 | NULL | NULL | 2008-10-12 00:54:36 | UPS1 | 3...
[ { "answer_id": 419671, "author": "ewalshe", "author_id": 47429, "author_profile": "https://Stackoverflow.com/users/47429", "pm_score": 3, "selected": false, "text": "<p>I have changed the query so that Date column case matches exactly what you have in your query results.</p>\n\n<pre><cod...
2009/01/07
[ "https://Stackoverflow.com/questions/419660", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I am having table in the below format. I need mysql query to get the no of rows perday when i give date between 2008-10-12 and 2008-10-13 ``` Name | KW | KV | I | Date | ------+--------+------+------+---------------------+ UPS1 | 353.50 | NULL | NULL | 2008-10-12 00:54:36 | UPS1 | 352.50 | ...
I have changed the query so that Date column case matches exactly what you have in your query results. ``` select Date, count(Date) from TABLE where Date >= '2008-10-12' and Date <= '2008-10-13' group by Date ``` You will need to change TABLE in the from clause, but everything else should be correct for your table. ...
419,670
<p>I wonder if anyone has managed to create a working code for sending out binary messages (to configure Symbian phones) and have also some binary data sample. So far all the samples I have found fail to leave the Outbox or never return.</p> <pre><code>// Current entry is the Draft folder. iSmsMtm-&gt;SwitchCurren...
[ { "answer_id": 420149, "author": "michael aubert", "author_id": 17867, "author_profile": "https://Stackoverflow.com/users/17867", "pm_score": 1, "selected": false, "text": "<p>Use the JSR120 specification and the wireless toolkit. they contain java example code that will work for sure.</...
2009/01/07
[ "https://Stackoverflow.com/questions/419670", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44715/" ]
I wonder if anyone has managed to create a working code for sending out binary messages (to configure Symbian phones) and have also some binary data sample. So far all the samples I have found fail to leave the Outbox or never return. ``` // Current entry is the Draft folder. iSmsMtm->SwitchCurrentEntryL( KMsvDraf...
The solution that worked is to use RComm and "DATAPORT::1" to send out the binary SMS using AT commands (like using a modem).
419,698
<p><strong>Overall Plan</strong></p> <p>Get my class information to automatically optimize and select my uni class timetable</p> <p>Overall Algorithm</p> <ol> <li>Logon to the website using its Enterprise Sign On Engine login</li> <li>Find my current semester and its related subjects (pre setup)</li> <li>Navigate to...
[ { "answer_id": 419741, "author": "gimel", "author_id": 6491, "author_profile": "https://Stackoverflow.com/users/6491", "pm_score": 0, "selected": false, "text": "<p><a href=\"http://www.crummy.com/software/BeautifulSoup/\" rel=\"nofollow noreferrer\">BeautifulSoup</a> was mentioned here ...
2009/01/07
[ "https://Stackoverflow.com/questions/419698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/45211/" ]
**Overall Plan** Get my class information to automatically optimize and select my uni class timetable Overall Algorithm 1. Logon to the website using its Enterprise Sign On Engine login 2. Find my current semester and its related subjects (pre setup) 3. Navigate to the right page and get the data from each related s...
Depending on how far you plan on taking #6, and how big the dataset is, it may be non-trivial; it certainly smacks of NP-hard global optimisation to me... Still, if you're talking about tens (rather than hundreds) of nodes, a fairly dumb algorithm should give good enough performance. So, you have two constraints: 1....
419,702
<p>I see in MSDN links such as "CompareOrdinal Overloads". How can I write such a link in C#?</p> <p>I tried:</p> <pre><code>&lt;seealso cref="MyMethod"&gt;MyMethod Overloads&lt;/seealso&gt; </code></pre> <p>But the compiler gives me a warning about being an ambiguous reference for the method which has other overloa...
[ { "answer_id": 419711, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 4, "selected": false, "text": "<p>To target <em>specific</em> members, I believe you just match the signature:</p>\n\n<pre><code>/// &lt;seealso cre...
2009/01/07
[ "https://Stackoverflow.com/questions/419702", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41283/" ]
I see in MSDN links such as "CompareOrdinal Overloads". How can I write such a link in C#? I tried: ``` <seealso cref="MyMethod">MyMethod Overloads</seealso> ``` But the compiler gives me a warning about being an ambiguous reference for the method which has other overloads. (Beginner question: do I actually need t...
Xml documentation doesn't have a means to reference all overloads of a method. The most popular documentation generator for C# projects is Sandcastle. It will automatically create a link to an overloads list page if necessary. Hence in a members list page the name of an overloaded method will appear only once, clickin...
419,707
<p>Can anyone find a constant in the .NET framework that defines the number of days in a week (7)?</p> <pre><code>DateTime.DaysInAWeek // Something like this??? </code></pre> <p>Of course I can define my own, but I'd rather not if it's somewhere in there already.</p> <h2>Update:</h2> <p>I am looking for this becaus...
[ { "answer_id": 419713, "author": "Drew Noakes", "author_id": 24874, "author_profile": "https://Stackoverflow.com/users/24874", "pm_score": 1, "selected": false, "text": "<p>I don't believe there is one. TimeSpan defines constants for the number of ticks per milli/second/minute/hour/day,...
2009/01/07
[ "https://Stackoverflow.com/questions/419707", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39709/" ]
Can anyone find a constant in the .NET framework that defines the number of days in a week (7)? ``` DateTime.DaysInAWeek // Something like this??? ``` Of course I can define my own, but I'd rather not if it's somewhere in there already. Update: ------- I am looking for this because I need to allow the user to sele...
You could probably use [System.Globalization.DateTimeFormatInfo.CurrentInfo.DayNames](http://msdn.microsoft.com/en-us/library/system.globalization.datetimeformatinfo.daynames.aspx).Length.
419,710
<p>I have a <code>UIImageView</code> that is displaying an image that is wider and taller than the <code>UIImageView</code> is. I would like to pan the image within the view using an animation (so that the pan is nice and smooth).</p> <p>It seems to me that I should be able to just adjust the <code>bounds.origin</code...
[ { "answer_id": 421646, "author": "Brad Larson", "author_id": 19679, "author_profile": "https://Stackoverflow.com/users/19679", "pm_score": 6, "selected": false, "text": "<p>I'd highly recommend enclosing your <code>UIImageView</code> in a <code>UIScrollView</code>. Have the <code>UIImag...
2009/01/07
[ "https://Stackoverflow.com/questions/419710", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5657/" ]
I have a `UIImageView` that is displaying an image that is wider and taller than the `UIImageView` is. I would like to pan the image within the view using an animation (so that the pan is nice and smooth). It seems to me that I should be able to just adjust the `bounds.origin` of the `UIImageView`, and the image shoul...
Brad Larson pointed me down the right road with his suggestion to put the `UIImageView` inside a `UIScrollView`. In the end I put the `UIImageView` inside of a `UIScrollView`, and set the scrollView's `contentSize` **and** the `imageView`'s bounds to be the same size as the image in the UIImage: ``` UIImage* image = ...
419,714
<p>I have set my Visual Studio to start Nunit as an external program to run all the tests written in a module. </p> <p>Now what I am trying to do is to create a batch file which will call Myproj.exe. What I am expecting is that it will run Nunit as I have set it to run an external program and execute all my tests in n...
[ { "answer_id": 419720, "author": "Tom Anderson", "author_id": 13502, "author_profile": "https://Stackoverflow.com/users/13502", "pm_score": 0, "selected": false, "text": "<p>you can just shell nunit.exe with the command line to your assembly to run tests in.</p>\n" }, { "answer_i...
2009/01/07
[ "https://Stackoverflow.com/questions/419714", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have set my Visual Studio to start Nunit as an external program to run all the tests written in a module. Now what I am trying to do is to create a batch file which will call Myproj.exe. What I am expecting is that it will run Nunit as I have set it to run an external program and execute all my tests in nunit.exe, ...
You can make NUnit start everytime you debug your "NUnit tests". You can attach the debugger in Visual Studio Express doing it [that](http://thespoke.net/forums/923583/ShowPost.aspx) way. If you use a "full version" of VS do it that way: > > Note that if you’re using the full and > not the express version of Visual...
419,738
<p>I have an application which makes decisions based on part of URL:</p> <pre><code> if ( isset($this-&gt;params['url']['url']) ) { $url = $this-&gt;params['url']['url']; $url = explode('/',$url); $id = $this-&gt;Provider-&gt;getProviderID($url[0]); $this-&gt;providerName = $url[0]; //set the provi...
[ { "answer_id": 419799, "author": "Michael Borgwardt", "author_id": 16883, "author_profile": "https://Stackoverflow.com/users/16883", "pm_score": 1, "selected": false, "text": "<p>What are valid provider names? Test if the URL parameter is one, otherwise reject it.</p>\n\n<p>Hopefully you...
2009/01/07
[ "https://Stackoverflow.com/questions/419738", "https://Stackoverflow.com", "https://Stackoverflow.com/users/69346/" ]
I have an application which makes decisions based on part of URL: ``` if ( isset($this->params['url']['url']) ) { $url = $this->params['url']['url']; $url = explode('/',$url); $id = $this->Provider->getProviderID($url[0]); $this->providerName = $url[0]; //set the provider name return $id; ...
Other comments here are correct, in AppController's beforeFilter validate the provider against the providers in your db. However, if all URLs should be prefixed with a provider string, you are going about extracting it from the URL the wrong way by looking in $this->params['url']. This kind of problem is exactly what...
419,763
<p>The Yahoo Javascript library (YUI), JQuery and less so Google maps all allow you to reference their files using the following format:</p> <pre><code>&lt;script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"&gt;&lt;/script&gt; </code></pre> <p>This does a reques...
[ { "answer_id": 419798, "author": "Rene Saarsoo", "author_id": 15982, "author_profile": "https://Stackoverflow.com/users/15982", "pm_score": 1, "selected": false, "text": "<p>Of course they produce statistics - at minimum they need to know how many resources they spend on hosting these sc...
2009/01/07
[ "https://Stackoverflow.com/questions/419763", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21574/" ]
The Yahoo Javascript library (YUI), JQuery and less so Google maps all allow you to reference their files using the following format: ``` <script type="text/javascript" src="http://yui.yahooapis.com/2.6.0/build/yahoo-dom-event/yahoo-dom-event.js"></script> ``` This does a request for the script from their servers, w...
Chris, I work on the YUI team at Yahoo. We host only YUI on yui.yahooapis.com; Google hosts YUI and many other libraries on its CDN. I can tell you from the Yahoo side that we don't monitor site usage of YUI from our CDN. We do track general growth of yui.yahooapis.com usage, but we don't track which sites are genera...
419,769
<p>I have an asp.net page, some of its controls are created dynamically, these controls are one of the following; textbox, calendar, or dropdownlist.</p> <p>These controls in some cases, should be validated based on flag read from db?</p> <blockquote> <p>Is there any way to validate dynamically created controls?<...
[ { "answer_id": 419780, "author": "Sergio", "author_id": 32037, "author_profile": "https://Stackoverflow.com/users/32037", "pm_score": 0, "selected": false, "text": "<p>You can create validators at the same time you create those controls</p>\n" }, { "answer_id": 419782, "autho...
2009/01/07
[ "https://Stackoverflow.com/questions/419769", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14118/" ]
I have an asp.net page, some of its controls are created dynamically, these controls are one of the following; textbox, calendar, or dropdownlist. These controls in some cases, should be validated based on flag read from db? > > Is there any way to validate > dynamically created controls? > > >
I got a solution for that problem. One of the main problems that I had with this page that it's ajax-enabled and I need to validate dynamically created controls. My solution and it works properly, while creating the Control, I added an input attribute to it markes it as it is required or not, and another attribute tha...
419,774
<p>If you put a DataGridView that is 400 pixels high on a panel that's 300 pixels high, so that there's a scroll bar on the panel, then scroll down so that the lower half of the grid is shown, then click on a control outside the panel, then click on a line in the grid, the panel scrolls up to the top and the wrong row ...
[ { "answer_id": 421094, "author": "jhunter", "author_id": 51709, "author_profile": "https://Stackoverflow.com/users/51709", "pm_score": 0, "selected": false, "text": "<p>I understand your pain, this has gotten me more than once.</p>\n\n<p>If your DataGridView is the only thing in the pane...
2009/01/07
[ "https://Stackoverflow.com/questions/419774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
If you put a DataGridView that is 400 pixels high on a panel that's 300 pixels high, so that there's a scroll bar on the panel, then scroll down so that the lower half of the grid is shown, then click on a control outside the panel, then click on a line in the grid, the panel scrolls up to the top and the wrong row in ...
I am guessing that you are setting the AutoScroll property of the panel to true. When you do so, switching applications resets the scroll position to zero and the panel resets its position. If you switch off AutoScroll and add your own scrollbar you can set the scrollbar's maximum and minimum to match the requirements...
419,775
<p>I am developing an application for video recording and I want to overlay the video preview with a logo and recording timer.</p> <p>I tried to run the full-screen application and everything worked fine. Then I tried to run the application as a regular Windows application and it returned an error.</p> <p>Could anyon...
[ { "answer_id": 421094, "author": "jhunter", "author_id": 51709, "author_profile": "https://Stackoverflow.com/users/51709", "pm_score": 0, "selected": false, "text": "<p>I understand your pain, this has gotten me more than once.</p>\n\n<p>If your DataGridView is the only thing in the pane...
2009/01/07
[ "https://Stackoverflow.com/questions/419775", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22996/" ]
I am developing an application for video recording and I want to overlay the video preview with a logo and recording timer. I tried to run the full-screen application and everything worked fine. Then I tried to run the application as a regular Windows application and it returned an error. Could anyone take a look at ...
I am guessing that you are setting the AutoScroll property of the panel to true. When you do so, switching applications resets the scroll position to zero and the panel resets its position. If you switch off AutoScroll and add your own scrollbar you can set the scrollbar's maximum and minimum to match the requirements...
419,800
<p>i'm currently using File::Basename fileparse to separate out a file's directory, base file name and it's extension using something like this:</p> <pre><code>my($myfile_name,$mydirectory, $file_extension) = fileparse($$rhash_params{'storage_full_path_location'},'\..{1,4}'); </code></pre> <p>But see that there's a v...
[ { "answer_id": 419814, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 3, "selected": true, "text": "<blockquote>\n <p><code>1</code>. Is there a list of commonly used extension for Windows and Unix\n systems? But in my case...
2009/01/07
[ "https://Stackoverflow.com/questions/419800", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38124/" ]
i'm currently using File::Basename fileparse to separate out a file's directory, base file name and it's extension using something like this: ``` my($myfile_name,$mydirectory, $file_extension) = fileparse($$rhash_params{'storage_full_path_location'},'\..{1,4}'); ``` But see that there's a variation where you can act...
> > `1`. Is there a list of commonly used extension for Windows and Unix > systems? But in my case it's mainly > for Windows. > > > Yes, loads, all over the internet: <http://www.google.com/search?q=common+file+extensions> > > `2`. And is it safe to assume that all file names in Windows should have > an exten...
419,804
<p>I have taken a liking to jQuery/Javascript's way of extending functionality via closures. Is it possible to do something similar in PHP 5.3?</p> <pre><code>class Foo { public $bar; } $foo = new Foo; $foo-&gt;bar = function($baz) { echo strtoupper($baz); }; $foo-&gt;bar('lorem ipsum dolor sit amet'); // LOREM I...
[ { "answer_id": 419867, "author": "Martijn Laarman", "author_id": 47020, "author_profile": "https://Stackoverflow.com/users/47020", "pm_score": 1, "selected": false, "text": "<p>PHP can via <a href=\"http://nl3.php.net/create_function\" rel=\"nofollow noreferrer\">create_function()</a>. T...
2009/01/07
[ "https://Stackoverflow.com/questions/419804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/31003/" ]
I have taken a liking to jQuery/Javascript's way of extending functionality via closures. Is it possible to do something similar in PHP 5.3? ``` class Foo { public $bar; } $foo = new Foo; $foo->bar = function($baz) { echo strtoupper($baz); }; $foo->bar('lorem ipsum dolor sit amet'); // LOREM IPSUM DOLOR SIT AMET ...
PHP 5.3 will allow the creation of lambda functions and closures which would allow you to implement your code example. From the [PHP RFC](http://wiki.php.net/rfc/closures): ``` function & (parameters) use (lexical vars) { body } ``` The function is returned as reference and can be passed as a callback. For example, ...
419,810
<p>Here's what I'm seeing: I have a conditional-get caching policy in place (cache-control: private, must-revalidate).</p> <p>It works fine if I'm on the page, then try to hit the browser's refresh button.</p> <p>However, in another part of my site, I use location.replace(url) to go to that page... if I do that, its ...
[ { "answer_id": 419867, "author": "Martijn Laarman", "author_id": 47020, "author_profile": "https://Stackoverflow.com/users/47020", "pm_score": 1, "selected": false, "text": "<p>PHP can via <a href=\"http://nl3.php.net/create_function\" rel=\"nofollow noreferrer\">create_function()</a>. T...
2009/01/07
[ "https://Stackoverflow.com/questions/419810", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Here's what I'm seeing: I have a conditional-get caching policy in place (cache-control: private, must-revalidate). It works fine if I'm on the page, then try to hit the browser's refresh button. However, in another part of my site, I use location.replace(url) to go to that page... if I do that, its not makign that c...
PHP 5.3 will allow the creation of lambda functions and closures which would allow you to implement your code example. From the [PHP RFC](http://wiki.php.net/rfc/closures): ``` function & (parameters) use (lexical vars) { body } ``` The function is returned as reference and can be passed as a callback. For example, ...
419,833
<p>I have a list of jar files, all containing slightly different versions of the same system.</p> <p>I want to execute a set of test cases on each jar file while being able to obtain the results for each jar (via RunListener or something like that).</p> <p>I am a bit confused with the class loading problems that are ...
[ { "answer_id": 419861, "author": "Yoni Roit", "author_id": 34161, "author_profile": "https://Stackoverflow.com/users/34161", "pm_score": 0, "selected": false, "text": "<p>If the jars maintain the same interface, then all you have to do is run each test with a slighly different classpath ...
2009/01/07
[ "https://Stackoverflow.com/questions/419833", "https://Stackoverflow.com", "https://Stackoverflow.com/users/41315/" ]
I have a list of jar files, all containing slightly different versions of the same system. I want to execute a set of test cases on each jar file while being able to obtain the results for each jar (via RunListener or something like that). I am a bit confused with the class loading problems that are implied. How can...
If you are using ant, the JUnit task takes a classpath. ``` <target name="test"> <junit ..."> <classpath> <pathelement path="${test.jar.path}" /> </classpath> ... </junit> </target> ``` You can use the antcall task to call your test target repeatedly with a differed value for the test.jar.path ...
419,849
<p>My current web app works fine locally and on live, what i am currently playing around with is compiling my Web App with the Visual Studio Option "Add Web Deployment Project" so all the code behind is compiled into DLL's.</p> <p>There's is one particular build error i can not get rid off</p> <p>Error 50 The type or...
[ { "answer_id": 419904, "author": "Sergio", "author_id": 32037, "author_profile": "https://Stackoverflow.com/users/32037", "pm_score": 0, "selected": false, "text": "<p>I am guessing here, but it looks like your calendarcell user control is not compiling properly.</p>\n\n<p>When this happ...
2009/01/07
[ "https://Stackoverflow.com/questions/419849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
My current web app works fine locally and on live, what i am currently playing around with is compiling my Web App with the Visual Studio Option "Add Web Deployment Project" so all the code behind is compiled into DLL's. There's is one particular build error i can not get rid off Error 50 The type or namespace name '...
The problem comes from the fact that the namespace ASP is a 'pseudo' namespace, which can't be referenced when compiling. The solution I found was to actually integrate the current namespace into the usercontrol definition. I adapted the names of the elements to your naming conventions, but I don't know anything about...
419,857
<p>I want to take advantage of the new partitioning in MySQL 5.1 but using a standard ActiveRecord model. The problem I have encountered is that to use the partitioning the primary key on the table must include the columns used in the partitioning function. (<a href="http://dev.mysql.com/doc/refman/5.1/en/partitionin...
[ { "answer_id": 421749, "author": "Frank Flynn", "author_id": 52549, "author_profile": "https://Stackoverflow.com/users/52549", "pm_score": 2, "selected": false, "text": "<p>I believe what you describe, create the ActiveRecord model then alter it directly in MySQL will work. The possible...
2009/01/07
[ "https://Stackoverflow.com/questions/419857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2843/" ]
I want to take advantage of the new partitioning in MySQL 5.1 but using a standard ActiveRecord model. The problem I have encountered is that to use the partitioning the primary key on the table must include the columns used in the partitioning function. (<http://dev.mysql.com/doc/refman/5.1/en/partitioning-limitations...
I believe what you describe, create the ActiveRecord model then alter it directly in MySQL will work. The possible down side is that Rails will not know about 'task\_id' and of course would not include it in the queries. The problem being that the major advantage of partitioning is the query optimizer would see that th...
419,858
<p>How can I deep copy an irregularly shaped 2D array in Java?</p> <p>Ie.</p> <pre><code>int[][] nums = {{5}, {9,4}, {1,7,8}, {8,3,2,10}} </code></pre> <p>I'm unable to use <code>Arrays.arrayCopy()</code> for some reason (versioning?)</p>
[ { "answer_id": 419887, "author": "Joao da Silva", "author_id": 46329, "author_profile": "https://Stackoverflow.com/users/46329", "pm_score": 4, "selected": false, "text": "<pre><code>int[][] copy = new int[nums.length][];\n\nfor (int i = 0; i &lt; nums.length; i++) {\n copy[i] = new i...
2009/01/07
[ "https://Stackoverflow.com/questions/419858", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33033/" ]
How can I deep copy an irregularly shaped 2D array in Java? Ie. ``` int[][] nums = {{5}, {9,4}, {1,7,8}, {8,3,2,10}} ``` I'm unable to use `Arrays.arrayCopy()` for some reason (versioning?)
``` int[][] copy = new int[nums.length][]; for (int i = 0; i < nums.length; i++) { copy[i] = new int[nums[i].length]; for (int j = 0; j < nums[i].length; j++) { copy[i][j] = nums[i][j]; } } ``` You can replace the second loop with System.arraycopy() or Arrays.copyOf().
419,868
<p>The following code will not run correctly in IE7 with the latest service packs installed.</p> <pre><code>System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Disposition", "attachment;filename=Contacts.xls"); response.ContentType = "application/oc...
[ { "answer_id": 420234, "author": "scunliffe", "author_id": 6144, "author_profile": "https://Stackoverflow.com/users/6144", "pm_score": 3, "selected": true, "text": "<p>Add a Header telling IE <em>explicitly</em> to CACHE the file. IE has known bugs with not being able to properly save a...
2009/01/07
[ "https://Stackoverflow.com/questions/419868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52039/" ]
The following code will not run correctly in IE7 with the latest service packs installed. ``` System.Web.HttpResponse response = System.Web.HttpContext.Current.Response; response.Clear(); response.AddHeader("Content-Disposition", "attachment;filename=Contacts.xls"); response.ContentType = "application/octet-stream"; ...
Add a Header telling IE *explicitly* to CACHE the file. IE has known bugs with not being able to properly save a file if it is sent as a no-cache file.
419,878
<p>I have an object that is generated in one class</p> <pre><code>public class CreatingClass { public T CreateObject&lt;T&gt;(Dictionary&lt;string, object&gt; parameters) where T : IMyInterface, new() { .... } public void DestroyObject(IMyInterface objectToDestroy) { .... } } <...
[ { "answer_id": 419888, "author": "Binary Worrier", "author_id": 18797, "author_profile": "https://Stackoverflow.com/users/18797", "pm_score": 3, "selected": false, "text": "<p>What you want is </p>\n\n<pre><code>public void DestroyClass(ref IMyInterface objectToDestroy)\n{\n ....\n ...
2009/01/07
[ "https://Stackoverflow.com/questions/419878", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5302/" ]
I have an object that is generated in one class ``` public class CreatingClass { public T CreateObject<T>(Dictionary<string, object> parameters) where T : IMyInterface, new() { .... } public void DestroyObject(IMyInterface objectToDestroy) { .... } } ``` I call this function ...
Note that you can't actually destroy an object; you are subject to the rules of garbage collection. At a push, you could check for `IDisposable` and call Dispose(), You can use the `ref` samples provided, but I'm not sure there is much point; it is simpler just to clear the field with "obj = null;". The `ref` usage c...
419,908
<p>How to get the text of selected item from a drop down box element in html forms? (using python) How can I store the value to a variable, when I select one item from the drop down box using mouse? (ie. without using a submit button)</p> <p>This is for a application which I am doing in app engine which only supports ...
[ { "answer_id": 419947, "author": "sastanin", "author_id": 25450, "author_profile": "https://Stackoverflow.com/users/25450", "pm_score": 2, "selected": false, "text": "<p>Your python code runs on the server (google appengine). HTML form runs on the client (in the browser). The client and ...
2009/01/07
[ "https://Stackoverflow.com/questions/419908", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52393/" ]
How to get the text of selected item from a drop down box element in html forms? (using python) How can I store the value to a variable, when I select one item from the drop down box using mouse? (ie. without using a submit button) This is for a application which I am doing in app engine which only supports Python.
Your question shows some misunderstanding on how [web applications](http://en.wikipedia.org/wiki/Web_application) work. The user has to type an address in a browser to get to the application. That sends a request to the server. The server code (written in python) receives this request and has the opportunity to send a...
419,954
<p>I have following Code Block Which I tried to optimize in the Optimized section</p> <pre><code>DataSet dsLastWeighing = null; DataSet ds = null; DataSet dsWeight = null; string strQuery = string.Empty; string strWhere = string.Empty; Database db = null; #region Original Code Block try { ...
[ { "answer_id": 419970, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 0, "selected": false, "text": "<p>If C#’s StringBuilder is anything like Java’s StringBuilder then a line like</p>\n\n<pre><code>strMain.append(strQuery+\"...
2009/01/07
[ "https://Stackoverflow.com/questions/419954", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I have following Code Block Which I tried to optimize in the Optimized section ``` DataSet dsLastWeighing = null; DataSet ds = null; DataSet dsWeight = null; string strQuery = string.Empty; string strWhere = string.Empty; Database db = null; #region Original Code Block try { ...
I would suggest: * Use parameterised SQL * Get rid of the catch block, or *at least* use "throw" instead of "throw ex" so you don't lose the information * Get rid of the finally block - it's not helping you * Declare variables when they're first needed, not all at the top of the method * Break the method up into more ...
419,963
<p>I'm trying to parse XML directly from an HTTPS URL, as follows:</p> <pre><code>NSString *const URL = @"https://some/HTTPS/url"; NSURL* url = [NSURL URLWithString:URL]; NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:self]; [parser parse]; </code></pre> <p>I have the follo...
[ { "answer_id": 422592, "author": "Rob Keniger", "author_id": 50122, "author_profile": "https://Stackoverflow.com/users/50122", "pm_score": 2, "selected": false, "text": "<p>You should use NSURLConnection to download the XML data and then parse the output rather than using -initWithConten...
2009/01/07
[ "https://Stackoverflow.com/questions/419963", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2288585/" ]
I'm trying to parse XML directly from an HTTPS URL, as follows: ``` NSString *const URL = @"https://some/HTTPS/url"; NSURL* url = [NSURL URLWithString:URL]; NSXMLParser* parser = [[NSXMLParser alloc] initWithContentsOfURL:url]; [parser setDelegate:self]; [parser parse]; ``` I have the following delegate method for t...
1. None of the initWithContentsOfURL:... methods will allow you to answer the authentication message from the https server. So look at [NSURLConnection](http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSURLConnection_Class/Reference/Reference.html) and [NSURLDownload](http://developer.apple....
419,966
<p>I want to create a parallel object oriented system in QNX using c++ and threads. How do I do this?</p> <p>I tried:</p> <pre><code>pthread_t our_thread_id; pthread_create(&amp;our_thread_id, NULL, &amp;functionA ,NULL); </code></pre> <p>with function A being a pointer to a function:</p> <pre><code>void *functionA...
[ { "answer_id": 420024, "author": "Roger Lipscombe", "author_id": 8446, "author_profile": "https://Stackoverflow.com/users/8446", "pm_score": 2, "selected": false, "text": "<p>See <a href=\"http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2\" rel=\"nofollow noreferrer...
2009/01/07
[ "https://Stackoverflow.com/questions/419966", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to create a parallel object oriented system in QNX using c++ and threads. How do I do this? I tried: ``` pthread_t our_thread_id; pthread_create(&our_thread_id, NULL, &functionA ,NULL); ``` with function A being a pointer to a function: ``` void *functionA() { //do something } ``` However this function on...
See ["How do I pass a pointer-to-member-function to a signal handler, X event callback, system call that starts a thread/task, etc?"](http://www.parashift.com/c++-faq-lite/pointers-to-members.html#faq-33.2). In short, you pass a static function (the "trampoline") as the function pointer. You pass "this" as the user-de...
419,967
<p>I'm wanting to test that a class has an EventHandler assigned to an event. Basically I'm using my IoC Container to hook up EventHandlers for me, and I'm wanting to check they get assigned properly. So really, I'm testing my IoC config.</p> <pre><code>[Test] public void create_person_event_handler_is_hooked_up_by_...
[ { "answer_id": 419983, "author": "Yuval Adam", "author_id": 24545, "author_profile": "https://Stackoverflow.com/users/24545", "pm_score": 0, "selected": false, "text": "<p>Sounds like you are trying to <em>prod</em> some information out of your object in order to <em>assert</em> it is on...
2009/01/07
[ "https://Stackoverflow.com/questions/419967", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12459/" ]
I'm wanting to test that a class has an EventHandler assigned to an event. Basically I'm using my IoC Container to hook up EventHandlers for me, and I'm wanting to check they get assigned properly. So really, I'm testing my IoC config. ``` [Test] public void create_person_event_handler_is_hooked_up_by_windsor() { ...
Not questioning what you pretend with this, the only way of testing and enumerating the registered events is if your register them in your own collection. See this example: ``` public class MyChangePersonService : IChangePersonService { private IList<EventHandler> handlers; private EventHandler _personEvent;...
419,977
<p>Aparently, encoding japanese emails is somewhat challenging, which I am slowly discovering myself. In case there are any experts (even those with limited experience will do), can I please have some guidelines as to how to do it, how to test it and how to verify it?</p> <p>Bear in mind that I've never set foot anywh...
[ { "answer_id": 419987, "author": "Bombe", "author_id": 43582, "author_profile": "https://Stackoverflow.com/users/43582", "pm_score": 3, "selected": false, "text": "<p>Check <a href=\"http://en.wikipedia.org/wiki/MIME#Encoded-Word\" rel=\"noreferrer\">http://en.wikipedia.org/wiki/MIME#Enc...
2009/01/07
[ "https://Stackoverflow.com/questions/419977", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21692/" ]
Aparently, encoding japanese emails is somewhat challenging, which I am slowly discovering myself. In case there are any experts (even those with limited experience will do), can I please have some guidelines as to how to do it, how to test it and how to verify it? Bear in mind that I've never set foot anywhere near J...
I've been dealing with Japanese encodings for almost 20 years and so I can sympathize with your difficulties. Websites that I've worked on send hundreds of emails daily to Japanese customers so I can share with you what's worked for us. * First of all, do not use Shift-JIS. I personally receive tons of Japanese emails...
419,979
<p>In Visual Studio 2003, I am trying to set an environment variable in the pre-build event that will then be used in the compilation step, but the value doesn't seem to be propagated. For example, if the pre-build event contains this (either directly or within a batch file):</p> <pre><code>set MY_LIB_VERSION=1.0.0 <...
[ { "answer_id": 420011, "author": "Timo Geusch", "author_id": 29068, "author_profile": "https://Stackoverflow.com/users/29068", "pm_score": 3, "selected": false, "text": "<p>I must admit that I've never attempted to set environment variables in a pre-build step, and I can see why it would...
2009/01/07
[ "https://Stackoverflow.com/questions/419979", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5536/" ]
In Visual Studio 2003, I am trying to set an environment variable in the pre-build event that will then be used in the compilation step, but the value doesn't seem to be propagated. For example, if the pre-build event contains this (either directly or within a batch file): ``` set MY_LIB_VERSION=1.0.0 ``` and Additi...
You might want to investigate this tool: <http://workspacewhiz.com/SolutionBuildEnvironmentReadme.html> We use it all the time to manage environment variables in our build environment.
419,980
<p>How to change the row position of virtual mode DataGridView?</p> <p>I am using <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow noreferrer">Windows Forms</a>.</p>
[ { "answer_id": 425880, "author": "Marcus Erickson", "author_id": 38373, "author_profile": "https://Stackoverflow.com/users/38373", "pm_score": 2, "selected": false, "text": "<p>You have to clear the old position and set a new one</p>\n\n<p>The collection dataGridView1.SelectedRows has th...
2009/01/07
[ "https://Stackoverflow.com/questions/419980", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11432/" ]
How to change the row position of virtual mode DataGridView? I am using [Windows Forms](http://en.wikipedia.org/wiki/Windows_Forms).
Marcus's answer is correct, but you may also need to set the DataGridView's current cell property... ``` dgv.CurrentCell = dgv.Rows[0].Cells[0]; ``` I believe this will scroll the grid. Also, to be absolutely safe, you may want to add this before the other line of code... ``` dgv.CurrentCell = null; ``` This will...
420,022
<p>Is there something wrong with this code?<br> Sometimes I get an unhandled "Invalid transaction object" exception in it:</p> <pre><code>procedure BlaBla; var TD: TDBXTransaction; begin TD := SQLConnection.BeginTransaction; try SQLConnection.ExecuteDirect('some sql command'); SQLConnection.ExecuteDirect...
[ { "answer_id": 420424, "author": "Craig Stuntz", "author_id": 7714, "author_profile": "https://Stackoverflow.com/users/7714", "pm_score": 2, "selected": false, "text": "<p>What would happen if CommitFreeAndNil threw an exception?</p>\n\n<p>RollbackFreeAndNil would be called. Would TD be ...
2009/01/07
[ "https://Stackoverflow.com/questions/420022", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2089/" ]
Is there something wrong with this code? Sometimes I get an unhandled "Invalid transaction object" exception in it: ``` procedure BlaBla; var TD: TDBXTransaction; begin TD := SQLConnection.BeginTransaction; try SQLConnection.ExecuteDirect('some sql command'); SQLConnection.ExecuteDirect('some sql comm...
The problem is that SQLConnection.BeginTransaction returns nil if SQLConnection is not Connected to the database. And then I get the exception of invalid transaction object. I never expected that. It should try to connect or raise an exception. Returning nil doesn't make sense to me.
420,031
<p>My application heavily uses the UIImage object to change images on a single UIImageView based on user input and the previous image which was set. I use [UIImage imageNamed:] to create my UIImage objects.</p> <p>I guess this is not the best way to use UIImage coz my memory usage keeps increasing with time and never ...
[ { "answer_id": 420098, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 5, "selected": true, "text": "<pre><code>[UIImage imageNamed:] \n</code></pre>\n\n<p>caches the image you're loading into memory. This is great if you w...
2009/01/07
[ "https://Stackoverflow.com/questions/420031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46297/" ]
My application heavily uses the UIImage object to change images on a single UIImageView based on user input and the previous image which was set. I use [UIImage imageNamed:] to create my UIImage objects. I guess this is not the best way to use UIImage coz my memory usage keeps increasing with time and never drops. (Go...
``` [UIImage imageNamed:] ``` caches the image you're loading into memory. This is great if you want to reuse the same set of images over and over again, but if you are constantly showing different (or large) images, then you should use: ``` NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName o...
420,035
<p>Is there any way how to run the setup.exe bootstrapper generated by VS2008 with .NET 2.0 WinForms application on Windows 2000 SP4? If I try to run it, it gives me an error message about missing HeapSetInformation in Kernel32.dll and it doesn't run.</p> <p>I tried to install manually Windows Installer 3.1 and also ....
[ { "answer_id": 420098, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 5, "selected": true, "text": "<pre><code>[UIImage imageNamed:] \n</code></pre>\n\n<p>caches the image you're loading into memory. This is great if you w...
2009/01/07
[ "https://Stackoverflow.com/questions/420035", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20353/" ]
Is there any way how to run the setup.exe bootstrapper generated by VS2008 with .NET 2.0 WinForms application on Windows 2000 SP4? If I try to run it, it gives me an error message about missing HeapSetInformation in Kernel32.dll and it doesn't run. I tried to install manually Windows Installer 3.1 and also .NET 2.0 Fr...
``` [UIImage imageNamed:] ``` caches the image you're loading into memory. This is great if you want to reuse the same set of images over and over again, but if you are constantly showing different (or large) images, then you should use: ``` NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName o...
420,057
<p>Does anyone know where I can go to find the results of usability testing of widely used software? </p> <p>I want to be able to make informed decisions about: </p> <ul> <li>which bits of existing packages to copy in my software</li> <li>how to choose between multiple packages (programs, components, etc). </li> <...
[ { "answer_id": 420098, "author": "rustyshelf", "author_id": 6044, "author_profile": "https://Stackoverflow.com/users/6044", "pm_score": 5, "selected": true, "text": "<pre><code>[UIImage imageNamed:] \n</code></pre>\n\n<p>caches the image you're loading into memory. This is great if you w...
2009/01/07
[ "https://Stackoverflow.com/questions/420057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7211/" ]
Does anyone know where I can go to find the results of usability testing of widely used software? I want to be able to make informed decisions about: * which bits of existing packages to copy in my software * how to choose between multiple packages (programs, components, etc). Really, I would be grateful for anyth...
``` [UIImage imageNamed:] ``` caches the image you're loading into memory. This is great if you want to reuse the same set of images over and over again, but if you are constantly showing different (or large) images, then you should use: ``` NSString *fileLocation = [[NSBundle mainBundle] pathForResource:fileName o...
420,058
<p>How do I copy a symbolic link (and not the file it points to) in a Perl program while preserving all of the symbolic link attributes (such as owner and permissions)?</p>
[ { "answer_id": 420080, "author": "Alnitak", "author_id": 6782, "author_profile": "https://Stackoverflow.com/users/6782", "pm_score": 4, "selected": true, "text": "<p>In Perl you can use the <code>readlink()</code> function to find out the destination of a symlink.</p>\n\n<p>You can also ...
2009/01/07
[ "https://Stackoverflow.com/questions/420058", "https://Stackoverflow.com", "https://Stackoverflow.com/users/46635/" ]
How do I copy a symbolic link (and not the file it points to) in a Perl program while preserving all of the symbolic link attributes (such as owner and permissions)?
In Perl you can use the `readlink()` function to find out the destination of a symlink. You can also use the `lstat()` function to read the permissions of the symlink (as opposed to `stat()` which will read the details of the file pointed to by the symlink). Actually setting the ownership on the new symlink can't be ...
420,067
<p>I need to bind the column Header text of a DataGrid to a Resource string in a XAML file. Does anybody know if this is possible ?</p> <p>The column Header definition looks like this but I would like to replace the "MyHeaderText" with text from a resource file:-</p> <pre><code>&lt;data:DataGridTextColumn Header="MyH...
[ { "answer_id": 420317, "author": "Sorskoot", "author_id": 31722, "author_profile": "https://Stackoverflow.com/users/31722", "pm_score": 0, "selected": false, "text": "<p>Have you tried anything like:</p>\n\n<pre><code>&lt;data:DataGridTextColumn Header=\"{StaticResource SomeData}\" \n ...
2009/01/07
[ "https://Stackoverflow.com/questions/420067", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52408/" ]
I need to bind the column Header text of a DataGrid to a Resource string in a XAML file. Does anybody know if this is possible ? The column Header definition looks like this but I would like to replace the "MyHeaderText" with text from a resource file:- ``` <data:DataGridTextColumn Header="MyHeaderText" Binding="{Bin...
The header presentation area is limited. You can achieve this though by utilizing a string instead of a UIElement. Make sure you have the xmlns for the "System" namespace in your xaml file like so: ``` xmlns:sys="clr-namespace:System;assembly=mscorlib" ``` Then have the following defined in your UserControl's Resour...
420,076
<p>I am trying to get a description in a XUL application to wrap, even if it contains long lines.</p> <p>For example, if I save the following as a .xul file and open it in Firefox, it looks fine and wraps appropriately:</p> <pre><code>&lt;?xml version="1.0"?&gt; &lt;?xml-stylesheet href="chrome://global/skin/" type=...
[ { "answer_id": 436417, "author": "Muxecoid", "author_id": 50194, "author_profile": "https://Stackoverflow.com/users/50194", "pm_score": 3, "selected": true, "text": "<p>Firefox 3.1 supports this: <a href=\"http://www.css3.info/preview/word-wrap/\" rel=\"nofollow noreferrer\">http://www.c...
2009/01/07
[ "https://Stackoverflow.com/questions/420076", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20925/" ]
I am trying to get a description in a XUL application to wrap, even if it contains long lines. For example, if I save the following as a .xul file and open it in Firefox, it looks fine and wraps appropriately: ``` <?xml version="1.0"?> <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> <window id="...
Firefox 3.1 supports this: <http://www.css3.info/preview/word-wrap/> > > The word-wrap property was invented by Microsoft and added to CSS3. It allows long words to be able to be broken and wrap onto the next line. It takes in two values; normal or break-word. > This is currently supported in IE, Safari, and Firefox...
420,095
<p>The trouble here is that I can't declare variables inside a function after the function already has some statements in it. Declaring at the start works fine, but after something, it gives a parse error. For example:</p> <pre><code>int main() { int b; b = sisesta(); float st[b]; return 0; } </code></pre> <p>I'...
[ { "answer_id": 420111, "author": "Raghu", "author_id": 41518, "author_profile": "https://Stackoverflow.com/users/41518", "pm_score": 2, "selected": false, "text": "<p>Dude in C you have to declare all variables at the start. You can't declare between statements </p>\n" }, { "answ...
2009/01/07
[ "https://Stackoverflow.com/questions/420095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The trouble here is that I can't declare variables inside a function after the function already has some statements in it. Declaring at the start works fine, but after something, it gives a parse error. For example: ``` int main() { int b; b = sisesta(); float st[b]; return 0; } ``` I'd like to declare an array...
In C standards before C99, you have to declare your local variables at the beginning of the function. Beginning with C99, this is no longer required. Since Dev-C++ ships with gcc and recent gcc versions do support C99 partially, you can try adding `-std=c99` to the gcc argument list in the Dev-C++ settings to trigger ...
420,099
<pre><code>#include&lt;iostream&gt; class name { public: int a; name():a(0){}; }; void add(name * pname) { pname = NULL; } int main() { name varName(); name * pName = new name(); add(pName); add(&amp;varName);//error C2664: 'add' : cannot convert parameter 1 from 'name __cdecl *)(void)' to '...
[ { "answer_id": 420113, "author": "MiniQuark", "author_id": 38626, "author_profile": "https://Stackoverflow.com/users/38626", "pm_score": 5, "selected": false, "text": "<p>The error is on the first line of the main function:</p>\n\n<pre><code>name varName();\n</code></pre>\n\n<p>You are <...
2009/01/07
[ "https://Stackoverflow.com/questions/420099", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22076/" ]
``` #include<iostream> class name { public: int a; name():a(0){}; }; void add(name * pname) { pname = NULL; } int main() { name varName(); name * pName = new name(); add(pName); add(&varName);//error C2664: 'add' : cannot convert parameter 1 from 'name __cdecl *)(void)' to 'name *' } ```
I think it's worth telling you about a similar problem, that also causes trouble: ``` struct foo { }; struct bar { bar(foo f); }; int main() { // does *not* create a bar object initialized by a default constructed // foo object. bar b(foo()); } ``` What b really is is a function that returns a `bar` and take...
420,103
<p>For a POST method, the W3 specs say:</p> <blockquote> <p>If a resource has been created on the origin server, the response SHOULD be 201 (Created) and contain an entity which describes the status of the request and refers to the new resource, and a Location header (see Section 10.4).</p> </blockquo...
[ { "answer_id": 420207, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 5, "selected": true, "text": "<p>Redirect after post or post/redirect/get is something your application must do to be user friendly.</p>\n\n<p><strong>Edi...
2009/01/07
[ "https://Stackoverflow.com/questions/420103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/50136/" ]
For a POST method, the W3 specs say: > > If a resource has been created on the origin server, the response > SHOULD be 201 (Created) and contain an entity which describes the > status of the request and refers to the new resource, and a Location > header (see Section 10.4). > > > <http://www.ietf.org/internet-...
Redirect after post or post/redirect/get is something your application must do to be user friendly. **Edit**. This is above and beyond the HTTP specifications. If we simply return a 201 after a POST, the browser back button behaves badly. Note that Web Services requests (which do NOT respond to a browser) follow the ...
420,118
<p>I want to make a bookmark of my webpage by using javascript code. I want a javascript code to make a bookmark that should be opened in a new window.</p> <p>I am using firefox. </p>
[ { "answer_id": 420139, "author": "Andreas Grech", "author_id": 44084, "author_profile": "https://Stackoverflow.com/users/44084", "pm_score": 2, "selected": false, "text": "<p>Use this function:</p>\n\n<pre><code>function bookmark_us(url, title){\nif (window.sidebar) // firefox\n windo...
2009/01/07
[ "https://Stackoverflow.com/questions/420118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I want to make a bookmark of my webpage by using javascript code. I want a javascript code to make a bookmark that should be opened in a new window. I am using firefox.
Use this function: ``` function bookmark_us(url, title){ if (window.sidebar) // firefox window.sidebar.addPanel(title, url, ""); else if(window.opera && window.print){ // opera var elem = document.createElement('a'); elem.setAttribute('href',url); elem.setAttribute('title',title); elem.setAttribute...
420,130
<p>I have a ASP.NET GridView that uses template columns and user controls to allow me to dynamically construct the datagrid. Now I'm implementing the event handler for inserting a row. To do that, I create an array of default values and add it to the data table which is acting as a data source. However, when my OnLoad ...
[ { "answer_id": 420489, "author": "craigmoliver", "author_id": 12252, "author_profile": "https://Stackoverflow.com/users/12252", "pm_score": 0, "selected": false, "text": "<p>Do you have the EnableViewState=true on the usercontrols and the GridView?</p>\n" }, { "answer_id": 420522...
2009/01/07
[ "https://Stackoverflow.com/questions/420130", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26140/" ]
I have a ASP.NET GridView that uses template columns and user controls to allow me to dynamically construct the datagrid. Now I'm implementing the event handler for inserting a row. To do that, I create an array of default values and add it to the data table which is acting as a data source. However, when my OnLoad eve...
You have to add the controls to the grid on every page\_load, not just if it's (!Postback)
420,136
<p>I've got the following piece of code in an aspx webpage:</p> <pre><code>Response.Redirect("/Someurl/"); </code></pre> <p>I also want to send a different referrer with the redirect something like:</p> <pre><code>Response.Redirect("/Someurl/", "/previousurl/?message=hello"); </code></pre> <p>Is this possible in As...
[ { "answer_id": 420165, "author": "Rowland Shaw", "author_id": 50447, "author_profile": "https://Stackoverflow.com/users/50447", "pm_score": 0, "selected": false, "text": "<p>The referrer comes solely from the client browser (which may be lying to you, too)</p>\n" }, { "answer_id"...
2009/01/07
[ "https://Stackoverflow.com/questions/420136", "https://Stackoverflow.com", "https://Stackoverflow.com/users/383/" ]
I've got the following piece of code in an aspx webpage: ``` Response.Redirect("/Someurl/"); ``` I also want to send a different referrer with the redirect something like: ``` Response.Redirect("/Someurl/", "/previousurl/?message=hello"); ``` Is this possible in Asp.net or is the referrer handled solely by the br...
Referrer is readonly and meant to be that way. I do not know why you need that but you can send query variables as instead of ``` Response.Redirect("/Someurl/"); ``` you can call ``` Response.Redirect("/Someurl/?message=hello"); ``` and get what you need there, if that helps.
420,143
<p>I'd like to use git to record all the changes to a file. </p> <p>Is there a way I can turn git 'commit' on to automatically happen every time a file is updated - so there is a new commit for every change to a file?</p> <p>Ideally I'd like my users to not even know that git is running behind the scenes. A user coul...
[ { "answer_id": 420160, "author": "Hank Gay", "author_id": 4203, "author_profile": "https://Stackoverflow.com/users/4203", "pm_score": 1, "selected": false, "text": "<p>I'm pretty sure you'd need to hook that into whatever editor your users are using. You could write something to poll for...
2009/01/07
[ "https://Stackoverflow.com/questions/420143", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52416/" ]
I'd like to use git to record all the changes to a file. Is there a way I can turn git 'commit' on to automatically happen every time a file is updated - so there is a new commit for every change to a file? Ideally I'd like my users to not even know that git is running behind the scenes. A user could then potentiall...
On Linux you could use **inotifywait** to automatically execute a command every time a file's content is changed. Edit: the following command commits file.txt as soon as it is saved: ``` inotifywait -q -m -e CLOSE_WRITE --format="git commit -m 'autocommit on change' %w" file.txt | sh ```
420,151
<p>I would like to write an simple application able to retrieve some certain data from another process(application)'s allocated memory.</p> <p>Say I already know a process' id and I would like to obtain a value in this process' memory always from a fixed offset (like 0x523F1C), is this doable in the user-mode, or it h...
[ { "answer_id": 420167, "author": "Vilx-", "author_id": 41360, "author_profile": "https://Stackoverflow.com/users/41360", "pm_score": 0, "selected": false, "text": "<p>There is a <a href=\"http://msdn.microsoft.com/lv-lv/library/ms680553(en-us,VS.85).aspx\" rel=\"nofollow noreferrer\">Rea...
2009/01/07
[ "https://Stackoverflow.com/questions/420151", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52415/" ]
I would like to write an simple application able to retrieve some certain data from another process(application)'s allocated memory. Say I already know a process' id and I would like to obtain a value in this process' memory always from a fixed offset (like 0x523F1C), is this doable in the user-mode, or it has to be i...
Use ReadProcessMemory - you'll need a handle with PROCESS\_VM\_READ access to the other process[1], but if you're an administrator (or possibly, if you have SE\_DEBUG privs) it should be straightforward. ``` BOOL WINAPI ReadProcessMemory( __in HANDLE hProcess, __in LPCVOID lpBaseAddress, __out LPVOID lpBuff...
420,162
<p>I need to execute an entire javascript function.</p> <p>Found what I was doing wrong:</p> <pre><code>var edit = igedit_getById("FG2100RefNo"); var editText = edit.getText(); alert(!isNaN(editText)); </code></pre> <p>But, this only checks &amp; displays a message box.</p> <p>I need to execute the below javascript...
[ { "answer_id": 420170, "author": "xtofl", "author_id": 6610, "author_profile": "https://Stackoverflow.com/users/6610", "pm_score": 1, "selected": false, "text": "<p><a href=\"http://msdn.microsoft.com/en-us/library/khbh432d(VS.80).aspx\" rel=\"nofollow noreferrer\">ATLTrace Tool</a> inte...
2009/01/07
[ "https://Stackoverflow.com/questions/420162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I need to execute an entire javascript function. Found what I was doing wrong: ``` var edit = igedit_getById("FG2100RefNo"); var editText = edit.getText(); alert(!isNaN(editText)); ``` But, this only checks & displays a message box. I need to execute the below javascript: ``` <script language=Javascript> <!-- ...
"File" -> "SaveOutputAs..." let's you save the contents of the output window to a file, but I imagine you want to redirect the output to a file while debugging? I'm still looking for a way to do that myself..
420,185
<p>I need to get the version information of a DLL file I created in Visual&nbsp;Studio&nbsp;2008 C++. How do I get it?</p>
[ { "answer_id": 420189, "author": "frankodwyer", "author_id": 42404, "author_profile": "https://Stackoverflow.com/users/42404", "pm_score": 0, "selected": false, "text": "<p>It should be there in the properties (version tab) when you open it in windows explorer</p>\n" }, { "answer...
2009/01/07
[ "https://Stackoverflow.com/questions/420185", "https://Stackoverflow.com", "https://Stackoverflow.com/users/44521/" ]
I need to get the version information of a DLL file I created in Visual Studio 2008 C++. How do I get it?
Thanks for the answers. This worked for me: ``` WCHAR fileName[_MAX_PATH]; DWORD size = GetModuleFileName(g_dllHandle, fileName, _MAX_PATH); fileName[size] = NULL; DWORD handle = 0; size = GetFileVersionInfoSize(fileName, &handle); BYTE* versionInfo = new BYTE[size]; if (!GetFileVersionInfo(fileName, handle, size, ve...
420,193
<p>I am trying to <em>process</em> a <em>dimension</em> using <strong>SQL Server 2005 Analysis Services</strong>. This has worked in the past without problems but recently fails.</p> <p>The dimension is hierarchical using 4 columns from a single table (the entire cube uses a single table).</p> <p>The error message re...
[ { "answer_id": 420203, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": -1, "selected": true, "text": "<p>See <a href=\"http://msdn.microsoft.com/en-us/library/aa266542(VS.60).aspx\" rel=\"nofollow noreferrer\">Data Access Us...
2009/01/07
[ "https://Stackoverflow.com/questions/420193", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7295/" ]
I am trying to *process* a *dimension* using **SQL Server 2005 Analysis Services**. This has worked in the past without problems but recently fails. The dimension is hierarchical using 4 columns from a single table (the entire cube uses a single table). The error message received (regardless if I process the entire c...
See [Data Access Using Data Access Objects (DAO)](http://msdn.microsoft.com/en-us/library/aa266542(VS.60).aspx) and [Microsoft ActiveX Data Objects (ADO)](http://msdn.microsoft.com/en-us/library/ms675532(VS.85).aspx)
420,275
<p>I'm coding in C# and I have a dictionary with tons of data. One of the members is "children" but when I try to write out its values, I get: System.Object[]</p> <p>I know that children contains data, probably nested data, but I'm unsure if it's a list, dictionary, array, etc.</p> <p>How do I write out all the data ...
[ { "answer_id": 420283, "author": "flq", "author_id": 51428, "author_profile": "https://Stackoverflow.com/users/51428", "pm_score": 2, "selected": false, "text": "<p>The default response of any instantiated .NET type to \"ToString()\" is to write out the fully qualified type name.</p>\n\n...
2009/01/07
[ "https://Stackoverflow.com/questions/420275", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
I'm coding in C# and I have a dictionary with tons of data. One of the members is "children" but when I try to write out its values, I get: System.Object[] I know that children contains data, probably nested data, but I'm unsure if it's a list, dictionary, array, etc. How do I write out all the data within "children"...
The default response of any instantiated .NET type to "ToString()" is to write out the fully qualified type name. System.Object[] means that you have an array where each element is of type "Object". This "box" could contain anything since every type in .NET derives from Object. The following may tell you what the arra...
420,278
<p>Right now I'm using exec to redirect stderr to an error log with</p> <pre><code>exec 2&gt;&gt; ${errorLog} </code></pre> <p>The only downside is that I have to start each run with a timestamp since exec just pushes the text straight into the log file. Is there a way to redirect stderr but allow me to append text t...
[ { "answer_id": 420735, "author": "Johannes Schaub - litb", "author_id": 34509, "author_profile": "https://Stackoverflow.com/users/34509", "pm_score": 5, "selected": true, "text": "<p>This is very interesting. I've asked a guy who knows bash quite well, and he told me this way:</p>\n\n<pr...
2009/01/07
[ "https://Stackoverflow.com/questions/420278", "https://Stackoverflow.com", "https://Stackoverflow.com/users/204/" ]
Right now I'm using exec to redirect stderr to an error log with ``` exec 2>> ${errorLog} ``` The only downside is that I have to start each run with a timestamp since exec just pushes the text straight into the log file. Is there a way to redirect stderr but allow me to append text to it, such as a time stamp?
This is very interesting. I've asked a guy who knows bash quite well, and he told me this way: ``` foo() { while IFS='' read -r line; do echo "$(date) $line" >> file.txt; done; }; ``` First, that creates a function reading one line of raw input from stdin, while the assignment to IFS makes it doesn't ignore blanks....
420,294
<p>I'm trying to get the exact equivalent (not functional) of this vb.net code in F#:</p> <pre><code>Function FastPow(ByVal num As Double, ByVal exp As Integer) As Double Dim res As Double = 1 If exp &lt; 1 Then If exp = 0 Then Return res exp = -exp num = 1 / num End If Do While exp &gt; ...
[ { "answer_id": 420375, "author": "zendar", "author_id": 25732, "author_profile": "https://Stackoverflow.com/users/25732", "pm_score": 0, "selected": false, "text": "<p>It means that after <code>then</code> there should be some expression, but you have integer value. You cannot jump out f...
2009/01/07
[ "https://Stackoverflow.com/questions/420294", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38561/" ]
I'm trying to get the exact equivalent (not functional) of this vb.net code in F#: ``` Function FastPow(ByVal num As Double, ByVal exp As Integer) As Double Dim res As Double = 1 If exp < 1 Then If exp = 0 Then Return res exp = -exp num = 1 / num End If Do While exp > 1 If exp Mod 2...
In F#, a function's return value is the last expression evaluated in the function. So, lets focus on the following: ``` if ex < 1 then if ex = 0 then res (* <--- this is not an early return *) ex <- -ex (* <--- F# evaluates this code after the *) n <- 1 / n (* if sta...
420,299
<p>I have a table that has a list of restaurant names and links to another table that holds the cuisine type.</p> <p>I want to provide a search box on my web page that when typing, each word is searched for in the database and results returned. I was looking for a solution that doesn't involve setting up sql full text...
[ { "answer_id": 420311, "author": "friism", "author_id": 2942, "author_profile": "https://Stackoverflow.com/users/2942", "pm_score": 2, "selected": false, "text": "<p>I don't how know this will affect your testing, but LinqtoSQL can be made to work with full-text indexing with a few wiggl...
2009/01/07
[ "https://Stackoverflow.com/questions/420299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/33054/" ]
I have a table that has a list of restaurant names and links to another table that holds the cuisine type. I want to provide a search box on my web page that when typing, each word is searched for in the database and results returned. I was looking for a solution that doesn't involve setting up sql full text search as...
You could use full text search and still use LINQ to SQL. You can create a stored procedure and have LINQ call it. In addition to finding exact matches you could return: * Simple searches for specific words or phrases * Thesaurus searches for synonymous forms of word – a search on IE might return hits to Internet Expl...
420,300
<p>The following does not work in this particular case, complaining that whatever you give it is not a character.</p> <pre><code>(handler-bind ((sb-int:character-coding-error #'(lambda (c) (invoke-restart 'use-value #\?)))) (sb-ext:octets-to-string *euc-jp* :external-format :...
[ { "answer_id": 422068, "author": "Matthias Benkard", "author_id": 15517, "author_profile": "https://Stackoverflow.com/users/15517", "pm_score": 0, "selected": false, "text": "<p>It works for me:</p>\n\n<pre><code>CL-USER&gt; (handler-bind ((sb-int:character-coding-error\n ...
2009/01/07
[ "https://Stackoverflow.com/questions/420300", "https://Stackoverflow.com", "https://Stackoverflow.com/users/52433/" ]
The following does not work in this particular case, complaining that whatever you give it is not a character. ``` (handler-bind ((sb-int:character-coding-error #'(lambda (c) (invoke-restart 'use-value #\?)))) (sb-ext:octets-to-string *euc-jp* :external-format :euc-jp)) ``` ...
There's an expression in SBCL 1.0.18's `mb-util.lisp` that looks like this: ``` (if code (code-char code) (decoding-error array pos (+ pos bytes) ,format ',malformed pos)) ``` I'm not very familiar with SBCL's internals, but this looks like a bug. The consequent returns a character, while...
420,304
<p>Does anyone know how to maintain text formatting when using XPath to extract data?</p> <p>I am currently extracting all blocks</p> <p><code> &lt;div class="info"&gt; &lt;h5&gt;title&lt;/h5&gt; text &lt;a href="somelink"&gt;anchor&lt;/a&gt; &lt;/div&gt; </code></p> <p>from a page. The problem is when I access the ...
[ { "answer_id": 420323, "author": "Ciaran McNulty", "author_id": 34024, "author_profile": "https://Stackoverflow.com/users/34024", "pm_score": 3, "selected": true, "text": "<p>If you have it as a DomElement $element as part of a DomDocument $dom then you will want to do something like:</p...
2009/01/07
[ "https://Stackoverflow.com/questions/420304", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Does anyone know how to maintain text formatting when using XPath to extract data? I am currently extracting all blocks `<div class="info"> <h5>title</h5> text <a href="somelink">anchor</a> </div>` from a page. The problem is when I access the nodeValue, I can only get plain text. How can I capture the contents incl...
If you have it as a DomElement $element as part of a DomDocument $dom then you will want to do something like: ``` $string = $dom->saveXml($element); ``` The NodeValue of an element is really the textual value, not the structured XML.
420,310
<p>Using Amazon's own <a href="http://developer.amazonwebservices.com/connect/entry.jspa?externalID=552&amp;categoryID=187" rel="nofollow noreferrer">client libraries</a> (or <a href="http://code.google.com/p/typica/" rel="nofollow noreferrer">alternatives</a>), you can get listings of available pre-packaged AMIs, but ...
[ { "answer_id": 420323, "author": "Ciaran McNulty", "author_id": 34024, "author_profile": "https://Stackoverflow.com/users/34024", "pm_score": 3, "selected": true, "text": "<p>If you have it as a DomElement $element as part of a DomDocument $dom then you will want to do something like:</p...
2009/01/07
[ "https://Stackoverflow.com/questions/420310", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29903/" ]
Using Amazon's own [client libraries](http://developer.amazonwebservices.com/connect/entry.jspa?externalID=552&categoryID=187) (or [alternatives](http://code.google.com/p/typica/)), you can get listings of available pre-packaged AMIs, but the interface is definitely designed for scriptability, not readability. [Elastic...
If you have it as a DomElement $element as part of a DomDocument $dom then you will want to do something like: ``` $string = $dom->saveXml($element); ``` The NodeValue of an element is really the textual value, not the structured XML.
420,337
<p>I'm concerned about the third parameter in this overload, validateImageData. The documentation doesn't explain much about it, it only states that it causes the image data to be validated but no details, what exactly is done to validate the image data?</p> <pre><code>public static Image FromStream ( Stream strea...
[ { "answer_id": 420366, "author": "Lasse V. Karlsen", "author_id": 267, "author_profile": "https://Stackoverflow.com/users/267", "pm_score": 0, "selected": false, "text": "<p>Why not just try and see what happens with that flag set and not set?</p>\n\n<p>In either case you should handle a...
2009/01/07
[ "https://Stackoverflow.com/questions/420337", "https://Stackoverflow.com", "https://Stackoverflow.com/users/676066/" ]
I'm concerned about the third parameter in this overload, validateImageData. The documentation doesn't explain much about it, it only states that it causes the image data to be validated but no details, what exactly is done to validate the image data? ``` public static Image FromStream ( Stream stream, bool us...
From Reflector, we see: ``` if (validateImageData) { num = SafeNativeMethods.Gdip.GdipImageForceValidation(new HandleRef(null, zero)); if (num != 0) { SafeNativeMethods.Gdip.GdipDisposeImage(new HandleRef(null, zero)); throw SafeNativeMethods.Gdip.StatusException(num); } } ``` So we s...
420,350
<ul> <li><p>environment: linux, userspace-application created via g++ from a couple of C++ files (result is an ELF)</p></li> <li><p>there is a problem (SIGSEGV) when traversing the constructor list </p></li> </ul> <pre> ( __CTOR_LIST__ ) </pre> <p>(note: code called via this list is a kind of system initialisatio...
[ { "answer_id": 420402, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 1, "selected": false, "text": "<p>It's possible that you're being bitten by the so-called \"Static Initialization Order Fiasco\".</p>\n\n<p>Basic...
2009/01/07
[ "https://Stackoverflow.com/questions/420350", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
* environment: linux, userspace-application created via g++ from a couple of C++ files (result is an ELF) * there is a problem (SIGSEGV) when traversing the constructor list ``` ( __CTOR_LIST__ ) ``` (note: code called via this list is a kind of system initialisation for every class, *not* the constructor-cod...
There are many possible reasons of this. Ranges from that you access objects not yet created (because order of creation of objects across different translation units is undefined) which i think is quite probable in this case, and ranges to an error on your build-environment. To make a own function be called before ot...
420,352
<p>With <code>:limit</code> in query, I will get first N records. What is the easiest way to get last N records?</p>
[ { "answer_id": 420370, "author": "frankodwyer", "author_id": 42404, "author_profile": "https://Stackoverflow.com/users/42404", "pm_score": -1, "selected": false, "text": "<p>Add an :order parameter to the query</p>\n" }, { "answer_id": 420415, "author": "Dan McNevin", "au...
2009/01/07
[ "https://Stackoverflow.com/questions/420352", "https://Stackoverflow.com", "https://Stackoverflow.com/users/30958/" ]
With `:limit` in query, I will get first N records. What is the easiest way to get last N records?
Updated Answer (2020) --------------------- You can get last N records simply by using [last](https://apidock.com/rails/ActiveRecord/FinderMethods/last) method: `Record.last(N)` Example: `User.last(5)` Returns 5 users in descending order by their id. Deprecated (Old Answer) ----------------------- An active reco...
420,362
<p>Can someone explain the syntax in the source attribute here? What the heck is "pack:" and "application:" and why 3 commas? I couldn't find any decent desciptions.</p>
[ { "answer_id": 420370, "author": "frankodwyer", "author_id": 42404, "author_profile": "https://Stackoverflow.com/users/42404", "pm_score": -1, "selected": false, "text": "<p>Add an :order parameter to the query</p>\n" }, { "answer_id": 420415, "author": "Dan McNevin", "au...
2009/01/07
[ "https://Stackoverflow.com/questions/420362", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47118/" ]
Can someone explain the syntax in the source attribute here? What the heck is "pack:" and "application:" and why 3 commas? I couldn't find any decent desciptions.
Updated Answer (2020) --------------------- You can get last N records simply by using [last](https://apidock.com/rails/ActiveRecord/FinderMethods/last) method: `Record.last(N)` Example: `User.last(5)` Returns 5 users in descending order by their id. Deprecated (Old Answer) ----------------------- An active reco...
420,380
<p>I am wondering why the link to profile looks like: </p> <pre><code>http://stackoverflow.com/users/ID/NAME </code></pre> <p>not simply:</p> <pre><code>http://stackoverflow.com/users/ID </code></pre> <p>or even better:</p> <pre><code>http://stackoverflow.com/users/NAME </code></pre> <p>Can there be couple users ...
[ { "answer_id": 420390, "author": "roryf", "author_id": 270, "author_profile": "https://Stackoverflow.com/users/270", "pm_score": 2, "selected": false, "text": "<p>I would assume doing a database lookup solely on the name string would be more expensive than a numerical lookup on the prima...
2009/01/07
[ "https://Stackoverflow.com/questions/420380", "https://Stackoverflow.com", "https://Stackoverflow.com/users/37086/" ]
I am wondering why the link to profile looks like: ``` http://stackoverflow.com/users/ID/NAME ``` not simply: ``` http://stackoverflow.com/users/ID ``` or even better: ``` http://stackoverflow.com/users/NAME ``` Can there be couple users with the same name? Or can one user have many names?
All SO-URLs are of the form id/description where the ID is unique and the description is optional. So [`/users/12890/arne-burmeister`](https://stackoverflow.com/users/12890/arne.burmeister) is the same as [`/users/12890/huhu`](https://stackoverflow.com/users/12890/huhu) and [`/questions/420380/why-does-the-link-to-the-...
420,386
<p>I'm trying to create a DataGridTableStyle object so that I can control the column widths of a DataGrid. I've created a BindingSource object bound to a List. Actually it's bound to an anonymous type list created though Linq in the following manner (variable names changed for clarity of what I'm doing):</p> <pre><cod...
[ { "answer_id": 420406, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>The query returns <code>IEnumerable&lt;T&gt;</code> for some <code>T</code>, but most binding sources (except ASP....
2009/01/07
[ "https://Stackoverflow.com/questions/420386", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9732/" ]
I'm trying to create a DataGridTableStyle object so that I can control the column widths of a DataGrid. I've created a BindingSource object bound to a List. Actually it's bound to an anonymous type list created though Linq in the following manner (variable names changed for clarity of what I'm doing): ``` List<myType>...
I've found the way to make this work. I'll break it out into sections... --- ``` List<myType> myList = new List<myType>(someCapacity); . ...populate the list with query from database... . ``` --- ``` DataGridTableStyle myDataGridTableStyle = new DatGridtTableStyle(); DataGridTextBoxColumn colA = new DataGridTextBo...
420,396
<p>Im trying to get pretty.js to prettify code in CODE tags, using this js:</p> <pre><code>onload_functions.push(function() { var node_list=document.getElementsByTagName('code'); for (i=0; i &lt; node_list.length; i++) { node_list[i].setAttribute('class','prettyprint'); } prettyPrint(); }); </c...
[ { "answer_id": 420453, "author": "phihag", "author_id": 35070, "author_profile": "https://Stackoverflow.com/users/35070", "pm_score": 1, "selected": true, "text": "<p>If the code element has any other class names, this will yield chaos in IE. Using the (IE-specific) JavaScript property <...
2009/01/07
[ "https://Stackoverflow.com/questions/420396", "https://Stackoverflow.com", "https://Stackoverflow.com/users/428/" ]
Im trying to get pretty.js to prettify code in CODE tags, using this js: ``` onload_functions.push(function() { var node_list=document.getElementsByTagName('code'); for (i=0; i < node_list.length; i++) { node_list[i].setAttribute('class','prettyprint'); } prettyPrint(); }); ``` This works fin...
If the code element has any other class names, this will yield chaos in IE. Using the (IE-specific) JavaScript property `className` will likely work. I commented on the `onload` function on your website. Btw, the way you embed the JavaScript it will break future standard-compatible browsers, see the [W3C validator's ou...
420,404
<p>I found this statement is some old code and it took me a second to figure out...</p> <pre><code>IsTestActive = (TestStateID == 1 ? true : false); </code></pre> <p>Please correct me if I'm wrong but isn't this the same as this one?:</p> <pre><code>IsTestActive = (TestStateID == 1); </code></pre> <p>If it is, why ...
[ { "answer_id": 420408, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 6, "selected": true, "text": "<p>Yes, it is exactly the same.</p>\n\n<p>Yes, the latter is more readable.</p>\n" }, { "answer_id": 420411...
2009/01/07
[ "https://Stackoverflow.com/questions/420404", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23855/" ]
I found this statement is some old code and it took me a second to figure out... ``` IsTestActive = (TestStateID == 1 ? true : false); ``` Please correct me if I'm wrong but isn't this the same as this one?: ``` IsTestActive = (TestStateID == 1); ``` If it is, why would you ever want to use the first? Which one i...
Yes, it is exactly the same. Yes, the latter is more readable.
420,410
<p>I.e.:</p> <pre><code>echo H#97llo | MagicPerlCommand </code></pre> <p>Stdout:</p> <pre><code>Hallo </code></pre> <p>were MagicPerlCommand is something like </p> <pre><code>perl -pnle "s/#(\d+)/chr(\1)/ge" </code></pre> <p>(but that doesn't work).</p>
[ { "answer_id": 420420, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 4, "selected": true, "text": "<p>Change <code>\\1</code> to <code>$1</code> in your MagicPerlCommand. The <code>\\digit</code> backreference sty...
2009/01/07
[ "https://Stackoverflow.com/questions/420410", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4085/" ]
I.e.: ``` echo H#97llo | MagicPerlCommand ``` Stdout: ``` Hallo ``` were MagicPerlCommand is something like ``` perl -pnle "s/#(\d+)/chr(\1)/ge" ``` (but that doesn't work).
Change `\1` to `$1` in your MagicPerlCommand. The `\digit` backreference style doesn't t work when the replacement expression is evaluated (i.e. `s///e`). That worked for me on Windows and Linux.
420,412
<p>How Can I change an Image (its an OLE Object) in a Crystal report using C#?</p>
[ { "answer_id": 605894, "author": "Axarydax", "author_id": 72746, "author_profile": "https://Stackoverflow.com/users/72746", "pm_score": 1, "selected": false, "text": "<p>Suppose you have your image in a Bitmap object,\nsave it to MemoryStream in Bitmap format,<br>\nCreate a DataSource, c...
2009/01/07
[ "https://Stackoverflow.com/questions/420412", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
How Can I change an Image (its an OLE Object) in a Crystal report using C#?
you can add CRAXDRT.dll and CrystalDecisions.Shared.dll to your references then you can use this code: ``` CRAXDRT.Report report2 = new CRAXDRT.Report(); CRAXDRT.Application app2 = new CRAXDRT.Application(); report2 = app2.OpenReport("YourReportName.rpt", OpenReportMetho...
420,423
<p>I tried two ways of catching unexpected unhandled exceptions:</p> <pre><code>static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ErrorHandler.HandleException); Application.EnableVisualStyles(); Applicatio...
[ { "answer_id": 420431, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": false, "text": "<p>I take it that you have an exception in your Form's <code>OnLoad</code> method or <code>Load</code> event, then. T...
2009/01/07
[ "https://Stackoverflow.com/questions/420423", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40872/" ]
I tried two ways of catching unexpected unhandled exceptions: ``` static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ErrorHandler.HandleException); Application.EnableVisualStyles(); Application.SetCompatibl...
I should handle System.Windows.Forms.Application.ThreadException - then it works.
420,429
<p>In a C# console application, is there a smart way to have console output mirrored to a text file?</p> <p>Currently I am just passing the same string to both <code>Console.WriteLine</code> and <code>InstanceOfStreamWriter.WriteLine</code> in a log method.</p>
[ { "answer_id": 420459, "author": "tvanfosson", "author_id": 12950, "author_profile": "https://Stackoverflow.com/users/12950", "pm_score": 4, "selected": false, "text": "<p>Check out <a href=\"http://logging.apache.org/log4net/index.html\" rel=\"noreferrer\">log4net</a>. With log4net you...
2009/01/07
[ "https://Stackoverflow.com/questions/420429", "https://Stackoverflow.com", "https://Stackoverflow.com/users/82/" ]
In a C# console application, is there a smart way to have console output mirrored to a text file? Currently I am just passing the same string to both `Console.WriteLine` and `InstanceOfStreamWriter.WriteLine` in a log method.
This may be some kind of more work, but I would go the other way round. Instantiate a `TraceListener` for the console and one for the log file; thereafter use `Trace.Write` statements in your code instead of `Console.Write`. It becomes easier afterwards to remove the log, or the console output, or to attach another lo...
420,433
<p>Kicking around some small structures while answering <a href="https://stackoverflow.com/questions/414981/directly-modifying-listt-elements">this post</a>, I came across the following unexpectedly:</p> <p>The following structure, using an int field is perfectly legal:</p> <pre><code>struct MyStruct { public My...
[ { "answer_id": 420441, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 7, "selected": true, "text": "<p>From C# 6 onward: this is no longer a problem</p>\n\n<hr>\n\n<p>Becore C# 6, you need to call the default construc...
2009/01/07
[ "https://Stackoverflow.com/questions/420433", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10429/" ]
Kicking around some small structures while answering [this post](https://stackoverflow.com/questions/414981/directly-modifying-listt-elements), I came across the following unexpectedly: The following structure, using an int field is perfectly legal: ``` struct MyStruct { public MyStruct ( int size ) { ...
From C# 6 onward: this is no longer a problem --- Becore C# 6, you need to call the default constructor for this to work: ``` public MyStruct(int size) : this() { Size = size; } ``` A bigger problem here is that you have a mutable struct. This is **never** a good idea. I would make it: ``` public int Size { g...
420,442
<h3>Background Information</h3> <p>For saving out crash dumps, I have a script passed to <code>cdb.exe</code> in the <code>Debugger</code> value of the <code>AeDebug</code> registry key:</p> <pre><code>C:\progra~1\debugg~1\cdb.exe -p %ld -e %ld -g -y SRV*c:\mss*http://msdl.microsoft.com/download/symbols -c "$&lt;d:\t...
[ { "answer_id": 793431, "author": "Mark", "author_id": 37923, "author_profile": "https://Stackoverflow.com/users/37923", "pm_score": 0, "selected": false, "text": "<p><code>ntdll.dll</code> will be present in every process, so I'm guessing the problem is symbol loading.</p>\n\n<p>Anyway, ...
2009/01/07
[ "https://Stackoverflow.com/questions/420442", "https://Stackoverflow.com", "https://Stackoverflow.com/users/28950/" ]
### Background Information For saving out crash dumps, I have a script passed to `cdb.exe` in the `Debugger` value of the `AeDebug` registry key: ``` C:\progra~1\debugg~1\cdb.exe -p %ld -e %ld -g -y SRV*c:\mss*http://msdl.microsoft.com/download/symbols -c "$<d:\tgticker\Dumps\RDFD.cdbscript" ``` Here is the first p...
So here I am years later with an answer. The Answer ========== In the absence of symbol files, this is the best way I've found to get the name of the executable that crashed so that it can be used in a filename for writing a log file or crash dump from a script: ``` aS ${/v:CrashFirstModule} "UnknownModule" .foreach...
420,456
<p>Is there something similar to the "Open Command Window Here" Windows Powertoy for Mac OS? I've found a couple plugins through a google search but wanted to see what works best for developers out there.</p>
[ { "answer_id": 420501, "author": "Henrik Hartz", "author_id": 50830, "author_profile": "https://Stackoverflow.com/users/50830", "pm_score": 3, "selected": false, "text": "<p>Also, you can copy an item from the finder using command-C, jump into the Terminal (e.g. using Spotlight or QuickS...
2009/01/07
[ "https://Stackoverflow.com/questions/420456", "https://Stackoverflow.com", "https://Stackoverflow.com/users/47110/" ]
Is there something similar to the "Open Command Window Here" Windows Powertoy for Mac OS? I've found a couple plugins through a google search but wanted to see what works best for developers out there.
As of Mac OS X Lion 10.7, Terminal includes exactly this functionality as a Service. As with most Services, these are disabled by default, so you'll need to enable this to make it appear in the Services menu. > > System Preferences > Keyboard > Shortcuts > Services > > > Enable **New Terminal at Folder**. There's...
420,483
<p>I found <a href="http://www.ajaxpro.info/" rel="nofollow noreferrer">this AJAX .NET framework</a> the other day, and so far I am enjoying working with it. However, one thing I can't figure out (the documentation is rather poor atm) is how to pass variables through the AJAX script. This is what I have so far:</p> ...
[ { "answer_id": 420779, "author": "Zhaph - Ben Duguid", "author_id": 33051, "author_profile": "https://Stackoverflow.com/users/33051", "pm_score": 0, "selected": false, "text": "<p>It's been a while since I used that framework (version 6.9.22.2, so things may have changed a little) - have...
2009/01/07
[ "https://Stackoverflow.com/questions/420483", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
I found [this AJAX .NET framework](http://www.ajaxpro.info/) the other day, and so far I am enjoying working with it. However, one thing I can't figure out (the documentation is rather poor atm) is how to pass variables through the AJAX script. This is what I have so far: ``` //default2.aspx.vb <AjaxPro.AjaxMethod()...
With AjaxPro you pass the parameters first and a callback function as the last parameter. If you use an anonymous function here you can get access to both the response and the original value. It would looks something like this: ``` function doTest(x){ Default2.testSomething(x, function(res){ doTest_callbac...
420,484
<p>The following code is suppose to open CMD from my C# application and open the file text.txt.</p> <p>I tried to set the file path as an environment variable but when notepad opens it looks for %file%.txt instead of text.txt</p> <p>Any idea why?</p> <pre><code>System.Diagnostics.Process proc = new System.Diagnostic...
[ { "answer_id": 420494, "author": "Joe", "author_id": 13087, "author_profile": "https://Stackoverflow.com/users/13087", "pm_score": 1, "selected": false, "text": "<p>One obvious problem is that you have UseShellExecute set false. This means you are executing notepad directly without pass...
2009/01/07
[ "https://Stackoverflow.com/questions/420484", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
The following code is suppose to open CMD from my C# application and open the file text.txt. I tried to set the file path as an environment variable but when notepad opens it looks for %file%.txt instead of text.txt Any idea why? ``` System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.En...
If your purpose is to start the editor with a .txt file (like the title of the question says) just use: ``` Process.Start("C:\\text.txt") ```
420,515
<p>I'll admit I'm completely dumbed by python install. Can someone help me on how to install module</p> <p>I want to play with PyGame, PyOpenGL etc. So I install them, but I everytime I type "import pygame" error message shows up.</p> <p>here's my environment so far.</p> <p>In .bash_profile</p> <pre><code>PATH=${PA...
[ { "answer_id": 420543, "author": "Alex Fort", "author_id": 12624, "author_profile": "https://Stackoverflow.com/users/12624", "pm_score": 1, "selected": false, "text": "<p>I'm not a huge fan of the default python install on OS X in the first place, mostly because it's usually a pretty old...
2009/01/07
[ "https://Stackoverflow.com/questions/420515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9774/" ]
I'll admit I'm completely dumbed by python install. Can someone help me on how to install module I want to play with PyGame, PyOpenGL etc. So I install them, but I everytime I type "import pygame" error message shows up. here's my environment so far. In .bash\_profile ``` PATH=${PATH}:/System/Library/Frameworks/Pyt...
I'm not a huge fan of the default python install on OS X in the first place, mostly because it's usually a pretty old version. I find everything works better if I use the macports package. easy\_install seems to work better with the macports package, but maybe that's just because I'm too lazy to figure out all the nua...
420,533
<p>If I am using JAXB as part of Metro Web Services under Glassfish v2, how do tell JAXB to add: </p> <pre><code> &lt;xsd:any/&gt; and &lt;xsd:anyAttribute/&gt; </code></pre> <p>tags to my generated complex types so that if I make changes in the future to add elements or attributes to my response objects then my curr...
[ { "answer_id": 420564, "author": "Michael Haren", "author_id": 29, "author_profile": "https://Stackoverflow.com/users/29", "pm_score": 0, "selected": false, "text": "<p>If you decide to roll your own, <a href=\"http://searchsqlserver.techtarget.com/tip/0,289483,sid87_gci1327798,00.html\"...
2009/01/07
[ "https://Stackoverflow.com/questions/420533", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1126/" ]
If I am using JAXB as part of Metro Web Services under Glassfish v2, how do tell JAXB to add: ``` <xsd:any/> and <xsd:anyAttribute/> ``` tags to my generated complex types so that if I make changes in the future to add elements or attributes to my response objects then my current clients won't break. JAXB documen...
I tried the built-in log shipping and found some real problems with it so I developed my own. I blogged about it [here](http://sqlblogcasts.com/blogs/davidwimbush/archive/2009/07/05/roll-your-own-log-shipping.aspx). PS: And just for the record, you definitely get log shipping in the Workgoup edition. I don't know wher...
420,538
<p>So i am building an application that will have lots of windows, all with the same basic layout:</p> <ol> <li>A main Window</li> <li>A logo in the top corner</li> <li>A title block</li> <li>A status displayer down the bottom</li> <li>An area for window specific controls.</li> </ol> <p>At the moment i have to recrea...
[ { "answer_id": 420558, "author": "Stephen Wrighton", "author_id": 7516, "author_profile": "https://Stackoverflow.com/users/7516", "pm_score": -1, "selected": false, "text": "<p>why exactly are you using \"lots of windows?\" Why not just a single window with a tab control? Or a single w...
2009/01/07
[ "https://Stackoverflow.com/questions/420538", "https://Stackoverflow.com", "https://Stackoverflow.com/users/38438/" ]
So i am building an application that will have lots of windows, all with the same basic layout: 1. A main Window 2. A logo in the top corner 3. A title block 4. A status displayer down the bottom 5. An area for window specific controls. At the moment i have to recreate this structure in every window. Ideally i want t...
You can create a new ControlTemplate that targets a window to accomplish this as shown below. ``` <ControlTemplate x:Key="WindowControlTemplate1" TargetType="{x:Type Window}"> <Border Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{...
420,554
<p>After a large SQL Query is run that is built through my ASPX Pages I see the following two items listed in sql profiler.</p> <pre><code> Event Class TextData ApplicationName CPU Reads Writes SQL:BatchCompleted Select N'Testing Connection....
[ { "answer_id": 420573, "author": "Rich", "author_id": 28442, "author_profile": "https://Stackoverflow.com/users/28442", "pm_score": 2, "selected": false, "text": "<p>SQL Server 2008 has a new \"Resource Governor\" that may help. I don't know if you're using SQL Server 2008 or not but you...
2009/01/07
[ "https://Stackoverflow.com/questions/420554", "https://Stackoverflow.com", "https://Stackoverflow.com/users/29515/" ]
After a large SQL Query is run that is built through my ASPX Pages I see the following two items listed in sql profiler. ``` Event Class TextData ApplicationName CPU Reads Writes SQL:BatchCompleted Select N'Testing Connection...' ...
No, it takes 1609 milliseconds of CPU in total. What is the duration? I bet the same or slighty more because I doubt SQL Agent queries use parallelism. Are you trying to reduce background processes using CPU? If so, then you reduce functionality by disabling SQL Agent (no backups then for example) and restarting SQL S...
420,569
<p>In WCF, contracts can be switched to streaming mode, to transfer large messages.</p> <p>After reading and testing it seems to me, that streaming mode can not be used with duplex channels (channels with OneWay-calls and a callback interface).</p> <p>Is this so? Do duplex and streaming can not be used with each othe...
[ { "answer_id": 453555, "author": "Sailing Judo", "author_id": 42620, "author_profile": "https://Stackoverflow.com/users/42620", "pm_score": 2, "selected": false, "text": "<p>Out of curiosity I was about to start some testing on your question but then Google revealed to me the two samples...
2009/01/07
[ "https://Stackoverflow.com/questions/420569", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
In WCF, contracts can be switched to streaming mode, to transfer large messages. After reading and testing it seems to me, that streaming mode can not be used with duplex channels (channels with OneWay-calls and a callback interface). Is this so? Do duplex and streaming can not be used with each other? Or is there a ...
to load the file from the client to the server, you can use the following code: service ``` [ServiceContract(SessionMode=SessionMode.Required, CallbackContract=typeof(IFreeBoxServiceCallBack))] public interface IFreeBoxService { [OperationContract(IsOneWay = true)] void sendFile(byte[] bytes, ...
420,623
<p>In My Asp.net webpage I need to display today's date into one of the textbox , so in my form load I wrote the following code </p> <pre><code>textbox1.text = System.DateTime.Today.ToShortDateString(); </code></pre> <p>this line is giving me date like 1/7/09 but I want date like 01/07/09 , Is there anyway I can c...
[ { "answer_id": 420633, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": "<pre><code> DateTime.Today.ToString(\"MM/dd/yy\")\n</code></pre>\n\n<p>Look at the docs for <a href=\"http://msdn.microso...
2009/01/07
[ "https://Stackoverflow.com/questions/420623", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14299/" ]
In My Asp.net webpage I need to display today's date into one of the textbox , so in my form load I wrote the following code ``` textbox1.text = System.DateTime.Today.ToShortDateString(); ``` this line is giving me date like 1/7/09 but I want date like 01/07/09 , Is there anyway I can conver this date into mm/dd/yy...
``` DateTime.Today.ToString("MM/dd/yy") ``` Look at the docs for [custom date and time format strings](http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx) for more info. (Oh, and I hope this app isn't destined for other cultures. That format could really confuse a lot of people... I've never understood the whole...
420,662
<p>Is there any way to serialize a property with an internal setter in C#?<br> I understand that this might be problematic - but if there is a way - I would like to know.</p> <p><strong>Example:</strong></p> <pre><code>[Serializable] public class Person { public int ID { get; internal set; } public string Nam...
[ { "answer_id": 420689, "author": "Stormenet", "author_id": 2090, "author_profile": "https://Stackoverflow.com/users/2090", "pm_score": 2, "selected": false, "text": "<p>I think that <strike>the only alternative</strike> one way is to implement <a href=\"http://www.developerfusion.com/cod...
2009/01/07
[ "https://Stackoverflow.com/questions/420662", "https://Stackoverflow.com", "https://Stackoverflow.com/users/936/" ]
Is there any way to serialize a property with an internal setter in C#? I understand that this might be problematic - but if there is a way - I would like to know. **Example:** ``` [Serializable] public class Person { public int ID { get; internal set; } public string Name { get; set; } public int Age ...
If it is an option, [`DataContractSerializer`](https://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractserializer(v=vs.110).aspx) (.NET 3.0) can serialize non-public properties: ``` [DataContract] public class Person { [DataMember] public int ID { get; internal set; } [DataMember]...
420,671
<p>I'd like to edit my Sharepoint Wiki content programmatically. One of the advantages would be to add indexes to the Wiki environment automatically.</p> <p>Has anyone been able to do this? Language doesn't matter, but looking for scripting solution. </p>
[ { "answer_id": 420872, "author": "DylanW", "author_id": 13463, "author_profile": "https://Stackoverflow.com/users/13463", "pm_score": 3, "selected": true, "text": "<p>A SharePoint wiki is just a special type of document library. There's just a few oddities I've run into when trying to do...
2009/01/07
[ "https://Stackoverflow.com/questions/420671", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21275/" ]
I'd like to edit my Sharepoint Wiki content programmatically. One of the advantages would be to add indexes to the Wiki environment automatically. Has anyone been able to do this? Language doesn't matter, but looking for scripting solution.
A SharePoint wiki is just a special type of document library. There's just a few oddities I've run into when trying to do this. A SharePoint wiki page consists of a template file and a list item. When you view the page, fields from the list item are inserted into the template file. So to update a wiki page, you just h...
420,703
<h2>Here's my custom filter:</h2> <pre><code>from django import template register = template.Library() @register.filter def replace(value, cherche, remplacement): return value.replace(cherche, remplacement) </code></pre> <h2>and here are the ways I tried using it in my template file that resulted in an error:</...
[ { "answer_id": 420738, "author": "bchhun", "author_id": 48500, "author_profile": "https://Stackoverflow.com/users/48500", "pm_score": 2, "selected": false, "text": "<p>This feature has been marked as WONTFIX in 2013 Django's Trac: <a href=\"http://code.djangoproject.com/ticket/1199\" rel...
2009/01/07
[ "https://Stackoverflow.com/questions/420703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/48500/" ]
Here's my custom filter: ------------------------ ``` from django import template register = template.Library() @register.filter def replace(value, cherche, remplacement): return value.replace(cherche, remplacement) ``` and here are the ways I tried using it in my template file that resulted in an error: -----...
It is possible and fairly simple. Django only allows one argument to your filter, but there's no reason you can't put all your arguments into a single string using a comma to separate them. So for example, if you want a filter that checks if variable X is in the list [1,2,3,4] you will want a template filter that loo...
420,705
<p><strong>SETUP</strong></p> <p>I have to insert a couple million rows in either SQL Server 2000/2005, MySQL, or Access. Unfortunately I don't have an easy way to use bulk insert or BCP or any of the other ways that a normal human would go about this. The inserts will happen on one particular database but that code...
[ { "answer_id": 420730, "author": "GvS", "author_id": 11492, "author_profile": "https://Stackoverflow.com/users/11492", "pm_score": 1, "selected": false, "text": "<p>For SQL Server:</p>\n\n<ol>\n<li>You can set the recovery model to \"Simple\", so your transaction log will be kept small. ...
2009/01/07
[ "https://Stackoverflow.com/questions/420705", "https://Stackoverflow.com", "https://Stackoverflow.com/users/245/" ]
**SETUP** I have to insert a couple million rows in either SQL Server 2000/2005, MySQL, or Access. Unfortunately I don't have an easy way to use bulk insert or BCP or any of the other ways that a normal human would go about this. The inserts will happen on one particular database but that code needs to be db agnostic ...
The single biggest thing that will kill performance here is the fact that (it sounds like) you're executing a million different INSERTs against the DB. Each INSERT is treated as a single operation. If you can do this as a single operation, then you will almost certainly have a huge performance improvement. Both MySQL ...
420,718
<p>I have a linq2sql setup where objects are sent from client side (flex via flourinefx) and attach them to a new datacontext a seen below: </p> <p>I also have a "global" datacontext that is used throughout the session.</p> <pre><code> public static void Update(Enquiry enquiry) { OffertaDataContext db ...
[ { "answer_id": 421156, "author": "BenAlabaster", "author_id": 40650, "author_profile": "https://Stackoverflow.com/users/40650", "pm_score": 2, "selected": false, "text": "<p>Are you trying to add multiple new objects in one hit where the LinqEntities are being created with a key of 0?</p...
2009/01/07
[ "https://Stackoverflow.com/questions/420718", "https://Stackoverflow.com", "https://Stackoverflow.com/users/40939/" ]
I have a linq2sql setup where objects are sent from client side (flex via flourinefx) and attach them to a new datacontext a seen below: I also have a "global" datacontext that is used throughout the session. ``` public static void Update(Enquiry enquiry) { OffertaDataContext db = new OffertaDataCont...
I think this error happens if you `Attach` an *entity* to a `DataContext` that was already loaded. The code that causes the error is exactly like you show here? After creating the new `OffertaDataContext` do you query anything before the `Attach`?
420,722
<p>[This is on an iSeries/DB2 database if that makes any difference]</p> <p>I want to write a procedure to identify columns that are left as blank or zero (given a list of tables).</p> <p>Assuming I can pull out table and column definitions from the central system tables, how should I check the above condition? My fi...
[ { "answer_id": 425839, "author": "Neil", "author_id": 52115, "author_profile": "https://Stackoverflow.com/users/52115", "pm_score": 0, "selected": false, "text": "<p>I'm assuming you mean you want to know if there are any values in all the rows of a given column. If your column can have...
2009/01/07
[ "https://Stackoverflow.com/questions/420722", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23447/" ]
[This is on an iSeries/DB2 database if that makes any difference] I want to write a procedure to identify columns that are left as blank or zero (given a list of tables). Assuming I can pull out table and column definitions from the central system tables, how should I check the above condition? My first guess is for ...
To check for columns that contain only NULLs on DB2: 1. Execute RUNSTATS on your database (<http://www.ibm.com/developerworks/data/library/techarticle/dm-0412pay/>) 2. Check the database statistics by quering SYSSTAT.TABLES and SYSSTAT.COLUMNS . Comparing SYSSTAT.TABLES.CARD and SYSSTAT.COLUMNS.NUMNULLS will tell you ...
420,723
<p>I'm just learning the Model / View / ViewModel pattern and it's variations (DataModel / View / ViewModel, or Model / View / Presenter).</p> <p>What I wonder is: if I use this pattern with a WCF service, is the service the Model (DataModel), or do I need a separate Model to encapsulate the WCF service layer??</p> <...
[ { "answer_id": 424711, "author": "Sam", "author_id": 7021, "author_profile": "https://Stackoverflow.com/users/7021", "pm_score": 3, "selected": true, "text": "<p>Woot, after two days of wacking away at this problem I found a solution I can live with:</p>\n\n<p>As seen in the code example...
2009/01/07
[ "https://Stackoverflow.com/questions/420723", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
I'm just learning the Model / View / ViewModel pattern and it's variations (DataModel / View / ViewModel, or Model / View / Presenter). What I wonder is: if I use this pattern with a WCF service, is the service the Model (DataModel), or do I need a separate Model to encapsulate the WCF service layer?? When I use WCF ...
Woot, after two days of wacking away at this problem I found a solution I can live with: As seen in the code example above, I use this helper class to manage my WCF connection (because of proper handling of Close vs Abort): ``` public delegate void UseServiceDelegate<T>(T proxy); public static class Service<T> { p...
420,726
<p>I have code similar to this in my application:</p> <pre><code>class A { public: int b; } class C { public: int d; } void DoThings (void *arg1, MYSTERYTYPE arg2); A obj_a; C obj_c; DoThings(&amp;obj_a, &amp;A::b); DoThings(&amp;obj_c, &amp;C::d); </code></pre> <p>The question is - What should MYSTERYTYPE be...
[ { "answer_id": 420787, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 2, "selected": false, "text": "<p>Are you simply trying to call a function with the address of an integer that happens to live inside an <code>A<...
2009/01/07
[ "https://Stackoverflow.com/questions/420726", "https://Stackoverflow.com", "https://Stackoverflow.com/users/39702/" ]
I have code similar to this in my application: ``` class A { public: int b; } class C { public: int d; } void DoThings (void *arg1, MYSTERYTYPE arg2); A obj_a; C obj_c; DoThings(&obj_a, &A::b); DoThings(&obj_c, &C::d); ``` The question is - What should MYSTERYTYPE be? neither void\* nor int work, despite the...
You have a data member pointer to two unrelated classes. Well, you can't find a common type that can hold both pointers. It will only work if the function parameter is a data member pointer to a member of the derived, because it's guaranteed to contain the member too, if a base contains it: ``` struct a { int c; }; st...
420,727
<p>Consider:</p> <pre><code>class C { private: class T {int a, b;}; }; C::T *p; </code></pre> <p>As expected, this produces a compilation error saying that C::T is private in the context of Line 6.</p> <p>Now change this to pointer-to-member:</p> <pre><code>class C { private: class T {int a, b;}; }; int C::...
[ { "answer_id": 420787, "author": "j_random_hacker", "author_id": 47984, "author_profile": "https://Stackoverflow.com/users/47984", "pm_score": 2, "selected": false, "text": "<p>Are you simply trying to call a function with the address of an integer that happens to live inside an <code>A<...
2009/01/07
[ "https://Stackoverflow.com/questions/420727", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
Consider: ``` class C { private: class T {int a, b;}; }; C::T *p; ``` As expected, this produces a compilation error saying that C::T is private in the context of Line 6. Now change this to pointer-to-member: ``` class C { private: class T {int a, b;}; }; int C::T::*p; ``` This time around, gcc version 3...
You have a data member pointer to two unrelated classes. Well, you can't find a common type that can hold both pointers. It will only work if the function parameter is a data member pointer to a member of the derived, because it's guaranteed to contain the member too, if a base contains it: ``` struct a { int c; }; st...