instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>In a SQL-database I make some selects, that get an duration (as result of a subtraction between two dates) in seconds as an int. But I want to format this result in a human-readable form like 'hh:mm' or 'dd:hh'. Is that possible in SQL and how can I realize this?</p>
<p>In SQL 2005, You can use the following:</p> <pre><code> select convert(varchar(8), dateadd(second, [SecondsColumn], 0), 108) </code></pre> <p>Which first converts the seconds into a date after 1900-01-01, and then gets the hh:mm:ss part. </p> <p>If the column is more than 24 hours, this will roll over, if you...
<p>There is no standard, though many DBMSs have their own custom syntax.</p> <p>In general it is better to be doing formatting-for-human-readability work in your application's presentation layer rather than anywhere near the database.</p>
23,962
<p>Looking at the <a href="https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Global_Objects/Array" rel="noreferrer">mozilla documentation</a>, looking at the regular expression example (headed &quot;Creating an array using the result of a match&quot;), we have statements like:</p> <blockquote> <p>input: A ...
<p><strong>Edit:</strong> Since this answer was written, a new, better way using <code>Object.defineProperty</code> has been standardized in EcmaScript 5, with support in newer browsers. See <a href="https://stackoverflow.com/questions/366047/can-read-only-properties-be-implemented-in-pure-javascript/2964881#2964881">A...
<p><a href="http://www.bobjs.com" rel="nofollow">bob.js framework</a> provides a way to declare read-only properties. Under the hood, it declares a private field and exposes the getter/setter functions for it. bob.js provides multiple ways of doing this same thing, depending on the convenience and specific goals. Here'...
47,781
<p>I'm using <a href="http://en.wikipedia.org/wiki/Eclipse_%28software%29#Releases" rel="noreferrer">Eclipse Ganymede</a>. Everything works fine, but I have an anal-retentive yearning for a warning-free Problems tab. Right now it (correctly) complains about my <a href="http://en.wikipedia.org/wiki/Apache_Ant" rel="no...
<p>The simplest is to supply a minimal DTD to shut it up.</p> <pre><code>&lt;!DOCTYPE project&gt; </code></pre> <p>for ant files</p>
<p>right click on the warning to delete it, then clean</p>
47,486
<p>So the chain of events is:</p> <ol> <li>The user submits a form.</li> <li>During the processing of the submission, there is a message generated, such as "Your record was saved."</li> <li>The user is redirected to a new page, say the search results.</li> <li>The new page needs to display the message.</li> </ol> <p>...
<p>I would recommend AGAINST storing these messages either in the database or in the session, for one simple reason: tabs. (Well, really, the stateless nature of HTTP.)</p> <p>Think of a person who's got multiple tabs open of different sections of your website. This person performs some action and while that loads, ...
<p>Store it in the database as well as the session. This way the user can get to his history if he needs it, and you have easy access through the session data.</p> <p>Don't use a query parameter, it'll only confuse the user at some point when the message is displayed when it shouldn't be.</p> <p>Displaying the messa...
39,077
<p>I have a Button style and can't seem to property databind the border's CornerRadius property to the template. This is a dependency property, so it should be data bindable. I wonder if I'm missing the right XAML syntax to use?</p> <pre><code>&lt;Style TargetType="{x:Type Button}" BasedOn="{x:Null}"&gt; ...
<p>You're trying to set/bind a <code>CornerRadius</code> property on class <code>Button</code>, but there is no such property. So the error is expected.</p>
<p>Kent is right. A way around this is to create your own custom control that inherits from the button class. Then inside this derived class, create a dependency property and register it to the window for the CornerRadius property. Then you may use the above code, but instead of setting the style property on a Button c...
42,496
<p>I need some help regarding algorithm for randomness. So Problem is.</p> <p>There are 50 events going to happen in 8 hours duration. Events can happen at random times. Now it means in each second there is a chance of event happening is 50/(8*60*60)= .001736. How can I do this with random generation algorithm?</p> <...
<p>Both <code>r</code> and <code>RAND_MAX</code> are integers, so the expression</p> <pre><code>double chance = r / RAND_MAX; </code></pre> <p>is computed with integer arithmetic. Try:</p> <pre><code>double chance = 1.0 * r / RAND_MAX; </code></pre> <p>which will cause the division to be a floating point division.<...
<p>Why not create a 28,800 element list and pull 50 elements from it to determine the time of the events? This does assume that 2 events can't occur at the same time and each event takes 1 second of time. You can use the random number generator to generate integer values between 0 and x so that it is possible to pick...
36,651
<p>I'm writing opengl code in python using the library pyglet. When I draw to the screen using pyglet.graphics.vertex_list or pyglet.graphics.batch objects, they are very slow (~0.1 fps) compared to plain old pyglet.graphics.draw() or just glVertex() calls, which are about 40fps for the same geometry. In Linux the vert...
<p>Don't forget to invoke your pyglet scripts with 'python -O myscript.py', the '-O' flag can make a huge performance difference.</p> <p>See pyglet docs <a href="https://pyglet.readthedocs.io/en/pyglet-1.3-maintenance/programming_guide/gl.html?highlight=performance#error-checking" rel="nofollow noreferrer">here</a> an...
<p>I don't know personally, but I noticed that you haven't posted to <a href="http://groups.google.com/group/pyglet-users" rel="nofollow noreferrer">the pyglet mailing list</a> about this. More Pyglet users, as well as the primary developer, read that list.</p>
9,282
<p>I develop a web application that needs to be load balanced across 4 webservers. My company is purchasing the load balancer hardware (Cisco). There is confusion on how to tell the load balancer that a webserver should be in the rotation.</p> <p>The IT Hardware support team wants me to create a one page web applicat...
<p>Read <a href="https://rads.stackoverflow.com/amzn/click/com/067232699X" rel="nofollow noreferrer" rel="nofollow noreferrer">Scalable Internet Architectures</a>.</p> <p>The balancer can only see the web servers. If the web server appears up, but can't talk to the database (because, say, Apache is running but your a...
<p>I always put a real simple html page on the webserver. If the HTTP status from status.html comes back 200, then keep the server in the rotation, if not, suspend the web server.</p> <p>What if your DB goes down hard? while you are restoring, you should be able to place a status message that says "sorry, back soon". ...
49,177
<p>I have a procedure with a lot of </p> <pre><code>i := i +1; </code></pre> <p>in it and I think </p> <pre><code> inc(i); </code></pre> <p>looks a lot better. Is there a performance difference or does the function call just get inlined by the compiler? I know this probably doesn't matter at all to my app, I'm ju...
<p>Modern compilers optimize the code.<br> inc(i) and i:= i+1; are pretty much the same.</p> <p>Use whichever you prefer.</p> <p>Edit: As Jim McKeeth corrected: with Overflow Checking there is a difference. Inc does not do a range checking.</p>
<p>"On some platforms, Inc may generate optimized code, especially useful in tight loops." For optimized compiler such as Delphi it doesn't care. That is about old compilers (e.g. Turbo Pascal)</p>
16,821
<p>I have a set of callback classes that I use for handling callbacks with variable numbers of parameters. Right now I have about 6 different instances of it to handle differing numbers of arguments. Is there a way to make one instance than can handle a variable number of arguments?? Ultimately I would love to have eac...
<p>Not yet in the language itself but C++0x will have support for <a href="http://en.wikipedia.org/wiki/C%2B%2B0x#Variadic_templates" rel="nofollow noreferrer">variadic templates</a>.</p>
<p>How about sidestepping this issue through the use of <a href="http://www.boost.org/doc/libs/1_36_0/libs/bind/bind.html" rel="nofollow noreferrer">Boost Bind</a>? You could make your code accept a single argument, or none at all, and bind arguments you need at the call site.</p>
18,720
<p>I have the following code sample :</p> <pre><code>public class Base { public virtual void MyMethod(int param) { Console.WriteLine(&quot;Base:MyMethod - Int {0}&quot;, param); } } public class Derived1 : Base { public override void MyMethod(int param) { Console.WriteLine(&quot;Deri...
<p>Oddly, I was discussing this with Jon the other evening! There is a precedence issue - the overridden method is <strong>defined</strong> in the base-class, so for "best method" purposes, the overload (even with an implicit cast) is preferable, since it is defined in the most-specific type (the subclass).</p> <p>If ...
<p>I'd guess that when calling MyMethod(5), 5 could be a double or an int as well and double has higher priority. Have you tried calling MyMethod((int)5)?</p>
49,432
<p>Doug McCune had created something that was exactly what I needed (<a href="http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/" rel="nofollow noreferrer">http://dougmccune.com/blog/2007/05/10/analyze-your-actionscript-code-with-this-apollo-app/</a>) but alas - it was for AIR be...
<p>There is a Code Metrics Explorer in the Enterprise Flex Plug-in below:</p> <p><a href="http://www.deitte.com/archives/2008/09/flex_builder_pl.htm" rel="nofollow noreferrer">http://www.deitte.com/archives/2008/09/flex_builder_pl.htm</a></p>
<p>To get a rough estimate, you could always run <code>find . -type f -exec cat {} \; | wc -l</code> in the project directory if you're using Mac OS X. </p>
5,607
<p>I'd like something like</p> <pre><code>int minIndex = list.FindMin(delegate (MyClass a, MyClass b) {returns a.CompareTo(b);}); </code></pre> <p>Is there a builtin way to do this in .NET?</p>
<p>Try looking at these:</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb909313.aspx" rel="noreferrer">Min</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/bb909073.aspx" rel="noreferrer">Max</a></p> <p>As long as your class implements IComparable, all you have to do is:</p> <pre><code>List&lt;...
<p>Using Linq you have the Min() and Max() functions.</p> <p>So you can do <code>list.AsQueryable().Min();</code></p>
31,178
<p>I'm trying to make a combo box that behaves somewhat like the Firefox 3 Awesomebar, with the following behavior:</p> <ol> <li>Type in text</li> <li>Asynchronously bring back results</li> <li>Up and down selects results in the list, <strong>BUT</strong> leaves the text that was typed in the entry box so the user can...
<p>If you read the documentation, it says, "This member is not meaningful for this control." If you want the control to be drawn utilizing double-buffering, you'll have to implement it yourself. Besides the fact that if you owner-draw the control, you would have to implement double-buffering yourself anyhow.</p>
<p>Not sure, but you might try double-buffering the control that contains the tab control. </p>
27,616
<p>I have an NSDictionary (stored in a plist) that I'm basically using as an associative array (strings as keys and values). I want to use the array of keys as part of my application, but I'd like them to be in a specific order (not really an order that I can write an algorithm to sort them into). I could always stor...
<p>The solution of having an associated NSMutableArray of keys isn't so bad. It avoids subclassing NSDictionary, and if you are careful with writing accessors, it shouldn't be too hard to keep synchronised.</p>
<p>I don’t like C++ very much, but one solution that I see myself using more and more is to use Objective-C++ and <code>std::map</code> from the Standard Template Library. It is a dictionary whose keys are automatically sorted on insertion. It works surprisingly well with either scalar types or Objective-C objects both...
49,217
<p>What I want to do is an outer join to a table, where I exclude records from the joined table based on matching a constant, however keep records from the main table. For example:</p> <pre><code>SELECT a.id, a.other, b.baz FROM a LEFT OUTER JOIN b ON a.id = b.id AND b.bar = 'foo' </code></pre> <p>Expected resul...
<p>Crystal reports can't generate that commonly used SQL statement based on its links and report selection criteria. You have to use a "command" or build a view.</p> <p>In short, Crystal sucks. </p>
<p>Not sure if you can do this in Crystal but how about joining to a Select?</p> <pre><code>SELECT a.id, x.baz FROM a LEFT OUTER JOIN (SELECT id, baz FROM b WHERE bar = 'foo') As x ON a.id = x.id </code></pre>
27,978
<p>I'm using Repetier and Slic3r and it is printing a gap between the perimeter and infill on the first layer. Also, the infill is lifting (as in photo). Any advise?</p> <p><a href="https://i.stack.imgur.com/mXJCl.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/mXJCl.jpg" alt="infill issue"></a> </p>
<p>You're not sticking to your bed. Adjust your bed height. You are too far. Otherwise you are going too fast and or too hot.</p> <p>Calibrate the bed. Reduce speed. Then adjust temps. </p> <p>Also could be material contamination</p> <p>See this link for a visual troubleshooting.</p> <p><a href="http://reprap.org/w...
<p>I found a solution that works for me.</p> <p>I have increased my first layer extrusion width to 250 %, reduced the print speed of perimeters to 30 mm/s, reduced the brim width to 1 and increased the infill/perimeter overlap to 30 %.</p> <p>This was PLA with heat bed off (no heating), printing on glass and using hair...
363
<p>Now that everyone is talking about MVC, I notice that the business rules are not being addressed. In the old days of the 3-tier architecture, The business rules were in the middle layer. Where do they fall in the new MVC?</p>
<p>At first brush, I'd say they belong in the model. The <a href="http://en.wikipedia.org/wiki/Model-view-controller" rel="noreferrer">MVC Entry on Wikipedia</a> seems to agree: "In MVC, the model represents the information (the data) of the application and the business rules used to manipulate the data". After all, by...
<p>You guys are wrong the business rules live within the controller and not the model...</p>
26,056
<p>As far as I know (not much I'll admit), the currently popular programming paradigms are Object Oriented (Java, C#, Ruby) vs functional (F#). As someone who is mostly familiar with the first paradigm, I have several questions:</p> <ul> <li>Can a programmer simply stick with one paradigm all of his/her life? Or in ot...
<p>"Or in other words, can all problems be reduced to nails for one hammer?" Yes. Period. Any programming language you are likely to run into will be as complete as all others. There's actually a formal definition of "completeness" for a programming language.</p> <p>"Have people ever needed to learn a new paradigm...
<p>Developing the design and architecting skills with OOP in mind is the most desirable skillset for a great language agnostic career.</p> <p>The benifit when you code in Oops is both for the other team members out there and for the organization as a whole. Because the code will be understandable to all and if the dev...
22,916
<p>I am new to 3D printing. I have just put together my own 3D printer with some help.</p> <p>I was advised I shouldn't print directly onto the aluminium plate - I assume it's aluminium.</p> <ol> <li><p>The manufacturer did give me a piece of matrix board (i.e. no cooper at all) to print on. Will this work well?</p><...
<p>Obviously being in a rush can limit your options, but here are a few thoughts:</p> <p><strong>Quick solutions:</strong></p> <ul> <li><strong>Blue painters tape</strong> (as Carl mentioned) will work directly on your heated bed...assuming it's a flat piece of aluminum with the heating element under it. Your surfac...
<p>I have been printing for over 2 years directly onto the 3 mm Aluminum heated bed platform using a touch of PVA based print adhesion spray 3DLAC or Dimafix (see e.g. <a href="https://3dprinting.stackexchange.com/a/6861/">this answer</a> on question "<a href="https://3dprinting.stackexchange.com/questions/3710/should-...
400
<p>I find myself needing to store public key certificates, and a single private key certificate for an in-house application.</p> <p>A member of our team suggested storing the X509 certificates in the database, instead of storing it in the windows certificate store, as we have been doing up until now. I don't like re-i...
<p>What is the purpose of your application?</p> <p>If you are handling all the crypto in your application, and can reference a PKCS#12 cert + private key file, then going the database route is probably fine.</p> <p>If you need to use Windows Crypto API to access the certs, then you'll probably want to keep using the ...
<p>I would be reluctant to move the private key to any other location unless really necessary. Its not required if the key is being used for signing and would only be required if the key is being used for decrypting and you wish to archive it for the future. Even in this instance the certificate authority that issued t...
20,980
<p>I have an application in which a gecko browser is embedded. The application is crashing when I try to access any https url's because nss is not properly initialised at this point. The crash is in PK11_TokenExists(). I want to block my browser from rendering https sites. If a user clicks on a https link I can block t...
<p>I would first try to figure out why your application is crashing on HTTPS/SSL connections. I think it would be better to fix the crash than trying to avoid it.</p>
<p>You can implement this the following way:</p> <p>Implement the <code>OnStateChange</code> method of the <code>nsIWebProgressListener</code> interface.</p> <p>Check the parameter <code>aStateFlags</code>: If this parameter contains the flags <code>STATE_IS_DOCUMENT</code> and <code>STATE_START</code>, then a new lo...
12,627
<p>I am looking into streaming binary data into a browser (through http). I am looking for opinions as to good ways to go about doing this. Ultimately I will have a real time data source and I would like to manipulate this data and display it (in real-ish time) in a browser. Firefox comes first, IE would be nice... but...
<p>A lot of this depends on what you want to do with the data. I assume render it.</p> <p>Flash probably would be the simplest solution. It's a common enough add-on that just about everyone should have it by now; so you're not running much of a risk for incompatibility.</p> <p>JavaScript just hasn't been considered m...
<p>You can use Base64 to convert the binary to text and send that to the browser. With IE you can convert it directly to binary, but I'm not sure if you can do it with Firefox and others. I did see jscripts for Base64 enflate/deflate and a script named base64.js which probably does the conversion as well.</p> <p>Howev...
44,449
<p>How can I restore a mysql database that was dropped using a "drop database" command? I have access to binary logs which should make this type of rollback possible.</p>
<p>Documentation Sucks. It alludes to DROP DATABASE being recoverable, but only in odd conditions i'm not familiar with <a href="http://dev.mysql.com/doc/refman/5.0/en/binary-log.html" rel="noreferrer">http://dev.mysql.com/doc/refman/5.0/en/binary-log.html</a> </p> <p>According to Docs, binlogs are just a sequence of ...
<p>No backup no party.</p> <p>So I'll answer:</p> <p>To never be in your situation again install the ultra simple and ultra powerful automysqlbackup (if you're on linux):</p> <p>sudo apt-get install automysqlbackup</p> <p>configure it:</p> <p>sudo nano /etc/default/automysqlbackup</p> <p>Then upload its content a...
11,447
<p>We're usually 1-4 developers / art directors / copywriters on each project at my firm, what methodology would you recommend use to use? Agile? XP? Scrum? Something else? (I know they are all variations of essentially the same concept, yes)</p>
<p>I don't think there's a general answer for it, the question is too broad, and you can't just "adopt a methodology" as if it were a product that you take out of the box, it's something that you evolve over time...but in any case I highly recommend you getting a copy of this book: <a href="https://rads.stackoverflow.c...
<p>They are very close to business side which is bad thing because programmers often do not understand well implications of accounting, time or risk management, etc. Even if they think they do. They see business as another attractive opportunity to improve their sophisticated technical skills. As company is small it is...
41,947
<p>What books or online resource would you recommend for learning how to do advanced charts and dashboard design with Reporting Services? </p>
<p>While not specific to SSRS <a href="http://www.edwardtufte.com/tufte/books_vdqi" rel="nofollow noreferrer">The Visual Display of Quantitative Information</a> is the place to start.</p>
<p>SSRS might not be the best approach for a dashboard, though it offers great reporting functionality.</p> <p>You may want to take a look at Microsoft PerformancePoint 2007. It can make dashboards and widgets out of SSRS, SQL, Excel etc data and display it visually on Sharepoint.</p>
15,276
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/188444/reading-writing-ms-word-files-in-python">Reading/Writing MS Word files in Python</a> </p> </blockquote> <p>I know there are some libraries for editing excel files but is there anything for editing msword...
<p>Why not look at using <a href="http://wiki.services.openoffice.org/wiki/Python" rel="nofollow noreferrer">python-uno</a> to load the document into OpenOffice and manipulate it using the UNO interface. There is some example code on the site I just linked to which can get you started.</p>
<p>The <a href="http://python.net/crew/mhammond/win32/Downloads.html" rel="nofollow noreferrer">PyWin32</a> library allows you to access COM objects from Python, including all of the various Office COM APIs. I won't claim it's <strong>easy</strong> to use, but it does work.</p>
49,236
<p>I may be in the minority here, but I very much enjoy <a href="https://perldoc.perl.org/perlform" rel="nofollow noreferrer">Perl's formats</a>. I especially like being able to wrap a long piece of text within a column (&quot;~~ ^&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&quot; type stuff). Ar...
<p><a href="http://formatr.rubyforge.org/" rel="noreferrer">FormatR</a> provides Perl-like formats for Ruby.</p> <p>Here is an example from the documentation:</p> <pre><code>require "formatr" include FormatR top_ex = &lt;&lt;DOT Piggy Locations for @&lt;&lt; @#, @### month, day, year Number:...
<p>There is the <a href="http://gigamonkeys.com/book/a-few-format-recipes.html" rel="nofollow noreferrer">Lisp <code>(format ...)</code> function</a>. It supports looping, conditionals, and a whole bunch of other fun stuff.</p> <p>for example (copied from above link):</p> <pre><code>(defparameter *english-list* "~{...
29,282
<p>How can I make a SQL Compact 2008 application for the desktop? I know how to connect to a .SDF file with SQL Management Studio 2008, but I can't figure out how to connect to it with my app. I have seen tutorials about this and I can see in the C# code they are referencing some special namespaces, but I can't seem ...
<p>Have you <a href="http://msdn.microsoft.com/en-us/library/aa983341.aspx" rel="nofollow noreferrer">gone here and downloaded all the components</a> listed (including the design tools)?</p> <p>If you post the "error" you get it might be easier to diagnose your problem.</p>
<p>You need to download SQL Sever Compact 3.5.</p> <p>Then you could create a LINQ2SQL model (dbml) using the sqlmetal tool that comes with the .NET SDK (and Visual Studio). Currently it is not possible to create LINQ2SQL classes for the compact framework inside Visual Studio, but you will be able to view and edit the...
31,686
<p>What is a good way to create and read an OpenOffice spreadsheet in Perl?</p>
<p>I think that the open office native document format is based around the OpenDocument specifications, and is bascially a zip compressed XML format. This being true you could probably manipulate it using your perl XML manipulation tools of choice. </p> <p>Alternatively, there's the <a href="http://search.cpan.org/per...
<p>This is with version 2.4, because the latest version is unstable. It does work with the latest though sometimes. This will allow realtime DDE features in Calc as opposed to manipulating files. This is using Cygwin Perl on XP but should work with others. I just want to say the Excel VBA programming API is 10 times be...
35,110
<p>Does anyone know a good way to do this? I need to have simple forms that submit to email without writing a lot of code. These forms will be hosted in content-viewer web parts or similar in MOSS 2007. I'd like to avoid using InfoPath.</p>
<p>You could use a list which would give you the input form.</p> <p>It depends on a) whether people should be able to see each other's submissions and b) who the e-mail should go to.</p> <p>You could set an alert (Actions -> Alert Me) to send an e-mail to a person/people when a new item is added to the list.</p> <p>...
<p>With the sharepoint sdk, you can create your own webparts. If you add them to the GAC you can include them on your sharepoint site. You'd of course have to build a webpart for emailing though.</p>
8,917
<p>I am getting the following error when I try to call a stored procedure that contains a SELECT Statement:</p> <blockquote> <p>The operation is not valid for the state of the transaction</p> </blockquote> <p>Here is the structure of my calls:</p> <pre><code>public void MyAddUpdateMethod() { using (Transactio...
<p>After doing some research, it seems I cannot have two connections opened to the same database with the TransactionScope block. I needed to modify my code to look like this:</p> <pre><code>public void MyAddUpdateMethod() { using (TransactionScope Scope = new TransactionScope(TransactionScopeOption.RequiresNew)) ...
<p>You can't have two transactions open at the same time. What I do is that I specify <strong>transaction.Complete()</strong> before returning results that will be used by the 2nd transaction ;)</p>
23,480
<p>I need to do a modulus operation on very large integers. The biggest integer supported by my platform (edit: .NET 2.0) is a 64 bit integer, which aren't big enough for the numbers I'm working with.</p> <p>How can I do a modulus on really big integers, like 12654875632126424875387321657498462167853687516876876?</p>...
<p>You haven't specified where the numbers are coming from, but you might be able to make some simplifications. If the numbers are originally smaller, then consider things like:</p> <pre><code>(a + b) MOD n = ((a MOD n) + (b MOD n)) MOD n </code></pre> <p>or</p> <pre><code>ab MOD n = (a MOD n)(b MOD n) MOD n </code...
<p>You need an arbitrary-precision integer math library such as <a href="http://www.codeplex.com/IntX/" rel="nofollow noreferrer">IntX</a>.</p>
35,163
<p>I'm subclassing a native window (the edit control of a combobox...)</p> <p>oldWndProc = SetWindowLong(HandleOfCbEditControl, GWL_WNDPROC, newWndProc);</p> <p>In my subclassing wndproc, I'll have code like this, right, but I can't figure out the syntax for calling the oldWndProc.</p> <pre><code> int MyWndProc(i...
<p>You'll call <a href="http://msdn.microsoft.com/en-us/library/aa452919.aspx" rel="nofollow noreferrer">CallWindowProc</a> by P/Invoke. Just define the parameters as int variables (as it looks like that's how you defined them in the SetWindowLong call), so something like this:</p> <p>[DllImport("CallWindowProc"...] ...
<p>This <a href="http://www.pinvoke.net/" rel="nofollow noreferrer">site</a> will be very helpful with all of your interop/p-invoke efforts (<a href="http://www.pinvoke.net/default.aspx/user32/SetWindowLong.html" rel="nofollow noreferrer">SetWindowLong</a>)</p>
24,528
<p>What is your favorite technique for launching a windbg user-mode remote debugging session? Why is do you prefer this technique over other techniques? (pros/cons)</p> <p>There are at least four different ways to do user-mode remote debug using windbg, as documented in the "Remote Debugging" section of the debugging ...
<p>There is no "the best" solution. Each of the possibilities has advantages and disadvantages and it's good to understand all of them. It depends on several factors like:</p> <ul> <li>where are the symbols located</li> <li>which PC has access to the Internet to download the OS symbols</li> <li>what amount of data may...
<p>Option 1 is my favourite because it is the simplest. I get to launch the app in the normal way without worry about getting WinDbg to set the right working directory, pass any command line arguments, etc.</p> <p>Fortunately I've not run into any cases where this hasn't worked!</p>
7,620
<p>I've become very comfortable in the world of pointer-free, garbage-collected programming languages. Now I have to write a small Mac component. I've been learning Objective-C, but as I confront the possibility of dangling pointers and the need to manage retain counts, I feel disheartened.</p> <p>I know that Objectiv...
<p>What do you mean by "component?" Do you mean a chunk of code or a library you are going to hand to other people to link into their apps? If so then it is not realistic to use any of the bridged languages at this time. While a lot of the bridges are very nice, they almost always have complications and issues that mos...
<p>Look at <a href="http://www.python.org" rel="nofollow noreferrer">Python</a> and <a href="http://wxpython.org/" rel="nofollow noreferrer">wxPython</a> (the wxWidgets in Python).</p> <p>The wxWidgets have a very elegant App-Doc-View application design pattern that's very, very nice. It's not used enough, IMO. I ha...
33,667
<p>Which is better (for the user, for longevity, for performance, for whatever) to have:</p> <p>http://{site}/{login} e.g. <a href="http://wildobs.com/adam_jack" rel="nofollow noreferrer">http://wildobs.com/adam_jack</a></p> <p>or</p> <p>http://{site}/user/{login}</p> <p>Pros of former:</p> <ul> <li>User feels mor...
<p>I would say the cons outweigh the pros, so go with /user/login over /login. Consider stackoverflow, since it's MVC as well: I think it's easier to program knowing that everything in /user/blah will always refer to a user, whereas if you don't do this you'll have to consider every possibility.</p> <p>For example, in...
<p>Personally I'd go for /user/{login}</p> <p>Using /{login} feels too much like cluttering up the global namespace, and we all know globals are bad ;)</p>
26,255
<p>I've uploaded a bunch of images to Amazon S3, and now want to add a Cache-Control header to them. </p> <p>Can the header be updated without downloading the entire image? If so, how?</p>
<p>It's beta functionality, but you can specify new meta data when you <a href="http://docs.amazonwebservices.com/AmazonS3/2006-03-01/index.html?RESTObjectCOPY.html" rel="noreferrer">copy an object</a>. Specify the same source and destination for the copy, and this has the effect of just updating the meta data on your ...
<p>Here is a helping code in Python. <div class="snippet" data-lang="js" data-hide="false"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>import boto one_year = 3600*24*365 cckey = 'cache-control' s3_connection = S3Connection() bucket_name = 'my_bucket' bucket...
33,909
<p>The developer environment db server is SqlServer 2005 (developer edition)</p> <p>Is there any way to make sure my SQL Queries will run in SqlServer 2000?</p> <p>This database is set to Compatibility level "SQL Server 2000 (80)" but some queries that run without problems in the development system can not run in the...
<p>Compatibility levels are designed to work the opposite way - to allow an older version of T-SQL code to work without modifications on a newer version of SQL Server. The changes typically involve T-SQL syntax and reserved words, and it's possible to use SQL Server 2005 features such as INCLUDED columns in indexes on...
<p>Problem solved:</p> <p>In correlated subqueries you have to (in SQL2000) explicitly define the external field.</p> <p>SQL2005:</p> <pre>SELECT * FROM Loans WHERE EXISTS (SELECT * FROM Collaterals WHERE COLLATERAL_LOAN=LOAN_NUMBER) </pre> <p>SQL2000:</p> <pre>SELECT * FROM Loans WHERE EXISTS (SELECT * FROM Colla...
41,875
<p>Is a new (or different) instance of <code>TestCase</code> object is used to run each test method in a JUnit test case? Or one instance is reused for all the tests?</p> <pre><code>public class MyTest extends TestCase { public void testSomething() { ... } public void testSomethingElse() { ... } } </code></pre> ...
<p>Yes, a separate instance is created.</p> <p>While running that test, 2 instances of MyTest gets created.</p> <p>If you want a different behavior, one option is to use a similar tool called TestNG(<a href="http://testng.org/doc/" rel="noreferrer">http://testng.org/doc/</a>).</p>
<p>Yes, definitely. I found that data I stored in instance variables could not be accessed between tests due to this design.</p>
21,854
<p>I came across several issues which seem to have been lowered. Firstly, I changed from a 0.4 to a 0.5 mm nozzle. Because of the backpressure I was not able to print my PETG (Colorfabb XT filament) below 270°C which caused unresolvable oozing. After that I was able to extrude till 230°C.</p> <p>The left print below s...
<p>Have you tried adjusting the Extra Restart Distance in Simplify3D or Retraction Extra Prime in Ultimaker Cura? Most slicers should have a similar setting, perhaps named just slightly differently. A small positive value can help prime the nozzle after a long travel when you've lost back pressure or oozed a little.<...
<p>Zero retraction is just a special (worst) case of under-retraction. You'll pretty much always lose material to oozing if you don't retract before travel. At best this ends up hidden inside the print (but can still affect weight and weight balance); usually it'll also harm the surface.</p> <p>Ensure that retraction ...
950
<p>I want to use HTTP GET and POST commands to retrieve URLs from a website and parse the HTML. How do I do this?</p>
<p>You can use <a href="http://java.sun.com/javase/6/docs/api/java/net/HttpURLConnection.html" rel="noreferrer">HttpURLConnection</a> in combination with <a href="http://java.sun.com/javase/6/docs/api/java/net/URL.html" rel="noreferrer">URL</a>.</p> <pre><code>URL url = new URL("http://example.com"); HttpURLConnection...
<p>The easiest way to do a GET is to use the built in java.net.URL. However, as mentioned, httpclient is the proper way to go, as it will allow you among others to handle redirects.</p> <p>For parsing the html, you can use <a href="http://htmlparser.sourceforge.net/" rel="nofollow noreferrer">html parser</a>.</p>
46,888
<p>I'm searching a small <strong>Java</strong> based RSS/Feed Generator, something like the <a href="http://www.bitfolge.de/rsscreator-en.html" rel="noreferrer">FeedCreator.class.php</a> library, any suggestions?, thanks!</p>
<p>There's the Rome framework as well</p> <p><a href="http://rometools.github.io/rome/" rel="nofollow noreferrer">http://rometools.github.io/rome/</a></p> <p>Does RSS and Atom</p>
<p>How about <a href="http://jrss.sourceforge.net/" rel="nofollow noreferrer">jRSS</a>? It looks promising -- supports generating RSS 2 and is relatively small.</p>
17,417
<p>I am getting this warning: "Missing XML comment for publicly visible type or member".</p> <p>How to solve this?</p>
<p>5 options:</p> <ul> <li>Fill in the documentation comments (great, but time-consuming)</li> <li>Turn off the comment generation (in project properties)</li> <li>Disable the warning in project properties (in 'Project properties' go to Project properties -> Build > "Errors and warnings" (section), Suppress Warnings (...
<p>I got that message after attached an attribute to a method</p> <pre><code>[webMethod] public void DoSomething() { } </code></pre> <p>But the correct way was this:</p> <pre><code>[webMethod()] // Note the Parentheses  public void DoSomething() { } </code></pre>
24,941
<p>I heard that Visual Studio came with an Image Library, but I can't find it anywhere. Does anyone know where it is?</p>
<p>From Visual Studio 2012 onward, the icons are downloadable separately from Visual Studio:</p> <ul> <li><a href="https://learn.microsoft.com/en-us/visualstudio/designers/the-visual-studio-image-library" rel="noreferrer">The Visual Studio Image Library</a></li> </ul> <p>The library contains application images that a...
<p>Visual Studio 2012 for windows phone</p> <p>C:\Program Files (x86)\Microsoft SDKs\Windows Phone\v8.0\Icons</p>
38,758
<p>A few years ago I developed a web app for which we wanted to make sure the users weren't sharing credentials.</p> <p>One of the things we decided to to, was only allow the user to be logged in from one computer at a time. The way I did this, was to have a little iframe ping the server every N seconds; as long as th...
<p>I've implemented this by maintaining a hashtable of currently logged in users, the key was the username, the value was their last activity time.</p> <p>When logging in, you just check this hashtable for the key, and if it exists, reject the login.</p> <p>When the user does anything, you update the hashtable with t...
<p>In a highly secure application, you may be required to do such. What you can do is keep a login count incrementing that for the user that logs in and the IP address. The count should never be 2. If it is then you log the other IP out and whomever it is logged into that IP gets thrown out. That wont prevent user-1...
16,561
<p>I have a query form that I would like to submit as a GET request so the result page may be bookmarked and otherwise RESTful. It's your classical text field with a submit button. How do I induce Seam/JSF to use GET and include the query expression as a parameter rather than POST, the default?</p>
<p>All you need to do is enable the SeamFilter in web.xml. See <a href="http://docs.jboss.com/seam/2.0.2.SP1/reference/en-US/html_single/#blog" rel="nofollow noreferrer">Blog Example</a> for an example RESTful application using Seam. The key is to use a Seam page parameter, defined in WEB-INF/pages.xml</p>
<p>you can use a PhaseListener to convert POST requests to GET requests or just to interpret GET requests so that they can be bookmarkable.</p> <p>This page should explain in more detail:</p> <p><a href="http://balusc.blogspot.com/2007/03/post-redirect-get-pattern.html" rel="nofollow noreferrer">http://balusc.blogspo...
12,842
<p>Before I ask my question, here's the offending code:</p> <pre><code>var coords = dojo.coords(g); g.style.left = coords.x + "px"; g.style.top = coords.y + "px"; g.style.position = "absolute"; </code></pre> <p>Now imagine that <code>g</code> is a relatively positioned element with an <code>x</code> position of 70 an...
<p>I still would love someone to explain why this works, but here's a solution:</p> <pre><code>var coords = dojo.coords(g); g.style.left = coords.x + "px"; g.style.top = coords.y + "px"; setTimeout(function(h) { h.style.position = "absolute"; }, 0, g); </code></pre> <p>Cheers</p>
<p>sorry to not respond your question, (because I do not know dojo) but unless coords.x and coords.y returns a string, there is an error in your function,</p> <blockquote> <p>g.style.left = coords.x + &quot;px&quot;;</p> <p>g.style.top = coords.y + &quot;px&quot;;</p> </blockquote> <p>You need to pass always a string t...
37,801
<p>Oftentimes a developer will be faced with a choice between two possible ways to solve a problem -- one that is idiomatic and readable, and another that is less intuitive, but may perform better. For example, in C-based languages, there are two ways to multiply a number by 2:</p> <pre><code>int SimpleMultiplyBy2(in...
<p>You missed one.</p> <p>First code for correctness, then for clarity (the two are often connected, of course!). Finally, and only if you have real empirical evidence that you actually need to, you can look at optimizing. Premature optimization really is evil. Optimization almost always costs you time, clarity, ma...
<p>If you're going to release your software, you must care about the result, not the process.</p> <p>The users are not going to read your code, they are going to use your software, and they don't want to be frustrated by unnecessary long waiting. They will hate you if your well-indented properly-commented application ...
22,148
<p>Apply / find / create a stainless steel coating to apply to a PETG or PLA part to make it react to a magnet.</p> <p>My goal is to make a small tubular and conical shapes that can be painted with a stainless steel coating and will react with a magnet.</p> <p>I know I can buy iron filled PLA but these rust which I wan...
<h1>The surface won't work</h1> <p>The only true-metallic surface treatments I know to be actual metal in large enough amounts to conduct electricity would be leafmetal, akin to leaf gold, and electroplating. However, you can't use the procedures for stainless steels, and even then, the thickness is in the tenth of a µ...
<p>No rust but has magnetic properties? You could try varnishing the iron filled PLA.</p>
1,854
<p>Using the Qt Visual studio integration, adding a new Qt class adds two separate moc.exe generated files - one for debug and one for release (and one for any other configuration currently existing). Yet the two eventual generated files seem to be identical.</p> <p>On the other hand when adding a UI class, the uic.ex...
<p>My guess would be that separate debug and release versions are needed because the moc output is generated from user-defined source code. So the moc output might be different between debug and release builds if the preprocessed class source differs between debug and release (for example, a signal that exists only in ...
<p>Moc parses the source for pre-processor directives. So if you had a header file like this:</p> <pre><code>class Test : public QObject { Q_OBJECT public: Test(); public slots: #ifndef DEBUG void Foo(); #endif }; </code></pre> <p>Then the slot Foo will only exist in the release b...
22,483
<p>In Visual Studio, when I type the line "<code>Implements IDisposable</code>", the IDE automatically adds:</p> <ul> <li>a <code>disposedValue</code> member variable</li> <li>a <code>Sub Dispose() Implements IDisposable.Dispose</code></li> <li>a <code>Sub Dispose(ByVal disposing As Boolean)</code></li> </ul> <p>The ...
<p>If you actually are holding non-managed resources that will not be automatically cleaned up by the garbage collector and cleaning those up in your Dispose(), then yes, you should do the same in Finalize().</p> <p>If you're implementing IDisposable for some other reason, implementing Finalize() isn't required.</p> ...
<p>As others have said, you don't need to implement a finalizer unless you're directly holding unmanaged resources. Also, assuming you're working in .NET 2.0 or later, it's unlikely you'll ever need to implement a finalizer because typically SafeHandle can be used to wrap your unmanaged resources.</p> <p>I wrote a <a ...
13,834
<p>Unit tests are cheaper to write and maintain, but they don't cover all scenarios. What is the right balance between them?</p>
<p>I like <a href="http://www.exampler.com/old-blog/2003/08/21/#agile-testing-project-1" rel="nofollow noreferrer">Brian Marick's quadrant</a> on automated tests where the distinctions are business vs. technology facing and support programming vs. critique product.</p> <p>With that framework the question of balance be...
<p>On the app I am working on at the moment, there are probably 10:1 unit to functional tests. The unit test work simply things like retrieving entities from DB, error handling tests for db/network connectivity etc. These things run quick - minutes or less and are run by devs daily.</p> <p>functional tests while fewer...
40,328
<p>How do I use grep to perform a search which, when a match is found, will print the file name as well as the first n characters in that file? Note that <code>n</code> is a parameter that can be specified and it is irrelevant whether the first n characters actually contains the matching string.</p>
<pre><code>grep -l pattern *.txt | while read line; do echo -n "$line: "; head -c $n "$line"; echo; done </code></pre> <p>Change <code>-c</code> to <code>-n</code> if you want to see the first <code>n</code> lines instead of bytes. </p>
<p>Two thoughts here:</p> <p>1) If efficiency was not a concern (like that would ever happen), you could check <em>$status</em> [csh] after running <em>grep</em> on each file. E.g.: (For <strong>N</strong> characters <strong>= 25</strong>.)</p> <pre><code>foreach FILE ( file1 file2 ... fileN ) grep targetToMatch ...
48,875
<p>I'm hopeless at Javascript. This is what I have:</p> <pre><code>&lt;script type="text/javascript"&gt; function beginrefresh(){ //set the id of the target object var marquee = document.getElementById("marquee_text"); if(marquee.scrollLeft &gt;= marquee.scrollWidth - parseInt(marquee.sty...
<p>Here is a jQuery plugin with a lot of features:</p> <p><a href="http://jscroller2.markusbordihn.de/example/image-scroller-windiv/" rel="noreferrer">http://jscroller2.markusbordihn.de/example/image-scroller-windiv/</a></p> <p>And this one is "silky smooth"</p> <p><a href="http://remysharp.com/2008/09/10/the-silky-...
<p>Working with @Stano code and some jQuery I have created a script that will replace the old <code>marquee</code> tag with standard <code>div</code>. The code will also parse the <code>marquee</code> attributes like <code>direction</code>, <code>scrolldelay</code> and <code>scrollamount</code>.</p> <p>Here is the cod...
43,769
<p>I know that one of the defining principles of Test driven development is that you write your Unit tests first and then write code to pass those unit tests, but is it necessary to do it this way?</p> <p>I've found that I often don't know what I am testing until I've written it, mainly because the past couple of proj...
<p>Some good comments here, but I think that one thing is getting ignored.</p> <p>writing tests first drives your design. This is an important step. If you write the tests "at the same time" or "soon after" you might be missing some design benefits of doing TDD in micro steps.</p> <p>It feels really cheesy at first...
<p>I don't write the actual unit tests first, but I do make a test matrix before I start coding listing all the possible scenarios that will have to be tested. I also make a list of cases that will have to be tested when a change is made to any part of the program as part of regression testing that will cover most of t...
30,682
<p>I have a PHP application that will on occasion have to handle URLs where more than one parameter in the URL will have the same name. Is there an easy way to retrieve all the values for a given key? PHP $_GET returns only the last value. </p> <p>To make this concrete, my application is an OpenURL resolver, and may g...
<p>Something like:</p> <pre><code>$query = explode('&amp;', $_SERVER['QUERY_STRING']); $params = array(); foreach( $query as $param ) { // prevent notice on explode() if $param has no '=' if (strpos($param, '=') === false) $param += '='; list($name, $value) = explode('=', $param, 2); $params[urldecode($name...
<p>AFAIK there is no way to get duplicate values using <code>$_GET</code> as the second value will overwrite the first</p> <p>To get around it you could access the raw querystring using <code>$_SERVER['QUERY_STRING']</code> and then parse it yourself.</p>
46,022
<p>If I have a table in my database called 'Users', there will be a class generated by LINQtoSQL called 'User' with an already declared empty constructor.</p> <p>What is the best practice if I want to override this constructor and add my own logic to it?</p>
<p>The default constructor which is generated by the O/R-Designer, calls a partial function called <code>OnCreated</code> - so the best practice is not to override the default constructor, but instead implement the partial function <code>OnCreated</code> in <code>MyDataClasses.cs</code> to initialize items:</p> <pre><...
<p>Here's the C# version:</p> <pre><code>public partial class PENCILS_LinqToSql_DataClassesDataContext { public PENCILS_LinqToSql_DataClassesDataContext() : base(ConnectionString(), mappingSource) { } public static String ConnectionString() { String CS; String Key; Key = ...
10,813
<p>Wizards can kick-start features. They can also obfuscate your code, and are anti-YAGNI.</p> <p>On balance, do you think Wizards are more useful or more harmful?</p>
<p>They are more useful than harmful <strong>if</strong> and only if you understand the code they generate. Only after you mastered the problem the wizard is trying to solve they are really useful. Otherwise you'll hit walls later in the project, because the generated code <strong>will</strong> need modifications at so...
<p>Wizards are "mostly harmless" when they generate an encapsulated entity - a function, a class or a set of classes - which you don't need to modify and which you interact with through a well-defined, well-designed interface.</p> <p>On the other end of the spectrum is a wizard that that generates skeleton code that n...
31,963
<p>I like to generate a thread dump programmatically. I've learned that there a basically two ways to do it:</p> <ol> <li>Use the "Java Virtual Machine Tool Interface" JVM-TI</li> <li>Use the higher abstracted "Java Debugger Interface" JDI</li> </ol> <p>For the JVM-TI I was able to find some useful information, but I...
<p>There is a third way: Thread.getAllStackTraces()</p> <p><a href="http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#getAllStackTraces()" rel="noreferrer">http://java.sun.com/javase/6/docs/api/java/lang/Thread.html#getAllStackTraces()</a></p> <p>This is much easier than the debugger interface...</p>
<p>Did you consider the remote alternative ? I.e. <a href="http://java.sun.com/javase/6/docs/technotes/guides/visualvm/applications_local.html" rel="nofollow noreferrer">VisualVM</a></p> <p><img src="https://i.stack.imgur.com/U0ckF.png" alt="thead dump with visualVM"></p> <p><a href="http://wiki.caucho.com/Thread_dum...
29,641
<p>I have read the documentation on this and I think I understand. An <a href="http://msdn.microsoft.com/en-us/library/system.threading.autoresetevent.aspx" rel="noreferrer"><code>AutoResetEvent</code></a> resets when the code passes through <code>event.WaitOne()</code>, but a <a href="http://msdn.microsoft.com/en-us/l...
<p>Yes. It's like the difference between a tollbooth and a door. The <code>ManualResetEvent</code> is the door, which needs to be closed (reset) manually. The <code>AutoResetEvent</code> is a tollbooth, allowing one car to go by and automatically closing before the next one can get through.</p>
<p>If you want to understand AutoResetEvent and ManualResetEvent you need to understand not threading but interrupts!</p> <p>.NET wants to conjure up low-level programming the most distant possible.</p> <p>An interrupts is something used in low-level programming which equals to a signal that from low became high (or ...
18,586
<p>When using SQLBulkCopy on a table with a GUID primary key and default newsequentialid()</p> <p>e.g</p> <pre><code>CREATE TABLE [dbo].[MyTable]( [MyPrimaryKey] [uniqueidentifier] NOT NULL CONSTRAINT [MyConstraint] DEFAULT (newsequentialid()), [Status] [int] NULL, [Priority] [int] NULL, CONSTRAINT [PK_MyTable] PRI...
<p>You need to set up the column mappings. First call</p> <pre><code>sqlCopy.ColumnMappings.Clear(); </code></pre> <p>Then call</p> <pre><code>sqlBulkCopy.ColumnMappings.Add("Status", "Status"); sqlBulkCopy.ColumnMappings.Add("Priority", "Priority"); </code></pre> <p>This means the bulk copy will stop trying to ins...
<p>You're only options are to remove the MyPrimaryKey field from the data that is being loaded or to modify the table structure.</p> <p>With the field being there with no values you are telling SQL that you want to force a null into the field, which, obviously, is not allowed.</p>
16,739
<p>We have a simple project where we read data from a socket and we want to populate a table with the coming data, but we can't find a way to add rows to a yet created <code>JTable</code> object, we can only find how to add rows at creation time of the table.</p> <p>Is it possible to add rows dynamically to a <code>JT...
<p>You should create a custom <a href="http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/table/TableModel.html" rel="noreferrer"><code>TableModel</code></a>. A <code>JTable</code> doesn't actually store the rows, it always delegates that to a <code>TableModel</code>. To help you implementing it, you should make use o...
<p>Once you start dynamically adding and removing elements from a JTable, you really need to start using a TableModel.</p> <p>See the <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/table.html" rel="noreferrer">Java Tutorial</a> for more details.</p>
37,793
<p>What are the common algorithms being used to measure the processor frequency?</p>
<p>Intel CPUs after Core Duo support two Model-Specific registers called IA32_MPERF and IA32_APERF.<br> MPERF counts at the maximum frequency the CPU supports, while APERF counts at the actual current frequency.</p> <p>The actual frequency is given by:</p> <p><img src="https://chart.apis.google.com/chart?cht=tx&amp;c...
<p>I'm not sure why you need assembly for this. If you're on a machine that has the /proc filesystem, then running:</p> <pre><code>&gt; cat /proc/cpuinfo </code></pre> <p>might give you what you need.</p>
9,085
<p>I am not able to get the selection object's start and end offsets in Opera (v9.50) when the selection is collapsed (i.e. just point and click instead of highlighting text). This is my simple test code, which works in FF and Safari but does not work in Opera. </p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script typ...
<p>This question is very similar to <a href="https://stackoverflow.com/questions/49378/deploy-mysql-server-db-with-net-application">another question</a>. However, the answers don't really help.</p> <p>You can <a href="http://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/" ...
<p>Have a look at using Visual Studio's package and deployment tool. It should automatically bring in the MySQL dependencies if you connect natively (MySQL .NET components) rather than an ODBC connection. In any case it allows you to add other software to an installation program that can be automatically unpacked if yo...
49,339
<p>I have a ASP.NET page with an asp:button that is not visible. I can't turn it visible with JavaScript because it is not rendered to the page.</p> <p>What can I do to resolve this?</p>
<p>If you need to manipulate it on the client side, you can't use the Visible property on the server side. Instead, set its CSS display style to "none". For example:</p> <pre><code>&lt;asp:Label runat="server" id="Label1" style="display: none;" /&gt; </code></pre> <p>Then, you could make it visible on the client si...
<p>If you wait until the page is loaded, and then set the button's display to none, that should work. Then you can make it visible at a later point.</p>
2,937
<p>Are declaring custom .NET event such as <a href="http://www.c-sharpcorner.com/UploadFile/rmcochran/customgenericeventargs05132007100456AM/customgenericeventargs.aspx" rel="nofollow noreferrer">this</a>, more common in a winform app than webform?</p>
<p>Create a user/login to the DB that you can control. Assign that user as the owner (using grants) of the tables you need to "hide/lock". Use grants to make the tables inaccessible ( or read only) to other users.</p>
<p>After creating the user, make sure you remove the grants for other users. By default, default users have the grant. So make sure only your user has all the the grants</p>
44,594
<p>The log file from a JVM crash contains all sorts of useful information for debugging, such as shared libraries loaded and the complete environment. Can I force the JVM to generate one of these programmatically; either by executing code that crashes it or some other way? Or alternatively access the same information a...
<p>You can try throwing an OutOfMemoryError and adding the -XX:+HeapDumpOnOutOfMemoryError jvm argument. This is new as of 1.6 as are the other tools suggested by McDowell. <a href="http://blogs.oracle.com/watt/resource/jvm-options-list.html" rel="nofollow noreferrer">http://blogs.oracle.com/watt/resource/jvm-options-...
<p>I am pretty sure this can be done with the IBM JDK as I was playing around with their stack analyzer some time ago. One option to force the dump would just to cause an outOfMemoryException. </p> <p>These tools may provide some clues <a href="http://www.ibm.com/developerworks/java/library/j-ibmtools1/" rel="nofollow...
43,841
<p>I've currently got a tool which allows me to configure a database connection (using JDBC) and specify a set of queries to run against the database. This is scheduled to run at a specific time of day (using cron or windows scheduler currently). The tool then exports the results to a file (xml) and sends this file to ...
<p>If your tool already exists and is working, I think the best approach would be to just read a bit about GUI events programming (it's fairly easy once you get the grasp of it and have a nice GUI Builder) and wrap up a small GUI using a GUI Builder.</p> <p>For Java I can recommend the Netbeans IDE and its GUI Builder...
<p>In my opinion, it's quite easy and fast to make a decent UI via Swing. <a href="http://java.sun.com/docs/books/tutorial/uiswing/" rel="nofollow noreferrer">The Swing tutorial</a> may be a good start.</p>
49,850
<p>The first time I load the website in the production web server, it start very slow, subsequent pages load very quickly (included the home page).</p> <p>I precompiled the site, but nothing changes. </p> <p>I don't have any code at Application start. I don't have cached items.</p> <p>Any ideas? How can I find out w...
<p>It's just your app domain loading up and loading any binaries into memory. Also, it's initializing static variables, so if you have a static variable that loads up a lot of data from the db, it might take a bit.</p>
<p>This sounds very much like background compiling; though if you're precompiling, that shouldn't be an issue.</p> <p>First thing I would look at is your ORM (if any). NHibernate, in particular, has a serious startup penalty, as it runs multiple compilers in the background at startup to turn each class in your data la...
4,586
<p>I've seen a couple questions around here like <a href="https://stackoverflow.com/questions/165720/how-to-debug-restful-services">How to debug RESTful services</a>, which mentions:</p> <blockquote> <p>Unfortunately that same browser won't allow me to test HTTP PUT, DELETE, and to a certain degree even HTTP POST.</...
<p>No. The <a href="http://w3c.github.io/html/sec-forms.html#form-control-infrastructure-form-submission" rel="noreferrer">HTML 5 spec</a> mentions:</p> <blockquote> <p>The method and formmethod content attributes are enumerated attributes with the following keywords and states:</p> <p>The keyword <strong>get...
<p>Just to add - Safari 2 and earlier definitely didn't support PUT and DELETE. I get the impression 3 did, but I don't have it around to test anymore. Safari 4 definitely does support PUT and DELETE.</p>
20,021
<p>I have two SQL scripts which get called within a loop that accept a number parameter. Here is what I'm currently using:</p> <pre><code>for /l %%i in (1, 1, 51) do ( sqlplus u/p@name @script.sql a%%i.html %%i sqlplus u/p@name @script.sql b%%i.html %%i ) </code></pre> <p>Everything works fine, but it seems l...
<p>You can create a masterscript.sql that contains your two script.sql statements. The only thing I'm not sure about is if it will pass in your variables.</p> <p>MasterScript.sql would contain:</p> <pre><code>@@script1.sql @@script2.sql </code></pre> <p>and neither of your sub-scripts should contain an exit.</p> <p...
<p>Try This</p> <p>( echo @%query% user )<br> | sqlplus username/password@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=XX.XX.XX.XX)(Port=152X))(CONNECT_DATA=(SID=ABC))) </p>
40,634
<p>I'm working on a java web application that uses thousands of small files to build artifacts in response to requests. I think our system could see performance improvements if we could map these files into memory rather than run all over the disk to find them all the time. </p> <p>I have heard of mmap in linux, and m...
<p>You can try to put all the files in a JAR and put that on the classpath. Java uses some built-in tricks to make reading from a JAR file very fast. That will also keep the directory of all files in RAM, so you don't have to access the disk to find a file (that happens before you can start loading it).</p> <p>The JVM...
<p>Just to clarify, <code><a href="http://linux.die.net/man/2/mmap" rel="nofollow noreferrer">mmap()</a></code> in Unix-like systems would not allow you to access files as such; it simply makes the contents of a file available in memory, as memory. You cannot use <code>open()</code> to further open any contained files....
43,669
<p>I would like to create an HTML table with row colors changing based on position and content. But instead of alternating every row, I'd like to be able to group rows together, so that I can have some XML like this:</p> <pre><code>&lt;itemlist&gt; &lt;item group="0"&gt;Conent...blah blah&lt;/item&gt; &lt;item ...
<p>Here's an example of using "choose" to apply a different class value based on the group value. Something similar to this would work if you want to treat each group in a specific way. If your decision logic for handling group 2 is more complex, then you could place additional decision logic inside the "when" statemen...
<p>The first two groups are simple as you can parse them based on their group number.</p> <p>To handle group 2, consider using the <a href="http://www.zvon.org/xxl/XSLTreference/Output/axis_preceding.html" rel="nofollow noreferrer">preceding</a> function to get a list of proir notes, and use <a href="http://www.zvon.o...
31,867
<p>What would be the best way to calculate someone's age in years, months, and days in T-SQL (SQL Server 2000)?</p> <p>The <code>datediff</code> function doesn't handle year boundaries well, plus getting the months and days separate will be a bear. I know I can do it on the client side relatively easily, but I'd like...
<p>Here is some T-SQL that gives you the number of years, months, and days since the day specified in @date. It takes into account the fact that DATEDIFF() computes the difference without considering what month or day it is (so the month diff between 8/31 and 9/1 is 1 month) and handles that with a case statement that...
<pre><code>DECLARE @DoB AS DATE = '1968-10-24' DECLARE @cDate AS DATE = CAST('2000-10-23' AS DATE) SELECT --Get Year difference DATEDIFF(YEAR,@DoB,@cDate) - --Cases where year difference will be augmented CASE --If Date of Birth greater than date passed return 0 WHEN YEAR(@DoB) - YEAR(@cDate) &gt;= 0 THEN DA...
8,193
<p>When I first got my 3D printer (a FlashForge Adventurer 3), it came with a sample pack of filament. With this filament, I was able to use skirts for my first layer. When the sample filament ran out, I switched to Hatchbox PLA filament. For some reason, I cannot use skirts with the Hatchbox filament. Now, whenever I ...
<p>PLA is a forgiving filament, you can even print such filament without a heated bed. Although there are differences in quality between brands, PLA shouldn't need a raft to be printed. Hatchbox filament is not considered as a low quality type of filament; it is economical and has been around since 2013. A raft is a st...
<p>Please try one (or more) of the following:</p> <ol> <li><p>Change the temperature of your heated bed (50 - 60 °C)</p> </li> <li><p>Check your nozzle height (0.15 - 0.25 mm is what I use)</p> </li> <li><p>Make sure your bed is level (Maybe use a leaving stick (or whatever those bubble things are called))</p> </li> <l...
1,933
<p>I am looking for a best practice for End to End Authentication for internal Web Applications to the Database layer.</p> <p>The most common scenario I have seen is to use a single SQL account with the permissions set to what is required by the application. This account is used by all application calls. Then when p...
<p>Dale - That's it exactly. If you want to provide access to the underlying data store to those users then do it via services. And in my experience, it is those experienced computer users coming out of Uni/College that damage things the most. As the saying goes, they know just enough to be dangerous.</p> <p>If they w...
<p>I've been responsible for developing several internal web applications over the past year.</p> <p>Our solution was using Windows Authentication (Active Directory or LDAP).</p> <p>Our purpose was merely to allow a simple login using an existing company ID/password. We also wanted to make sure that the existing depa...
10,442
<p>After some months of good quality prints, since yesterday my heatbed does not heat anymore.</p> <p>I've a BQ Prusa i3 Hephestos with <a href="https://www.reprap.org/wiki/File:RRD-Mk2b-dual-power_blk.jpg" rel="nofollow noreferrer">this</a> heatbed, controlled by <a href="https://images-na.ssl-images-amazon.com/images...
<p>I see four points of error:</p> <ul> <li>The heatbed could be faulty.</li> <li>The lines could be faulty.</li> <li>The trigger signal could be faulty.</li> <li>The power supply could be faulty.</li> </ul> <p>So, how to check what it might be? We need to measure, but we need to measure in a setup of 12/24 V circuits ...
<p>Assuming you are using the correct voltage hot bed, what you have set up should be just fine.</p> <p>On the other hand, if it’s a 12 volt bed with a 24 volt power supply, you could have easily burned it out.</p> <p>If the voltages were matched properly, you may have just gotten unlucky.</p>
1,758
<p>I am playing with a CAD application using MFC. I was thinking it would be nice to save the document (model) as an SQLite database.</p> <p>Advantages:</p> <ul> <li>I avoid file format changes (SQLite takes care of that)</li> <li>Free query engine</li> <li>Undo stack is simplified (table name, column name, new value...
<p>This is a fine idea. Sqlite is very pleasant to work with!</p> <p>But remember the old truism (I can't get an authoritative answer from Google about where it originally is from) that storing your data in a relational database is like parking your car by driving it into the garage, disassembling it, and putting eac...
<p>This is a great idea but before you start I have a few recommendations:</p> <ul> <li><p>Be careful that each database is uniquely identifiable in some way besides file name such as having a table that describes the file within the database.</p></li> <li><p>Take a look at some of the MFC based examples and wrappers ...
18,581
<p>I've been trying to learn about Neural Networks for a while now, and I can understand some basic tutorials online, and I've been able to get through portions of <a href="https://rads.stackoverflow.com/amzn/click/com/0852742622" rel="noreferrer" rel="nofollow noreferrer">Neural Computing - An Introduction</a> but ev...
<p>If you want a list of college courses that you'll need to understand the book, here it is:</p> <ul> <li>Calculus (I, II and III)</li> <li>Differential Equations</li> <li>Linear Algebra</li> <li>Statistics (or a good covering of Bayes)</li> </ul> <p>However, I did just fine in my NN classes without Diff. Eq. and ju...
<p>even though i am answering it in 2018 but i think it will help a lot of newcomers who are trying to learn neural network. All the online course material available online expect the reader to have high degree of mathematical knowledge or experience. There is a book called "MAKE YOUR OWN NEURAL NETWORK" by Tariq Rash...
43,641
<p>I have this PHP script that I wrote to automatically follow users that post messages with certain terms. It works 100% of the time on a bunch of test accounts but then does not work on the account I'd like to use it with. </p> <p>I've checked the account's API rate limit and it's well within the boundaries. I've ...
<p>To debug your cURL request everything has been said, but maybe you could use <a href="http://pear.php.net/package/Services_Twitter" rel="nofollow noreferrer">Services_Twitter</a>, which is a package wrapped around the Twitter-API. It provides pretty robust response handling.</p> <p>Currently supports search and fri...
<p>Try using:</p> <pre><code>curl_setopt($ch, CURLOPT_VERBOSE, 1); </code></pre> <p>to and see if it helps identifying the problem.</p>
35,843
<p>I'm sure that all of us have had to deal with telecommuters at some point in time, and I'm facing a situation now where my new project will have a "core" group of office workers and some off-site telecommuters. Not wanting to repeat past mistakes, I'd really like to know what ways people have tried in the past to e...
<p>Set the ground rules upfront. Don't be wishy-washy about them.</p> <p>You've probably eliminated the "I got stuck in traffic" excuse for missing the meeting or whatever when they're working from home (or a satellite site) and so there's no reason to expect less out of them.</p> <p>Take advantage of technology:</p...
<p>One place I worked used Asterisk instead of a normal phone system. It worked well because when you are working from home, you simply log on, people can call your direct line number, outsiders don't need to know. Even though phone call cost are relativity trivial these days, having a 'always on' connection encourages...
23,194
<p>How can I play audio (it would be like a 1 second sound) from a Python script?</p> <p>It would be best if it was platform independent, but firstly it needs to work on a Mac.</p> <p>I know I could just execute the <code>afplay file.mp3</code> command from within Python, but is it possible to do it in raw Python? I ...
<p>Your best bet is probably to use <a href="http://www.pygame.org" rel="noreferrer">pygame/SDL</a>. It's an external library, but it has great support across platforms.</p> <pre><code>pygame.mixer.init() pygame.mixer.music.load("file.mp3") pygame.mixer.music.play() </code></pre> <p>You can find more specific documen...
<p>If you're on OSX, you can use the "os" module or "subprocess" etc. to call the OSX "play" command. From the OSX shell, it looks like </p> <p>play "bah.wav"</p> <p>It starts to play in about a half-second on my machine.</p>
32,602
<p>In a C# Web app, VS 2005 (I am avoiding 2008 because I find the IDE to be hard to deal with), I am getting into a layout stew.</p> <p>I am moving from absolute positioning toward CSS relative positioning.</p> <p>I'd like to divide the screen into four blocks: top (header band), middle left (a stacked menu), middle...
<p>So far as I know, there's nothing specific to ASP.NET, and you are right (at least in 2008) about it not using referenced stylesheets.</p> <p>These may be of use to you, however:</p> <p><a href="http://www.positioniseverything.net/" rel="nofollow noreferrer">http://www.positioniseverything.net/</a> - Position is E...
<p>As Jeff says, there is nothing specific to ASP.NET with regards to how CSS is implemented. As for styling your forms with CSS have a read of these to give you some ideas:</p> <ul> <li><a href="http://www.sitepoint.com/article/fancy-form-design-css/" rel="nofollow noreferrer">http://www.sitepoint.com/article/fancy-f...
19,087
<p>Have you used the Application Recovery APIs with vista? </p> <p><a href="http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa373347(VS.85).aspx</a></p> <p>Do you find them to be reliable and easy to work with? </p> <p>I am reading throu...
<p>It would be helpful if you describe why you need to monitor it. </p> <p>Is it running unattended without a GUI? Then you might create a Windows Service instead. There are restart options for Services already in XP.</p> <p>Is it a GUI app, that provides some background services even if the user is away? Consider se...
<p>The only way is to have a service monitoring the application. </p> <p>The reason being that if the application has a truly fatal error that the app itself can't handle, then something outside of it has to perform the recovery operation.</p> <p>The background service can use WMI (works on XP, Vista, etc) to monito...
46,483
<p>What's a more elegant way of having the code below where i want to return a derived class based on the type of another class.</p> <pre><code> if (option_ is Rectangle) { modelInputs = new Foo(); } else if (option_ is Circle) { ...
<p>Have Rectangle, Circle and Triangle implement IHasModelInput:</p> <pre><code>interface IHasModelInput { IModelInput GetModelInput(); } </code></pre> <p>then you can do</p> <pre><code>IModelInput modelInputs = option_.GetModelInput(); </code></pre>
<p>You could associate a type with "option_", if it allows, and then just create an instance of it.</p>
29,970
<p>I would like to ensure that I only subscribe once in a particular class for an event on an instance.</p> <p>For example I would like to be able to do the following:</p> <pre><code>if (*not already subscribed*) { member.Event += new MemeberClass.Delegate(handler); } </code></pre> <p>How would I go about implem...
<p>If you are talking about an event on a class that you have access to the source for then you could place the guard in the event definition.</p> <pre><code>private bool _eventHasSubscribers = false; private EventHandler&lt;MyDelegateType&gt; _myEvent; public event EventHandler&lt;MyDelegateType&gt; MyEvent { add...
<p>Invoke only distinct elements from <code>GetInvocationList</code> while raising:</p> <pre><code>using System.Linq; .... public event HandlerType SomeEvent; .... //Raising code foreach (HandlerType d in (SomeEvent?.GetInvocationList().Distinct() ?? Enumerable.Empty&lt;Delegate&gt;()).ToArray()) d.Invoke(sender, ...
47,967
<p>I have an XLL Excel addin and now another team wants to use the same functionality in their project (unmanaged C++). Is there a way to interface with this XLL directly from C++?</p>
<p>PreviewMouseDown is your friend...</p> <p>Add this event to your control, and set the Handled property on true...</p> <p>All events tunnel first from root to leaves in the preview fase, then they are handled from leaves to root in the actual event case...</p> <p>So PreviewMouseDown handles the Grid before the But...
<p>You should be able to extend whatever control you want (assuming it is not sealed). In your extended class you can override the click event and swallow it (do not pass it to the base class).</p>
35,096
<p>There is a simple C++ method to use pattern matching on strings? The code should sound like this:</p> <pre><code>if (regexpcmp("l?nole*[0-9]", "linoleum1")) { //we have a match! } else { //no match } </code></pre>
<p>Did you already look at <a href="http://www.boost.org/doc/libs/release/libs/regex/" rel="nofollow noreferrer">Boost.Regex</a>?</p> <pre><code>const boost::regex e("l?nole*[0-9]"); if (regex_match("linoleum1", e)) { //we have a match! } else { //no match } </code></pre>
<p>A standard regex library (that is based on boost::regex) is available in the TR1 namespace if you use lasts versions of the most used compilers : std::tr1::regex.</p>
42,696
<p>I created a program using dev-cpp and wxwidgets which solves a puzzle.</p> <p>The user must fill the operations blocks and the results blocks, and the program will solve it. I'm solving it using brute force, I generate all non-repeated 9 length number combinations using a recursive algorithm. It does it pretty fast....
<p>Not sure that this is really what you're looking for but..<br> Any Object Oriented language such as C++ or C# will allow you to create an "Operator" base class and then to derive from this base class a "PlusOperator" or "MinusOperator" etc'. this is the standard way to avoid such case statements. </p> <p>However I...
<p>You can represent the numbers and operators as objects, so the parsing is done only once in the beginning of the solving.</p>
13,440
<p>I work in a biological laboratory where we have been using the FABtotum personal fabricator for several months now. The machine is good, however not flawless, and has set us back from doing experiments.</p> <p>I have overcome many common 3D printing issues, which I find necessary to do when becoming proficient in t...
<p>I have only tried 2 different printers. I started with an Up plus printer and it was good to get started. After a few years you really want more control. I did a lot of research and ended up buying the Extrabot. It is based on the ultimaker however the guy that puts them together upgrades the motors and a few other ...
<p>I have only tried 2 different printers. I started with an Up plus printer and it was good to get started. After a few years you really want more control. I did a lot of research and ended up buying the Extrabot. It is based on the ultimaker however the guy that puts them together upgrades the motors and a few other ...
596
<p>Greetings,</p> <p>I need to include a property in my class which is a collection of System.IO.FileInfo objects. I am not really sure how to do this and how I would add and removed objects from an instance of the the class (I would assume like any other collection). </p> <p>Please let me know if I need to add m...
<p><code>File</code> is a static class. So let's assume you meant <code>FileInfo</code>.</p> <p>There are lots of ways, you can:</p> <ul> <li>Expose a private field</li> <li>Use Iterators</li> <li>Expose a private field through a ReadOnlyCollection&lt;></li> </ul> <p>For example,</p> <pre><code>class Foo { publ...
<p>One simple way to do this is to create a property as such (sorry for the VB.Net)</p> <pre><code>Public ReadOnly Property Files As Generic.List(Of IO.File) GET Return _Files END GET END Property </code></pre> <p>Where _Files is a private class variable of type Generic.List(Of IO.File), which holds t...
20,469
<p>With the asp.net MVC framework the blogs of the team members (Rob Conery, Phil Haack etc) really helped me on my way and made me feel comfortable the development was going in the right direction. Is there something similar for Silverlight?</p> <p>-Edit: I would like to mention that I would like to find members of t...
<p>Method ~ of ~ failed by Tim Heuer: <a href="http://feeds.timheuer.com/timheuer-silverlight" rel="nofollow noreferrer">http://feeds.timheuer.com/timheuer-silverlight</a></p> <p>Jesse Liberty - Silverlight Geek: <a href="https://feeds.feedburner.com/JesseLiberty-SilverlightGeek" rel="nofollow noreferrer">http://feeds....
<p><a href="http://weblogs.asp.net/Scottgu/" rel="nofollow noreferrer">Scott Guthrie</a> the product manager of .NET Framework writes form time to time about Silverlight in his <a href="http://weblogs.asp.net/Scottgu/" rel="nofollow noreferrer">blog</a>. He reports about new releases and the feature they come with it a...
26,756
<p>Interested if anyone has used VSTS Database Edition extensively and, if so, which features did you find the most useful over the standard Visual Studio database projects?</p> <p>What are the most compelling features as opposed to alternative schema management options or tools like RedGate's SqlCompare etc?</p> <p>...
<p>We use the database edition functionality of Team Suite on Stack Overflow. As Vaibhav said, <strong>mostly it is useful because it gives you a one-click way to reverse engineer a database into source control</strong>, and keep it up to date.</p> <p>Note that it also has decent Data and Schema compare tools as well....
<p>You can do database versioning for one. That is useful.</p> <p>The other thing that is really useful is the ability to define type of seed data for testing. Through this Visual Studio will populate the database with random data and this is great for testing purposes.</p> <p>There are other benefits as well of cour...
20,497
<p>I've been thinking lately, would it be a good form of syntactic sugar in languages like Java and C#, to include a "duck" type as a method parameter type? This would look as follows:</p> <pre><code>void myFunction(duck foo) { foo.doStuff(); } </code></pre> <p>This could be syntactic sugar for invoking doStuff()...
<p>The <code>dynamic</code> keyword supports these exact semantics and will be in C# 4.0.</p> <p>It is not just for reflection, though. It is an implementation of <a href="http://en.wikipedia.org/wiki/Dynamic_dispatch" rel="nofollow noreferrer">dynamic dispatch</a> which uses reflection only if no other mechanism is a...
<p>Actually, that's very much like the "dynamic" type that will be part of C#4.</p>
40,157
<p>The scriptaculous wiki has a demo (<a href="http://github.com/madrobby/scriptaculous/wikis/effect-slidedown" rel="nofollow noreferrer">http://github.com/madrobby/scriptaculous/wikis/effect-slidedown</a>) that shows the SlideDown effect in use. However I need to have the same link to slide down if a certain DIV is hi...
<p>Use <a href="http://github.com/madrobby/scriptaculous/wikis/effect-toggle" rel="noreferrer">Effect.toggle</a>.</p> <pre><code>Effect.toggle('element_id', 'slide'); </code></pre>
<p>Wrap it in a function, call the function instead.</p> <pre><code>function slideMe(myDiv) { if(Element.visible(myDiv)) { //slide up } else { //slide down } } </code></pre>
30,788
<p>I am in the process of designing a .net windows forms application that uses metadata to drive the UI. Apart from finding <a href="http://msdn.microsoft.com/en-us/library/ms954610.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms954610.aspx</a>, I have nothing much to look forward to. Anyone ...
<p>The most obvious answer would be that Microsoft have themselves embraced this concept through their use of Xaml in <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation" rel="nofollow noreferrer">Windows Presentation Foundation</a> which replaces WinForms (to an extent).</p> <p>If you want to stick ...
<p>You may want to check out Evolutility CRUD framework. It is an open source metadata driven framework for CRUD generating all UI at run-time.</p> <p>It comes w/ source code (in C# and JS) and many samples.</p> <p><a href="http://www.evolutility.org" rel="nofollow noreferrer">http://www.evolutility.org</a></p>
12,995
<p>I am using the following function to load a PlayList of Songs from 'PlayListJSON.aspx' but somethings seems wrong,evrytime OnFailure is getting called, I am unable to debug it further. any help would be really gr8.</p> <pre><code>Player.prototype.loadPlaylist = function(playlistId, play) { req = new Ajax.Request(...
<p>Generally, OnFailure gets called when the page you are calling out to can't be reached for some reason.</p> <p>Are you positive that the URL <strong>/PlaylistJSON.aspx</strong> is valid?</p> <hr> <p>Have you tried passing the parameters argument instead of specifying them as part of the url?</p> <pre><code>req =...
<p>Yes the Page PlayListJSon.aspx is in the root directory.</p>
29,242
<p>Given a latitude and longitude, what is the easiest way to find the name of the city and the US zip code of that location.</p> <p>(This is similar to <a href="https://stackoverflow.com/questions/23572/latitude-longitude-database">https://stackoverflow.com/questions/23572/latitude-longitude-database</a>, except I wa...
<p>This is the web service to call. <a href="http://developer.yahoo.com/search/local/V2/localSearch.html" rel="nofollow noreferrer">http://developer.yahoo.com/search/local/V2/localSearch.html</a></p> <p>This site has ok web services, but not exactly what you're asking for here. <a href="http://www.usps.com/webtools/" ...
<p>geonames has an extensive set of ws that can handle this (among others): <br><br> <a href="http://www.geonames.org/export/web-services.html#findNearbyPostalCodes" rel="nofollow noreferrer">http://www.geonames.org/export/web-services.html#findNearbyPostalCodes</a><br> <a href="http://www.geonames.org/export/web-serv...
5,081
<p>These days, i came across a problem with Team System Unit Testing. I found that the automatically created accessor class ignores generic constraints - at least in the following case:</p> <p>Assume you have the following class:</p> <pre><code>namespace MyLibrary { public class MyClass { public Nullable&lt;T&gt;...
<p>I vote bug. I don't see how this could be by design.</p>
<p>Search for unit tests with generics on msdn. This is a known limitation. Vote for a resolution on Microsoft Connect, as it is definately needs resolving.</p>
9,042