qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
187,453
<p>Would it suppose any difference regarding overhead to write an import loading all the types within one package (<code>import java.*</code>); than just a specific type (i.e. <code>import java.lang.ClassLoader</code>)? Would the second one be a more advisable way to use than the other one?</p>
[ { "answer_id": 187487, "author": "Chris Cudmore", "author_id": 18907, "author_profile": "https://Stackoverflow.com/users/18907", "pm_score": 7, "selected": false, "text": "java.lang.reflect.Array\njava.sql.Array\n" }, { "answer_id": 187789, "author": "Juan Carlos Blanco Martí...
2008/10/09
[ "https://Stackoverflow.com/questions/187453", "https://Stackoverflow.com", "https://Stackoverflow.com/users/94303/" ]
187,455
<p>How can I count the number of elements in an array, because contrary to logic array.count(string) does not count all the elements in the array, it just searches for the number of occurrences of string.</p>
[ { "answer_id": 187463, "author": "Trent", "author_id": 9083, "author_profile": "https://Stackoverflow.com/users/9083", "pm_score": 9, "selected": true, "text": "len(myArray)\n" }, { "answer_id": 187493, "author": "Kevin Little", "author_id": 14028, "author_profile": "...
2008/10/09
[ "https://Stackoverflow.com/questions/187455", "https://Stackoverflow.com", "https://Stackoverflow.com/users/115/" ]
187,465
<p>Any ideas how i can best drive a USB POS printer from c#. POS printers are usually serial, TCP/IP or USB based. I know how to accomplish serial and TCP/IP but have no idea about communications through USB in C#. I know that there is a layer available from Microsoft called POS.NET, but I want to try and avoid using this. Any ideas or any C# libraries that people can recomend would be really appreciated. Thanks</p>
[ { "answer_id": 187504, "author": "Mark Cidade", "author_id": 1659, "author_profile": "https://Stackoverflow.com/users/1659", "pm_score": 2, "selected": false, "text": " [ DllImport( \"hid.dll\", SetLastError=true ) ]\n public static extern Boolean \n HidD_FlushQueue( SafeFileHan...
2008/10/09
[ "https://Stackoverflow.com/questions/187465", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20339/" ]
187,482
<p>I'd like to use the newer <code>&lt;button&gt;</code> tag in an ASP.NET website which, among other things, allows CSS-styled text and embedding a graphic inside the button. The asp:Button control renders as <code>&lt;input type="button"&gt;</code>, is there any way to make a preexisting control render to <code>&lt;button&gt;</code>?</p> <p>From what I've read there is an incompatibility with IE posting the button's markup instead of the value attribute when the button is located within a <code>&lt;form&gt;</code>, but in ASP.NET it will be using the onclick event to fire __doPostBack anyway, so I don't think that this would be a problem.</p> <p>Are there any reasons why I shouldn't use this? If not, how would you go about supporting it with asp:Button, or a new server control based on it? I would prefer to not write my own server control if that can be avoided.</p> <hr> <p>At first the <code>&lt;button runat="server"&gt;</code> solution worked, but I immediately ran into a situation where it needs to have a CommandName property, which the HtmlButton control doesn't have. It looks like I'm going to need to create a control inherited from Button after all. </p> <p>What do I need to do in order to override the render method and make it render what I want?</p> <hr> <p><strong>UPDATE</strong></p> <p>DanHerbert's reply has made me interested in finding a solution to this again, so I've spent some more time working on it. </p> <p>First, there's a far easier way of overloading the TagName:</p> <pre><code>public ModernButton() : base(HtmlTextWriterTag.Button) { } </code></pre> <p>The problem with Dan's solution as it stands is the innerhtml of the tag is placed into the value property, which causes a validation error on postback. A related problem is, even if you render the value property correctly, IE's braindead implementation of the <code>&lt;button&gt;</code> tag posts the innerhtml instead of the value anyway. So, any implementation of this needs to override the AddAttributesToRender method in order to correctly render the value property, and also provide some sort of workaround for IE so it doesn't completely screw up the postback.</p> <p>The IE problem may be insurmountable if you want to take advantage of the CommandName/CommandArgument properties for a databound control. Hopefully someone can suggest a workaround for this.</p> <p>I have made progress on the rendering:</p> <p><a href="http://gist.github.com/69841" rel="noreferrer">ModernButton.cs</a></p> <p>This renders as a proper html <code>&lt;button&gt;</code> with the correct value, but it doesn't work with the ASP.Net PostBack system. I've written some of what I need to provide the <code>Command</code> event, but it doesn't fire.</p> <p>When inspecting this button side-by-side with a regular asp:Button, they look the same other than the differences I need. So I'm not sure how ASP.Net is wiring up the <code>Command</code> event in this case.</p> <p>An additional problem is, nested server controls aren't rendered (as you can see with the ParseChildren(false) attribute). It's pretty easy to inject literal html text into the control during render, but how do you allow support for nested server controls?</p>
[ { "answer_id": 573990, "author": "Dan Herbert", "author_id": 392, "author_profile": "https://Stackoverflow.com/users/392", "pm_score": 5, "selected": false, "text": "Button" }, { "answer_id": 975539, "author": "David Andersson", "author_id": 120521, "author_profile": ...
2008/10/09
[ "https://Stackoverflow.com/questions/187482", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1249/" ]
187,495
<p>In my program, how can I read the properties set in AssemblyInfo.cs:</p> <pre><code>[assembly: AssemblyTitle("My Product")] [assembly: AssemblyDescription("...")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("Radeldudel inc.")] [assembly: AssemblyProduct("My Product")] [assembly: AssemblyCopyright("Copyright @ me 2008")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] </code></pre> <p>I'd like to display some of these values to the user of my program, so I'd like to know how to load them from the main program and from komponent assemblies I'm using.</p>
[ { "answer_id": 187529, "author": "Jeff Yates", "author_id": 23234, "author_profile": "https://Stackoverflow.com/users/23234", "pm_score": 7, "selected": true, "text": "typeof(MyTypeInAssembly).Assembly\n" }, { "answer_id": 874889, "author": "Community", "author_id": -1, ...
2008/10/09
[ "https://Stackoverflow.com/questions/187495", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7021/" ]
187,505
<p>I have few different applications among which I'd like to share a C# enum. I can't quite figure out how to share an enum declaration between a regular application and a WCF service. </p> <p>Here's the situation. I have 2 lightweight C# destop apps and a WCF webservice that all need to share enum values. </p> <p>Client 1 has </p> <pre><code> Method1( MyEnum e, string sUserId ); </code></pre> <p>Client 2 has </p> <pre><code>Method2( MyEnum e, string sUserId ); </code></pre> <p>Webservice has </p> <pre><code>ServiceMethod1( MyEnum e, string sUserId, string sSomeData); </code></pre> <p>My initial though was to create a library called Common.dll to encapsulate the enum and then just reference that library in all of the projects where the enum is needed. However, WCF makes things difficult because you need to markup the enum for it to be an integral part of the service. Like this: </p> <pre><code>[ServiceContract] [ServiceKnownType(typeof(MyEnum))] public interface IMyService { [OperationContract] ServiceMethod1( MyEnum e, string sUserId, string sSomeData); } [DataContract] public enum MyEnum{ [EnumMember] red, [EnumMember] green, [EnumMember] blue }; </code></pre> <p>So .... Is there a way to share an enum among a WCF service and other applictions? </p>
[ { "answer_id": 189029, "author": "Keith G", "author_id": 5208, "author_profile": "https://Stackoverflow.com/users/5208", "pm_score": 5, "selected": false, "text": "using Common; \n\n[ServiceContract]\n[ServiceKnownType(typeof(MyEnum))]\npublic interface IMyService\n{\n [OperationCont...
2008/10/09
[ "https://Stackoverflow.com/questions/187505", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5208/" ]
187,506
<p>I'm involved with updating an Access solution. It has a good amount of VBA, a number of queries, a small amount of tables, and a few forms for data entry &amp; report generation. It's an ideal candidate for Access.</p> <p>I want to make changes to the table design, the VBA, the queries, and the forms. How can I track my changes with version control? (we use Subversion, but this goes for any flavor) I can stick the entire mdb in subversion, but that will be storing a binary file, and I won't be able to tell that I just changed one line of VBA code.</p> <p>I thought about copying the VBA code to separate files, and saving those, but I could see those quickly getting out of sync with what's in the database.</p>
[ { "answer_id": 211210, "author": "Oliver", "author_id": 28828, "author_profile": "https://Stackoverflow.com/users/28828", "pm_score": 9, "selected": true, "text": "OpenAccessProject()" }, { "answer_id": 1849498, "author": "DaveParillo", "author_id": 167483, "author_pr...
2008/10/09
[ "https://Stackoverflow.com/questions/187506", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1753/" ]
187,515
<p>I have two arrays. One contains <code>id=&gt;count</code> and the other contains <code>id=&gt;name</code>. I'm trying to produce a single array that is <code>name=&gt;count</code>. Any suggestions on a straightforward way to do this?</p> <p>I have looked at the <a href="http://us2.php.net/manual/en/ref.array.php" rel="nofollow noreferrer">Array Functions in the PHP Manual</a> and didn't see anything that stood out as doing what I want, so I'm guessing I'll need a combination of functions, but I'm having trouble coming up with something that's not convoluted.</p>
[ { "answer_id": 187533, "author": "KernelM", "author_id": 22328, "author_profile": "https://Stackoverflow.com/users/22328", "pm_score": 3, "selected": true, "text": "foreach($countA as $id => $count)\n{\n $newArray[$nameA[$id]] = $count;\n}\n" }, { "answer_id": 187534, "aut...
2008/10/09
[ "https://Stackoverflow.com/questions/187515", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
187,526
<p>I'd like to be able to run my aliases from my .bashrc in the "Run Application" dialog that comes up when you hit Alt+F2 in Ubuntu/Gnome.</p> <p>Does anyone know how to do this?</p>
[ { "answer_id": 198830, "author": "Anders Eurenius", "author_id": 1421, "author_profile": "https://Stackoverflow.com/users/1421", "pm_score": 3, "selected": true, "text": ".bashrc" }, { "answer_id": 2753932, "author": "Nostoc", "author_id": 330870, "author_profile": "h...
2008/10/09
[ "https://Stackoverflow.com/questions/187526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26510/" ]
187,531
<p>I have a package that I just made and I have an "old-mode" that basically makes it work like it worked before: importing everything into the current namespace. One of the nice things about having this as a package is that we no longer have to do that. Anyway, what I would like to do is have it so that whenever anyone does:</p> <pre><code>use Foo qw(:oldmode); </code></pre> <p>I throw a warning that this is deprecated and that they should either import only what they need or just access functions with Foo->fun();</p> <p>Any ideas on how to do this?</p>
[ { "answer_id": 187541, "author": "moritz", "author_id": 14132, "author_profile": "https://Stackoverflow.com/users/14132", "pm_score": 4, "selected": false, "text": "sub import" }, { "answer_id": 187625, "author": "Axeman", "author_id": 11289, "author_profile": "https:...
2008/10/09
[ "https://Stackoverflow.com/questions/187531", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12448/" ]
187,537
<p>Is there a case insensitive version of the <a href="http://docs.jquery.com/Selectors/contains" rel="noreferrer">:contains</a> jQuery selector or should I do the work manually by looping over all elements and comparing their .text() to my string?</p>
[ { "answer_id": 187557, "author": "Pat", "author_id": 238, "author_profile": "https://Stackoverflow.com/users/238", "pm_score": 8, "selected": true, "text": "jQuery.extend(\n jQuery.expr[':'], { \n Contains : \"jQuery(a).text().toUpperCase().indexOf(m[3].toUpperCase())>=0\" \n})...
2008/10/09
[ "https://Stackoverflow.com/questions/187537", "https://Stackoverflow.com", "https://Stackoverflow.com/users/238/" ]
187,550
<p>I have a lot of Java source code that requires custom pre-processing. I'd like rid of it but that's not feasible right now so I'm stuck with it. Given that I have an unfortunate problem that shouldn't have existed in the first place, how do I solve it using maven? </p> <p>(For the full story, I'm replacing a python-based build system with a maven one, so one improvement at a time please. Fixing the non-standard source code is harder, and will come later.)</p> <p>Is it possible using any existing Maven plugins to actually alter the source files during compile time? (Obviously leaving the original, unprocessed code alone)</p> <p>To be clear, by preprocessing I mean preprocessing in the same sense as antenna or a C compiler would preprocess the code, and by custom I mean that it's completely proprietary and looks nothing at all like C or antenna preprocessing.</p>
[ { "answer_id": 189299, "author": "Travis B. Hartwell", "author_id": 10873, "author_profile": "https://Stackoverflow.com/users/10873", "pm_score": 4, "selected": true, "text": " <build>\n <plugins>\n <plugin>\n <groupId>org.apache.maven.plugins</groupId>\n <artifactId>maven...
2008/10/09
[ "https://Stackoverflow.com/questions/187550", "https://Stackoverflow.com", "https://Stackoverflow.com/users/974/" ]
187,552
<p>What's the best way of capturing an mp3 stream coming off of http and saving it to disk with python?</p> <p>Thus far I've tried</p> <pre><code>target = open(target_path, "w") conn = urllib.urlopen(stream_url) while True: target.write(conn.read(buf_size)) </code></pre> <p>This gives me data but its garbled or wont play in mp3 players.</p>
[ { "answer_id": 187563, "author": "Adam Rosenfield", "author_id": 9530, "author_profile": "https://Stackoverflow.com/users/9530", "pm_score": 5, "selected": true, "text": "target" }, { "answer_id": 3193428, "author": "Boiler", "author_id": 385355, "author_profile": "ht...
2008/10/09
[ "https://Stackoverflow.com/questions/187552", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2906/" ]
187,555
<p>I have a flash program that loads movie clips dynamically and sometimes they want to use more than the space that I give them. Ideally I'd like to force them to only show content in borders I give them. The reason I want this is that my program has a user interface that sometimes gets covered up by this behavior. I'd like to avoid rewriting my program to have these loaded movies be on the first level but that's looking like my only option. Any suggestions?</p>
[ { "answer_id": 188666, "author": "defmeta", "author_id": 10875, "author_profile": "https://Stackoverflow.com/users/10875", "pm_score": 0, "selected": false, "text": "private function onClipLoaded(clipRef:MovieClip) {\n if (clipRef.width > myViewArea.width) {\n var scaleRatio:Nu...
2008/10/09
[ "https://Stackoverflow.com/questions/187555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12261/" ]
187,560
<p>I am migrating a site from SharePoint 2 to 3 (in fact, from SharePoint Portal Server 2003 to Microsoft Office SharePoint Server 2007). There are a handful of 3rd party web parts and since this is a migration, not an in-place upgrade, I need to install these web parts on the new farm.</p> <p>How do I do this, given that I have the packaged up web parts as provided by the SharePoint Configuration Analyzer in the form of cab files? Can I simply deploy these cab files somehow, even though they are not packaged as solutions? Or do I need to pull the cab files apart and repackage them as solutions? Or do I need to get new versions of the web parts, written for SharePoint 3, and maybe edit the pages that use them?</p>
[ { "answer_id": 188684, "author": "Ryan", "author_id": 20198, "author_profile": "https://Stackoverflow.com/users/20198", "pm_score": 3, "selected": true, "text": "STSADM -o addwppack -filename <filename.CAB>\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187560", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3142/" ]
187,567
<p>I used Visual Studio's Application Wizard to create a skeleton MFC program with a multi-document interface. When I start this program, it automatically creates a child frame, which I don't want it to do - I need the main frame's client area to be empty until the user chooses to open a file.</p> <p>The debugger tells me that a CChildFrame object is created when the application class's InitInstance() function calls ProcessShellCommand(), but what is a good entry point for me to override this behaviour?</p>
[ { "answer_id": 187931, "author": "jeffm", "author_id": 1544, "author_profile": "https://Stackoverflow.com/users/1544", "pm_score": 3, "selected": true, "text": "if (!ProcessShellCommand(cmdInfo))\n" }, { "answer_id": 190286, "author": "titanae", "author_id": 2387, "au...
2008/10/09
[ "https://Stackoverflow.com/questions/187567", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11575/" ]
187,576
<p>I am developing a little app that retrieves an XML file, located on a remote server (<code>http://example.com/myfile.xml</code>) This file is relatively big, and it contains a big list of geolocations with other information that I need to use for my app. So I read this file remotely once and insert it into a little SqlCE file (<code>database.sdf</code>)</p> <p>So If I need to be accessing geolocation #1, I ll just make a SELECT statement into this DATABASE instead of loading the whole XML file every time.</p> <p>But I would like to know if its possible to do this without using .sdf files?</p> <p>What is the most efficient way (fastest)?</p> <p>Saving the big XML file once locally and load if every time I start my app to load it in a data set? this is would make the app a bit long to load every time</p> <p>Saving the big XML file once locally and reading the nodes one by one to look for geolocation #1?</p> <p>Or is it possible to retrieve geolocation #1 from the remote XML directly(<code>http://example.com/myfile.xml</code>) without reading the whole file?</p>
[ { "answer_id": 187909, "author": "Marc Gravell", "author_id": 23354, "author_profile": "https://Stackoverflow.com/users/23354", "pm_score": 2, "selected": true, "text": ".proto" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187576", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12067/" ]
187,583
<p>I have one std::list&lt;> container and these threads:</p> <ul> <li><p>One writer thread which adds elements indefinitely.</p></li> <li><p>One reader/writer thread which reads and removes elements while available.</p></li> <li><p>Several reader threads which access the SIZE of the container (by using the size() method)</p></li> </ul> <p>There is a normal mutex which protects the access to the list from the first two threads. My question is, do the size reader threads need to acquire this mutex too? should I use a read/write mutex?</p> <p>I'm in a windows environment using Visual C++ 6.</p> <p><strong>Update</strong>: It looks like the answer is not clear yet. To sum up the main doubt: Do I still need to protect the SIZE reader threads even if they only call size() (which returns a simple variable) taking into account that I don't need the exact value (i.e. I can assume a +/- 1 variation)? How a race condition could make my size() call return an invalid value (i.e. one totally unrelated to the good one)?</p> <p><strong>Answer</strong>: In general, the reader threads must be protected to avoid race conditions. Nevertheless, in my opinion, some of the questions stated above in the update haven't been answered yet.</p> <p>Thanks in advance! </p> <p>Thank you all for your answers!</p>
[ { "answer_id": 242721, "author": "Tal", "author_id": 11287, "author_profile": "https://Stackoverflow.com/users/11287", "pm_score": 1, "selected": false, "text": "volatile unsigned int ContainerSize = 0;\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187583", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11441/" ]
187,587
<p>I'm looking for the equivalent of the Unix 'tail' command that will allow me to watch the output of a log file while it is being written to.</p>
[ { "answer_id": 187826, "author": "Philibert Perusse", "author_id": 7984, "author_profile": "https://Stackoverflow.com/users/7984", "pm_score": 4, "selected": false, "text": "---------- T.TXT: 15\n" }, { "answer_id": 188126, "author": "Alex", "author_id": 26564, "autho...
2008/10/09
[ "https://Stackoverflow.com/questions/187587", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445016/" ]
187,588
<p>We have a shrink wrap type Windows server application where we need to create a self signed certificate on the server to be used by some WCF web services. From our searches on the web, it appears that the makecert utility in the PlatformSDK from Microsoft cannot be distributed with our application, so we're looking for alternatives. </p> <p>Does anyone know how to use OpenSSL to create a certificate and get it into the Windows LocalMachine certificate store? Or, alternatively is it straight forward to insert the certificate into the store in a .NET application and should we just create the certificate file with openssl? Any help/suggestions would be appreciated. </p>
[ { "answer_id": 2273239, "author": "Naveen", "author_id": 220854, "author_profile": "https://Stackoverflow.com/users/220854", "pm_score": 4, "selected": true, "text": "Windows SDK Files\n\nSubject to the license terms for the software, the following files may be distributed unmodified:\n\...
2008/10/09
[ "https://Stackoverflow.com/questions/187588", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3429/" ]
187,619
<p>I have headers in <code>&lt;h1&gt;</code> through <code>&lt;h6&gt;</code> tags. Is there a way that I can use JavaScript to generate a table of contents for the contents that serves as anchor tags as well?</p> <p>I would like the output to be something like:</p> <pre><code>&lt;ol&gt; &lt;li&gt;Header 1&lt;/li&gt; &lt;li&gt;Header 1&lt;/li&gt; &lt;li&gt;Header 2&lt;/li&gt; &lt;li&gt;Header 3&lt;/li&gt; &lt;/ol&gt; </code></pre> <p>I am not currently using a JavaScript framework, but I don't see why I couldn't use one.</p> <p>I am also looking for something done, since I'm guessing this is a common problem, but if not, a starting point to roll my own would be good.</p>
[ { "answer_id": 187649, "author": "Ates Goral", "author_id": 23501, "author_profile": "https://Stackoverflow.com/users/23501", "pm_score": 1, "selected": false, "text": "getElementsByTagName()" }, { "answer_id": 187946, "author": "Ates Goral", "author_id": 23501, "auth...
2008/10/09
[ "https://Stackoverflow.com/questions/187619", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
187,621
<p>I am aware of how to setup autocompletion of python objects in the python interpreter (on unix). </p> <ul> <li>Google shows many hits for explanations on how to do this.</li> <li>Unfortunately, there are so many references to that it is difficult to find what I need to do, which is slightly different.</li> </ul> <p>I need to know how to enable, tab/auto completion of arbitrary items in a command-line program written in python.</p> <p>My specific use case is a command-line python program that needs to send emails. I want to be able to autocomplete email addresses (I have the addresses on disk) when the user types part of it (and optionally presses the TAB key).</p> <p>I do not need it to work on windows or mac, just linux.</p>
[ { "answer_id": 187660, "author": "ephemient", "author_id": 20713, "author_profile": "https://Stackoverflow.com/users/20713", "pm_score": 7, "selected": true, "text": "readline" }, { "answer_id": 187701, "author": "Florian Bösch", "author_id": 19435, "author_profile": ...
2008/10/09
[ "https://Stackoverflow.com/questions/187621", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3045/" ]
187,627
<p>I'm trying to use a static library created by me in Visual C++ 2005 (unmanaged C++). I declare one function "int myF(int a);" into a .h file, I implement it in a .cpp file, I compile it - the .lib file is produced.</p> <p>I create a new project (a separate solution) in VC++ 2005 (also native C++), I add the paths for the include file and the lib file; when I invoke the function myF the linker reports an error: "error LNK2019: unresolved external symbol _myF referenced in function _main". if I create the client project in the same solution as the library project and then add a reference to the library projects, it works, but I'm not going to implement everything like this, but rather to add external libraries to my projects...</p> <p>What is wrong?</p> <p>Thank you.</p>
[ { "answer_id": 187680, "author": "Rodney Schuler", "author_id": 6188, "author_profile": "https://Stackoverflow.com/users/6188", "pm_score": 2, "selected": false, "text": "#pragma comment(lib, \"MyStatic.lib\")\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187627", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26519/" ]
187,629
<p>I'm looking at maybe moving from an older AMD64 to a new Intel dual-core which is 32 bit. Installation isn't a problem but can I transfer all the installed apps? I haven't been able to find anything so far on Google except where the migration is to a similar platform and file-system. I won't change the filesystem but the platform will be different. Is there something on the lines of the "World" file in Gentoo?</p>
[ { "answer_id": 187747, "author": "Mark Roddy", "author_id": 9940, "author_profile": "https://Stackoverflow.com/users/9940", "pm_score": 2, "selected": false, "text": "dpkg -l|awk '/^ii\\s*(.*)\\s*/ {print $2}'|packages.txt\n" }, { "answer_id": 187756, "author": "Jay", "au...
2008/10/09
[ "https://Stackoverflow.com/questions/187629", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5549/" ]
187,633
<p>First of all, I'd like to say that this site is great!</p> <p>My question is, what are the reasons for the following 2 error messages?</p> <p>1) In VB.NET (I know this is a C# forum but my next question is from C# experience), property evaluation failed (I do this when putting a watch on an exception variable).</p> <p>2) In C#, method or class (Can't remember which) does not have a constructor. I think I got this with HttpContext or HttpApplication, which is a class if I remember correctly? Pretty sure it is as it has its own properties and methods.</p> <p>Thanks</p>
[ { "answer_id": 187667, "author": "John Rudy", "author_id": 14048, "author_profile": "https://Stackoverflow.com/users/14048", "pm_score": 2, "selected": false, "text": "HttpContext context = new HttpContext;\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187633", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
187,640
<p>Is it good practice to have a class constructor that uses default parameters, or should I use separate overloaded constructors? For example:</p> <pre><code>// Use this... class foo { private: std::string name_; unsigned int age_; public: foo(const std::string&amp; name = "", const unsigned int age = 0) : name_(name), age_(age) { ... } }; // Or this? class foo { private: std::string name_; unsigned int age_; public: foo() : name_(""), age_(0) { } foo(const std::string&amp; name, const unsigned int age) : name_(name), age_(age) { ... } }; </code></pre> <p>Either version seems to work, e.g.:</p> <pre><code>foo f1; foo f2("Name", 30); </code></pre> <p>Which style do you prefer or recommend and why?</p>
[ { "answer_id": 187693, "author": "Sam Stokes", "author_id": 20131, "author_profile": "https://Stackoverflow.com/users/20131", "pm_score": 6, "selected": false, "text": "class Vehicle {\npublic:\n Vehicle(int wheels, std::string name = \"Mini\");\n};\n\nVehicle x = 5; // this compiles j...
2008/10/09
[ "https://Stackoverflow.com/questions/187640", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
187,644
<p>Is there a tool that creates a diff of a file structure, perhaps based on an MD5 manifest. My goal is to send a package across the wire that contains new/updated files and a list of files to remove. It needs to copy over new/updated files and remove files that have been deleted on the source file structure?</p>
[ { "answer_id": 189378, "author": "Robᵩ", "author_id": 8747, "author_profile": "https://Stackoverflow.com/users/8747", "pm_score": 2, "selected": false, "text": "rsync -az --del /path/to/master dup-site:/path/to/duplicate\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187644", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24279/" ]
187,669
<p>I have a linker command file that assigns the top address of the stack into a variable </p> <pre><code>_stack = . + 0x80000; </code></pre> <p>I want to use this address in a 'c' program - I want to copy the stack to another location and then update the stack pointer to point to the new location before doing a destructive memory test on the orginal bank of RAM.</p> <p>I'm finding that if I do something like</p> <pre><code>extern u32 *_stack; myFunction(_stack); </code></pre> <p>Then the function seems to get passed the value stored at the stack location </p> <pre><code>lwz r3,0(r8) </code></pre> <p>Rather than the address of the stack itself. Can anyone help?</p>
[ { "answer_id": 187727, "author": "Mark Ransom", "author_id": 5987, "author_profile": "https://Stackoverflow.com/users/5987", "pm_score": 4, "selected": true, "text": "extern u32 _stack;\nU32 * stackPtr;\nstackPtr = &_stack;\n" }, { "answer_id": 194229, "author": "Tall Jeff", ...
2008/10/09
[ "https://Stackoverflow.com/questions/187669", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23402/" ]
187,676
<p>I know this is a bit of a newbie question, but are there equivalents to C#'s string operations in Java?</p> <p>Specifically, I'm talking about <code>String.Format</code> and <code>String.Join</code>.</p>
[ { "answer_id": 187720, "author": "Allain Lalonde", "author_id": 2443, "author_profile": "https://Stackoverflow.com/users/2443", "pm_score": 6, "selected": false, "text": " static String join(Collection<?> s, String delimiter) {\n StringBuilder builder = new StringBuilder();\n Ite...
2008/10/09
[ "https://Stackoverflow.com/questions/187676", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
187,695
<p>I've just seen this in the MS Visual Studio docs and the part in bold doesn't make sense to me. Is it wrong or am I not understanding it properly? If you run this, b appears to hold "hello" (as I would expect) and not "h".</p> <p>Strings are <em>immutable</em>--the contents of a string object cannot be changed after the object is created, although the syntax makes it appear as if you can do this. For example, when you write this code, the compiler actually creates a new string object to hold the new sequence of characters, <strong>and the variable b continues to hold "h"</strong>. </p> <p>string b = "h";</p> <p>b += "ello";</p>
[ { "answer_id": 187709, "author": "user7116", "author_id": 7116, "author_profile": "https://Stackoverflow.com/users/7116", "pm_score": 3, "selected": false, "text": "string b = \"h\";\nb = b + \"ello\";\n" }, { "answer_id": 187721, "author": "Jon Skeet", "author_id": 22656...
2008/10/09
[ "https://Stackoverflow.com/questions/187695", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
187,713
<p>In C++, what's the generic way to convert any floating point value (float) to <a href="http://en.wikipedia.org/wiki/Fixed-point_arithmetic" rel="noreferrer"><strong>fixed point</strong></a> (int, 16:16 or 24:8)?</p> <p><strong>EDIT:</strong> For clarification, fixed-point values have two parts to them: an integer part and a fractional part. The integer part can be represented by a signed or unsigned integer data type. The fractional part is represented by an unsigned data integer data type.</p> <p>Let's make an analogy with money for the sake of clarity. The fractional part may represent cents -- a fractional part of a dollar. The range of the 'cents' data type would be 0 to 99. If a 8-bit unsigned integer were to be used for fixed-point math, then the fractional part would be split into 256 evenly divisible parts.</p> <p>I hope that clears things up.</p>
[ { "answer_id": 187808, "author": "Kevin", "author_id": 6386, "author_profile": "https://Stackoverflow.com/users/6386", "pm_score": 6, "selected": true, "text": "// A signed fixed-point 16:16 class\nclass FixedPoint_16_16\n{\n short intPart;\n unsigned short fracPart;\n\npu...
2008/10/09
[ "https://Stackoverflow.com/questions/187713", "https://Stackoverflow.com", "https://Stackoverflow.com/users/209/" ]
187,736
<p>I'm writing a command line tool to help my web app. It needs a password to connect to the service. I'd like the script to show a password prompt so I don't have to pass it as a command line argument. </p> <p>That's easy enough, but I'd like it to not echo the password to the screen as it's typed. How can I do this with PHP? </p> <p>Bonus points for doing it in pure PHP (no <code>system('stty')</code>) and replacing the characters with <code>*</code>. </p> <p><strong>EDIT:</strong></p> <p>The script will run on a unix like system (linux or mac). The script is written in PHP, and will most likely stay like that.</p> <p>Also, for the record, the <code>stty</code> way of doing it is:</p> <pre><code>echo "Password: "; system('stty -echo'); $password = trim(fgets(STDIN)); system('stty echo'); // add a new line since the users CR didn't echo echo "\n"; </code></pre> <p>I'd prefer to not have the <code>system()</code> calls in there.</p>
[ { "answer_id": 187821, "author": "Gabriel Gilini", "author_id": 25853, "author_profile": "https://Stackoverflow.com/users/25853", "pm_score": 2, "selected": false, "text": "@echo off\ncls\nSET /P uname=Enter Username:\necho hP1X500P[PZBBBfh#b##fXf-V@`$fPf]f3/f1/5++u5>in.com\nset /p passw...
2008/10/09
[ "https://Stackoverflow.com/questions/187736", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2506/" ]
187,742
<p>I have this:</p> <pre><code>public string Log { get { return log; } protected set { if (log != value) { MarkModified(PropertyNames.Log, log); log = value; } } } </code></pre> <p>And my utility class for databinding does this:</p> <pre><code>PropertyInfo pi = ReflectionHelper.GetPropertyInfo(boundObjectType, sourceProperty); if (!pi.CanWrite) SetReadOnlyCharacteristics(boundEditor); </code></pre> <p>But PropertyInfo.CanWrite does not care whether the set is publicly accessible, only that it exists.</p> <p>How can I determine if there's a <strong>public</strong> set, not just <strong>any</strong> set?</p>
[ { "answer_id": 187769, "author": "Darren Kopp", "author_id": 77, "author_profile": "https://Stackoverflow.com/users/77", "pm_score": 2, "selected": false, "text": "PropertyInfo property = type.GetProperty(\"MyProperty\", BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.Insta...
2008/10/09
[ "https://Stackoverflow.com/questions/187742", "https://Stackoverflow.com", "https://Stackoverflow.com/users/549/" ]
187,761
<p>POSIX allows mutexes to be recursive. That means the same thread can lock the same mutex twice and won't deadlock. Of course it also needs to unlock it twice, otherwise no other thread can obtain the mutex. Not all systems supporting pthreads also support recursive mutexes, but if they want to be <a href="http://www.opengroup.org/onlinepubs/009695399/functions/pthread_mutexattr_gettype.html" rel="noreferrer">POSIX conform, they have to</a>.</p> <p>Other APIs (more high level APIs) also usually offer mutexes, often called Locks. Some systems/languages (e.g. Cocoa Objective-C) offer both, recursive and non recursive mutexes. Some languages also only offer one or the other one. E.g. in Java mutexes are always recursive (the same thread may twice "synchronize" on the same object). Depending on what other thread functionality they offer, not having recursive mutexes might be no problem, as they can easily be written yourself (I already implemented recursive mutexes myself on the basis of more simple mutex/condition operations).</p> <p>What I don't really understand: What are non-recursive mutexes good for? Why would I want to have a thread deadlock if it locks the same mutex twice? Even high level languages that could avoid that (e.g. testing if this will deadlock and throwing an exception if it does) usually don't do that. They will let the thread deadlock instead.</p> <p>Is this only for cases, where I accidentally lock it twice and only unlock it once and in case of a recursive mutex, it would be harder to find the problem, so instead I have it deadlock immediately to see where the incorrect lock appears? But couldn't I do the same with having a lock counter returned when unlocking and in a situation, where I'm sure I released the last lock and the counter is not zero, I can throw an exception or log the problem? Or is there any other, more useful use-case of non recursive mutexes that I fail to see? Or is it maybe just performance, as a non-recursive mutex can be slightly faster than a recursive one? However, I tested this and the difference is really not that big.</p>
[ { "answer_id": 62178568, "author": "Igor G", "author_id": 11102572, "author_profile": "https://Stackoverflow.com/users/11102572", "pm_score": 1, "selected": false, "text": "pthread_mutex_unlock" }, { "answer_id": 64199419, "author": "BitTickler", "author_id": 2225104, ...
2008/10/09
[ "https://Stackoverflow.com/questions/187761", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15809/" ]
187,768
<p>I've created a copy utility in c# (.NET 2.0 Framework) that copies files, directories and recursive sub directories etc. The program has a GUI that shows the current file being copied, the current file number (sequence), the total number of files to be copied and the percentage completed for the copy operations. There is also a progress bar, that is based on current file / total files.</p> <p>My problem is related to copying large files. I've been unable to find a way to indicate the total copy progress of a large file (using my current class structure that utilitzes FileInfo.CopyTo method). As a workaround I've separated the file copy operations and GUI display to their own threads and set up a visual cue to show that work is being done. At least the user is aware that the program isn't frozen and is still copying files.</p> <p>It would be nicer to be able to show the progress based on the total number of bytes or have some type of event that fires from the FileInfo.CopyTo method that indicates the total number of bytes copied from the current file.</p> <p>I'm aware of the FileInfo.Length property, so I'm sure there is a way MacGuyver my own event that is based on this and have a handler on the GUI side of things reading the updates (maybe based on checking the FileInfo.Length property of the destination object using some type of timer?).</p> <p>Does anyone know of a way to do this that I'm overlooking. If I can avoid it, I'd rather not rewrite my class to copy bytes through a stream and track it that way (though I'm thinking I might be stuck with going that route).</p> <p>PS - I'm stuck with the .NET 2.0 framework for now, so any solution that requires features available in &gt;= 3.0 only are not an option for me.</p> <p>PPS - I'm open to solutions in any .NET language variety, not only c#.</p>
[ { "answer_id": 190853, "author": "cfeduke", "author_id": 5645, "author_profile": "https://Stackoverflow.com/users/5645", "pm_score": 3, "selected": false, "text": "Microsoft.VisualBasic.FileIO.FileSystem.CopyFile(\n srcPath, \n dstPath, \n Microsoft.VisualBasic.FileIO.UIOption.A...
2008/10/09
[ "https://Stackoverflow.com/questions/187768", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9732/" ]
187,770
<p>I have a database called foo and a database called bar. I have a table in foo called tblFoobar that I want to move (data and all) to database bar from database foo. What is the SQL statement to do this?</p>
[ { "answer_id": 187785, "author": "Amy B", "author_id": 8155, "author_profile": "https://Stackoverflow.com/users/8155", "pm_score": 9, "selected": true, "text": "INSERT INTO bar..tblFoobar( *fieldlist* )\nSELECT *fieldlist* FROM foo..tblFoobar\n" }, { "answer_id": 187833, "aut...
2008/10/09
[ "https://Stackoverflow.com/questions/187770", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7952/" ]
187,774
<p>I have XML that looks like</p> <pre><code>&lt;answers&gt; &lt;answer&gt; &lt;question-number&gt;1&lt;/question-number&gt; &lt;value&gt;3&lt;/value&gt; &lt;mean xsi:nil="1" /&gt; &lt;/answer&gt; &lt;answer&gt; &lt;question-number&gt;2&lt;/question-number&gt; &lt;value&gt;2&lt;/value&gt; &lt;mean&gt;2.3&lt;/mean&gt; &lt;/answer&gt; &lt;answer&gt; &lt;question-number&gt;3&lt;/question-number&gt; &lt;value&gt;3&lt;/value&gt; &lt;mean xsi:nil="1" /&gt; &lt;/answer&gt; .... &lt;/answers&gt; </code></pre> <p>I'm formatting each answer using xsl:for-each. If there is a mean present I have a graphical representation of the mean. For some potential lists of answers the mean will always be null.</p> <p>At the bottom of the page I want to put a legend explaining the graphical representation of the mean. But I only want it to appear if I actually displayed a mean at all. So I want to be able to do a check, after closing the xsl:for-each, to say "do any of the answer elements have a non-null mean value?".</p> <p>Really not sure how to do that. </p>
[ { "answer_id": 187843, "author": "Robert Gould", "author_id": 15124, "author_profile": "https://Stackoverflow.com/users/15124", "pm_score": 0, "selected": false, "text": "<xs:if test=\"/answers/answer/mean\">You have a mean</xs:if>\n" }, { "answer_id": 187933, "author": "Jasp...
2008/10/09
[ "https://Stackoverflow.com/questions/187774", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1237/" ]
187,777
<p>How can I get the BSSID / MAC (Media Access Control) address of the wireless access point my system is connected to using C#?</p> <p>Note that I'm interested in the BSSID of the WAP. This is different from the MAC address of the networking portion of the WAP.</p>
[ { "answer_id": 187867, "author": "Iain", "author_id": 5993, "author_profile": "https://Stackoverflow.com/users/5993", "pm_score": 6, "selected": true, "text": "netsh wlan show networks mode=Bssid | findstr \"BSSID\"\n" }, { "answer_id": 7797261, "author": "Lennard", "auth...
2008/10/09
[ "https://Stackoverflow.com/questions/187777", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5993/" ]
187,779
<p>Is it possible to update IIS on Windows XP from 5.1 to 6?</p> <p>If so how?</p> <p>Thanks.</p>
[ { "answer_id": 187802, "author": "Grant Wagner", "author_id": 9254, "author_profile": "https://Stackoverflow.com/users/9254", "pm_score": 6, "selected": true, "text": "XP = IIS 5.1\n2003 = IIS 6\n2008 = IIS 7\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187779", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12148/" ]
187,795
<p>For simplicity lets say I have two flex mxml pages. </p> <p>form.mxml<br> button.mxml</p> <p>If the form.mxml page had the following code, it should work fine:</p> <pre><code>&lt;custom:SelectView dSource="{_thedata}" id="form" visible="false"&gt; &lt;/custom:SelectView&gt; &lt;mx:LinkButton label="Show" id="lbShow" click="form.visible=true;&gt; &lt;mx:LinkButton label="Show" id="lbHide" click="form.visible=false;&gt; </code></pre> <p>But if the code was like:</p> <p>form.mxml</p> <pre><code> &lt;custom:SelectView dSource="{_thedata}" id="form" visible="false"&gt; &lt;/custom:SelectView&gt; </code></pre> <p>button.mxml</p> <pre><code>&lt;mx:LinkButton label="Show" id="lbShow" click="form.visible=true;&gt; &lt;mx:LinkButton label="Show" id="lbHide" click="form.visible=false;&gt; </code></pre> <p>how can I make a call from button.mxml to change form.mxml</p> <p>---- a bit more details ---</p> <p>My page actually looks like this: where query:AdvancedSearchFields is basically including a flex form into the page, and I want it to show/hide the custom view below after the search is complete. </p> <pre><code>&lt;query:AdvancedSearchFields searchType="projects" searchCategory="advanced" visible="true" id="AdvancedSearch" /&gt; &lt;custom:SelectView dSource="{_searchResults}" id="sv" visible="false"&gt; </code></pre>
[ { "answer_id": 187889, "author": "Matt Dillard", "author_id": 863, "author_profile": "https://Stackoverflow.com/users/863", "pm_score": 0, "selected": false, "text": "button.mxml" }, { "answer_id": 187914, "author": "Herms", "author_id": 1409, "author_profile": "https...
2008/10/09
[ "https://Stackoverflow.com/questions/187795", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24563/" ]
187,797
<p>Say I've got a class like this:</p> <pre><code>class Test { int x; SomeClass s; } </code></pre> <p>And I instantiate it like this:</p> <pre><code>Test* t = new Test; </code></pre> <p>Is x on the stack, or the heap? What about s?</p>
[ { "answer_id": 187806, "author": "Avdi", "author_id": 20487, "author_profile": "https://Stackoverflow.com/users/20487", "pm_score": 3, "selected": false, "text": "new" }, { "answer_id": 187811, "author": "moonshadow", "author_id": 11834, "author_profile": "https://Sta...
2008/10/09
[ "https://Stackoverflow.com/questions/187797", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12828/" ]
187,799
<p>Let me start by saying I'm a huge fan of the elegance of this pattern -- I have a group of basic entities that I have implemented builders for (specifically for testing). However I have found (and this may be the caveat) that as my program evolved I kept having to go back and re-work the builders. In the end, it really hasn't seemed worth it to keep them updated, and I've gone back to primarily keeping a Object Mother that has a lot of pre-configured entities. Should I continue to update the builders for future use, or is the TDBs something that should only be created once you're design has reached some stability and the Object Mother becomes too large?</p> <p>Also note, I've found I'm not using the builders anywhere else in the app, as I enjoy using .Net 3.0 's new syntax for property initialization.</p>
[ { "answer_id": 222686, "author": "craigb", "author_id": 18590, "author_profile": "https://Stackoverflow.com/users/18590", "pm_score": 4, "selected": true, "text": "User fred = CreateUser(\"fred\").WithReputation(900)\n .WithScholarBadge()\n ...
2008/10/09
[ "https://Stackoverflow.com/questions/187799", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25807/" ]
187,804
<p>I would like a "system" that monitors a process and would kill said process if:</p> <ul> <li>the process exceeds some memory requirements</li> <li>the process does not respond to a message from the "system" in some period of time</li> </ul> <p>I assume this "system" could be something as simple as a monitoring process? A code example of how this could be done would be useful. I am of course not averse to a completely different solution to this problem.</p>
[ { "answer_id": 187824, "author": "Avdi", "author_id": 20487, "author_profile": "https://Stackoverflow.com/users/20487", "pm_score": 4, "selected": true, "text": "ulimit" }, { "answer_id": 12206999, "author": "Jon Jensen", "author_id": 1637217, "author_profile": "https...
2008/10/09
[ "https://Stackoverflow.com/questions/187804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/21317/" ]
187,827
<p>So for this one project, we have a bunch of queries that are executed on a regular basis (every minute or so. I used the "Analyze Query in Database Engine " to check on them. </p> <p>They are pretty simple: select * from tablex where processed='0'</p> <p>There is an index on processed, and each query should return &lt;1000 rows on a table with 1MM records.</p> <p>The Analyzer recommended creating some STATISTICS on this.... So my question is: What are those statistics ? do they really help performance ? how costly are they for a table like above ? </p> <p>Please bear in mind that by no means I would call myself a SQL Server experienced user ... And this is the first time using this Analyzer.</p>
[ { "answer_id": 188179, "author": "Josef", "author_id": 5581, "author_profile": "https://Stackoverflow.com/users/5581", "pm_score": 6, "selected": true, "text": "SELECT * FROM tablename WHERE col1=value" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187827", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23238/" ]
187,836
<p>Sometimes while debugging, I need to restart a service on a remote machine. Currently, I'm doing this via Remote Desktop. How can it be done from the command line on my local machine?</p>
[ { "answer_id": 187854, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 9, "selected": true, "text": "sc \\\\machine stop <service>\n" }, { "answer_id": 187918, "author": "Andrew Moore", "author_id": 262...
2008/10/09
[ "https://Stackoverflow.com/questions/187836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/549/" ]
187,849
<p>I am experiencing some weird behavior with localized messages reported from my background worker process in my windows forms application.</p> <p>The application is a setup application with windows forms. The application launches a background worker to perform and IIS reset and then install MSIs.</p> <p>The first time I run the application on a Spanish Win Server 2003 VM the forms are in spanish but not the BWP messages. If i immediately run it again, the messages are in spanish.</p> <p>The .Resources files are embedded resources and are extracted to the temp directory upon application startup.</p> <p>My code retrieves the localized strings through a custom resource manager class. This class creates a file based resource to the .Resources files in the temp directory. This is working correctly because the windows forms labels and title are localized every time.</p> <p>Has anyone experienced this? I'm absolutely stuck, please help. Thanks, Andrew</p>
[ { "answer_id": 8898322, "author": "Maik Preuss", "author_id": 1154412, "author_profile": "https://Stackoverflow.com/users/1154412", "pm_score": 2, "selected": false, "text": " private delegate CultureInfo GetUICultureCallback();\n\n private CultureInfo GetUICulture()\n ...
2008/10/09
[ "https://Stackoverflow.com/questions/187849", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26540/" ]
187,851
<p>How can I open a synchronous dialog in Flex? I need to call a function from an External Interface (JavaScript) that will open a simple dialog in the Flex application and returns an value according to the button the user has clicked (OK/Cancel).</p> <p>So it should by a synchronous call to a dialog, i.e. the call waits until the user has closed the dialog like this.</p> <pre><code>//This function is called by JavaScript function onApplicationUnload():Boolean { var result:Boolean; result = showDialogAndWaitForResult(); return result } </code></pre> <p>Does anybody know how I can do this? I could write a loop that waits until the dialog has set a flag and then reads the result to return it, but there must be something that is way more elegant and reusable for waiting of the completion of other asynchronous calls.</p> <p><strong>EDIT:</strong> Unfortunately a callback does not work as the JavaScript function that calls onApplicationUnload() itself has to return a value (similar to the onApplicationUnload() function in Flex). This JavaScript function has a fixed signature as it is called by a framework and I cannot change it. Or in other words: The call from JavaScript to Flex must also be synchronous.</p>
[ { "answer_id": 187955, "author": "David Arno", "author_id": 7122, "author_profile": "https://Stackoverflow.com/users/7122", "pm_score": 2, "selected": false, "text": "function onApplicationUnload():void\n{\n showDialog(resultMethod);\n}\n\nfunction resultMethod(result:Boolean):void\n{...
2008/10/09
[ "https://Stackoverflow.com/questions/187851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7524/" ]
187,855
<p>I keep hearing about the DRY Principle and how it is so important in ASP.NET MVC, but when I do research on Google I don't seem to quite understand exactly how it applies to MVC.</p> <p>From what I've read its not really the copy &amp; paste code smell, which I thought it was, but it is more than that.</p> <p>Can any of you give some insight into how I might use the DRY Principle in my ASP.NET MVC application?</p>
[ { "answer_id": 195769, "author": "Matt Hinze", "author_id": 2676, "author_profile": "https://Stackoverflow.com/users/2676", "pm_score": 3, "selected": true, "text": "FormsAuthentication.Logout()" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/187855", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4481/" ]
187,857
<p>We have a TIBCO EMS solution that uses built-in server failover in a 2-4 server environment. If the TIBCO admins fail-over services from one EMS server to another, connections are supposed to be transfered to the new server automatically at the EMS service level. For our C# applications using the EMS service, this is not happening - our user connections are not being transfered to the new server after failover and we're not sure why.</p> <p>Our application connection to EMS at startup only so if the TIBCO admins failover after users have started our application, they users need to restart the app in order to reconnect to the new server (our EMS connection uses a server string including all 4 production EMS servers - if the first attempt fails, it moves to the next server in the string and tries again).</p> <p>I'm looking for an automated approach that will attempt to reconnect to EMS periodically if it detects that the connection is dead but I'm not sure how best to do that.</p> <p>Any ideas? We are using TIBCO.EMS.dll version 4.4.2 and .Net 2.x (SmartClient app)</p> <p>Any help would be appreciated.</p>
[ { "answer_id": 234966, "author": "ScottCher", "author_id": 24179, "author_profile": "https://Stackoverflow.com/users/24179", "pm_score": 3, "selected": false, "text": "private void initEMS()\n{\n Tibems.SetExceptionOnFTSwitch(true);\n _ConnectionFactory = new TIBCO.EMS.TopicConnect...
2008/10/09
[ "https://Stackoverflow.com/questions/187857", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24179/" ]
187,886
<p>I need to grant select permission for all tables owned by a specific user to another user. Can I do this with a single command along the lines of:</p> <pre><code>Grant Select on OwningUser.* to ReceivingUser </code></pre> <p>Or do I have to generate the sql for each table with something along the lines of:</p> <pre><code> Select 'GRANT SELECT ON OwningUser.'||Table_Name||'TO ReceivingUser' From All_Tables Where Owner='OWNINGUSER' </code></pre>
[ { "answer_id": 189496, "author": "DCookie", "author_id": 8670, "author_profile": "https://Stackoverflow.com/users/8670", "pm_score": 7, "selected": true, "text": "BEGIN\n FOR R IN (SELECT owner, table_name FROM all_tables WHERE owner='TheOwner') LOOP\n EXECUTE IMMEDIATE 'grant sel...
2008/10/09
[ "https://Stackoverflow.com/questions/187886", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9940/" ]
187,890
<p>I have an ASP.NET page which pulls a set of images from a database table, and using an enumerator, goes through all of them and displays then.</p> <p>This all happens in the codebehind (VB.NET), where the code adds the placeholder and some controls inside tables (tables inside the placeholder).</p> <p>I've added a button to this placeholder (inside a table cell), all programatically, but how can I add a click event to the button programatically? I want to fire a javascript (lightbox) which shows a large preview of the image (this works when the user clicks a small image, which invokes a string hyperlink on the code that points to the javascript).</p>
[ { "answer_id": 187898, "author": "alexmac", "author_id": 23066, "author_profile": "https://Stackoverflow.com/users/23066", "pm_score": 4, "selected": false, "text": "cmdMyButton.attributes.add(\"onclick\", \"alert('hello');\")" }, { "answer_id": 187905, "author": "WebDude", ...
2008/10/09
[ "https://Stackoverflow.com/questions/187890", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
187,893
<p>This is what I'd like to do, but it doesn't seem possible: (edit: changed single to double quotes)</p> <pre><code>function get_archives($limit, $offset) { $query = $this-&gt;db-&gt;query(" SELECT archivalie.id, archivalie.signature, type_of_source.description AS type_of_source_description, media_type.description AS media_type_description, origin.description AS origin_description FROM archivalie, type_of_source, media_type, origin WHERE archivalie.type_of_source_id = type_of_source.id AND type_of_source.media_type_id = media_type.id AND archivalie.origin_id = origin.id ORDER BY archivalie.id ASC LIMIT $limit, $offset "); // etc... } </code></pre> <p>It gives this error: (edit: new error message using double quotes, and with an offset number passed in the URL)</p> <pre><code>ERROR: LIMIT #,# syntax is not supported HINT: Use separate LIMIT and OFFSET clauses. </code></pre> <p>It only works if you pass the variables using the ActiveRecord format:</p> <pre><code>$this-&gt;db-&gt;select('archivalie.id, archivalie.signature, etc, etc'); // from, where, etc. $this-&gt;db-&gt;limit($limit, $offset); $query = $this-&gt;db-&gt;get(); </code></pre>
[ { "answer_id": 190539, "author": "meleyal", "author_id": 4196, "author_profile": "https://Stackoverflow.com/users/4196", "pm_score": 1, "selected": false, "text": "$query = $this->db->query(\"\n SELECT archivalie.id, \n archivalie.signature, \n type_of_source.de...
2008/10/09
[ "https://Stackoverflow.com/questions/187893", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4196/" ]
187,894
<p>From C#, I want to do the equivalent of the following:</p> <pre><code>arp -a |findstr 192.168.1.254 </code></pre> <p>Alternatively, the answer could call the <a href="http://msdn.microsoft.com/en-us/library/aa366358.aspx" rel="noreferrer">SendARP</a> function and get the results.</p> <p>This will allow my application to do some other processing that requires the MAC address.</p>
[ { "answer_id": 187929, "author": "jop", "author_id": 11830, "author_profile": "https://Stackoverflow.com/users/11830", "pm_score": 6, "selected": true, "text": "[DllImport(\"iphlpapi.dll\", ExactSpelling=true)]\npublic static extern int SendARP( int destIp, int srcIP, byte[] macAddr, ref...
2008/10/09
[ "https://Stackoverflow.com/questions/187894", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5993/" ]
187,913
<p>What I'd like to avoid: </p> <pre><code>ManagementClass m = new ManagementClass("Win32_LogicalDisk"); ManagementObjectCollection managementObjects = m.GetInstances(); List&lt;ManagementObject&gt; managementList = new List&lt;ManagementObject&gt;(); foreach(ManagementObject m in managementObjects){ managementList.Add(m); } </code></pre> <p>Isn't there a way to get that collection into a List that looks something like: </p> <pre><code>List&lt;ManagementObject&gt; managementList = new List&lt;ManagementObjec&gt;(collection_array); </code></pre>
[ { "answer_id": 187922, "author": "steffenj", "author_id": 15328, "author_profile": "https://Stackoverflow.com/users/15328", "pm_score": 1, "selected": false, "text": "List<ManagementObject> managementList = new List<ManagementObject>(managementObjects.ToArray());\n" }, { "answer_...
2008/10/09
[ "https://Stackoverflow.com/questions/187913", "https://Stackoverflow.com", "https://Stackoverflow.com/users/64/" ]
187,915
<p>How do I detect if a process is already running under the Windows Task Manager? I'd like to get the memory and cpu usage as well. </p>
[ { "answer_id": 187930, "author": "Tomalak", "author_id": 18771, "author_profile": "https://Stackoverflow.com/users/18771", "pm_score": 1, "selected": false, "text": "\"SELECT * FROM Win32_Process WHERE Name = '<your process name here>'\"\n" }, { "answer_id": 187977, "author":...
2008/10/09
[ "https://Stackoverflow.com/questions/187915", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1316/" ]
187,920
<p>I'm logged into a SQL Server 2005 database as a non-sa user, 'bhk', that is a member of the 'public' server role only. The following code tries to execute within a stored procedure called by user 'bhk'. This line of code...</p> <pre><code>TRUNCATE TABLE #Table1 DBCC CHECKIDENT('#Table1', RESEED, @SequenceNumber) WITH NO_INFOMSGS </code></pre> <p>causes this error...</p> <blockquote> <p>User 'guest' does not have permission to run DBCC CHECKIDENT for object<br> '#Table1__00000000007F'.</p> </blockquote> <p>I'm aware of the permissions required to run DBCC CHECKIDENT...<br> <strong><em>Caller must own the table</strong>, or be a member of the sysadmin fixed server role, the db_owner fixed database role, or the db_ddladmin fixed database role.</em></p> <p>So I have two questions:</p> <ol> <li>Since 'bhk' is calling a stored procedure that creates a temporary table, shouldn't 'bhk' be the owner and be allowed to run DBCC CHECKIDENT?</li> <li>Why does the error message return that user 'guest' doesn't have permission? To my knowledge, I'm not logged in as 'guest'.</li> </ol> <p>Any help would be greatly appreciated.</p>
[ { "answer_id": 194185, "author": "splattne", "author_id": 6461, "author_profile": "https://Stackoverflow.com/users/6461", "pm_score": 2, "selected": false, "text": "CREATE TABLE #NotMyTable (TestID int identity)" }, { "answer_id": 197069, "author": "Tim C", "author_id": 7...
2008/10/09
[ "https://Stackoverflow.com/questions/187920", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14360/" ]
187,974
<p>I have a simple Word to Pdf converter as an MSBuild Task. The task takes Word files (ITaskItems) as input and Pdf files (ITaskItems) as output. The script uses a Target transform for conversion:</p> <pre><code>&lt;Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"&gt; &lt;UsingTask AssemblyFile="$(MSBuildExtensionsPath)\MyTasks.dll" TaskName="MyTasks.DocToPdf" /&gt; &lt;Target Name="Build" DependsOnTargets="Convert" /&gt; &lt;Target Name="Convert" Inputs="@(WordDocuments)" Outputs="@(WordDocuments-&gt;'%(FileName).pdf')"&gt; &lt;DocToPdf Inputs="@(WordDocuments)" Outputs="%(FileName).pdf"&gt; &lt;Output TaskParameter="ConvertedFiles" ItemName="PdfDocuments" /&gt; &lt;/DocToPdf&gt; &lt;/Target&gt; &lt;ItemGroup&gt; &lt;WordDocuments Include="One.doc" /&gt; &lt;WordDocuments Include="SubDir\Two.doc" /&gt; &lt;WordDocuments Include="**\*.doc" /&gt; &lt;/ItemGroup&gt; &lt;/Project&gt; </code></pre> <p>What's happening is that SubDir\Two.doc gets converted on every incremental build, One.doc does not (ie MSBuild correctly skips that file because it was already converted). If I use the recursive items spec (the third one above), I get the same behaviour (ie. One.doc only gets converted if the PDF is out of date or missing, but all documents in subdirectories always get converted regardless).</p> <p>What am I doing wrong here?</p>
[ { "answer_id": 188060, "author": "lesscode", "author_id": 18482, "author_profile": "https://Stackoverflow.com/users/18482", "pm_score": 3, "selected": true, "text": " <Target Name=\"Convert\"\n Inputs=\"@(WordDocuments)\"\n Outputs=\"@(WordDocuments->'%(RelativeDir)%(F...
2008/10/09
[ "https://Stackoverflow.com/questions/187974", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18482/" ]
187,981
<p>I have the following regular expression : I figured out most of the part which is as follows :</p> <pre> ValidationExpression="^[\u0020\u0027\u002C\u002D\u0030-\u0039\u0041-\u005A\u005F\u0061-\u007A\u00C0-\u00FF°&#46;/]{1,256}$" u0020 : SPACE u0027 : APOSTROPHE u002C : COMMA u002D : HYPHEN / MINUS u0030-\u0039\ : 0-9 u0041-\u005A : A - Z u005F : UNDERSCORE u0061-\u007A\ : a - z u00C0-\u00FF°&#46;/ : ?? </pre> <p>Need help in understanding the final part of the validation expression : </p> <pre>u00C0-\u00FF°&#46;/</pre> <p>Anyone has any idea what does this mean?</p>
[ { "answer_id": 49766641, "author": "Roland Illig", "author_id": 225757, "author_profile": "https://Stackoverflow.com/users/225757", "pm_score": 0, "selected": false, "text": "\\u0020\n\\u0027\n\\u002C\n\\u002D\n\\u0030-\\u0039\n\\u0041-\\u005A\n\\u005F\n\\u0061-\\u007A\n\\u00C0-\\u00FF\n...
2008/10/09
[ "https://Stackoverflow.com/questions/187981", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24958/" ]
187,983
<p>I have a requirement to hide a process in Task Manager. It is for Intranet scenario. So, everything is legitimate. :) </p> <p>Please feel free to share any code you have (preferably in C#) or any other techniques or any issues in going with this route.</p> <p><strong>Update1</strong>: Most of the users have admin privileges in order to run some legacy apps. So, one of the suggestion was to hide it in task manager. If there are other approaches to prevent users from killing the process, that would be great.</p> <p><strong>Update2</strong>: Removing the reference to rootkit. Somehow made this post look negative.</p>
[ { "answer_id": 188092, "author": "Chris Smith", "author_id": 9073, "author_profile": "https://Stackoverflow.com/users/9073", "pm_score": 4, "selected": false, "text": "DACL_SECURITY_INFORMATION" }, { "answer_id": 14278714, "author": "Cacoon", "author_id": 1948659, "au...
2008/10/09
[ "https://Stackoverflow.com/questions/187983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4337/" ]
187,990
<p>I'm not a C++ developer, but I've always been interested in compilers, and I'm interested in tinkering with some of the GCC stuff (particularly LLVM).</p> <p>On Windows, GCC requires a POSIX-emulation layer (cygwin or MinGW) to run correctly.</p> <p>Why is that?</p> <p>I use lots of other software, written in C++ and cross-compiled for different platforms (Subversion, Firefox, Apache, MySQL), and none of them require cygwin or MinGW.</p> <p>My understanding about C++ best-practice programming is that you can write reasonably platform-neutral code and deal with all the differences during the compilation process.</p> <p>So what's the deal with GCC? Why can't it run natively on Windows?</p> <hr> <p>EDIT:</p> <p>Okay, the two replies so far say, basically, "GCC uses the posix layer because it uses the posix headers".</p> <p>But that doesn't really answer the question.</p> <p>Let's say I already have a set of headers for my favorite standard library. Why would I still need the posix headers?</p> <p>Does GCC require cygwin/mingw to actually <em>RUN</em>?</p> <p>Or does it only need the emulation layer for headers and libraries? If so, why can't I just give it a "lib" directory with the required resources?</p> <hr> <p>EDIT AGAIN:</p> <p>Okay, I'll try again to clarify the question...</p> <p>I also write code in <a href="http://digitalmars.com/d" rel="noreferrer">the D Programming Language</a>. The official compiler is named "dmd" and there are official compiler binaries for both Windows and linux.</p> <p>The Windows version doesn't require any kind of POSIX emulation. And the Linux version doesn't require any kind of Win32 emulation. If the compiler has assumptions about its environment, it hides those assumptions pretty well.</p> <p>Of course, I have to tell the compiler where to find the standard library and where to find libraries to statically or dynamically link against.</p> <p>GCC, by contrast, insists on pretending it's operating within a posix environment, and it asks ME to humor those assumptions by setting up an emulation layer.</p> <p>But what, exactly, within GCC relies on that layer? Is it just looking for stdlib headers, and it assumes it'll find those headers within "/usr/lib"?</p> <p>If that's the case, shouldn't I just be able to tell it to look in "C:/gcc/lib" to find those header files?</p> <p>Or does GCC itself rely on the POSIX libraries to access the file system (and to do other low-level stuff)? If that's the case, then I wonder why they don't just statically link with their favorite windows POSIX libraries. Why require the user to set up the dependencies, when they could build those dependencies right into the application?</p>
[ { "answer_id": 354767, "author": "Brad Gilbert", "author_id": 1337, "author_profile": "https://Stackoverflow.com/users/1337", "pm_score": 5, "selected": false, "text": "cygwin1.dll" }, { "answer_id": 764852, "author": "Artyom", "author_id": 66522, "author_profile": "h...
2008/10/09
[ "https://Stackoverflow.com/questions/187990", "https://Stackoverflow.com", "https://Stackoverflow.com/users/22979/" ]
187,998
<p>Is there any way in SQL Server to get the results starting at a given offset? For example, in another type of SQL database, it's possible to do:</p> <pre><code>SELECT * FROM MyTable OFFSET 50 LIMIT 25 </code></pre> <p>to get results 51-75. This construct does not appear to exist in SQL Server. </p> <p>How can I accomplish this without loading all the rows I don't care about? Thanks! </p>
[ { "answer_id": 188031, "author": "Unsliced", "author_id": 2902, "author_profile": "https://Stackoverflow.com/users/2902", "pm_score": 2, "selected": false, "text": "select top 25 *\nfrom ( \n select top 75 *\n from table \n order by field asc\n) a \norder by field desc \n" }, { ...
2008/10/09
[ "https://Stackoverflow.com/questions/187998", "https://Stackoverflow.com", "https://Stackoverflow.com/users/420/" ]
187,999
<p>One small function of a large program examines assemblies in a folder and replaces out-of-date assemblies with the latest versions. To accomplish this, it needs to read the version numbers of the existing assembly files without actually loading those assemblies into the executing process.</p>
[ { "answer_id": 188036, "author": "jop", "author_id": 11830, "author_profile": "https://Stackoverflow.com/users/11830", "pm_score": 3, "selected": false, "text": "AssemblyName.GetAssemblyName(\"assembly.dll\");" }, { "answer_id": 188038, "author": "Joel B Fant", "author_id...
2008/10/09
[ "https://Stackoverflow.com/questions/187999", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26553/" ]
188,001
<p>I am attempting to rewrite my <a href="http://ForestPad.com" rel="nofollow noreferrer">ForestPad</a> application utilizing WPF for the presentation layer. In WinForms, I am populating each node programmatically but I would like to take advantage of the databinding capabilities of WPF, if possible.</p> <p>In general, what is the best way to two-way databind the WPF TreeView to an Xml document?</p> <p>A generic solution is fine but for reference, the structure of the Xml document that I am trying to bind to looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;forestPad guid="6c9325de-dfbe-4878-9d91-1a9f1a7696b0" created="5/14/2004 1:05:10 AM" updated="5/14/2004 1:07:41 AM"&gt; &lt;forest name="A forest node" guid="b441a196-7468-47c8-a010-7ff83429a37b" created="01/01/2003 1:00:00 AM" updated="5/14/2004 1:06:15 AM"&gt; &lt;data&gt; &lt;![CDATA[A forest node This is the text of the forest node.]]&gt; &lt;/data&gt; &lt;tree name="A tree node" guid="768eae66-e9df-4999-b950-01fa9be1a5cf" created="5/14/2004 1:05:38 AM" updated="5/14/2004 1:06:11 AM"&gt; &lt;data&gt; &lt;![CDATA[A tree node This is the text of the tree node.]]&gt; &lt;/data&gt; &lt;branch name="A branch node" guid="be4b0993-d4e4-4249-8aa5-fa9c940ae2be" created="5/14/2004 1:06:00 AM" updated="5/14/2004 1:06:24 AM"&gt; &lt;data&gt; &lt;![CDATA[A branch node This is the text of the branch node.]]&gt;&lt;/data&gt; &lt;leaf name="A leaf node" guid="9c76ff4e-3ae2-450e-b1d2-232b687214aa" created="5/14/2004 1:06:26 AM" updated="5/14/2004 1:06:38 AM"&gt; &lt;data&gt; &lt;![CDATA[A leaf node This is the text of the leaf node.]]&gt; &lt;/data&gt; &lt;/leaf&gt; &lt;/branch&gt; &lt;/tree&gt; &lt;/forest&gt; &lt;/forestPad&gt; </code></pre>
[ { "answer_id": 188084, "author": "Joel B Fant", "author_id": 22211, "author_profile": "https://Stackoverflow.com/users/22211", "pm_score": 4, "selected": true, "text": "<node type=\"forest\">\n <node type=\"tree\">\n ...\n" }, { "answer_id": 71343808, "author": "B. ...
2008/10/09
[ "https://Stackoverflow.com/questions/188001", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12919/" ]
188,007
<p>I'm using my code-behind page to create a save button programmatically:</p> <pre><code> Button btnSave = new Button(); btnSave.ID = "btnSave"; btnSave.Text = "Save"; </code></pre> <p>However I think this must create an html button or perhaps needs something else as I cannot seem to set the OnClick attribute in the following line, I can specify OnClientClick but this isn't the one I want to set.</p>
[ { "answer_id": 188021, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 3, "selected": false, "text": "//Add the handler to your button, passing the name of the handling method \nbtnSave.Click += new System.EventHa...
2008/10/09
[ "https://Stackoverflow.com/questions/188007", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26126/" ]
188,030
<p>I want to program graphical 2D games more complex than the basic 2D stuff I already know. I don't want to do 3D programming. Just more complex 2D stuff. I dropped high school before I could learn a lot of stuff so I walked away with enough algebra knowledge to balance my checkbook and do some light 2D Cartesian programming.</p> <p>Are there any good resources out there for a guy with a limited attention span (say 20 minutes apiece for a subject I'm keenly interested in) to learn, gradually, how to do something more useful with math in programming?</p>
[ { "answer_id": 15651914, "author": "superlogical", "author_id": 52360, "author_profile": "https://Stackoverflow.com/users/52360", "pm_score": 1, "selected": false, "text": "1. VECTORS\n2. FORCES\n3. OSCILLATION\n4. PARTICLE SYSTEMS\n5. PHYSICS LIBRARIES\n6. AUTONOMOUS AGENTS\n7. CELLULAR...
2008/10/09
[ "https://Stackoverflow.com/questions/188030", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26557/" ]
188,057
<p>Quick question. What do you think, I have a few sites that use a 3 level drop-down menu that will be broken if IE8 released with its current CSS standards in IE8 beta2. So do I take the time to redo those drop downs now? I realize that the way they rendered CSS changed completely between beta 1 and 2, but 2 was/is supposed the be a general use beta and seeing as it is the final beta you would think something as crucial as CSS rendering would have been touched up to work properly.</p> <p>So what do you think, do you wait until 80% (random statistic) of ie7 users automatically update to IE8 and then worry about a broken navigation menu if it still exists. Or do you waste the time now. </p> <p>... if I had it my way all web developers would just make sure that their page did not work in IE8 and then Microsoft would be forced to properly handle CSS.... But I don't usually get things my way.</p>
[ { "answer_id": 188066, "author": "Gabriel Isenberg", "author_id": 1473493, "author_profile": "https://Stackoverflow.com/users/1473493", "pm_score": 4, "selected": true, "text": "<head>\n <meta http-equiv=\"X-UA-Compatible\" content=\"IE=EmulateIE7\"/>\n ...\n</head>\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188057", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19226/" ]
188,098
<p>I have a problem when an unhandeld exception occurs while debugging a WinForm VB.NET project.</p> <p>The problem is that my application terminates and I have to start the application again, instead of retrying the action as was the case in VS2003</p> <p>The unhandeld exception is implemented in the new My.MyApplication class found in ApplicationEvents.vb</p> <pre><code>Private Sub MyApplication_UnhandledException(ByVal sender As Object, ByVal e As Microsoft.VisualBasic.ApplicationServices.UnhandledExceptionEventArgs) Handles Me.UnhandledException Dim handler As New GlobalErrorHandler() handler.HandleError(e.Exception) e.ExitApplication = False End Sub </code></pre> <p>Note: handler.HandleError just shows a dialog box and logs the error to a log file.</p> <p>I also tried the following code that used to work in VS2003 but it results in the same behaviour when run in VS2008:</p> <pre><code> AddHandler System.Windows.Forms.Application.ThreadException, AddressOf OnApplicationErrorHandler AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf OnUnhandledExceptionHandler </code></pre> <p>OnApplicationErrorHandler and OnUnhandledExceptionHandler does the same as handle.HandleError</p> <p>Running the application outside VS2008 results in the expected behaviour (the application doesn't terminate) but it is increasing our test cycle during debugging.</p> <p><strong>Update:</strong> I have added sample code in my answer to demonstrate this problem in C#</p>
[ { "answer_id": 190244, "author": "Philip Fourie", "author_id": 11123, "author_profile": "https://Stackoverflow.com/users/11123", "pm_score": 1, "selected": false, "text": "using System;\nusing System.Windows.Forms;\nnamespace TestCSharpUnhandledException\n{\n public partial class Form...
2008/10/09
[ "https://Stackoverflow.com/questions/188098", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11123/" ]
188,114
<p>I'm trying to write a log file from an ASP.NET application under IIS7, but keep getting the following exception:</p> <blockquote> <p>UnauthorizedAccessException "Access to the path 'C:\Users\Brady\Exports' is denied."</p> </blockquote> <p>I have given write access to the iis_iusrs, iis_wpg, and aspnet users, based on various advices found by Google, but still get the error. Can someone please explain how I can create a log file in that directory, or, will creating a log directory under the web application itself automatically allow writing the file, and is this not perhaps a better solution?</p>
[ { "answer_id": 188125, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 3, "selected": true, "text": "ASPNET - Win XP and Win 2000\nNETWORK SERVICE - Win Vista and 2003\n" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188114", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8741/" ]
188,118
<p>I've tried this, but it doesn't work:</p> <pre><code>col * format a20000 </code></pre> <p>Do I really have to list every column specifically? That is a huge pain in the arse.</p>
[ { "answer_id": 188135, "author": "someguy", "author_id": 8913, "author_profile": "https://Stackoverflow.com/users/8913", "pm_score": 5, "selected": false, "text": "set wrap off\nset linesize 3000 -- (or to a sufficiently large value to hold your results page)\n" }, { "answer_id":...
2008/10/09
[ "https://Stackoverflow.com/questions/188118", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8913/" ]
188,120
<p>So .NET 3.0/3.5 provides us with lots of new ways to query, sort, and manipulate data, thanks to all the neat functions supplied with LINQ. Sometimes, I need to compare user-defined types that don't have a built-in comparison operator. In many cases, the comparison is really simple -- something like foo1.key ?= foo2.key. Rather than creating a new IEqualityComparer for the type, can I simply specify the comparison inline using anonymous delegates/lambda functions? Something like:</p> <pre><code>var f1 = ..., f2 = ...; var f3 = f1.Except( f2, new IEqualityComparer( (Foo a, Foo b) => a.key.CompareTo(b.key) ) ); </code></pre> <p>I'm pretty sure the above doesn't actually work. I just don't want to have to make something as "heavy" as a whole class just to tell the program how to compare apples to apples.</p>
[ { "answer_id": 188130, "author": "Jon Skeet", "author_id": 22656, "author_profile": "https://Stackoverflow.com/users/22656", "pm_score": 7, "selected": true, "text": "using System;\nusing System.Collections.Generic;\n\n/// <summary>\n/// Non-generic class to produce instances of the gene...
2008/10/09
[ "https://Stackoverflow.com/questions/188120", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26286/" ]
188,124
<p>I am writing a website with Visual Studio 2008 and ASP.NET 3.5. I have a masterpage set up to simplify the layout and to keep the content pages for content rather than content and layout.</p> <p>The navigation is list, css'd so it looks like a bar. In order to highlight the page on the bar, the list item needs to look like this <code>&lt;li id="current"&gt;</code>. I do not want to use <code>&lt;asp:ContentPlaceHolder&gt;</code> if I can avoid it. Is there some code I can add to each of my pages (or just to the masterpage?) to accomplish this or am I stuck using <code>&lt;asp:ContentPlaceHolder&gt;</code>'s?</p>
[ { "answer_id": 188173, "author": "John Sheehan", "author_id": 1786, "author_profile": "https://Stackoverflow.com/users/1786", "pm_score": 4, "selected": true, "text": "public string PageSection { get; set; }\n" }, { "answer_id": 189069, "author": "Dave Rutledge", "author_...
2008/10/09
[ "https://Stackoverflow.com/questions/188124", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25515/" ]
188,138
<p>I've seen a number of references to gzipping a javascript to save download time. <em>But</em> I also see a number of warnings that certain browsers do not support this.</p> <p>I have two different methods at my disposal:</p> <ol> <li>use <code>mod_deflate</code> to make Apache compress JS/CSS files in a given directory through htaccess</li> <li>use <code>ob_start('gzhandler')</code> to compress a file and return it to the browser with the correct headers.</li> </ol> <p>The problems with method 1 are that not all browsers support mod_deflate, and I have no clue how to write the <code>.htaccess</code> file to be smart enough to adjust for this.</p> <p>The problem with method 2 is that there is no definitive answer about how to tell if a browser supports a gzipped script, or stylesheet, and that if it does what mime-type must be given as the content type in the header.</p> <p>I need some advice. First, which method is more universally accepted by browsers? Second, how do I decay using either method to provide the uncompressed backup script? Third, would <code>&lt;script src="js/lib.js.gz" type="text/javascript"&gt;&lt;/script&gt;</code> work by itself? (It obviously wouldn't decay.)</p> <p>For the record, I'm using PHP5 with mod_deflate and full gzip creation capabilities, and my doctype is xhtml strict. Also, the javascript itself is compressed with YUI. <strong>Edit:</strong> I just went back and looked, but I have only Apache 1.3; I thought I had 2, so sorry for mentioning mod_deflate when I probably don't have it.</p>
[ { "answer_id": 188216, "author": "Owen", "author_id": 4853, "author_profile": "https://Stackoverflow.com/users/4853", "pm_score": 5, "selected": true, "text": "<IfModule mod_deflate.c>\n # stuff\n</IfModule>\n" }, { "answer_id": 188271, "author": "Ates Goral", "author_id...
2008/10/09
[ "https://Stackoverflow.com/questions/188138", "https://Stackoverflow.com", "https://Stackoverflow.com/users/24950/" ]
188,141
<p>I'm using C# on Framework 3.5. I'm looking to quickly sort a Generic <code>List&lt;T&gt;</code>. For the sake of this example, let's say I have a List of a <code>Person</code> type with a property of lastname. How would I sort this List using a lambda expression?</p> <pre><code>List&lt;Person&gt; people = PopulateList(); people.OrderBy(???? =&gt; ?????) </code></pre>
[ { "answer_id": 188149, "author": "Danimal", "author_id": 2757, "author_profile": "https://Stackoverflow.com/users/2757", "pm_score": 5, "selected": false, "text": "people.OrderBy(person => person.lastname).ToList();\n" }, { "answer_id": 188154, "author": "Jon Skeet", "aut...
2008/10/09
[ "https://Stackoverflow.com/questions/188141", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7215/" ]
188,147
<p>Trying to setup the exception_logger plugin on a production server. Everything worked fine on the dev machine. Trying to rake db:migrate on the prod server and i get this error:</p> <pre><code>rake aborted! no such file to load -- pagination </code></pre> <p>What am i missing?</p>
[ { "answer_id": 188228, "author": "Christoph Schiessl", "author_id": 20467, "author_profile": "https://Stackoverflow.com/users/20467", "pm_score": 1, "selected": false, "text": "rake db:migrate --trace" }, { "answer_id": 188268, "author": "Jason Miesionczek", "author_id": ...
2008/10/09
[ "https://Stackoverflow.com/questions/188147", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18811/" ]
188,160
<p>How have you decided to handle data/control validation in your silverlight applications? </p>
[ { "answer_id": 198728, "author": "Yuval Peled", "author_id": 20257, "author_profile": "https://Stackoverflow.com/users/20257", "pm_score": 2, "selected": false, "text": "// page.xaml.cs\n\nprivate bool clean = true;\n\n\nprivate void LayoutRoot_BindingValidationError( \n object sender,...
2008/10/09
[ "https://Stackoverflow.com/questions/188160", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5618/" ]
188,162
<p>Just wondering what little scripts/programs people here have written that helps one with his or her everyday life (aka not work related).</p> <p>Anything goes, groundbreaking or not. For me right now, it's a small python script to calculate running pace given distance and time elapsed.</p>
[ { "answer_id": 188183, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 8, "selected": true, "text": "o" }, { "answer_id": 188185, "author": "warren", "author_id": 4418, "author_profile": "https://Stackoverflo...
2008/10/09
[ "https://Stackoverflow.com/questions/188162", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25664/" ]
188,166
<p>I am using Team Foundation Server (TFS) for Visual Studio 2005.</p> <p>Whenever i wish to compare two file's versions TFS displays a window with the differences.</p> <p><strong>The problem is that it is always split vertically.</strong></p> <p>In fact, almost every time, <strong>i would prefer to have it split horizontally.</strong> I've already looked at TFS options and googled but i found nothing. I'm appalled to think that such option is not available!</p> <p>Is there any way to configure TFS to split it horizontally?</p>
[ { "answer_id": 36343799, "author": "palswim", "author_id": 393280, "author_profile": "https://Stackoverflow.com/users/393280", "pm_score": 0, "selected": false, "text": ".*" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188166", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20335/" ]
188,184
<p>Here I have:</p> <pre><code>Public Structure MyStruct Public Name as String Public Content as String End Structure Dim oStruct as MyStruct = New MyStruct() oStruct.Name = ... oStruct.Content = ... Dim alList as ArrayList = new ArrayList() alList.Add(oStruct) </code></pre> <p>I'd like to convert the ArrayList to a static strongly-typed Array of type MyStruct. How can I do that? I had no luck with ToArray.</p> <p>I am using .NET Framework 2.0.</p>
[ { "answer_id": 188196, "author": "Bill the Lizard", "author_id": 1288, "author_profile": "https://Stackoverflow.com/users/1288", "pm_score": 2, "selected": false, "text": "ToArray" }, { "answer_id": 188197, "author": "Marc Gravell", "author_id": 23354, "author_profile...
2008/10/09
[ "https://Stackoverflow.com/questions/188184", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1508/" ]
188,188
<p>We recently upgraded an application that that contained web services using the WSE 2.0 to .NET 3.5. When we converted the project in Visual Studio 2008, It did not mention anything about the removing and/or modifying the WSE 2.0 namespaces. Here is the basic architecture of the web services in the .NET 1.1 project.</p> <p>Web Service Source Code:</p> <pre><code>[WebService(Namespace="http://tempuri.org")] public class MyWebService : BaseWebService { //Do some stuff } </code></pre> <p>BaseWebService Source Code:</p> <pre><code>using Microsoft.Web.Services2; using Microsoft.Web.Services2.Security; using Microsoft.Web.Services2.Security.Tokens; namespace MyNameSpace { public class BaseWebService : System.Web.Services.WebService { public BaseWebService() { if(RequestSoapContext.Current == null) throw new ApplicationExcpetion("Only SOAP requests are permitted."); } } } </code></pre> <p>During the conversion, the BaseWebService.cs class was excluded from the project and the WSE2.0 namespaces were removed from the class.</p> <p>Have anyone else experiences any issues with trying to upgrade a web service from .NET 1.1 using the WSE to .NET 3.5?</p> <p>This is related to the previous question I had regarding a client consuming the upgraded web service:</p> <p><a href="https://stackoverflow.com/questions/185420/issues-with-client-consuming-a-net-web-service-upgraded-from-net-11-to-35">Stack Overflow Question</a></p>
[ { "answer_id": 202052, "author": "Michael Kniskern", "author_id": 26327, "author_profile": "https://Stackoverflow.com/users/26327", "pm_score": 0, "selected": false, "text": "<system.web>\n <webServices>\n <soapExtensionTypes>\n <add type=\"Microsoft.Web.Services2.We...
2008/10/09
[ "https://Stackoverflow.com/questions/188188", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26327/" ]
188,208
<p>There seem to be two bash idioms for redirecting STDOUT and STDERR to a file:</p> <pre><code>fooscript &amp;&gt; foo </code></pre> <p>... and ...</p> <pre><code>fooscript &gt; foo 2&gt;&amp;1 </code></pre> <p>What's the difference? It seems to me that the first one is just a shortcut for the second one, but my coworker contends that the second one will produce no output even if there's an error with the initial redirect, whereas the first one will spit redirect errors to STDOUT.</p> <p><strong>EDIT</strong>: Okay... it seems like people are not understanding what I am asking, so I will try to clarify:</p> <p>Can anyone give me an example where the two <em>specific lines</em> lines written above will yield different behavior?</p>
[ { "answer_id": 188217, "author": "J.J.", "author_id": 21204, "author_profile": "https://Stackoverflow.com/users/21204", "pm_score": 1, "selected": false, "text": "&> foo # Will take all and redirect all output to foo.\n\n2>&1 # will redirect stderr to stdout.\n" }, { "answer_id":...
2008/10/09
[ "https://Stackoverflow.com/questions/188208", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16034/" ]
188,209
<p>I have a page something.aspx, with associated codebehind something.aspx.cs. In that codebehind, I want to know the filesystem location of something.aspx. Is there any convenient way to get it?</p> <p>Update: I got several excellent answers, which unfortunately didn't work because of something else crazy I'm doing. I'm encoding some additional information on the URL I pass in, so it looks like this:</p> <p><a href="http://server/path/something.aspx/info1/info2/info3.xml" rel="nofollow noreferrer">http://server/path/something.aspx/info1/info2/info3.xml</a></p> <p>The server deals with this OK (and I'm not using querystring parameters to work around some other code that I didn't write). But when I call Server.MapPath(Request.Url.ToString()) I get an error that the full URL with the 'info' segments isn't a valid virtual path.</p>
[ { "answer_id": 188219, "author": "David Thibault", "author_id": 5903, "author_profile": "https://Stackoverflow.com/users/5903", "pm_score": 3, "selected": false, "text": "// File path\nstring absoluteSystemPath = Server.MapPath(\"~/relative/path.aspx\");\n// Directory path\nstring dir = ...
2008/10/09
[ "https://Stackoverflow.com/questions/188209", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6310/" ]
188,225
<p>I use Visual C++ 2008 in Visual Studio 2008. I frequently use the following command to diff an open file against its most recent checked-in version:</p> <pre><code>File | Source Control | Compare... </code></pre> <p>I can also do the same thing by clicking on an icon in the Source Control toolbar.</p> <p>I'm not certain, but I believe this command is the same for any source control plugin (I happen to use the Perforce plugin.)</p> <p>I'd like to assign a keyboard shortcut to execute this command but I can't seem to find it listed anywhere in dialog where such assignments are normally made:</p> <pre><code>Tools | Customize... | Commands </code></pre> <p>Did I just not see the command in the customize dialog? Is there another method to assign such a keyboard shortcut?</p>
[ { "answer_id": 188528, "author": "jwfearn", "author_id": 10559, "author_profile": "https://Stackoverflow.com/users/10559", "pm_score": 1, "selected": false, "text": "Tools | Options | Environment | Keyboard" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188225", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10559/" ]
188,242
<p>I just downloaded and installed the latest Adventure Works database from <a href="http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=16040" rel="nofollow noreferrer">http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=16040</a> to do some more playing around with LINQ and found that there are some data types that are not natively supported within Visual Studio 2008. I get the "One or more selected items contain a data type that is not supported by the designer." error message. </p> <p>I found that the spatial data type is the issue in this case. </p> <p>My questions are:</p> <ul> <li>What other data types are not inherently supported by Visual Studio that is in SQL Serve 2008?</li> <li>Why are these types not supported?</li> </ul> <p>The second question is I guess the most puzzling to me. I can understand why not all data types would be supported from MySQL, Oracle, Postgre SQL and so forth. I would think that the SQLServer development group, might give a heads up to the Visual Studio development group, you know yell down the hall or something. </p>
[ { "answer_id": 8906546, "author": "Pavan Bhardwaj", "author_id": 1155634, "author_profile": "https://Stackoverflow.com/users/1155634", "pm_score": 2, "selected": false, "text": "Geometry" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188242", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5578/" ]
188,248
<p>Does anyone have any info on creating/drawing a customised ListView object?</p> <p>Currently Im working on a project that requires a customised look and feel within the application. I am using a standard (Windows.Forms) ListView which is not in the same style as the rest of the GUI. We are NOT using a toolbox for custom controls, all controlls are 'skinned' inhouse as it were by overriding hte OnPaint() method for each control.</p> <p>What Im looking for is: - Information about how to handle drawing of the Scroll Bar. - How to use customised drawing routines to handle the column headers. - How to still handle the data shown and draw that correctly.</p> <p>Any and all help would be greatly received.</p>
[ { "answer_id": 188824, "author": "Mitchel Sellers", "author_id": 13279, "author_profile": "https://Stackoverflow.com/users/13279", "pm_score": 2, "selected": true, "text": "NM_CUSTOMDRAW" }, { "answer_id": 189131, "author": "Nick", "author_id": 1490, "author_profile":...
2008/10/09
[ "https://Stackoverflow.com/questions/188248", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1816/" ]
188,250
<p>I believe there is a discussion on this very topic somewhere on the net but I lost the url and I am unable to find it via googling.</p> <p>What I might try right now would be:</p> <pre><code>ISessionFactoryHolder factoryHolder = ActiveRecordMediator&lt;EntityClass&gt;.GetSessionFactoryHolder(); ISession session = factoryHolder.CreateSession(typeof(EntityClass)); try { IDbCommand cmd = session.Connection.CreateCommand(); cmd.CommandText = "spName"; cmd.ExecuteNonQuery(); } catch(Exception ex) { } finally { factoryHolder.ReleaseSession(session); } </code></pre> <p>However, I am not quite sure if this is the correct way to do this or if perhaps a better way exists.</p>
[ { "answer_id": 325642, "author": "Mauricio Scheffer", "author_id": 21239, "author_profile": "https://Stackoverflow.com/users/21239", "pm_score": 1, "selected": false, "text": "ActiveRecordMediator.GetSessionFactoryHolder()\n .GetSessionFactory(typeof(ActiveRecordBase))\n .Connectio...
2008/10/09
[ "https://Stackoverflow.com/questions/188250", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15396/" ]
188,281
<p>In Delphi 2009 I'm finding that any time I use TThread.CurrentThread in an application, I'll get an error message like the following when the application closes:</p> <pre><code>Exception EAccessViolation in module ntdll.dll at 0003DBBA. Access violation at address 7799DBBA in module 'ntdll.dll'. Write of address 00000014. </code></pre> <p>Unless it's just my machine, you can replicate this in a few seconds: create a new Delphi Forms Application, add a button to the form, and use something like the following for the button's event handler:</p> <pre><code>procedure TForm1.Button1Click(Sender: TObject); begin TThread.CurrentThread; end; </code></pre> <p>On both my Vista machine and my XP machine I'm finding that, if I <em>don't</em> click the button everything's fine, but if I <em>do</em> click the button I get the above error message when I close the application.</p> <p>So... I'm wondering if this is a bug, but at the same time I think it's rather likely that I'm simply not understanding something very basic about how you're supposed to work with TThreads in Delphi. I am a bit of a Delphi newbie I'm afraid.</p> <p>Is there something obviously wrong with using TThread.CurrentThread like that?</p> <p>If not, and you have Delphi 2009, do you get the same problem if you implement my simple sample project?</p> <hr> <h2><strong>Update: As François noted below, this actually is a bug in Delphi 2009 at the moment - you can <a href="http://qc.codegear.com/wc/qcmain.aspx?d=67726" rel="noreferrer">vote for it here</a>.</strong></h2> <hr> <h2><strong>Update: This bug was fixed in Delphi 2010.</strong></h2>
[ { "answer_id": 188448, "author": "Francesca", "author_id": 9842, "author_profile": "https://Stackoverflow.com/users/9842", "pm_score": 5, "selected": true, "text": "DoneThreadSynchronization" }, { "answer_id": 192027, "author": "gabr", "author_id": 4997, "author_profi...
2008/10/09
[ "https://Stackoverflow.com/questions/188281", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11961/" ]
188,299
<p>I have the following struct in C++:</p> <pre><code>#define MAXCHARS 15 typedef struct { char data[MAXCHARS]; int prob[MAXCHARS]; } LPRData; </code></pre> <p>And a function that I'm p/invoking into to get an array of 3 of these structures:</p> <pre><code>void GetData(LPRData *data); </code></pre> <p>In C++ I would just do something like this:</p> <pre><code>LPRData *Results; Results = (LPRData *)malloc(MAXRESULTS*sizeof(LPRData)); GetData( Results ); </code></pre> <p>And it would work just fine, but in C# I can't seem to get it to work. I've created a C# struct like this:</p> <pre><code>public struct LPRData { /// char[15] [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 15)] public string data; /// int[15] [MarshalAsAttribute(UnmanagedType.ByValArray, SizeConst = 15)] public int[] prob; } </code></pre> <p>And if I initialize an array of 3 of those (and all their sub-arrays) and pass it into this:</p> <pre><code>GetData(LPRData[] data); </code></pre> <p>It returns with success, but the data in the LPRData array has not changed.</p> <p>I've even tried to create a raw byte array the size of 3 LPRData's and pass that into a function prototype like this:</p> <p>GetData(byte[] data);</p> <p>But in that case I will get the "data" string from the very first LPRData structure, but nothing after it, including the "prob" array from the same LPRData.</p> <p>Any ideas of how to properly handle this?</p>
[ { "answer_id": 188396, "author": "JaredPar", "author_id": 23283, "author_profile": "https://Stackoverflow.com/users/23283", "pm_score": 4, "selected": false, "text": "static extern void GetData([Out] out IntPtr ptr);\n\nLPRData[] GetData()\n{\n IntPtr value;\n LPRData[] array = new...
2008/10/09
[ "https://Stackoverflow.com/questions/188299", "https://Stackoverflow.com", "https://Stackoverflow.com/users/194/" ]
188,306
<p>Right now, my SVN repository is on my laptop's HDD (although I use a code hosting service for more "critical" personal projects) and I just copy the directory over on a weekly basis (which will eventually be scripted or perhaps I'll make an app for the hell of it). Am I at risk for corrupting my SVN repository? So far, I haven't had any problems with the original or the copy, but that doesn't mean that I'm not at risk in the future.</p>
[ { "answer_id": 188319, "author": "Benjamin W. Smith", "author_id": 1068060, "author_profile": "https://Stackoverflow.com/users/1068060", "pm_score": 5, "selected": true, "text": "--clean-logs" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/572/" ]
188,311
<p>In a nutshell, the hashCode contract, according to Java's object.hashCode():</p> <ol> <li>The hash code shouldn't change unless something affecting equals() changes</li> <li>equals() implies hash codes are ==</li> </ol> <p>Let's assume interest primarily in immutable data objects - their information never changes after they're constructed, so #1 is assumed to hold. That leaves #2: the problem is simply one of confirming that equals implies hash code ==.</p> <p>Obviously, we can't test every conceivable data object unless that set is trivially small. So, what is the best way to write a unit test that is likely to catch the common cases?</p> <p>Since the instances of this class are immutable, there are limited ways to construct such an object; this unit test should cover all of them if possible. Off the top of my head, the entry points are the constructors, deserialization, and constructors of subclasses (which should be reducible to the constructor call problem).</p> <p>[I'm going to try to answer my own question via research. Input from other StackOverflowers is a welcome safety mechanism to this process.]</p> <p>[This could be applicable to other OO languages, so I'm adding that tag.]</p>
[ { "answer_id": 188345, "author": "Eli Courtwright", "author_id": 1694, "author_profile": "https://Stackoverflow.com/users/1694", "pm_score": 4, "selected": false, "text": "Set" }, { "answer_id": 188665, "author": "Rob Spieldenner", "author_id": 5118, "author_profile":...
2008/10/09
[ "https://Stackoverflow.com/questions/188311", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18160/" ]
188,327
<p>My question is on the ASP.NET GridView control. I am using a CommandField in the Columns tag as seen below.</p> <pre><code>&lt;asp:CommandField ShowEditButton="True" HeaderStyle-Width="40px" UpdateText="Save" ButtonType="Link" HeaderStyle-Wrap="true" ItemStyle-Wrap="true" ItemStyle-Width="40px"/&gt; </code></pre> <p>What renders is the shown in the following image (after I click on the Edit button). </p> <p><a href="https://i.stack.imgur.com/BUGrY.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/BUGrY.jpg" alt="alt text"></a></p> <p>As you can see <strong>I am trying to have the Cancel link show up a new line and my question is how do you do what?</strong> If I change the <code>ButtonType="Link"</code> to <code>ButtonType="Button"</code>, I get it rendering correctly as shown below.</p> <p><a href="http://i38.tinypic.com/2pqopxi.jpg" rel="nofollow noreferrer">alt text http://i38.tinypic.com/2pqopxi.jpg</a></p> <p>I've tried Google already and maybe I'm not searching on the right tags but I couldn't see this one addressed before.</p>
[ { "answer_id": 188662, "author": "denny", "author_id": 27, "author_profile": "https://Stackoverflow.com/users/27", "pm_score": 3, "selected": true, "text": "<asp:GridView id=\"gvGrid\" runat=\"server\" OnRowCommand=\"gvGrid_Command\">\n <Columns>\n <asp:TemplateField>\n <ItemTemplate>...
2008/10/09
[ "https://Stackoverflow.com/questions/188327", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26573/" ]
188,349
<p>I need to knock out a quick animation in C#/Windows Forms for a Halloween display. Just some 2D shapes moving about on a solid background. Since this is just a quick one-off project I <strong><em>really</em></strong> don't want to install and learn an entire new set of tools for this. (DirectX dev kits, Silverlight, Flash, etc..) I also have to install this on multiple computers so anything beyond the basic .Net framework (2.0) would be a pain in the arse.</p> <p>For tools I've got VS2k8, 25 years of development experience, a wheelbarrow, holocaust cloak, and about 2 days to knock this out. I haven't done animation since using assembler on my Atari 130XE (hooray for page flipping and player/missile graphics!)</p> <p>Advice? Here's some of the things I'd like to know:</p> <ul> <li>I can draw on any empty widget (like a panel) by fiddling with it's OnPaint handler, right? That's how I'd draw a custom widget. Is there a better technique than this?</li> <li>Is there a page-flipping technique for this kind of thing in Windows Forms? I'm not looking for a high frame rate, just as little flicker/drawing as necessary.</li> </ul> <p>Thanks.</p> <p><strong>Post Mortem Edit ... "a couple of coding days later"</strong></p> <p>Well, the project is done. The links below came in handy although a couple of them were 404. (I wish SO would allow more than one reply to be marked "correct"). The biggest problem I had to overcome was flickering, and a persistent bug when I tried to draw on the form directly.</p> <ul> <li>Using the OnPaint event for the Form: bad idea. I never got that to work; lots of mysterious errors (stack overflows, or ArgumentNullExceptions). I wound up using a panel sized to fill the form and that worked fine.</li> <li>Using the OnPaint method is slow anyway. Somewhere online I read that building the PaintEventArgs was slow, and they weren't kidding. Lots of flickering went away when I abandoned this. Skip the OnPaint/Invalidate() and just paint it yourself. </li> <li><p>Setting all of the "double buffering" options on the form still left some flicker that had to be fixed. (And I found conflicting docs that said "set them on the control" and "set them on the form". Well controls don't have a .SetStyle() method.) I haven't tested without them, so they might be doing something (<code>this</code> is the form):</p> <pre><code> this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); </code></pre></li> </ul> <p>So the workhorse of the code wound up looking like (<code>pf</code> is the panel control):</p> <pre><code> void PaintPlayField() { Bitmap bufl = new Bitmap(pf.Width, pf.Height); using (Graphics g = Graphics.FromImage(bufl)) { g.FillRectangle(Brushes.Black, new Rectangle(0, 0, pf.Width, pf.Height)); DrawItems(g); DrawMoreItems(g); pf.CreateGraphics().DrawImageUnscaled(bufl, 0, 0); } } </code></pre> <p>And I just called PaintPlayField from the inside of my Timer loop. No flicker at all.</p>
[ { "answer_id": 188377, "author": "Nick", "author_id": 1490, "author_profile": "https://Stackoverflow.com/users/1490", "pm_score": 5, "selected": true, "text": "Invalidate(true)" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188349", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8173/" ]
188,351
<p>I am using a DataGridView control in a Windows Forms application. When a user holds down control to select multiple items, it works fine. Now when the user releases control and clicks (and holds down the left mouse button) to start a drag operation, the selection changes. How can I stop the selection from clearing when the user holds down the left mouse button?</p>
[ { "answer_id": 11800199, "author": "charles young", "author_id": 604608, "author_profile": "https://Stackoverflow.com/users/604608", "pm_score": 0, "selected": false, "text": " private SC.ArrayList selectedCells()\n {\n SC.ArrayList cellsList = new SC.ArrayList();\n Int32 s...
2008/10/09
[ "https://Stackoverflow.com/questions/188351", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4770/" ]
188,364
<p>I've created a language pack for a site before, but I'm not sure if what I'm doing is the best method.</p> <p>Basically, all I have is a file with variables defining string constants. Usually a set of arrays where an array usually refers to a particular elements of the site.</p> <p>Then the site code just includes the appropriate file based on a flag and then echo's out the appropriate array element. </p> <p>What are some ways of doing this to reduce maintenance headaches and performance?</p>
[ { "answer_id": 188401, "author": "Greg", "author_id": 24181, "author_profile": "https://Stackoverflow.com/users/24181", "pm_score": 0, "selected": false, "text": "define('SOME_STRING', 'Some string');" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188364", "https://Stackoverflow.com", "https://Stackoverflow.com/users/26577/" ]
188,366
<p>I am trying to run a query that will give time averages but when I do... some duplicate records are in the calculation. how can I remove duplicates?</p> <p>ex.</p> <p>Column 1 / 07-5794 / 07-5794 / 07-5766 / 07-8423 / 07-4259</p> <p>Column 2 / 00:59:59 / 00:48:22 / 00:42:48/ 00:51:47 / 00:52:12</p> <p>I can get the average of the column 2 but I don't want identical values in column 1 to be calculated twice (07-5794) ???</p>
[ { "answer_id": 188380, "author": "Dave DuPlantis", "author_id": 8174, "author_profile": "https://Stackoverflow.com/users/8174", "pm_score": 1, "selected": false, "text": "select avg(min_time) as avg_time from\n (select incnum, min(col2) as min_time from inc group by incnum)\n" }, ...
2008/10/09
[ "https://Stackoverflow.com/questions/188366", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
188,373
<p>I'd like to re-brand (and send error emails) for all of the SSRS default error pages (picture below) when you access reports via /ReportServer/. I'm already handling the ASP OnError event and <em>some</em> of the default SSRS errors appear to catch their own exceptions and then render this page cancel the response all before the OnError event is ever fired.</p> <p>Any idea on how I can get a handle into SSRS to brand all error pages?</p> <p><img src="https://www.jazz2online.com/junk/reporting_error.gif" alt="Reporting Services Error"></p>
[ { "answer_id": 188380, "author": "Dave DuPlantis", "author_id": 8174, "author_profile": "https://Stackoverflow.com/users/8174", "pm_score": 1, "selected": false, "text": "select avg(min_time) as avg_time from\n (select incnum, min(col2) as min_time from inc group by incnum)\n" }, ...
2008/10/09
[ "https://Stackoverflow.com/questions/188373", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15050/" ]
188,388
<p>I would like to have both Eclipse and Netbeans (with JUnit) installed on one system, so I can be somewhat familiar with both.</p> <p>Besides GUI development (see "<a href="https://stackoverflow.com/questions/174308/using-both-eclipse-and-netbeans">Using both Eclipse and Netbeans</a>"), are there any other issues with using both IDEs on the same system, or even the same project?</p>
[ { "answer_id": 188818, "author": "Daniel Spiewak", "author_id": 9815, "author_profile": "https://Stackoverflow.com/users/9815", "pm_score": 2, "selected": false, "text": "project.xml" } ]
2008/10/09
[ "https://Stackoverflow.com/questions/188388", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16312/" ]
188,389
<p>I try to define a schema for XML documents I receive.</p> <p>The documents look like:</p> <pre><code>&lt;root&gt; &lt;items&gt; &lt;group name="G-1"&gt; &lt;item name="I-1"/&gt; &lt;item name="I-2"/&gt; &lt;item name="I-3"/&gt; &lt;item name="I-4"/&gt; &lt;/group&gt; &lt;/items&gt; &lt;data&gt; &lt;group name="G-1" place="here"&gt; &lt;customer name="C-1"&gt; &lt;item name="I-1" count="3"/&gt; &lt;item name="I-2" count="4"/&gt; &lt;/customer&gt; &lt;customer name="C-2"&gt; &lt;item name="I-3" count="7"/&gt; &lt;/customer&gt; &lt;/group&gt; &lt;/data&gt; &lt;/root&gt; </code></pre> <p>I tried XmlSpy and xsd.exe from .NET 2.0. Both created schema definitions which allow below <code>&lt;group&gt;</code> any number of <code>&lt;item&gt;</code> and <code>&lt;customer&gt;</code> elements. But what I'm looking for should restrict <code>&lt;group&gt;</code> below <code>&lt;items&gt;</code> to <code>&lt;item&gt;</code> elements, and <code>&lt;group&gt;</code> below <code>&lt;data&gt;</code> to <code>&lt;customer&gt;</code> elements.</p> <p>Is this something xml schema is not capable at all?</p>
[ { "answer_id": 188430, "author": "Peter Meyer", "author_id": 1875, "author_profile": "https://Stackoverflow.com/users/1875", "pm_score": 3, "selected": true, "text": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<xs:schema attributeFormDefault=\"unqualified\" elementFormDefault=\"qualifie...
2008/10/09
[ "https://Stackoverflow.com/questions/188389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/23772/" ]
188,414
<p>I have used the XML Parser before, and even though it worked OK, I wasn't happy with it in general, it felt like I was using workarounds for things that should be basic functionality.</p> <p>I recently saw SimpleXML but I haven't tried it yet. Is it any simpler? What advantages and disadvantages do both have? Any other parsers you've used?</p>
[ { "answer_id": 188445, "author": "Robert K", "author_id": 24950, "author_profile": "https://Stackoverflow.com/users/24950", "pm_score": 8, "selected": true, "text": "$root->myElement" }, { "answer_id": 4942773, "author": "NexusRex", "author_id": 445500, "author_profil...
2008/10/09
[ "https://Stackoverflow.com/questions/188414", "https://Stackoverflow.com", "https://Stackoverflow.com/users/25910/" ]
188,422
<p>How can I transform a website to be able to handle multi language (example : english, french, spanish)?</p> <p>I do not like the resource file because I feel limited and it's pretty long to build the list. Do you have any suggestion?</p> <h2>Update</h2> <p>For the moment the best way we found is to use an XML file and with some Xpath et get values.</p>
[ { "answer_id": 188475, "author": "Herb Caudill", "author_id": 239663, "author_profile": "https://Stackoverflow.com/users/239663", "pm_score": 3, "selected": false, "text": " <asp:linkbutton runat='server' text='<%$ LanguageStrings:ClickMe%>' />\n" }, { "answer_id": 11031726, ...
2008/10/09
[ "https://Stackoverflow.com/questions/188422", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13913/" ]
188,425
<p>I have been trying to work my way through Project Euler, and have noticed a handful of problems ask for you to determine a prime number as part of it.</p> <ol> <li><p>I know I can just divide x by 2, 3, 4, 5, ..., square root of X and if I get to the square root, I can (safely) assume that the number is prime. Unfortunately this solution seems quite klunky.</p></li> <li><p>I've looked into better algorithms on how to determine if a number is prime, but get confused fast.</p></li> </ol> <p>Is there a simple algorithm that can determine if X is prime, and not confuse a mere mortal programmer?</p> <p>Thanks much!</p>
[ { "answer_id": 188470, "author": "Lance Roberts", "author_id": 13295, "author_profile": "https://Stackoverflow.com/users/13295", "pm_score": -1, "selected": false, "text": "Input: Integer n > 1 \n\n\nif (n is has the form ab with b > 1) then output COMPOSITE \n\nr := 2 \nwhile (r < n)...
2008/10/09
[ "https://Stackoverflow.com/questions/188425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2156/" ]