instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I'm trying to figure out how big a certain database would be (it hasn't been created yet). I know how many rows and what the tables will be. Is there a feature in Oracle that will tell me the size of such a theoretical database? Is there a known math formula I can use? I know there is a feature to determine the size...
<p>you can from the size of the data types for the columns in a table. You can then get a rough estimate of the size of a row in that table. then for 1 to n tables, then for 1 row in 1 table for x rows in x tables = estimate of the database for a given rowsize.</p> <p>Long handed I know but this is how i normally do ...
<p>Having an exact size wasn't too important, so I went with littlegeek's method. I figured out what my tables and columns would be, and <a href="http://lbd.epfl.ch/f/teaching/courses/oracle8i/server.815/a68003/01_04blt.htm" rel="nofollow noreferrer">looked up the sizes of the data types</a>, then did some good 'ole mu...
3,224
<p>A VB6 application is using the Interop Forms Toolkit to work with forms written in .NET. The documentation for the toolkit advises calling a method on the toolkit to advise the toolkit when the VB6 application is shutting down.</p> <p>The VB6 application uses a Sub Main procedure that loads a splash screen, then di...
<p>In a module (probably the same one that contains Sub Main), create a public sub (e.g AppCleanUp) that will hold your cleanup code.</p> <p>Add a class to your project (e.g. clsAppCleanup). In this class, add code in the Class_Terminate event handler that calls the sub you created in the previous step.</p> <p>In a m...
<p>Its been a while since I wrote in VB6 but if I remember correctly you can use the Unload event to call your cleanup code (it similar to the closing event in .net). You can also check that there are no other forms in the VB6 app still running</p>
15,046
<p>I'm planning to make an LCD Resin printer. I'm still learning and I found out that I need daylight resin (which hardens when white light comes from the LCD).</p> <p>If I search for "Daylight resin" on Google, the only "useful" result I find is for <a href="https://photocentric3d.com/daylightresins/?v=9b6a28c805e0" ...
<p>It looks like <a href="https://store.ono3d.net/" rel="nofollow noreferrer">Ono</a> may fit what you are looking for. They have several colors listed on their site.</p> <p>Red <a href="https://i.stack.imgur.com/Em8Uu.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Em8Uu.jpg" alt="enter image des...
<p>ONO, as mentioned previously. But I do believe that resin will be rather expensive. Along the lines of $15 per 100ml. Since their resin sales are geared towards their printer (small, resin based printer that uses your smart phone as the light source) they sell smaller portions, as their printer can't hold all that m...
658
<p>Say you have a web form with some fields that you want to validate to be only some subset of alphanumeric, a minimum or maximum length etc.</p> <p>You can validate in the client with javascript, you can post the data back to the server and report back to the user, either via ajax or not. You could have the validati...
<p>all of the above:</p> <ol> <li>client-side validation is more convenient for the user</li> <li>but you can't trust the client so the code-behind should also validate</li> <li>similarly the database can't trust that you validated so validate there too</li> </ol> <p>EDIT: i see that you've edited the question to ask...
<p>A good data validation solution could make use of <a href="http://www.w3.org/TR/xmlschema-2/" rel="nofollow noreferrer">XML Schema</a> based datatypes definition, then both client and server would reuse the types as they would both need to executing it. Worth noting, Backbase Ajax Framework implement client-side use...
27,540
<p>I'm looking for a quick-and-dirty solution to this, I have to set up a Subversion server really quickly, like by the end of the day tomorrow. My initial thought was to just download a virtual appliance that we could load onto our host machine. The problem I am having however is that all the appliances I have found...
<p>You should consider this, it is really ZIRRO friction and it integrates well in various scenarios. <br />Not to mention it is free of charge.</p> <p><a href="http://www.visualsvn.com/server/" rel="noreferrer" title="VisualSVN Server">http://www.visualsvn.com/server/</a></p> <p>Cheers, <br />Dragos</p>
<p>I would agree with <a href="https://stackoverflow.com/users/1862/kibbee">Kibbee</a>. I wanted to jump in with SVN so I installed the daemon and had everything up and running in no time. It took me longer to get all the commands down for adding and committing files than the installation.</p>
4,838
<p>Does any one know the best way to deploy a resource file to the App_GlobalResource folder of the web application when a feature is activated?</p>
<p>So, as a final followup to this question here is what we finally did to completely automate this process.</p> <p>We did, as was suggested, use the ApplicationResourceFile element in the manifest file.</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;Solution SolutionId="{185E973C-3A10-4e2a-9E0F-DC14...
<p>We recently ran into the same issue on our farm installation. Unfortunately, adding ApplicationResourceFile entries in the manifest only gets your resources to the Resources-folder.</p> <p>While you can manually deploy the resource files from Resources to App_GlobalResources with stsadm -o copyappbincontent (must b...
37,855
<p>I would like to think that some of the software I'm writing today will be used in 30 years. But I am also aware that a lot of it is based upon the UNIX tradition of exposing time as the number of seconds since 1970.</p> <pre class="lang-c prettyprint-override"><code>#include &lt;stdio.h&gt; #include &lt;time.h&gt; ...
<p>I have written portable replacement for time.h (currently just localtime(), gmtime(), mktime() and timegm()) which uses 64 bit time even on 32 bit machines. It is intended to be dropped into C projects as a replacement for time.h. It is being used in Perl and I intend to fix Ruby and Python's 2038 problems with it...
<p>By 2038, time libraries should all be using 64-bit integers, so this won't actually be that big of a deal (on software that isn't completely unmaintained).</p> <p>COBOL programs might be fun though.</p>
5,690
<p>I tried "x = y ** e", but that didn't work.</p>
<p>use the <code>pow</code> function (it takes <code>float</code>s/<code>double</code>s though).</p> <p><code>man pow</code>:</p> <pre><code> #include &lt;math.h&gt; double pow(double x, double y); float powf(float x, float y); long double powl(long double x, long double y); </code></pre> <p><strong>EDIT...
<p>or you could just write the power function, with recursion as a added bonus</p> <pre><code>int power(int x, int y){ if(y == 0) return 1; return (x * power(x,y-1) ); } </code></pre> <p>yes,yes i know this is less effecient space and time complexity but recursion is just more fun!!</p>
26,182
<p>I am working on a rails application (I have some experience with rails). But, this time I am using RESTful to build it. I am wondering how do I validate my models in a RESTful fashion? What I mean by that is when a user enters data into a form, but the model validations prevent the model from being created what i...
<p>Josh - you mention wanting to know how to redirect the user back to create if it errored out. If you are use to earlier versions of Rails just make sure you are using the form_for helper rather then the start_form_tag from early. Your controller code will look pretty similar to how you might be used to... for exampl...
<p>Whether developing in a RESTful or regular fashion, the backend implementation remains generally the same. Just as in a non-RESTful app, you would simply re-render the create page with the form with the instance the user is trying to create. Really with REST, all you are doing is creating a uniform set of URLs which...
44,981
<p>I'm struggling with Test::Unit. When I think of unit tests, I think of one simple test per file. But in Ruby's framework, I must instead write: </p> <pre><code>class MyTest &lt; Test::Unit::TestCase def setup end def test_1 end def test_1 end end </code></pre> <p>But setup and teardown r...
<p>As mentioned in Hal Fulton's book "The Ruby Way". He overrides the self.suite method of Test::Unit which allows the test cases in a class to run as a suite. </p> <pre><code>def self.suite mysuite = super def mysuite.run(*args) MyTest.startup() super MyTest.shutdown() end mysuite en...
<p>Use the TestSuite as @romulo-a-ceccon described for special preparations for each test suite.</p> <p>However I think it should be mentioned here that Unit tests are ment to run in total isolation. Thus the execution flow is setup-test-teardown which should guarantee that each test run undisturbed by anything the ot...
31,943
<p>I need to be able to take an arbitrary text input that may have a byte order marker (BOM) on it to mark its encoding, and output it as ASCII. We have some old tools that don't understand BOM's and I need to send them ASCII-only data.</p> <p>Now, I just got done writing this code and I just can't quite believe the i...
<p>If you've got i_fileBytes in memory already, you can just check whether or not it starts with a BOM, and then convert either the whole of it or just the bit after the BOM using <code>Encoding.Unicode.GetString</code>. (Use the overload which lets you specify an index and length.)</p> <p>So as code:</p> <pre><code>...
<pre><code>System.Text.Encoding.ASCII.GetBytes(new StreamReader(new MemoryStream(i_fileBytes)).ReadToEnd()) </code></pre> <p>That should save a few round-trips.</p>
39,905
<p>I'm writing cross platform C++ code (Windows, Mac). Is there a way to check how much memory is in use by the current process? A very contrived snippet to illustrate:</p> <pre><code>unsigned long m0 = GetMemoryInUse(); char *p = new char[ random_number ]; unsigned long m1 = GetMemoryInUse(); printf( "%d bytes used\n...
<p>Here's some code I wrote to try to do this in a portable way. It's not perfect, but I think it should at least give a pointer to how to do this on each of several platforms.</p> <p>(P.S. I use OSX and Linux regularly, and know this works well. I use Windows more rarely, so caveats apply to the Windows clause, but...
<p>you can use "memory pool" pattern.All objects in your program allocate/deallocate memory from this pool so you can learn how much memory you consume. </p>
48,693
<p>I'm about to enter the 1st phases of designing a commodities trading application. A major function of this application is the capture and evaluation of pricing information. Pricing in this market is not fixed. It is usually a market benchmark +/- a premium. For example: (A and B are market benchmarks)</p> <ul> <li>...
<p>I bet your users like the flexibility of entering the formulas into Excel, so I'd suggest an approach like this:-</p> <ol> <li>Write something to allow them to enter formulas into your application using the type of operators that they actually will use with keywords for the different base prices. This can just be ...
<p>Interesting scenario. WARNING: This response is based on some ideas I had for approaching the problem and may not reflect best practices.</p> <p>I would try to see if you can boil down your potential formula rules into simpler constructs. This would then allow you to compose your rules together to create complex fo...
27,690
<p>I am using C# and DSL Tools for VS2005. </p> <p>I need to create Transactions to change some data but i want them to be hidden from the user, that means, to not show in the UNDO list in VS2005.</p> <p>I tried by disabling the UndoManager</p> <pre><code>store.UndoManager.UndoState = UndoState.Disabled; </code></pr...
<p><code>store.UndoManager.UndoState = UndoState.Disabled</code>; </p> <p>is almost right for what u want,</p> <p><code>store.UndoManager.UndoState = UndoState.DisabledNoFlush;</code> </p> <p>this will not clear the rest of the undo list :) cyas at lunch Luis.</p>
<p>I'm afraid I don't have an exact answer for your question but... are you sure you really need that? Most of the times when you need to change some data in the model is to react to other changes in the model. If that is the case, you might want to investigate using rules to get an existing transaction within the cont...
37,864
<p>I've been wondering about the performance improvements touted in Java SE 6 - is it in the compiler or the runtime? Put another way, would a Java 5 application compiled by JDK 6 see an improvement run under JSE 5 (indicating improved compiler optimization)? Would a Java 5 application compiled by JDK 5 see an improvem...
<p>I have not heard about improvements in the compiler, but extensive information has been published on the runtime performance improvements.</p> <p><strong>Migration guide:</strong></p> <p><a href="http://java.sun.com/javase/6/webnotes/adoption/adoptionguide.html" rel="nofollow noreferrer">http://java.sun.com/javase/6...
<p>Its almost 100% the runtime. While it is possible for some basic compilation tricks to make it into the Java compiler itself, I don't believe there are any significant improvements between Java 1.5 and 1.6.</p>
11,851
<p>For some reason I can't use <code>runat="server"</code> as an attribute for the input tag in order for the jQuery to display the image button and work. Is something wrong without <code>runat="server"</code>? It works fine. And I want the format to be "yyyy/mm/dd" and also I need it for the server because this is whe...
<p>it changes your id from "#datepicker" to "form1_ctl01_ctl05_datepicker" or something when you use runat='server'</p> <p>EDIT: For a solution, you could pick it up based on css class rather than ID</p> <pre><code>&lt;input id='datepicker' runat='server' class='datepicker' /&gt; $(document).ready(function(){ $(".da...
<p>For posterity:</p> <p>When using the <code>runat='server'</code> tag, add <code>clientidmode='static'</code> to your element tag to prevent mangling of the generated id. On complicated or nested forms this may mess with the uniqueness of your control ids, which is why they are prefixed by default with the id of the...
47,085
<p>I'm working on a .Net applications with multiple threads doing all sorts of things. When something goes wrong in production I want to be able to see which threads are running (by their managed name) and also be able to pause / kill them.</p> <p>Anyway to achieve this ?</p> <p>VS isn't always available (although a ...
<p>There's nothing built in to .net that will do this. If you want to programmatically iterate through your active threads, you have to register them somewhere on launch and either unregister them on completion or filter them before you act on them. We did a version of this and it requires a non-trivial amount of work....
<p>You can attach a managed debugger to view/freeze the threads, or use WinDbg with the SOS extensions if you want something lighter weight.</p>
12,797
<p>When should you use XML attributes and when should you use XML elements?</p> <p>e.g.</p> <pre><code>&lt;customData&gt; &lt;records&gt; &lt;record name="foo" description="bar" /&gt; &lt;/records&gt; &lt;/customData&gt; </code></pre> <p>or</p> <pre><code>&lt;customData&gt; &lt;records&gt; &lt;record&...
<p>There is an article titled "<a href="http://www.ibm.com/developerworks/xml/library/x-eleatt.html" rel="nofollow noreferrer">Principles of XML design: When to use elements versus attributes</a>" on IBM's website.</p> <p>Though there doesn't appear to be many hard and fast rules, there are some good guidelines mentio...
<p>I tend to use elements when it's data that a human reader would need to know and attributes when it's only for processing (e.g. IDs). This means that I rarely use attributes, as the majority of the data is relevant to the domain being modeled.</p>
18,375
<p>The very common beginner mistake is when you try to use a class property &quot;statically&quot; without making an instance of that class. It leaves you with the mentioned error message:</p> <blockquote> <p>You can either make the non static method static or make an instance of that class to use its properties.</p> <...
<p>You can't call something that doesn't exist. Since you haven't created an object, the non-static method doesn't exist yet. A static method (by definition) always exists.</p>
<p>The simple reason behind this is that Static data members of parent class can be accessed (only if they are not overridden) but for instance(non-static) data members or methods we need their reference and so they can only be called through an object.</p>
37,090
<p>The <code>java.net.InetAddress.GetByName(String host)</code> method can only return <code>A</code> records so to lookup other record types I need to be able to send DNS queries using the <code>dnsjava</code> library.</p> <p>However that normally relies on being able to parse <code>/etc/resolv.conf</code> or similar...
<p>The <a href="http://tools.ietf.org/rfc/rfc882.txt" rel="noreferrer">DNS protocol</a> is not that complex - can't you just do the DNS accesses using raw sockets (either TCP or UDP)? After a quick look at the dnsjava doco it seems to provide low level DNS support to assist with this.</p> <p>The other possible direct...
<p>We should be able to find dns address being irrespective to what network (wifi or ethernet) we are connected. Here is my program. </p> <p>In your <strong>AndroidManifest.xml</strong> file</p> <pre><code>&lt;uses-permission android:name="android.permission.INTERNET" /&gt; &lt;uses-permission android:name="android.p...
31,087
<p>On occasion I've heard people discuss the benefits of keeping track of programming mistakes, if for no other reason than it increases awareness of common errors. I've started to keep a list of bugs that I find in my code, along with what could have led to them. The main question I have is this:</p> <ul> <li>What ...
<p>This is only useful if you are actually vigilant with tracking and reviewing. When I was working on a team, no matter how much documented that for example our servers in the production environment were natted and would not be able to resolve their own domain names or public IP addresses, every 6 months, I'd get a ca...
<p>I would also want to ask the question of how much time would be required to accurately track the mistakes, and if that time could be better spent directly on improving the software instead. If you can do this in a minimal amount of time and are able to refer back to your records to prevent future mistakes, it may be...
38,113
<p>In Python is there any way to make a class, then make a second version of that class with identical dat,a but which can be changed, then reverted to be the same as the data in the original class? </p> <p>So I would make a class with the numbers 1 to 5 as the data in it, then make a second class with the same names ...
<p>A class is a template, it allows you to create a blueprint, you can then have multiple instances of a class each with different numbers, like so.</p> <pre><code>class dog(object): def __init__(self, height, width, lenght): self.height = height self.width = width self.length = length ...
<p>Classes don't have values. Objects do. Is what you want basically a class that can reset an instance (object) to a set of default values? </p> <p>How about just providing a reset method, that resets the properties of your object to whatever is the default?</p> <p>I think you should simplify your question, or tell ...
8,962
<p>I know that PHP doesn't yet have native Enumerations. But I have become accustomed to them from the Java world. I would love to use enums as a way to give predefined values which IDEs' auto-completion features could understand.</p> <p>Constants do the trick, but there's the namespace collision problem and (or actual...
<p>Depending upon use case, I would normally use something <em>simple</em> like the following:</p> <pre><code>abstract class DaysOfWeek { const Sunday = 0; const Monday = 1; // etc. } $today = DaysOfWeek::Sunday; </code></pre> <p>However, other use cases may require more validation of constants and value...
<p>I use a construction like the following for simple enums. Typically you can use them for switch statements. </p> <pre><code>&lt;?php define("OPTION_1", "1"); define("OPTION_2", OPTION_1 + 1); define("OPTION_3", OPTION_2 + 1); // Some function... switch($Val){ case OPTION_1:{ Perform_1();}break; ...
31,752
<p>I noticed the following today: <a href="http://tirania.org/blog/archive/2008/Oct-01-1.html" rel="nofollow noreferrer">Mono at the PDC 2008</a>?</p> <blockquote> <p>My talk will cover new technologies that we have created as part of Mono. Some of them are reusable on .NET (we try to make our code cross platform) a...
<p>These are some of the major <a href="http://www.mono-project.com/Libraries" rel="noreferrer">libraries</a> that you can use:</p> <ul> <li><a href="http://www.mono-project.com/GtkSharp" rel="noreferrer">Gtk#</a>, the Cross platform GUI API Unix, Windows, MacOS X, <ul> <li>this is an entire stack of libraries and i...
<p><a href="http://www.mono-project.com/Release_Notes_Mono_2.0" rel="nofollow noreferrer">Here</a> is more details about Mono 2.0</p>
20,040
<p>When I use Emacs I want to be able to easily display and navigate through a list of files I worked on from not just the current session but from previous sessions. (BTW, running Emacs 22.2 on Windows)</p>
<p>From <a href="http://www.joegrossberg.com/archives/000182.html" rel="noreferrer">Joe Grossberg</a>'s blog (no longer available):</p> <blockquote> <p>But if you're using GNU Emacs 21.2 (the latest version, which includes this as part of the standard distro), you can just put the following lines into your ....
<p>Even if you don't have recentf turned on, Emacs is saving a list of files entered via the minibuffer in the variable <code>file-name-history</code>. Also, executing <code>(savehist-mode 1)</code> in your <code>.emacs</code> file makes that variable persist across invocations of Emacs.</p> <p>So here's a little funct...
7,321
<p>OK - I have an interesting one here. I'm working on a tetris clone (basically to "level-up" my skills). I was trying to refactor my code to get it abstracted the way I wanted it. While it was working just fine before, now I get a segmentation fault before any images can be blitted. I've tried debugging it to no ...
<p>Look at line 15 to 18 of Surface.cpp:</p> <pre><code> surface = SDL_DisplayFormatAlpha( tempSurface ); surface = tempSurface; } SDL_FreeSurface( tempSurface ); </code></pre> <p>I assume it segfaults because when you use this surface later, you are actually operating on tempSurface because of this line:</p> ...
<p>I don't have SDL installed on my machine, but after looking through the code.</p> <p>I noticed this in the Output.cpp file:</p> <pre><code>display = new Surface(); </code></pre> <p>You do nothing. The constructor for this is empty. (surface is not initialized).</p> <p>Then in Output::initalize() you do:</p> <pr...
44,335
<p>Is it possible to create a form on Windows using Ruby? I have a Ruby script and I would like to have an input form to ask for a user's password, then use this in the rest of my script. </p> <p>update: I have successfully done this with wxRuby, although it looks ugly. Shoes looks promising, I might look into that if...
<p>I recall using <a href="http://wxruby.rubyforge.org/wiki/wiki.pl" rel="noreferrer">wxRuby</a> for this a while ago.</p>
<p><a href="http://www.ironruby.net/" rel="nofollow noreferrer">IronRuby</a> runs on the .NET runtime and as such has access to all of the .NET winforms API. It's in development, so it may or may not meet your needs yet. </p>
23,247
<p>I know of a couple of routines that work as follows: </p> <blockquote> <p>X<sub>n+1</sub> = Routine(X<sub>n</sub>, max) </p> </blockquote> <p>For example, something like a LCG generator: </p> <blockquote> <p>X<sub>n+1</sub> = (a*X<sub>n</sub> + c) mod m </p> </blockquote> <p>There isn't enough parameteri...
<p>From my response to <a href="https://stackoverflow.com/questions/158716/how-do-you-efficiently-generate-a-list-of-k-non-repeating-integers-between-0-an#161552">another question</a>:</p> <blockquote> <p>It is actually possible to do this in space proportional to the number of elements selected, rather than the...
<p>Is it possible to index a set of permutations without previously computing and storing the whole thing in memory? I tried something like this before and didn't find a solution - I think it is impossible (in the mathematical sense).</p> <p>Disclaimer: I may have misunderstood your question...</p>
19,662
<p>I've been tasked with finding (and potentially fixing) some serious performance problems with a Flex application that was delivered to us. The application will consistently take up 50 to 100% of the CPU at times when it is simply idling and shouldn't be doing anything.</p> <p>My first step was to run the profiler ...
<p>Theres a couple things that typically happen on an enterframe Handler within a flex project. Some things to watch for</p> <ol> <li><p>Manual &lt; mycomponent enterFrame="" > event responses or ones added manually via component.addEventListener(Event.ENTER_FRAME, myfunc)</p></li> <li><p>callLater() calls, these happ...
<p>Justin, thanks for the reply. The issue is not with enterFrame executing, but rather with it trying to do too much in each iteration.</p> <p>FYI: Coincidentally, the original poster and I are dealing with the same application. We have decided to remove all Degrafa resources in favor of ProgrammaticSkins. I'll rep...
43,962
<p>I have had many problems with my heat shrink for the thermostat on my Anet A8 melting from the heat block. </p> <p>Is there a way I can insulate my wires from heat but still have enough room to put the thermistor into the block?</p>
<p>For an illustration of how to employ the Kapton tape, that is mentioned in the answers from Harvey Lim and Howler, watch <a href="https://www.youtube.com/watch?v=0EIFIAWiPdU&amp;t=1290" rel="nofollow noreferrer">How to build a RepRap Prusa i3 (Assembly 7)</a> at 21:30:</p> <p><a href="https://i.stack.imgur.com/IEr...
<p>You could use Kapton tape to tape the thermistor. It is usually the best option for sticking something onto the hotend or on the heat block. You will also have less trouble since it is very thin.</p> <p>Note that if you use Kapton tape, you should use several layers of it for added insulation.</p>
593
<p>I can no longer use / at the windows xp command prompt, and it seems to have started after a botched cygwin installation, e.g. cd /windows won't work, but used to.</p> <p>Can anyone think of how this might have happened?</p> <p><strong>OOPS! It doesn't normally work in XP</strong>, though I had read that it does i...
<p>Actually, since DOS 2.0, the kernel and file APIs have <em>always</em> supported forward slash, and many command line calls. See: <a href="http://blogs.msdn.com/larryosterman/archive/2005/06/24/432386.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/larryosterman/archive/2005/06/24/432386.aspx</a>.</p> <p>I ...
<p>You imagined it - it never worked.</p> <p>If you happen to be in <code>C:\</code> and type</p> <blockquote> <p><code>C:\&gt;cd /windows</code></p> </blockquote> <p>it will take you to <code>C:\WINDOWS\</code> but that's only because <code>/windows</code> is not a valid option to <code>cd</code>, so it tries ign...
24,363
<pre><code>public class doublePrecision { public static void main(String[] args) { double total = 0; total += 5.6; total += 5.8; System.out.println(total); } } </code></pre> <p>The above code prints:</p> <pre class="lang-none prettyprint-override"><code>11.399999999999 </code>...
<p>As others have mentioned, you'll probably want to use the <a href="https://docs.oracle.com/javase/8/docs/api/java/math/BigDecimal.html" rel="noreferrer"><code>BigDecimal</code></a> class, if you want to have an exact representation of 11.4.</p> <p>Now, a little explanation into why this is happening:</p> <p>The <c...
<p>Do not waste your efford using BigDecimal. In 99.99999% cases you don't need it. java <strong>double</strong> type is of cource approximate but in almost all cases, it is sufficiently precise. Mind that your have an error at 14th significant digit. <strong>This is really negligible!</strong></p> <p>To get nice outp...
41,771
<p>I am trying to build out a useful 3d game engine out of the Ogre3d rendering engine for mocking up some of the ideas i have come up with and have come to a bit of a crossroads. There are a number of scripting languages that are available and i was wondering if there were one or two that were vetted and had a proper ...
<p>The syntax is a matter of taste, Lua is like Javascript but with curly braces replaced with Pascal-like keywords. It has the nice syntactic feature that semicolons are never required but whitespace is still not significant, so you can even remove all line breaks and have it still work. As someone who started with C ...
<p>I'd go with Lua since writing bindings is extremely easy, the license is very friendly (MIT) and existing libraries also tend to be under said license. Scheme is also nice and easy to bind which is why it was chosen for the Gimp image editor for example. But Lua is simply great. World of Warcraft uses it, as a very ...
11,350
<p>currently i am forcing my WPF app to use the luna theme no matter what, with this XAML code</p> <pre><code>&lt;Application.Resources&gt; &lt;ResourceDictionary&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source="Styles.xaml" /&gt; &lt;ResourceDictiona...
<p>Try </p> <pre><code>&lt;Style x:Key="{x:Type TextBox}" TargetType="{x:Type TextBox}"&gt; </code></pre>
<p>Have you tried to set the lune resourcedictionary first and your own resourcedictionary last? I can imagine the luna theme overrides your style.</p> <pre><code>&lt;Application.Resources&gt; &lt;ResourceDictionary&gt; &lt;ResourceDictionary.MergedDictionaries&gt; &lt;ResourceDictionary Source=...
41,842
<p>We have an auto-complete list that's populated when an you send an email to someone, which is all well and good until the list gets really big you need to type more and more of an address to get to the one you want, which goes against the purpose of auto-complete</p> <p>I was thinking that some logic should be adde...
<p>This kind of thing seems similar to what is done by firefox when hinting what is the site you are typing for.</p> <p>Unfortunately I don't know exactly how firefox does it, point system seems good as well, maybe you'll need to balance your points :)</p> <p>I'd go for something similar to:</p> <p>NoM = Number of M...
<p><a href="http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.52.2668" rel="nofollow">This paper</a> describes a single-parameter family of cache eviction policies that includes least recently used and least frequently used policies as special cases.</p> <p>The parameter, lambda, ranges from 0 to 1. When lambda ...
25,735
<p>I have checked in a huge Eclipse project from my desktop computer to the SVN server. I did it using the command line. However, by mistake I committed all the compiled classes also in the server.</p> <p>For every plug-in, there is a directory /bin/ that contains the compiled classes.</p> <p>Is there a way to quic...
<p>From <a href="http://bugs.sakaiproject.org/confluence/display/BOOT/Add+bin+and+target+to+global+svn+ignore+in+Eclipse" rel="nofollow noreferrer">here</a> (for the 'additionally part'):</p> <ol> <li>Click on Window -> Preferences</li> <li>Select Team -> Ignored Resources</li> <li>Click on Add Pattern and enter "bin"...
<p>To add to what VonC suggests, if you're using the command line, you can edit your configuration file (and change your global-ignores entry) here:</p> <pre><code>~/.subversion/config </code></pre> <p>or in the windows registry:</p> <pre><code>HKCU\Software\Tigris.org\Config </code></pre>
36,876
<p>I have a defunct process on my system:</p> <pre><code>abc 22093 19508 0 23:29 pts/4 00:00:00 grep ProcA abc 31756 1 0 Dec08 ? 00:00:00 [ProcA_my_collect] &lt;defunct&gt; </code></pre> <p>How can I kill the above process, without a reboot of the machine? I have tried with</p> <pre><code>k...
<p>You have killed the process, but a dead process doesn't disappear from the process table until its parent process performs a task called "reaping" (essentially calling <code>wait(3)</code> for that process to read its exit status). Dead processes that haven't been reaped are called "<a href="http://en.wikipedia.or...
<p>You're probably not going to be able to if killing the parent doesn't resolve it. For whatever reason the systems isn't collecting that zombie process.</p> <p>FWIW, I've seen it quite a bit on the SCO Openserver boxen that I used to administer. Heavy multi-user usage and low system resources, but it didn't seem t...
46,514
<ol> <li><p><strong>How do i redirect a url to domain .</strong> eg. <a href="http://www.mydomain.com/index.php=HairThing" rel="nofollow noreferrer">http://www.mydomain.com/index.php=HairThing</a> --> <a href="http://www.mydomain.com" rel="nofollow noreferrer">http://www.mydomain.com</a></p></li> <li><p><strong>How do...
<p>For your second question, the browser will <em>always</em> put a slash after the site name. This is because the trailing slash is required to indicate the root path of the web site.</p>
<p>you could use a general rule that works on every domain without having to change the name of the domain all the time. This is very helpful when you have multiple domains parked on same root.</p> <pre><code>RewriteCond %{HTTP_HOST} !^www\.[a-z0-9-]+\.[a-z]{2,6} [NC] RewriteCond %{HTTP_HOST} ([a-z0-9-]+\.[a-z...
46,310
<p>One title per answer.</p>
<p>Core War (<a href="http://en.wikipedia.org/wiki/Core_war" rel="noreferrer">http://en.wikipedia.org/wiki/Core_war</a>) is the classic, where two programs run in a simulated machine, each trying to halt the other one.</p>
<p>Life?&nbsp;</p>
17,310
<p>I'm trying to display the contents of an ordered array in something like a JTextField.</p> <pre><code>for (int i=0; i&lt;array.length; i++) { this.textField.setText(array[i]); } </code></pre> <p>This won't work for two reasons. The first minor reason: if the array length is 4 then jtextfield is getting it's va...
<h2>Quick & Dirty Answer</h2> <pre><code>for (int i=0; i&lt;array.length; i++) { this.myJTextField.setText(this.myJTextField.getText() + ", " + array[i]); } </code></pre> <h2>Correct Way</h2> <p>First, calling a member variable <code>JTextField</code> probably isn't wise. Since the class is already called like t...
<p>You can concatenate all those integers into a string the then present that value in the textfield.</p> <pre><code>StringBuilder sb = new StringBuilder(); for( int i : array ) { // &lt;-- alternative way to iterate the array sb.append( i ); sb.append( ", " ); } sb.delete(sb.length()-2, sb.length()-1); //...
42,086
<p>I am looking for a command in Unix that returns the status of a process(active, dead, sleeping, waiting for another process, etc.)</p> <p>is there any available?<br> A shell script maybe?</p>
<p>Try <em>pflags &lt;pid&gt;</em>, which will give you per-thread status information. Example:</p> <pre> root@weetbix # pflags $$ 3384: bash data model = _ILP32 flags = ORPHAN|MSACCT|MSFORK /1: flags = ASLEEP waitid(0x7,0x0,0xffbfefc0,0xf) sigmask = 0x00020000,0x00000000 </pre> <p>Also check ...
<p>Playing with ps options doesn't give you what you need?</p>
12,060
<p>I was checking out Intel's "whatif" site and their Transactional Memory compiler (each thread has to make atomic commits or rollback the system's memory, like a Database would). </p> <p>It seems like a promising way to replace locks and mutexes but I can't find many testimonials. Does anyone here have any input?</p...
<p>I have not used Intel's compiler, however, Herb Sutter had some interesting comments on it...</p> <p>From <a href="http://www.devx.com/go-parallel/Article/37839" rel="noreferrer">Sutter Speaks: The Future of Concurrency</a></p> <p><strong>Do you see a lot of interest in and usage of transactional memory, or is the...
<p>In some cases I can see this as being useful and even necessary.</p> <p>However, even if the processor has special instructions that make this process easier there is still a large overhead compared to a mutex or semaphore. Depending on how it's implemented it may also impact realtime performance (have to either s...
10,824
<p>I am new to this community, but I am working on a site that requires implementation of a user/password/register check upon entry, which would check against a database, or write to the database, in the case of registration. I have experience with XHTML and CSS, and just discovered RoR. I honestly have very little ins...
<p>I would recommend looking at <a href="http://github.com/technoweenie/restful-authentication/tree/master" rel="nofollow noreferrer">Restful Authentication</a>.</p> <p>Also, for good code examples in general, have a look at <a href="http://github.com/technoweenie/altered_beast/tree" rel="nofollow noreferrer">Altered ...
<p>Are you looking for information on how to implement user authentication in Rails? You could try <a href="http://wiki.rubyonrails.org/rails/pages/Acts_as_authenticated" rel="nofollow noreferrer"><code>acts_as_authenticated</code></a>.</p>
23,710
<p>I have a need to maintain the session state in the database. However I cannot access the database directly from the web server. The web server communicates with an app server which in turn has access to the database. <br /> Is there a way to configure this? Or does a custom component have to be written. <br /> The ...
<p>Your only option is to build a custom component.</p> <p>They really aren't that difficult to do as the only thing you need is for the browser to send you a value from either a cookie or the query string. What's stored is simply name value pairs.</p> <p>see <a href="http://msdn.microsoft.com/en-us/library/aa479034...
<p>You can write a custom SessionState provider.. I think it's the only way.. Have a look on <a href="http://msdn.microsoft.com/en-us/library/aa479034.aspx" rel="nofollow noreferrer">MSDN here</a>.</p>
48,329
<p>I just get the beach ball all day long (it's been doing nothing for hours). It's not taking CPU, not reading from disk, not using the network.</p> <p>I'm using <strong>Java 1.6</strong> on <strong>Mac OS X 10.5.4</strong>. It worked once, now even restarts of the computer won't help. Activity Monitor says it's "(No...
<p>I get the same problem after there's been an active connection sitting idle for a while. I solve it by restarting sql developer every once in a while.</p> <p>I also have Toad for Oracle running on a vmware XP session, and it works great. If you don't mind the money, try that.</p>
<p>The latest version of SQL Developer is very good and I have experienced no problems with it on my Mac Pro. DB Solo 3 is also quite good.</p>
3,395
<p>Is there a way in FreeBSD to (being root) run a command as unprivileged user, like nobody? Kind of like reverse of sudo. Oh and considering that 'nobody' has /usr/sbin/nologin as shell - so <b>su</b> is not an option.</p>
<p>sudo will allow you to run a command as another user.</p> <pre><code>sudo -u nobody &lt;command&gt; </code></pre> <p>will run as nobody, even if their login shell is not available.</p>
<p>sudo will allow you to run a command as another user.</p> <pre><code>sudo -u nobody &lt;command&gt; </code></pre> <p>will run as nobody, even if their login shell is not available.</p>
36,275
<p>The application that I'm designing will retrieve and store content from a variety of disparate sources on a schedule. In some cases, the content will be retrieved based on a time interval (think stock quotes), and in other cases the content will be retrieved based on a custom schedule (MWF @ 2pm). Many of the proc...
<p>I would approach this from a slightly different angle. I assume that the <code>Board</code> object traps mouse events first, so that it can decide which shape has been clicked on. I would have the board trap mouse movements as well, passing the correct (snapped or unsnapped) coordinates "down" to the selected <code>...
<p>Just trying to think together with you.. I see no big deal in Shapes having IBoard interface. Though, I don't like the idea that they have to check the flag on the board...</p> <p>How would you pass the flag as parameter? In OnMove() method? didn't understood this quite well...could you expand?</p> <p>Though.. If ...
40,745
<p>I've used a Continuous Integration server in the past with great success, and hadn't had the need to ever perform a code freeze on the source control system. </p> <p>However, lately it seems that everywhere I look, most shops are using the concept of code freezes when preparing for a release, or even a new test ver...
<p>Continuous integration is a "build" but it's part of the programming part of the development cycle. Just like the "tests" in TDD are part of the programming part of the development cycle.</p> <p>There will still be builds and testing as part of the overall development cycle.</p> <p>The point of continuous integra...
<p>I think that code freezes are important because each new feature is a potential new source of bugs. Sure regression tests are great and help address this issue. But code freezes allow the developers to focus on fixing <em>currently outstanding bugs</em> and get the current feature set into a release worthy state.</p...
35,717
<p>Given a .SCAD file which contains some modules, how can I execute one of those modules from the command line?</p> <p><strong>example.scad</strong></p> <pre><code>module One() { ... } module Two() { ... } </code></pre> <p><strong>render.sh</strong></p> <pre><code>openscad -q -o one.stl --module One example.scad </cod...
<p>The <code>openscad -D</code> option can actually include arbitrary code, not just variable definitions, so you can include a call to the module. You can even use <code>/dev/null</code> on Linux or NUL on Windows as the input file and have 100 % of your code in <code>-D</code> statements.</p>
<p>elaborating on the answer from @r-github-stop-helping-ice, I find the following pattern useful:</p> <h6>example.scad</h6> <pre><code>module a() { .. } module b() { .. } module c() { .. } module print(item=0) { if (item==1) a(); if (item==2) b(); if (item==3) c(); } item = 0; print(item); </code></pre> <h6>re...
1,786
<p>I use the VS2008 command prompt for builds, TFS access etc. and the cygwin prompt for grep, vi and unix-like tools. Is there any way I can 'import' the vcvars32.bat functionality into the cygwin environment so I can call "tfs checkout" from cygwin itself?</p>
<p>According to <a href="http://www.cs.ucl.ac.uk/research/vr/Dive/Local/compile.html" rel="noreferrer">this page</a> you need to:</p> <p>"Depending on your preference, you can either add the variables required for compilation direct to your environment, or use the vcvars32.bat script to set them for you. Note you have...
<p>witkamp's answer works for vs2005 -- for vs2008, use </p> <p>CALL "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"</p>
8,736
<p>We have a codebase that is several years old, and all the original developers are long gone. It uses many, many threads, but with no apparent design or common architectural principles. Every developer had his own style of multithreaded programming, so some threads communicate with one another using queues, some lo...
<p>Invest in a copy of Intel's <a href="http://www.intel.com/cd/software/products/asmo-na/eng/239144.htm" rel="nofollow noreferrer">VTune</a> and its thread profiling tools. It will give you both a system and a source level view of the thread behaviour. It's certainly not going to autodocument the thing for you, but sh...
<p>One thing to keep in mind with using log4net or similar tool is that they change the timing of the application and can often hide the underlying race conditions. We had some poorly written code to debug and introduced logging and this actually removed race conditions and deadlocks (or greatly reduced their frequency...
3,123
<p>When is it better to use a <a href="https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.list-1" rel="noreferrer">List</a> vs a <a href="https://learn.microsoft.com/en-us/dotnet/api/system.collections.generic.linkedlist-1" rel="noreferrer">LinkedList</a>?</p>
<p>In most cases, <code>List&lt;T&gt;</code> is more useful. <code>LinkedList&lt;T&gt;</code> will have less cost when adding/removing items in the middle of the list, whereas <code>List&lt;T&gt;</code> can only cheaply add/remove at the <em>end</em> of the list.</p> <p><code>LinkedList&lt;T&gt;</code> is only at it's...
<p>I asked a <a href="https://stackoverflow.com/questions/45643556/how-to-make-improve-performance-on-my-implement-of-this-linkedlist">similar question related to performance of the LinkedList collection</a>, and discovered <a href="https://github.com/StephenClearyArchive/Deque/blob/master/Source/PortableClassLibrary/D...
20,515
<p>EditPad Lite has a nice feature (<kbd>CTRL</kbd>-<kbd>E</kbd>, <kbd>CTRL</kbd>-<kbd>I</kbd>) which inserts a time stamp e.g. "2008-09-11 10:34:53" into your code.</p> <p>What is the best way to get this functionality in Vim?</p> <p>(I am using Vim 6.1 on a Linux server via SSH. In the current situation a number of...
<p><a href="http://kenno.wordpress.com/2006/08/03/vim-tip-insert-time-stamp/" rel="noreferrer">http://kenno.wordpress.com/2006/08/03/vim-tip-insert-time-stamp/</a></p> <p>Tried it out, it works on my mac:</p> <pre><code>:r! date </code></pre> <p>produces:</p> <pre><code>Thu Sep 11 10:47:30 CEST 2008 </code></pre> ...
<p>Another quick way not included by previous answers: type-</p> <p>!!date</p>
7,993
<p>Thinking in regards to Sliverlight, I would like to know where would be good places to go to get a refresher on 3d space, transforms, matrix manipulation, and all that good stuff.</p>
<p>There's always <em>The Bible</em></p> <p><img src="https://i.stack.imgur.com/8nEyw.jpg" alt="Foley &amp; van Dam"></p> <p>It <em>is</em> expensive and very heavy on the theory, so there's also the cheaper <em>Bible Lite</em></p> <p><img src="https://i.stack.imgur.com/zvmQ1.jpg" alt="alt text"></p> <p>As pointed ...
<p>Any linear algebra textbook should provide the math refresher; there's a fairly good one available online at <a href="http://joshua.smcvt.edu/linearalgebra/" rel="nofollow noreferrer">Linear Algebra textbook home page</a>.</p>
19,725
<p>I want to do some functional testing on a (restful) webservice. The testsuite contains a bunch of test cases, each of which performs a couple of HTTP requests on the webservice.</p> <p>Naturally, the webservice has to run or the tests will fail. :-)</p> <p>Starting the webservice takes a couple of minutes (it does...
<p>The answer is now to create a <code>@ClassRule</code> within your suite. The rule will be invoked before or after (depending on how you implement it) each test class is run. There are a few different base classes you can extend/implement. What is nice about class rules is that if you do not implement them as anonymo...
<p>As an aside, it's a bad idea to have unit tests actually calling external resources like webservices, databases, etc.</p> <p>Unit tests should be super-quick to run and a delay of 'a couple of minutes' for each run of the suite will mean it won't be run as much as it should.</p> <p>My advice:</p> <p>Look at mocki...
45,519
<p>I figure this problem is easier than just a regular spell checker since the list of U.S cities is small compared to all known English words.</p> <p>Anyhow, here's the problem: I have text files with full of city names; some of which are spelled correctly and some which aren't. </p> <p>What kind of algorithm can I ...
<p>Do you actually need to correct the misspellings or just flag them as with a normal spell checker? If the latter, you just need to obtain a list of correct spellings and make sure each name is the same as one in your list.</p> <p>If you want to actually correct them, you probably want to use the concept of <a href...
<p>If the same city name occurs more than once in the file you can use the number of occurrence of each city name and flag the one that appears only once. </p>
33,097
<p>I have a Window where I have put a Frame. I would like to add a Page to the Frame when I click a button that is also on the Window but not in the Frame. There are several buttons in the Window and each click on a button should load a different Page in the Frame.</p> <p>Since I'm a total newbie on this WPF stuff it'...
<p>the Frame class exposes a method named "Navigate" that takes the content you want to show in your frame as parameter. try calling </p> <pre><code>myFrame.Navigate(myPageObject); </code></pre> <p>this should work</p>
<p>yourFramName.NavigationService.Navigate(yourPageObject)</p> <p>e.g Frame1.NavigationService.Navigate(new Page1());</p>
16,706
<p>I came across an article about Car remote entry system at <a href="http://auto.howstuffworks.com/remote-entry2.htm" rel="nofollow noreferrer">http://auto.howstuffworks.com/remote-entry2.htm</a> In the third bullet, author says,</p> <blockquote> <p>Both the transmitter and the receiver use the same pseudo-random n...
<p>In PRNG functions, the output of the function is dependent on a 'seed' value, such that the same output will be provided from successive calls given the same seed value. So, yes.</p> <p>An example (using C#) would be something like:</p> <pre><code>// Provide the same seed value for both generators: System.Random r...
<p>As Erik and Claudiu have said, ad long as you seed your PRNG with the same value you'll end up with the same output.</p> <p>An example can be seen when using AES (or any other encryption algorithm) as the basis of your PRNG. As long as you keep using an inputs that match on both device (transmitter and receiver) th...
29,578
<p>We have several legacy applications which use Access databases for storing data and/or configuration. </p> <p>Sometimes we have to do small changes or corrections at our customers databases. (Adding an index, modifying a data row, ...) In many cases Access is available on the customers' workstations, but sometimes ...
<p>I use VBScript for edits and updates of databases when Access is not available. Scripts can be written quite quickly and there are a number of ready-made scripts available on-line, such as for compacting a database.</p> <p>This example links a table.</p> <pre><code>Dim adoCn Dim adoCat Dim adoTbl strLinkFile = "C...
<p>Personally I'd try and avoid doing this altogether. You're masking the problem rather than solving it.</p> <p>If an index is worth adding to a single customer's database for example, it's probably worth adding to all customer databases. Otherwise the same issues will occur repeatedly going forward. I understand the...
48,927
<p>I just stumbled across this bug in some legacy code:</p> <pre><code>class MyAPIHandler { private: int handle; public: void MyApiHandler() // default constructor { handle = 42; }; }; </code></pre> <p>It compiles fine, with no warnings - but the behaviour wasn't what I intended, bec...
<p>If you always use initialiser lists in your constructors:</p> <pre><code>MyApiHandler() // default constructor : handle(42) { } </code></pre> <p>the misnamed constructor bug would be even more unlikely, and it's better <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10" rel="noreferrer" title="style...
<p>Maybe you could do a</p> <pre><code>#define CONSTRUCTOR </code></pre> <p>And then in your code</p> <pre><code>class MyAPIHandler { public: CONSTRUCTOR MyAPIHandler() { // Deep magic } }; </code></pre> <p>Now, by itself this will not do anything, but if you get used to writing i...
42,814
<p>My voltage at the controller at max load is ~11.4&nbsp;V (heated bed + motors + hotend). Is this normal? </p> <p>I'm measuring 11.8&nbsp;V at the PSU, so 0.4&nbsp;V -> 5&nbsp;W lost in the wires.</p> <p>I have a pretty beefy ~2&nbsp;mm diameter copper wire that's ~1&nbsp;m long. Its area is 2.5&nbsp;mm<sup>2</sup...
<p>Regardless of how the voltage is lowered, you aren't delivering the power to the heating elements that they are designed to deliver. For a resistive heater, the power scales with the square of the voltage.</p> <p>Delivering 11.4&nbsp;V to the heaters will result in the power being <span class="math-container">$11....
<p>Per <a href="https://www.calculator.net/voltage-drop-calculator.html?material=copper&amp;wiresize=6.571&amp;voltage=12&amp;phase=dc&amp;noofconductor=1&amp;distance=6&amp;distanceunit=feet&amp;amperes=18&amp;x=34&amp;y=15" rel="nofollow noreferrer">this website</a> it matches the expectations. Using 13AWG =~ 2.5 mm^...
1,308
<p>I am trying to get the size of an array populated by stdin:</p> <pre><code>char *myArray; cin &gt;&gt; myArray cout &lt;&lt; sizeof(myArray); </code></pre> <p>This returns 4 when I enter a string greater with a length greater than 4 e.g. "40905898"</p> <p>Where am i going wrong?</p>
<p><code>sizeof</code> operator statically evaluates to the size of the thing you are passing to it. A <code>char*</code> is a pointer which, depending on the machine architecture has a specific size (4 bytes on 32 bit systems and 8 bytes on 64 bit machines). To accomplish what you are trying to do, I suggest you use t...
<p>You seem to have lots of problems here:</p> <p>myArray is not initialised - where is the input going to live?</p> <p>You usually use: cin >> myArray; (Note the direction of the chevrons and the semi-colon)</p> <p>sizeof(myArray) will always return the same value (4 on your platform)</p> <p>Try this version inst...
49,464
<p>What is the proper way to install Hibernate Tools in Eclipse as a plugin? The <a href="http://www.hibernate.org/255.html" rel="noreferrer" title="Hibernate site">Hibernate site</a> doesn't really give any instructions.</p> <p>Looking at the Hibernate Tools binary <code>HibernateTools-3.2.4.Beta1-R200810311334.zip</...
<p>Well, most convenient and safest way is to use JBoss update site within Eclipse software updates (Help -> Software Updates... -> Add Site...):</p> <p><a href="http://download.jboss.org/jbosstools/updates/stable/" rel="noreferrer">The latest stable release update site for JBoss Tools</a></p> <p>There you can find H...
<p>For Eclipse plugins, you just unzip them and drop the folder in the Eclipse\Plugins directory. Simple as that.</p>
45,787
<p>Suppose you have a fairly large (~2.2 MLOC), fairly old (started more than 10 years ago) Windows desktop application in C/C++. About 10% of modules are external and don't have sources, only debug symbols.</p> <p>How would you go about reducing application's memory footprint in half? At least, what would you do to f...
<p>Override malloc()/free() and new()/delete() with wrappers that keep track of how big the allocations are and (by recording the callstack and later resolving it against the symbol table) where they are made from. On shutdown, have your wrapper display any memory still allocated.</p> <p>This should enable you both to...
<p>I don't think your question is well posed.</p> <p>The size of source code is not directly related to the memory footprint. Sure, the compiled code will occupy some memory but the application might will have memory requirements on it's own. Both static (the variables declared in the code) and dynamic (the object the...
14,944
<p>Occasionally my MS Access reports: </p> <blockquote> <p>The search key was not found in any record</p> </blockquote> <p>After this happens the solution is to close Access, compact and repair the backend and then delete the record.</p> <p>What causes this and how can I avoid it?</p>
<p>This may be a rookie mistake on my part, but it still caused the error message. I was importing an excel spreadsheet and had a space in front of a field heading. Once the space was removed the file imported no problem</p> <p><strong>Note:</strong> The space only appears when you look at the file in Excel; when Ac...
<p>In Access 2007 this error occurs when importing an Excel file where there are two fields with the same column header.</p>
25,327
<p>I am trying to link two fields of a given table to the same field in another table. I have done this before so I can't work out what is wrong this time.</p> <p>Anyway:</p> <pre><code>Table1 - Id (Primary) - FK-Table2a (Nullable, foreign key relationship in DB to Table2.Id) - FK-Table2b (Nullable, foreign key relat...
<p>No idea on the cause, but I just reconstructed my .dbml from scratch and it fixed itself. Oh for a "refresh" feature...</p>
<p>I had the same problem. This error appeared when I tried to link different types of fields, or when I tryied to drag-and-drop table to .dbml space, but .dbml already had contained linked tables with different types of linked fields.</p>
6,686
<p>We have number of plugins to display images in a nice manner. For eg: mooflow(<a href="http://www.outcut.de/MooFlow/example-milkbox-bridge.html" rel="nofollow noreferrer">http://www.outcut.de/MooFlow/example-milkbox-bridge.html</a>) with which we can display images in mac itunes manner. But i am wondering whether we...
<p><a href="http://jquery.com/demo/thickbox/" rel="nofollow noreferrer">jQuery Thickbox</a> let's you do HTML contents (see 'Inline Content' example).</p>
<p>There are several modified versions of Lightbox that do this. An example is <a href="http://jquery.com/demo/thickbox/" rel="nofollow noreferrer">Thickbox</a>. See the the inline content example.</p>
47,466
<p>I am getting a lot of errors when starting RAD7. The server doesn't respond to class changes. Sometimes the server won't start. Sometimes RAD will not acknowledge modules that I added to the server. It is kind of buggy.</p> <p>I know there is metadata in the workspace, are there safe ways to clean the metadata ...
<p>Another tip is to remove all projects in your Servers view in Eclipse, stop your server, start your server, open the admin console of your server and see that everything is gone in there as well. If you still see configured apps, remove them in the admin console. Shutdown server, start again and check for a clean st...
<p>If you need to purge your metadata settings, try just deleting .metadata/.plugins/org.eclipse.core.resources first! That saved me quite a bit of trouble...</p>
38,290
<p>I am given an integer (lets call it x) and I need to generate an array of arrays, where each subarray is a list of elements which are one of a given set of integers, and the sum of all of the elements of each subarray is x. The array of arrays needs to contain all possible distinct subarrays of this form.</p> <p>Fo...
<p>For the storage, you probably want a LinkedList of HashSets:</p> <pre><code>LinkedList&lt;HashSet&lt;Integer&gt;&gt; l; </code></pre> <p>For the problem: This is the SubSet problem, which is NP-Complete, so I don't think there's a known, fast way to do it. I haven't taken any optimization theory, so the best I cou...
<p>Since you don't know the size of the "subarrays," I suggest you use one of the collections from Java such as <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/ArrayList.html" rel="nofollow noreferrer"><code>ArrayList&lt;E&gt;</code></a>.</p>
40,235
<p>Is there a specific name for that problem? What causes this, and is there a way how to solve it? </p> <p>Printed with PLA, 2&nbsp;mm nozzle diameter, 0.2&nbsp;mm layer height, 20-60&nbsp;mm/s, 200&nbsp;°C extruder, 60&nbsp;°C bed.</p> <p></p> <p><a href="https://i.stack.imgur.com/aSzrJ.jpg" rel="noreferrer" title...
<p>I have experienced this problem. This picture is one that I could have taken. </p> <p>It has always been because I was putting too much plastic into the available space.</p> <p>This has been caused two things: overextrusion -- squirting out too much plastic for the intended layer height, and the bed being too "hi...
<p>This could be a number of things, I personally think it could be either over extrusion or an issue with one of the belts. Depending on the printer, you may need to manually go in and adjust your steps per millimeter, which you should be able to find a guide on. If that doesn't work, then look into belt tension adjus...
1,394
<p>Do you know where I could find some useful third party (free) code snippets for VS 2008?</p>
<p><a href="http://gotcodesnippets.com/" rel="nofollow noreferrer">http://gotcodesnippets.com/</a><br> <a href="http://www.codekeep.net/" rel="nofollow noreferrer">http://www.codekeep.net/</a> has a VS add-in for their snippets, too</p>
<p>bdukes site has more options, but here are the ones MSDN has published...</p> <p><a href="http://msdn.microsoft.com/en-us/vstudio/aa718338.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/vstudio/aa718338.aspx</a></p>
4,597
<p>I cant seem to find much info on haskells layout features, as I understand it is something like pythons formatting requirements except that is optional. How can I choose not to use this option correctly? Would it be a good idea to start without it so that I get a solid feel for the language itself?</p>
<p>See <a href="http://en.wikibooks.org/wiki/Programming:Haskell_indentation" rel="nofollow noreferrer">http://en.wikibooks.org/wiki/Programming:Haskell_indentation</a> and <a href="http://www.haskell.org/onlinereport/lexemes.html#sect2.7" rel="nofollow noreferrer">http://www.haskell.org/onlinereport/lexemes.html#sect2...
<p>Haskell's layout is one of its defining features, imho. Part of the entire philosophy of Haskell is that it is more math-like. And using layout is a huge step towards that. For many programs, if you were to write pseudo-code out of math equations, it would end up being valid Haskell syntax using layout. I highly...
15,824
<p>If i have a function in a thread that is processing some data, then it calls a callback function to update the status in the UI.</p> <p>If the UI takes time to process the callback function then it is not so much usefull. Instead of just handling the update in the callback function, should it send some kind of mess...
<p>Usually there's a way of posting the callback to the UI thread without blocking.</p> <p>For instance:</p> <ul> <li>On Win32 there's <a href="http://msdn.microsoft.com/en-us/library/ms644944.aspx" rel="nofollow noreferrer">PostMessage</a></li> <li>In .NET Windows Forms there's <a href="http://msdn.microsoft.com/en-...
<p>Mapad posted a link to on UI and threads <a href="https://stackoverflow.com/questions/207230/hooking-up-gui-interface-with-asynchronous-sftp-operation">here</a> which you may find useful. You didn't mention which UI toolkit and which language so I can't give you any specifics. </p>
26,746
<p>According to HTML specs, the <code>select</code> tag in HTML doesn't have a <code>readonly</code> attribute, only a <code>disabled</code> attribute. So if you want to keep the user from changing the dropdown, you have to use <code>disabled</code>.</p> <p>The only problem is that disabled HTML form inputs don't get ...
<p>You should keep the <code>select</code> element <code>disabled</code> but also add another hidden <code>input</code> with the same name and value.</p> <p>If you reenable your SELECT, you should copy its value to the hidden input in an onchange event and disable (or remove) the hidden input.</p> <p>Here is a demo:<...
<p>In an option you can use <code>disabled="disabled"</code>, instead of on the select itself</p>
48,155
<p>How safe do you think it is to run an SLA 3D printer in the bedroom? I am planning to run Mi Air Purifier 3H/C while the printer is running, I am also thinking about adding <a href="https://rads.stackoverflow.com/amzn/click/com/B086277CNQ" rel="nofollow noreferrer" rel="nofollow noreferrer">this</a> inside the actua...
<p>The motor is mounted in a fixed position no matter if it's on top or bottom. You can imagine the lead screw as a rod hanging down and supporting the bed in the Z direction only, because all of the XY rigidity comes from the Liner rails the bed is attached to it works just as well if the stiff rod is under compressio...
<p>The motor is mounted in a fixed position no matter if it's on top or bottom. You can imagine the lead screw as a rod hanging down and supporting the bed in the Z direction only, because all of the XY rigidity comes from the Liner rails the bed is attached to it works just as well if the stiff rod is under compressio...
2,018
<pre><code>dev%40bionic%2Dcomms%2Eco%2Euk </code></pre> <p>I want to turn the above back in to readable text. Can anyone tell me how? Thanks</p> <p>EDIT Forgive my oversight, PHP is the language of choice!</p>
<p>You haven't said which language, but in many the function you want is urldecode</p> <p>(Looking at your other questions, you probably want PHP. It is <a href="http://uk3.php.net/urldecode" rel="noreferrer">urldecode</a> there :))</p>
<p>In JavaScript: <code>decodeURIComponent("dev%40bionic%2Dcomms%2Eco%2Euk")</code></p>
47,294
<p>Is the following possible in SQL Server 2000?</p> <pre><code>CREATE FUNCTION getItemType (@code varchar(18)) RETURNS int AS BEGIN Declare @Type tinyint Select @Type = case len(@code) WHEN 12,14,17 THEN 1 WHEN 13,15,18 THEN 2 WHEN 8,10 THEN 3 ELSE 0 END RETURN (@Type) END </code></pre> <p>Thanks.</p>
<p>try this:</p> <pre><code>Select @Type = (select case WHEN len(@code) IN (12,14,17) THEN 1 WHEN len(@code) IN (13,15,18) THEN 2 WHEN len(@code) IN (8,10) THEN 3 ELSE 0 END) </code></pre>
<pre><code> try SELECT CASE WHEN LEN(@gcode) IN(x, y, z) THEN a END etc. </code></pre> <p>or you may need </p> <pre><code>SELECT CASE LEN(@gcode) WHEN x THEN a WHEN y THEN a END </code></pre> <p>etc.</p> <p><a href="http://msdn.microsoft.com/en-us/library/m...
46,695
<p>I have this Web Application in JSP running on JBoss Application Server. I am using <a href="https://stackoverflow.com/questions/359147/mask-urls-in-jsp">Servlets for friendly urls</a>. I'm sending search parameters through my JSP's and Servlets. I am using a form with a text box, the Servlet </p> <p>The first Servl...
<p>Try to set URIEncoding in {jboss.server}/deploy/jboss-web.deployer/server.xml.</p> <p>Ex:</p> <pre><code>&lt;Connector port="8080" address="${jboss.bind.address}" maxThreads="250" maxHttpHeaderSize="8192" emptySessionPath="true" protocol="HTTP/1.1" enableLookups="false" redirectPort="8443" accep...
<p>There are three layers to configure. From what you've described, it sounds like your problem lies in the database configuration.</p> <ol> <li><strong>Browser Display and Form Submission</strong></li> </ol> <p>JSP</p> <pre><code>&lt;%@page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%&gt; </code></p...
48,993
<p>I've seen several products that will track the sales rank of an item on Amazon. Does Amazon have any web-services published that I can use to get the sales rank of a particular item? </p> <p>I've looked through the AWS and didn't see anything of that nature.</p>
<p>You should be able to determine the Sales Rank by querying for the SalesRank response group when doing an ItemLookup with the Amazon Associates Web Service.</p> <p>Example query:</p> <pre><code>http://ecs.amazonaws.com/onca/xml? Service=AWSECommerceService&amp; AWSAccessKeyId=[AWS Access Key ID]&amp; Operation=Ite...
<p>Amazon have changed their API so it now requires a signature: <a href="http://developer.amazonwebservices.com/connect/ann.jspa?annID=483" rel="nofollow noreferrer">http://developer.amazonwebservices.com/connect/ann.jspa?annID=483</a> so the above example no longer works from August 2009 onwards.</p>
16,419
<p>I've just started building a prototype application in Django. I started out by working through the <a href="http://docs.djangoproject.com/en/dev/intro/tutorial01/" rel="nofollow noreferrer">Django app tutorial on the Django site</a> which was pretty helpful, and gave me what I needed to get started. Now I have a cou...
<p>You need to look at the Django <a href="http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-index" rel="noreferrer">forms</a>.</p> <p>You should never build your own form like that.</p> <p>You should declare a Form class which includes a <a href="http://docs.djangoproject.com/en/dev/ref/forms/fields/#c...
<blockquote> <p>I feel like there must be a way to create a simple loop that counts from 1 to 10 that would generate most of those options for me, but I can't figure out how to do that...</p> </blockquote> <p>If you don't want to use Django forms (why btw?), check out this <a href="http://www.djangosnippets....
38,201
<p>How do I access parameters passed into an Oracle Form via a URL. Eg given the url:</p> <blockquote> <p><a href="http://example.com/forms90/f90servlet?config=cust&amp;form=" rel="nofollow noreferrer">http://example.com/forms90/f90servlet?config=cust&amp;form=</a>'a_form'&amp;p1=something&amp;p2=else</p> </blockqu...
<p>Within Forms you can refer to the parameters p1 an p2 as follows:</p> <ul> <li>:PARAMETER.p1</li> <li>:PARAMETER.p2</li> </ul> <p>e.g.</p> <pre><code>if :PARAMETER.p1 = 'something' then do_something; end if; </code></pre>
<p>Thanks Tony</p> <p>That was one part of the problem.</p> <p>The other needed part I eventually found on oracle.com was the url structure. After all the forms90 parameters (config etc), you need to supply an "otherparams" parameter supplying your parameters as a parameter to that. (parameters seperated by '+': eg</...
13,789
<p>The thing I've found about TDD is that its takes time to get your tests set up and being naturally lazy I always want to write as little code as possible. The first thing I seem do is test my constructor has set all the properties but is this overkill?</p> <p>My question is to what level of granularity do you writ...
<p>I get paid for code that works, not for tests, so my philosophy is to test as little as possible to reach a given level of confidence (I suspect this level of confidence is high compared to industry standards, but that could just be hubris). If I don't typically make a kind of mistake (like setting the wrong variabl...
<p>Generally, I start small, with inputs and outputs that I know must work. Then, as I fix bugs, I add more tests to ensure the things I've fixed are tested. It's organic, and works well for me.</p> <p>Can you test too much? Probably, but it's probably better to err on the side of caution in general, though it'll depe...
18,491
<p>I have this .NET regex:</p> <pre><code>^(?&lt;prefix&gt;("[^"]*"))\s(?&lt;attrgroup&gt;(\([^\)]*\)))\s(?&lt;suffix&gt;("[^"]*"))$ </code></pre> <p>It properly matches the following strings:</p> <pre><code>"some prefix" ("attribute 1" "value 1") "some suffix" "some prefix" ("attribute 1" "value 1" "attribute 2" "v...
<p>my, untested guess:</p> <pre><code>^(?&lt;prefix&gt;("[^"]*"))\s(?&lt;attrgroup&gt;(\(("[^"]*")(\s("[^"]*")*)**\)))\s(?&lt;suffix&gt;("[^"]*"))$ </code></pre> <p>hereby I've replaced</p> <pre><code>[^\)]* </code></pre> <p>with</p> <pre><code>("[^"]*")(\s("[^"]*")*)* </code></pre> <p>I assumed everything within...
<p>Hometoasts solution is a good one, though like any liberal regex it should only be used to extract data from sources you have a reasonable assurance are well formed and not for validation.</p>
22,289
<p>Hiya - been pointed at you guys by a friend of mine.</p> <p>I have an MDI application (C#, Winforms, .NET 2.0, VS2005, DevExpress 8.2) and one of my forms is behaving very strangely - not repainting itself properly where it overlaps with another instance of the same form class.</p> <p>The forms contain a custom co...
<p>Ah ha!</p> <p>I was changing the FormBorderStyle in code before showing the form. I removed that line and the problem went away...</p> <p>That'll do for me. :-)</p>
<p>I know this is an old thread, but something I did fixed the issue for me. This might help someone with a similar problem.</p> <p><strong>My problem:</strong> We have an application in which we embed two external applications in a parent window separated by a splitter. Its used for displaying information from the tw...
42,139
<p>I would like to be able to show a non-modal form in an already existing application. At the moment I can do something like:</p> <pre><code>myform.ShowDialog(handleToApp); </code></pre> <p>but that will create a modal form parented to the application and what I'm really looking for something that isn't modal so wh...
<p>I found what I was looking for, you have to make a class which looks like this:</p> <pre><code>public class MapinfoWindowHandle : System.Windows.Forms.IWin32Window { private IntPtr handle; public MapinfoWindowHandle(IntPtr hWnd) { handle = hWnd; } #region IWi...
<p>How about a simple <code>myForm.Show()</code>?</p>
43,180
<p>Is the WriteFile call properly synchronous, and can I delete the file written immediately after the call?</p>
<p>If you're writing a file to the client with <code>Response.WriteFile()</code>, a call to <code>Response.Flush()</code> will make sure it's been fully output to the client. Once that's done you can delete it off of the webserver.</p> <p>You may want to come up with a more robust system if the file is mission-critica...
<p>If memory serves it is synchronous, as are the rest of the RESPONSE commands.</p>
24,524
<p>How do you execute a JavaScript function without <code>onclick</code> like &quot;Grippie&quot; in a new post on SOF, like the <code>&lt;div class=&quot;grippie&quot; style=&quot;margin-right: 59px;&quot;/</code>&gt; on Stack Overflow when you post a question or answer? I get a nice CSS cursor which lets me know of t...
<p><a href="http://plugins.jquery.com/project/TextAreaResizer" rel="nofollow noreferrer">http://plugins.jquery.com/project/TextAreaResizer</a></p>
<p>The JavaScript in use on the site listens to click events and looks for the ID of the element being interacted with. The script will then either ignore the event or do something if the element ID is one of the expected objects that requires action.</p>
45,175
<p>I've been asked to find a way to send an alert to a blackberry when certain conditions are met on an Excel 2007 spreadsheet. The alert can be an SMS (preferred) or an email. The cell values are changing throughout the day from a DDE feed.</p> <p>What are the typical solutions that people use to solve this?</p>
<p>The sharepoint UserID = the one RS will use and detect. This is defined by UserID global in RS and picked up form the login token.</p> <p>You can hide the parameter (Report) or just specify it at the dataset level (SQL).</p>
<p>Have you tried getting row level security happening at the database end?</p> <p>You project then only needs to pass the users credentials through as it does anyway and you can then let SQL server security handle the issue?</p>
22,495
<p>I need to pass an array from JavaScript to a page method in C#. I have tried using a parameter in the C# method of IList and also a string[] array. Both ways throw an exception "cannot convert an object of type system.string to xxx", where xxx is the parameter type in the C# method. I am passing the object from jQue...
<p>Hmm, two things:</p> <ol> <li>JSON arrays have square brackets around them</li> <li>JSON numbers aren't quoted.</li> </ol> <p>Try this instead:</p> <pre><code>{"testNumbers": [5555555555,3333333333,4444444444]} </code></pre>
<pre><code>{"testNumbers":["5555555555","3333333333","4444444444"]} </code></pre> <p>should i think do the trick along with a deserialiser. see <a href="http://www.json.org/" rel="nofollow noreferrer"><code>http://www.json.org/</code></a> which has a great graphical representation of the json syntax.</p>
37,912
<p>I am the maintainer of a site that has allegedly 'lost' the source code to a flash swf file. How do I decompile this source?</p> <p>Are there any programs online or offline that I could use?</p>
<p>Usually 'lost' is a euphemism for "We stopped paying the developer and now he wont give us the source code."</p> <p>That being said, I own a copy of <a href="http://www.buraks.com/asv/index.html" rel="noreferrer">Burak's ActionScript Viewer</a>, and it works pretty well. A simple google search will find you many ot...
<p>I've had good luck with the <a href="http://search.cpan.org/dist/SWF-File/" rel="nofollow noreferrer">SWF::File</a> library on CPAN, and particularly the <a href="http://search.cpan.org/src/YSAS/SWF-File-0.42/dumpswf.plx" rel="nofollow noreferrer">dumpswf.plx</a> tool that comes with that distribution. It generates...
12,251
<p>These <code>for</code>-loops are among the first basic examples of formal correctness proofs of algorithms. They have different but equivalent termination conditions:</p> <pre><code>1 for ( int i = 0; i != N; ++i ) 2 for ( int i = 0; i &lt; N; ++i ) </code></pre> <p>The difference becomes clear in the postcon...
<p>We shouldn't look at the counter in isolation - if for any reason someone changed the way the counter is incremented they would change the termination conditions and the resulting logic if it's required for i==N.</p> <p>I would prefer the the second condition since it's more standard and will not result in endless ...
<p>In general I would prefer </p> <pre><code>for ( int i = 0; i &lt; N; ++i ) </code></pre> <p>The punishment for a buggy program in production, seems a lot less severe, you will not have a thread stuck forever in a for loop, a situation that can be very risky and very hard to diagnose. </p> <p>Also, in general I li...
16,025
<p>I've never used any of the .NET generics in my work, but I understand that they are fairly popular. Does anyone have any good links or book suggestions for learning them? As a bonus; I only vaguely understand what .NET generic collections are and what they do...does anyone have any practical examples of how they m...
<p>The obvious choice..</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms379564(VS.80).aspx" rel="noreferrer">MSDN C# Generics</a></p>
<p>My vote is- mostly you can just avoid them :) </p> <p>The main advantage for generics is to save casting, if you end up doing casting internally that doesn't make any sense. If you try to look into this issue you would found that mostly the candidates for generics are really those collections/sets which could creat...
11,071
<p>What is the difference between a proxy server and a reverse proxy server?</p>
<p>The previous answers were accurate, but perhaps too terse. I will try to add some examples.</p> <p>First of all, the word "proxy" describes someone or something acting on behalf of someone else.</p> <p>In the computer realm, we are talking about one server acting on the behalf of another computer.</p> <p>For the ...
<p>Let's consider the purpose of the service.</p> <p>In forward proxy:</p> <p>Proxy helps <strong>user</strong> to access server.</p> <p>In reverse proxy:</p> <p>Proxy helps <strong>server</strong> to be accessed by user.</p> <p>In the latter case, the one who is helped by the proxy is no longer a user, but a server, t...
27,766
<p>I'm looking to learn some fundamentals on cartesian geometry or coordinates based game programming. Platform is irrelevant, although I'm most proficient in JavaScript, C, Objective-C. Ultimately being able to create something such as dots or checkers would be ideal. The idea is for me to learn how sprites work and h...
<p>I think there's a few more steps to accomplishing your objective, which is understanding the basics of game programming. You mentioned understanding sprites and pathing, which are imperative to game programming, but I think that initially you should spend a little time understanding the programming and methodology b...
<p>Well, for Java, there's an API called <a href="http://www.horstmann.com/gridworld/" rel="nofollow noreferrer">GridWorld</a>, (Its used as a case study for the AP Computer Science exam, which is why I'm familiar with it) It uses a coordinate system, so you might learn something from looking at it. </p>
42,719
<p>Are the latest expression tools covered under a Microsoft MSDN subscription? I know in the past they were not part of MSDN downloads. I think I remember someone saying they are available now. Are these trial editions or full-blown versions?</p>
<p>Yes, the full Expression toolset is now available from Subscriber Downloads.</p> <p>I have VSTS Architecture Edition and I can download:</p> <p>Expression Blend 2 (x86) - DVD (English) Expression Design 2 (x86) - DVD (English) Expression Encoder 2 (x86) - DVD (English) Expression Media 2 (Mac) - DMG (English) Expr...
<p>Yes, I am also seeing the full Expressions Suit available from the Microsoft MSDN Subscription download site. These are the full version not trials. </p> <p>I just checked and these are the programs available for download: </p> <p>Expression Blend 2 (x86) - DVD (English)</p> <p>Expression Design 2 (x86) - DVD (En...
48,615
<p>I'm trying to select the "name" field from the author node in an ATOM feed using LINQ. I can get all the fields I need like so:</p> <pre><code>XDocument stories = XDocument.Parse(xmlContent); XNamespace xmlns = "http://www.w3.org/2005/Atom"; var story = from entry in stories.Descendants(xmlns + "entry") ...
<p>You basically want:</p> <pre><code>entry.Element(xmlns + "author").Element(xmlns + "name").Value </code></pre> <p>But you might want to wrap that in an extra method so you can easily take appropriate action if either the author or name elements are missing. You might also want to think about what you want to happe...
<p>It could be something like this:</p> <pre><code> var story = from entry in stories.Descendants(xmlns + "entry") from a in entry.Descendants(xmlns + "author") select new Story { Title = entry.Element(xmlns + "title").Value, ...
38,500
<p>I have a resource handler that is Response.WriteFile(fileName) based on a parameter passed through the querystring. I am handling the mimetype correctly, but the issue is in some browsers, the filename comes up as Res.ashx (The name of the handler) instead of MyPdf.pdf (the file I am outputting). Can someone inform ...
<p>Extending from Joel's comment, your actual code would look something like this:</p> <pre><code>context.Response.AddHeader("content-disposition", "attachment; filename=" + resource); </code></pre>
<p>Thank you guys for your answer. The final code works and checks for pdf.</p> <pre><code>if (extensionArray[extensionArray.Length - 1].ToLower() == "pdf") context.Response.AddHeader("content-disposition", "Attachment; filename=" + resource); </code></pre>
31,288
<p>I'm running into an odd problem with Visual Studio 2005: I have a data breakpoint that's set to run a macro and continue (that is, I select a macro and check Continue Execution.)</p> <p>Now, instead of silently running the macro when the value in the data breakpoint (tracepoint, really) changes, I first get a messa...
<p>It does this for me as well. The behavior does seem somewhat different based on how you set the "Continue execution" option, so my suspicion is that this behavior (painful as it is) may be by design. Or it may be a bug, but in either case you may be stuck.</p> <p>An alternative might be to use windbg or one of the ...
<p>I do not have vs.net 2005 on my machine.<br> So, I am speculating here.<br></p> <p>What is the line of execution?</p> <p>Is it trying to evaluate a property?<br> Is a conditional breakpoint set when the property is read? (i.e. break when property is read?)<br></p> <p>Try removing other breakpoints related to the ...
22,477
<p>I have a List of custom object, which consist of a custom list.</p> <pre><code>class person{ string name; int age; List&lt;friend&gt; allMyFriends; } class friend{ string name; string address; } </code></pre> <p>I'trying to bind a list of these objects to a GridView and the Grid should create for each fri...
<p>I was able to solve this using a DataTable as your datasource for the Grid. I don't like the idea of moving from a nice clean object to a DataTable, but it provides support for the dynamic binding you need. I modified your friend object to have a few constructors. This allowed me to cleanup the static code declar...
<p>use the following :</p> <p>DataBinder.Eval(Container.DataItem,"PPP.PPP")</p>
37,706
<p>Okay, you don't need to be a guru, but if you happen to have a good working knowledge on SSIS and you used some tutorials around the web to get you there, then please share them. I have been trying to find some solid stuff (screencasts maybe), but I am having a hard time. </p> <p>Any solid links would be appreciate...
<p><a href="http://blogs.conchango.com/jamiethomson" rel="noreferrer">http://blogs.conchango.com/jamiethomson</a>/ A very, very good place to start,</p>
<p>SSIS tutorials for the beginner: <a href="http://msdn.microsoft.com/en-us/library/ms169917.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms169917.aspx</a></p> <p>BI Monkey has some good examples: <a href="http://www.bimonkey.com/" rel="nofollow">http://www.bimonkey.com/</a></p> <p>SSIS team blog: <a...
17,170