instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>SslStream is supposed to negotiate the cipher type, key length, hash algorithm, etc. with its peer SSL stack. When using it in my code, I find that the negotiation always defaults to RC4 &amp; MD5. I would like to use 3DES or AES for some added security.</p> <p>Looking around the web I find only a few references to...
<p>SSLStream uses Schannel that is supplied with the operating system. The suites are listed in the default order in which they are chosen by the Microsoft Schannel Provider for :</p> <p><strong>Windows Vista:</strong></p> <blockquote> <p>RSA WITH AES_128 CBC SHA<br /> RSA WITH AES_256 CBC SHA<br /> RSA WITH RC4_128 SH...
<p>It should be using the most secure set of algorithms that were in both lists. I find it hard to believe that it isn't, because SslStream is wrapping the SChannel SSPI, and if that were broken then Internet Explorer, IIS and everything else on Windows would be broken too.</p> <p>It could be that you have an outdated...
11,670
<p>We've got a product that uses a Microsoft SQL Server database. We've got customers using various older versions of the product.</p> <p>How do people write/structure their database upgrade scripts in this situation?</p>
<p>You need a set of release-to-release patch scripts. On production systems with live data this is a bit trickier as you may also have to manipulate data in these scripts.</p> <p><a href="http://www.red-gate.com/products/SQL_Compare/index.htm" rel="nofollow noreferrer">Redgate SQL Compare Pro</a> is quite a good too...
<p>We have one SQL script that does both a clean installation and an upgrade. After installing SQL Express or full SQL server, we run this script that does the following:</p> <ol> <li>Creates the tables if they don't exist with CREATE TABLE.</li> <li>Delete and recreate all stored procedures</li> <li>Make modificatio...
45,457
<p>I am using the jQuery AutoComplete plugin in an html page where I also have an accordion menu which uses prototype.</p> <p>They both work perfectly separately but when I tried to implement both components in a single page I get an error that I have not been able to understand.</p> <blockquote> <p>uncaught except...
<p>There are two possible solutions: There was a conflict with an older version of Scriptaculous and jQuery (Scriptaculous was attempting to extend the native Array prototype incorrectly) - first try upgrading your copy of Scriptaculous.</p> <p>If that does not work you will need to use <code>noConflict()</code> (as a...
<p>jQuery lets you rename the jQuery function from <code>$</code> to something else to avoid namespace conflicts with other libraries. </p> <p>You can do something like this</p> <pre><code>var J = jQuery.noConflict(); </code></pre> <p>Details here: <a href="http://michaelshadle.com/2007/07/03/jquerys-no-conflict-mod...
16,290
<p>I've tried using a throat with a PTFE tube, but encountered the problem described in this <a href="https://3dprinting.stackexchange.com/questions/904/teflon-tubing-in-nozzle-throat-coming-out">question</a>. It seems only a small amount of excess pressure in the extruder is enough to force out the inner tube. This ma...
<p>In this case I would like to first recommend replacing your PTFE tube with a better quality product. Unfortunately, the quality:price ratio is as to be expected here. My reasoning:</p> <p>PTFE has great thermal properties for a polymer, just like ABS. In fact, the <a href="https://en.wikipedia.org/wiki/Glass_transi...
<p>I see, you want to Block the tefflon tube from going Up and Out of the extruder. Yes I see no reason why you would not fid a nut cap. Drill a hole and have it work. There is likely a special nut cap with a pre existing hole in it already but I decided the keywords was asking for bad results on a work computer. </p> ...
471
<p>I have a python list, say l</p> <pre><code>l = [1,5,8] </code></pre> <p>I want to write a sql query to get the data for all the elements of the list, say</p> <pre><code>select name from students where id = |IN THE LIST l| </code></pre> <p>How do I accomplish this?</p>
<p>Answers so far have been templating the values into a plain SQL string. That's absolutely fine for integers, but if we wanted to do it for strings we get the escaping issue.</p> <p>Here's a variant using a parameterised query that would work for both:</p> <pre class="lang-python prettyprint-override"><code>placehold...
<p>For example, if you want the sql query:</p> <pre><code>select name from studens where id in (1, 5, 8) </code></pre> <p>What about:</p> <pre><code>my_list = [1, 5, 8] cur.execute("select name from studens where id in %s" % repr(my_list).replace('[','(').replace(']',')') ) </code></pre>
35,968
<p>I have a few issues with the blue tape, which I'm trying out for the first time.</p> <p>The tape seems to warp, bubble and lift from the aluminum plate when it heats and cools and during printing. I put some clips on it, but not sure if this is standard.</p> <p>It also seems the print is lifting off the tape itsel...
<p>My Dad uses prittstick on the bed before the print and the bed keeps the prittstick just abbout the right temp for it to stick.</p> <p><a href="https://i.stack.imgur.com/23Uem.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/23Uem.jpg" alt="Me Gluing his print bed (No Need FOr tape)"></a></p>
<p>The absolute best way to solve sticking problem is Overture build surface. I could not get anything to stick. Got a free build sheet when I bought some filament from them. What a difference, everything sticks now, just clean with alcohol between uses.</p>
1,158
<p>If, like me, you shiver at the site of a While (True) loop, then you too must have thought long and hard about the best way to refactor it away. I've seen several different implementations, none really better than any other, such as the timer &amp; delegate combination.</p> <p>So what's the best way you've come up...
<p>My preference would be</p> <pre><code>start: // code goes here goto start; </code></pre> <p>This most clearly expresses the intent. Good luck getting it past your coding standards. (Wonder how much karma this is going to cost me).</p>
<pre><code>void whiletrue_sim(void) { //some code whiletrue_sim(); } </code></pre> <p>Warning: Your stack may overflow.</p>
30,313
<p>I'm generating an Eclipse update site and I'm trying to give it a label so that when it appears in a user's sites list, it would appear as a name (e.g., "Ganymede project") rather than as a URL.</p> <p>I haven't been able to find any parameter for it in the PDE or site.xml</p> <p>The only thing that I've seen is t...
<p>Not 100% sure on this since I'm not familiar with Eclipse update site building, but this page:</p> <p><a href="http://wiki.eclipse.org/Equinox_p2_Metadata_Generator" rel="nofollow noreferrer">http://wiki.eclipse.org/Equinox_p2_Metadata_Generator</a></p> <p>Seems to indicate you can generate the metadata for the upda...
<p>Perhaps I am misunderstanding your question, but doesn't the user choose the name of the site when they add it using find / install features? The dialog specifies a Name field and a URL field. The name is what is displayed in the "Sites to Search" list.</p>
21,301
<p>I'm trying to write a small class library for a C++ course.</p> <p>I was wondering if it was possible to define a set of classes in my shared object and then using them directly in my main program that demos the library. Are there any tricks involved? I remember reading this long ago (before I started really progra...
<p>C++ classes work fine in .so shared libraries (they also work in non-MFC DLLs on Windows, but that's not really your question). It's actually easier than Windows, because you don't have to explicitly export any symbols from the libraries.</p> <p>This document will answer most of your questions: <a href="http://peo...
<p>As I understand it, this is fine so long as you are linking .so files which were all compiled using the same compiler. Different compilers mangle the symbols in different ways and will fail to link.</p> <p>That is one of the advantages in using COM on Windows, it defines a standard for putting OOP objects in DLLs. ...
8,251
<p>I mean name off a programming project you did and how long it took, please. The boss has never complained but I sometimes feel like things take too long. But this could be because I am impatient as well. Let me know your experiences for comparison.</p> <p>I've also noticed that things always seem to take longer, so...
<p>It is best to simply time yourself, record your estimates and determine the average percent you're off. Given that, as long as you are consistent, you can appropriately estimate actual times based on when you believed you'd get it done. It's not simply to determine how bad you are at estimating, but rather to take i...
<p>I do projects from 2 weeks to 1 year. Generally my estimates are quite good, <em>a posteriori</em>. At the beginning of the project, though, I generally get bashed because my estimates are considered too large.</p> <p>This is because I consider a lot of things that people forget:</p> <ul> <li>Time for bug fixing</...
13,728
<p>What recommendations can you give for a system which must do the following:</p> <p>Load Plugins (and eventually execute them) but have 2 methods of loading these plugins:</p> <ul> <li>Load only authorized plugins (developed by the owner of the software) </li> <li>Load all plugins</li> </ul> <p>And we need to be ...
<p>This is all described in <a href="http://livedocs.adobe.com/flex/3/progAS_flex3.pdf" rel="nofollow noreferrer">The Adobe Flex 3 Programming ActionScript 3 PDF</a> on page 550 (Chapter 27: Flash Player Security / Cross-scripting):</p> <blockquote> <p>If two SWF files written with ActionScript 3.0 are served from d...
<p>Mayhaps <a href="http://livedocs.adobe.com/flex/15/flex_docs_en/wwhelp/wwhimpl/common/html/wwhelp.htm?context=Flex_Documentation&amp;file=00001750.htm" rel="nofollow noreferrer" title="Flex Documentation: System.Security.allowDomain">System.Security.allowDomain</a> is what you need?</p>
3,512
<p>How can I make the iPhone camera full-screen by removing the overlay?</p> <p>Can I change the camera toolbar style?</p>
<p>There is no reliable way to do this using the current iPhone SDK. You should file a <a href="http://bugreporter.apple.com" rel="nofollow noreferrer">bug</a> with Apple to try to get them to add more control over the camera.</p>
<p>I've been trying to do this for quite some time. </p> <p>Aswell as the link in the post above mine. I've stumbled across this page - <a href="http://blog.airsource.co.uk/index.php/2008/11/11/views-of-uiimagepickercontroller/" rel="nofollow noreferrer">http://blog.airsource.co.uk/index.php/2008/11/11/views-of-uiimag...
33,642
<p>I'm curious about OpenID. While I agree that the idea of unified credentials is great, I have a few reservations. What is to prevent an OpenID provider from going crazy and holding the OpenID accounts they have hostage until you pay $n? If I decide I don't like the provider I'm with this there a way to migrate to a ...
<p>This is why you can use <a href="http://wiki.openid.net/Delegation" rel="noreferrer">OpenID delegation</a>, i.e. you set up two META tags on your personal website and then you can use that site's URL as an alias for your current OpenID provider of choice. Should it get unfriendly you just switch to another and updat...
<p>I think you might be mixing free-market providers with governments. Latter abuse their power because you got nobody else to go to (try to get an "alternative" passport). Since the OpenID prividers have competition, you can always leave one provider and go to another.</p>
10,397
<p>I'm using GCC; __FILE__ returns the current source file's entire path and name: <code>/path/to/file.cpp</code>. Is there a way to get just the file's name <code>file.cpp</code> (without its path) at compile time? Is it possible to do this in a portable way? Can template meta programming be applied to strings?</p> <...
<p>If you're using a <code>make</code> program, you should be able to munge the filename beforehand and pass it as a macro to <code>gcc</code> to be used in your program. For example, in your <code>makefile</code>, change the line:</p> <pre><code>file.o: file.c gcc -c -o file.o src/file.c </code></pre> <p>to:</p> <...
<p>You can take __FILE__ and the strip off the part of path you don't want (programatically). If basedir satisfies your needs, then fine. Otherwise, get source dir root from your build system, and the rest should be doable.</p>
29,397
<p>I'm writing an applicationt hat was prototyped on MySQL and is now connecting to an Oracle database.</p> <p>All I had to do to connect to the oracle database (having built up the table structure) was change the connection string.</p> <p>What is the format to connect to a SQL Server DB on another machine?</p> <p>I...
<p>You should not use the JDBC-ODBC bridge in a production environment. It is much slower than other JDBC drivers and only necessary when a JDBC driver is not available.</p> <p>SQL Server has a <a href="http://www.microsoft.com/downloads/details.aspx?familyid=C47053EB-3B64-4794-950D-81E1EC91C1BA&amp;displaylang=en" re...
<p>These days its quite easy to use Factory pattern and then load JDBC drivers to work with given databse. This architecture gives best of both worlds i.e. Flexibility and efficiency. The one downside of this is bit configuration/programming to handle dynamic loading but i hope so if you want to make it database agnost...
37,781
<p>I'm looking mainly at things like new SQL syntax, new kinds of locking, new capabilities etc. Not so much in the surrounding services like data warehousing and reports...</p>
<p>There's a great article on the new T-SQL features <a href="http://msdn.microsoft.com/en-us/library/cc721270.aspx" rel="nofollow noreferrer">here</a> (by SQL guru Itzik Ben-Gan). It covers</p> <ul> <li>Declaring and initializing variables <li>Compound assignment operators <li>Table value constructor support through ...
<p>HotAdd CPU. <a href="http://msdn.microsoft.com/en-us/library/bb964703.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb964703.aspx</a></p>
10,111
<p>If I have records:</p> <pre> Row Date, LocationID, Account 1 Jan 1, 2008 1 1000 2 Jan 2, 2008 1 1000 3 Jan 3, 2008 2 1001 4 Jan 3, 2008 1 1001 5 Jan 3, 2008 3 1001 6 Jan 4, 2008 3 1002 </pre> <p>I need to get the row (<code...
<p>I think this would work:</p> <pre><code>SELECT t1.* FROM table t1 JOIN (SELECT MAX(Date), LocationID FROM table GROUP BY Date, LocationID) t2 on t1.Date = t2.Date and t1.LocationID = t2.LocationID </code></pre>
<p>Try something like:</p> <pre><code>select * from mytable t1 where date = (select max(date) from mytable t2 where t2.location = t1.location); </code></pre>
38,980
<p>I use ListBox to show Images. However I found if the Listbox contain more than 1000 Image Items, It is really slow if I want to zoom the thumbnails. I asked the qestion in <a href="https://stackoverflow.com/questions/181845/in-a-wpf-listbox-with-more-than-1000-image-items-the-zoom-images-become-slow">In a WPF ListBo...
<p>Read my response <a href="https://stackoverflow.com/questions/181845/in-a-wpf-listbox-with-more-than-1000-image-items-the-zoom-images-become-slow#186187">here</a>. You need to implement a VirtualizingWrapPanel!</p>
<p>I have worked around a similar problem by doing one of:</p> <ol> <li>Provide a combo box to filter the list box. Very few people can efficiently find one thing in 300.</li> <li>Provide pagination on the list box. Put a label below that says "1 of x" and the standard back/forward button set.</li> </ol>
22,480
<p>I creating a control for WPF, and I have a question for you WPF gurus out there.</p> <p>I want my control to be able to expand to fit a resizable window. </p> <p>In my control, I have a list box that I want to expand with the window. I also have other controls around the list box (buttons, text, etc).</p> <p>I wa...
<p>I've created a class to work around this problem:</p> <pre><code>public class RestrictDesiredSize : Decorator { Size lastArrangeSize = new Size(double.PositiveInfinity, double.PositiveInfinity); protected override Size MeasureOverride(Size constraint) { Debug.WriteLine("Measure: " + constraint)...
<p>While I wouldn't recommend creating a UI that requires outer scroll bars you can accomplish this pretty easily:</p> <pre><code>&lt;Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" &gt; &lt;ScrollViewer HorizontalScrollBarV...
24,207
<p>As a base SAS programmer, you know the drill:</p> <p>You submit your SAS code, which contains an unbalanced quote, so now you've got not only and unclosed quote, but also unclosed comments, macro function definitions, and a missing run; or quit; statement.</p> <p>What's your best trick for not having those unbalan...
<p>enterprise guide 3 used to put the following line at the top of its automatically generated code:</p> <pre><code>*';*";*/;run; </code></pre> <p>however, the only way to really "reset" from all kinds of something unbalanced problems is to quit the sas session, and balance whatever is unbalanced before re-submitting...
<p>Yes, I believe the official SAS documentation recommends the solution you have proposed for yourself.</p>
13,291
<p>I have an SSIS package that copies the data in a table from one SQL Server 2005 to another SQL Server 2005. I do this with a "Data Flow" task. In the package config file I expose the destination table name.</p> <p>Problem is when I change the destination table name in the config file (via notepad) I get the follo...
<p>Have you set DelayValidation to False on the Data Source Destination properties? If not, try that.</p> <p>Edit: Of course that should be DelayValidation to True, so it just goes ahead and tries rather than checking. Also, instead of altering your package in Notepad, why not put the table name in a variable, put the...
<p>If all you are doing is copying data from one SQL2005 server to another I would just create a Linked Server and use a stored proc to copy the data. An SSIS package is overkill.</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa560998.aspx" rel="nofollow noreferrer">How to Create linked server</a></p> <p>O...
15,084
<p>I'm currently developing an application using a MySQL database.</p> <p>The database-structure is still in flux and changes while development progresses (I change my local copy, leaving the one on the test-server alone).</p> <p>Is there a way to compare the two instances of the database to see if there were any cha...
<p>If you're working with small databases I've found running mysqldump on both databases with the <code>--skip-comments</code> and <code>--skip-extended-insert</code> options to generate SQL scripts, then running diff on the SQL scripts works pretty well.</p> <p>By skipping comments you avoid meaningless differences s...
<p>For the first part of the question, I just do a dump of both and diff them. Not sure about mysql, but postgres pg_dump has a command to just dump the schema without the table contents, so you can see if you've changed the schema any.</p>
27,910
<p>I'm newbie at this stackexchange and I have a "FlashForge Finder"; lately there are many problems with the horizontal surfaces quality (Bottom and Top at the same time).</p> <p>As some issue guides suggests, I changed: number of solid layers, % of filling and extrusion multiplier; I use "Flashprint", so some concep...
<p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the ...
<p>This could be caused by under extrusion, often caused by the bed being too close to the hot end / extruder nozzle. You could try to relevel the bed, or change the screws so that the bed moves down slightly. Often when levelling, you want to feel slight resistance when sliding a piece of paper between the bed an the ...
1,683
<p>I really need your help in my issue very quickly and it's too close to the previous issue. I want to call a function using thread from the main thread.</p> <p>for more explanaition, here is a sample from my code: // please look to the code begining from ( //------- ) </p> <pre><code> // this function is being c...
<p>You can't do operations on the UI from a different thread - but you could make GetFromServer and GetFromPC <em>fetch</em> the data on the other thread and then call Control.Invoke to get back to the UI thread to update the treeview.</p> <p>See <a href="http://pobox.com/~skeet/csharp/threads/winforms.shtml" rel="nof...
<p>For any single operation that only fetches data and then updates GUI and then its done till next time someone invokes it, use BackgroundWorker.</p> <p>Its a class that has simplified thread coding for you. That way you just write the code for fetching data in one function, and one method that displays the fetched d...
43,696
<p>I am considering creating some JSP-tags that will always give the same output. For example:</p> <pre><code>&lt;foo:bar&gt;baz&lt;/foo:bar&gt; </code></pre> <p>Will always output:</p> <pre><code>&lt;div class="bar"&gt;baz&lt;/div&gt; </code></pre> <p>Is there any way to get a JSP-tag to behave just like static ou...
<p>I am quite certain the performance hit will be negligeble considering the code you just showed. </p>
<p>I was wondering... why not use just a plain old <strong>include</strong>?</p>
28,326
<p>On OS X, does Objective-C compile to native code or byte-code?</p> <p>Can Objective-C programs be compiled on Linux?</p>
<p>Objective-C is compiled to native code by either GCC or LLVM[*]. You can compile ObjC programs on Linux (the generic GCC will happily support ObjC, though it uses a different runtime library than either of the Apple ones). For a cross-platform API similar to Cocoa (i.e. derived from Cocoa) which will happily work o...
<p>Objective-C is a variant of C. It compiles to native code.</p>
20,799
<p><em>When using threads I sometimes visualise them as weaving together 3 or more dimensional interconnections between Objects in a Spatial context. This isn't a general use case scenario, but for what I do it is a useful way to think about it.</em></p> <h3>Are there any APIs which you use which aid threading?</h3> <...
<p><strong>Are there any APIs which you use which aid threading?</strong></p> <p>You mean appart from <code>java.util.concurrent</code>? <a href="http://www.functionaljava.org/" rel="noreferrer">FunctionalJava</a> got some constructs which aid in concurrent programming, as described in a multipart tutorial that starts...
<blockquote> <p>When using threads I sometimes visualise them as weaving together 3 or more dimensional interconnections between Objects in a Spatial context. </p> </blockquote> <p>That does sound complicated, how would you conceptualise 600 threads for example? Why not think of them as multiple threads of execution...
23,126
<p>I have a cross platform app and for my Linux and Mac versions it generates a postscript file for printing reports and then prints them with CUPS. It works for simple characters and images but I would like to have the ability to embed a true type font directly into the postscript file. Does anyone know how to do this...
<p>In order to embed a TrueType font in a Postscript document, you will first need to convert it to a Type 42 font. This conversion turns the font into postscript code. There are several small utilities for doing this conversion, or you can read the <a href="http://www.adobe.com/devnet/font/pdfs/5012.Type42_Spec.pdf" r...
<p>In order to embed a TrueType font in a Postscript document, you will first need to convert it to a Type 42 font. This conversion turns the font into postscript code. There are several small utilities for doing this conversion, or you can read the <a href="http://www.adobe.com/devnet/font/pdfs/5012.Type42_Spec.pdf" r...
10,432
<p>I am working on a script that downloads emails and stores them in a db, I usually receive thousands of emails on this account, once downloaded the mails are deleted.</p> <p>Being paranoic, I want to have at least one month backup of my emails, but I cannot clutter my main mailbox address leaving them in there.</p> ...
<p>First, IMAP does not have a MOVE command only copy but even if it did you can copy from one IMAP server to another directly.</p> <p>Why not use a subfolder in the account for backups. Download them to your local machine then COPY them to the subfolder and then DELETE them from the INBOX.</p> <p>COPY and DELETE are...
<p>Why separate account and all the hassle that will be involved? Can't you either</p> <p>a) backup the mail account using standard backup tools like, eg. rdiff-backup?</p> <p>b) back them up in the db?</p> <p>or even</p> <p>c) create an alias so that emails go to both accounts and you have different criteria for r...
19,559
<p>I am maintaining a website with currently about 800 concurrent users. The business plan says that this number will be 10x higher in one year.</p> <p>This is my current configuration:</p> <pre><code>&lt;Connector port="8080" address="${jboss.bind.address}" maxThreads="500" maxHttpHeaderSize="8192" emptySessionP...
<p>I think that putting tomcat in Apache Http server is much more robust and faster approach. here are the pros &amp; cons taken from <a href="http://wiki.apache.org/tomcat/FAQ/Connectors" rel="nofollow noreferrer">http://wiki.apache.org/tomcat/FAQ/Connectors</a></p> <p>Why should I integrate Apache with Tomcat? (or ...
<p>You can tune this using <a href="http://jakarta.apache.org/jmeter/" rel="nofollow noreferrer">JMeter</a>. I think much depends on your specific hardware setup. A possible way to scale your site is to add machines. Check out the <a href="http://en.oreilly.com/velocity2008/public/content/home" rel="nofollow noreferrer...
32,633
<p>I am working on a very large scale computing library that is using STL heavily. The library is being built using MSVC2003 and it is using its STL implementation. I am looking for an alternative STL implementation that would help the library lower its memory requirements and increase its performance.</p> <p>It is no...
<p><a href="http://stlport.org/" rel="nofollow noreferrer">STLPort</a>. Haven't measured memory usage differences, but it's definitely quicker (yes, real world usage).</p>
<p>Most STL implementations, including the one of MSVC2003, are well implemented generic libraries. So you won't see a significant performance improvment from one implementation to the other.</p> <p>However, sometimes you can write algorithm (or container) that are faster than the STL for you because you know somethin...
14,807
<p>What's the advantage of passing data as parameters vs part of the URL in an Ajax GET request?</p> <p>Using parameters:</p> <pre><code>var ajax = new Ajax.Request('server.php',{ parameters: 'store=11200&amp;product=Meat', onSuccess: function(myData){whatever} }); </code></pre> <p>Using URL:</p> <pre><code...
<p>One advantage to using the <code>parameters</code> argument is that you can pass it a <code>Hash</code>-like object instead of as a string. (If you do this, though, make sure so set the <code>method</code> parameter to <code>"GET"</code>, as the default method for Prototype Ajax requests is POST; see <a href="http:/...
<ul> <li>Legibility</li> <li>Easy to use a object and serialise it ( <code>{store: 11200, product: "Meat"}</code>)</li> <li>Legibility</li> </ul>
26,868
<p>I know python functions are virtual by default. Let's say I have this:</p> <pre><code>class Foo: def __init__(self, args): do some stuff def goo(): print "You can overload me" def roo(): print "You cannot overload me" </code></pre> <p>I don't want them to be able to do this:</p>...
<p>You can use a metaclass:</p> <pre><code>class NonOverridable(type): def __new__(self, name, bases, dct): if bases and "roo" in dct: raise SyntaxError, "Overriding roo is not allowed" return type.__new__(self, name, bases, dct) class foo: __metaclass__=NonOverridable ... </co...
<p>If you'd like to enforce this at runtime but avoid messing with metaclasses, you can use <a href="https://docs.python.org/3/reference/datamodel.html?highlight=__init_subclass__#object.__init_subclass__" rel="nofollow noreferrer"><code>__init_subclass__</code></a> (added in Python 3.6):</p> <pre class="lang-py pretty...
41,532
<p>My users will import through cut and paste a large string that will contain company names. </p> <p>I have an existing and growing MYSQL database of companies names, each with a unique company_id.</p> <p>I want to be able to parse through the string and assign to each of the user-inputed company names a fuzzy match...
<p>You can start with using <a href="http://en.wikipedia.org/wiki/Soundex" rel="noreferrer"><code>SOUNDEX()</code></a>, this will probably do for what you need (I picture an auto-suggestion box of already-existing alternatives for what the user is typing).</p> <p>The drawbacks of <code>SOUNDEX()</code> are:</p> <ul> ...
<p>Probably been suggested before but why not dump the data out to Excel and use the Fuzzy Match Excel plugin. This will give a score from 0 to 1 (1 being 100%).</p> <p>I did this for business partner (company) data that was held in a database. Download the latest UK Companies House data and score against that.</p> <p>...
48,292
<p>Can any one tell me what files I need to submit to the Apple appstore when I submit my application?</p> <p>As an example, do the Resource file, Digital Developer certificate files and others need to be submitted? </p> <p>Please help me understand this process, or show me a resource on the web where I can learn mor...
<p>This is pretty well documented by Apple in the "<a href="http://adcdownload.apple.com/iphone/iphone_developer_program_user_guide/iphone_developer_program_user_guide__standard_program_v2.1.pdf" rel="nofollow noreferrer">iPhone Developer Program Portal User Guide</a>" -- see the Distribution section starting on page 2...
<p>If you walk through the submission webform it will ask you for various things, but basically the app binary, a high rez icon, and some screenshots. You do not need to submit a dev cert, Apple has the bits they need from when you generated them, and your app has already been appropriately signed as part of your build...
34,610
<p>My master branch layout is like this:</p> <p><strong>/</strong> &lt;-- top level</p> <p><strong>/client</strong> &lt;-- desktop client source files</p> <p><strong>/server</strong> &lt;-- Rails app</p> <p>What I'd like to do is only pull down the /server directory in my <code>deploy.rb</code>, but I can't seem to...
<p>Without any dirty forking action but even dirtier !</p> <p>In my config/deploy.rb :</p> <pre><code>set :deploy_subdir, "project/subdir" </code></pre> <p>Then I added this new strategy to my Capfile :</p> <pre><code>require 'capistrano/recipes/deploy/strategy/remote_cache' class RemoteCacheSubdir &lt; Capistrano...
<p>Looks like it's also not working with codebasehq.com so I ended up making capistrano tasks that cleans the mess :-) Maybe there's actually a less hacky way of doing this by overriding some capistrano tasks...</p>
4,886
<p>We've been developing a windows based application using Java for a while now, but NOW we want to make a mac port and have to reverse of code from Java 6 and Java 5. Is there any easy way to do this rather than re-coding Java 6 specific code? We'd like to keep our code up to date.</p>
<p>Apple released Java 6 on the latest version of OS X. What features are you using specifically from Java6 that aren't in java5? </p>
<p>You might be able to backport the additional libraries from Java 6 to Java 5, but I imagine it would be rather more trouble that it's worth. Intel Macs with 64-bit processors (so not the original Intel Mac Mini) running Leopard have Java 6, so perhaps you could just target them?</p>
3,862
<p>So, maybe I'm a bit old-school, but when we created websites in the past, we'd develop the site on a development server, then publish or promote the pages and files to the production server. This has always seemed to be a good way to go so that users didn't see messed up pages or (God forbid) a downed server becaus...
<p>The best way to go is developing with features. Once the features are done, you ca deploy them with Solution package (called WSP).</p> <p>The only thing left to do is to reactivate those features. That way, you can progressively roll-out new features without having to do everything in production.</p> <p><a href="h...
<p>We developed a custom solution which would update content types and fields for a Site Collection. Underneath the covers, through code, SharePoint allows us to modify the Fields as well as values in the Fields and Site/List Content types.</p> <p>For moving the actual content from QA to Prod we use Echo </p>
28,529
<p>I have a file in the following format:</p> <pre> Data Data Data [Start] Data I want [End] Data </pre> <p>I'd like to grab the <code>Data I want</code> from between the <code>[Start]</code> and <code>[End]</code> tags using a Regex. Can anyone show me how this might be done?</p>
<pre><code>\[start\](.*?)\[end\] </code></pre> <p>Zhich'll put the text in the middle within a capture.</p>
<p>Refer to this question to pull out text between tags with space characters and dots (<code>.</code>)</p> <p><code>[\S\s]</code> is the one I used </p> <p><a href="https://stackoverflow.com/questions/8303488/regex-to-match-any-character-including-new-lines">Regex to match any character including new lines</a></p>
2,363
<p>With the new approach of having the get/set within the attribut of the class like that :</p> <pre><code>public string FirstName { get; set; } </code></pre> <p>Why simply not simply put the attribute FirstName public without accessor?</p>
<p>Two of the big problems with direct access to variable inside class (field/attribute) are: </p> <p>1) You can't easily databind against fields.</p> <p>2) If you expose public fields from your classes you can't later change them to properties (for example: to add validation logic to the setters)</p>
<p>It preserve the encapsulation of the object and reduce the code to be more simple to read.</p>
20,990
<p>I recently got involved in a Java project at work: we're using MyEclipse for the IDE, and Subclipse for source control integration. Since I am new to the project, I am currently submitting any changes I make as patches, to make it easier for the other team members to review my changes and decide whether or not to co...
<p>The newest versions of subclipse are able to do what you say. Probably I have your same version because the 1.2.4 (my version) by default uses the filesystem as a patch root, while version 1.5.2 allows you to select the Patch Root (between project, workspace or selection) before creating the patchfile.</p> <p><em>W...
<p>The Subversion API was enhanced in 1.5 to allow the relative path location to be passed to the API. If you install Subclipse 1.4.x (which uses Subversion 1.5) then the patches will have relative paths. There are a number of other patch related enhancements including multi-project patches and the ability to select ...
32,163
<p>Creality does offer its firmware on <a href="https://www.creality3d.cn/download/firmware_c0001" rel="noreferrer">creality3d.cn</a> as .hex files. These are pretty good as backups as one can't alter and destroy them by accident.</p> <p>But... How do you install them?!</p> <hr> <p>This is about installing firmware ...
<p>Creality also does provide an installation PDF. The process they propose is twofold and might need different settings on other machines<sup>1</sup>. Spots where I assume you might need to adjust are noted with<sup>A</sup>. Note that <strong>this solution depends on CURA</strong>.</p> <h2>1. Install the printer as a...
<p>The Prusa i3 MK3 comes with <a href="https://www.prusa3d.com/slic3r-prusa-edition/" rel="nofollow noreferrer">Slic3r, Prusa Edition</a>. It has a menu for flashing the firmware, which takes a HEX file as input.</p> <p><a href="https://i.stack.imgur.com/L5TEH.png" rel="nofollow noreferrer"><img src="https://i.stack....
1,002
<p>Is there an equivalent of <a href="http://www.php.net/manual/en/function.get-defined-functions.php" rel="noreferrer"><code>get_defined_functions()</code></a> which only shows the functions of a given object?</p> <p>Example usage and output:</p> <pre><code>class A { function foo() { } function bar() { } } c...
<p>Ah I found it:</p> <p><a href="http://www.php.net/manual/en/function.get-class-methods.php" rel="noreferrer"><code>get_class_methods()</code></a></p>
<p>You could use <a href="https://php.net/manual/en/class.reflectionclass.php" rel="nofollow noreferrer"><code>ReflectionClass</code></a>...</p>
47,968
<p>Is there a way to get rid of the selection rectangle when clicking a link which does not refresh the current page entirely?</p>
<p>Do you mean the dotted outline of a target?</p> <p>Try:</p> <pre><code>:focus { outline: 0; } </code></pre> <p>This would remove all focus outlines. IT's essentially the same as onclick in JavaScript terms. You might prefer to apply this to <code>a:focus</code>.</p>
<p>Try adding this:</p> <pre><code>onclick="this.blur()" </code></pre> <p>Discussed here as well</p> <p><a href="https://stackoverflow.com/questions/176695/css-eliminating-browsers-selected-lines-around-a-hyperlinked-image">(CSS?) Eliminating browser&#39;s &#39;selected&#39; lines around a hyperlinked image?</a></p>...
21,650
<pre><code>$sourcePath = 'images/'; // Path of original image $sourceUrl = ''; $sourceName = 'photo1.jpg'; // Name of original image $thumbPath = 'thumbs/'; // Writeable thumb path $thumbUrl = 'thumbs/'; $thumbName = "test_thumb.jpg"; // Tip: Name dynamically $thumbWidth = 100; // Intended dimension of thumb // Beyond...
<p>Use <a href="http://pl2.php.net/manual/en/function.imagecreatetruecolor.php" rel="noreferrer">imagecreatetruecolor</a> instead of imagecreate and <a href="http://pl2.php.net/manual/en/function.imagecopyresampled.php" rel="noreferrer">imagecopyresampled</a> instead of imagecopyresized.</p>
<p>Try:</p> <pre><code>imagejpeg($targetImage, "$thumbPath/$thumbName", 100); </code></pre>
38,222
<p>I need to do a query that search for a text with <strong>'Nome % teste \ / '</strong> as prefix. I'm doing the query using:</p> <p><strong>where "name" ILIKE 'Nome a% teste \ /%' ESCAPE 'a'</strong> (using a as escape character).</p> <p>There is a row that match this, but this query returns nothing. Removing the ...
<p>Use the "ESCAPE" specifier </p> <pre><code>WHERE "name" ILIKE 'Nome ~% teste \\/' ESCAPE '~' </code></pre> <p><a href="http://www.postgresql.org/docs/8.2/static/functions-matching.html" rel="nofollow noreferrer">http://www.postgresql.org/docs/8.2/static/functions-matching.html</a></p> <p>Note: you still need to ...
<p>Have you tried just using the backslash to escape it like this:</p> <pre><code>where "name" ILIKE 'Nome \% teste \\\/'; </code></pre>
23,886
<p>I tend to get the feeling that most folks here think SVN is gold-plated goodness, whereas VSS is the worst program ever devised (at least as Version Control is concerned).</p> <p>That said, why? I've used some CVS, and my current job uses VSS, and from a grunt on the team's perspective, I can't really tell that mu...
<blockquote> <p><strong>“Visual SourceSafe? It would be safer to print out all your code, run it through a shredder, and set it on fire.”</strong> - <em>(Attributed to an unidentified Microsoft employee)</em>.</p> </blockquote> <p>SourceSafe has many problems and no redeeming features. There are several freely avai...
<p>Well CVS and VSS are pretty much the same thing as far as functionality goes. So they are not a good starting point to compare each of them. </p> <p>However you probably will never see a difference between SVN and VSS if you just use them as a grunt on the team. You really have to start using them as a project m...
39,407
<p>Is there a significance to the word "salt" for a password salt?</p>
<p><a href="http://www.derkeiler.com/Newsgroups/comp.security.misc/2003-05/0154.html" rel="noreferrer">http://www.derkeiler.com/Newsgroups/comp.security.misc/2003-05/0154.html</a></p> <blockquote> <p>The use of the word "salt" is probably a reference to warfare in ancient times, when people would salt the wells or...
<p>Because before you hash the password, you add a random text to it. So, it looks like as if you add some "salt" to the original "food" ... password :)</p>
30,380
<p>In an attempt to hide the Safari UI components for an web-app bookmarked as a Homescreen Icon. I am using this meta tag </p> <pre><code>&lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt; </code></pre> <p>as specified on <a href="https://developer.apple.com/library/content/documentation/AppleApplicati...
<pre><code>window.top.scrollTo(0, 1); </code></pre> <p>Works on iPhone, but not in iPad. I have been successful hiding the browser components on iPad (so presumably everywhere) by using</p> <pre><code>&lt;meta name="apple-mobile-web-app-capable" content="yes" /&gt; </code></pre> <p>and launching from a home-screen ...
<p>That should indeed behave as expected, I have used it in the past without any difficulties. </p>
34,483
<p>I tried the following code to get an alert upon closing a browser window:</p> <pre><code>window.onbeforeunload = confirmExit; function confirmExit() { return "You have attempted to leave this page. If you have made any changes to the fields without clicking the Save button, your changes will be lost. Are you su...
<p>Keep your code as is and use jQuery to handle links:</p> <pre><code>$(function () { $("a").click(function { window.onbeforeunload = null; }); }); </code></pre>
<p><strong>I have added an additional code that will to handle further process of if window is closed</strong></p> <pre><code>let disableConfirmation = false; window.addEventListener('beforeunload', event =&gt; { const confirmationText = 'Are you sure?'; if (!disableConfirmation) { event.returnValue = confirmat...
43,255
<p>I'm currently building a small web application that includes a fair amount of JavaScript. When I was prototyping the initial idea, I just hacked together a few functions to demonstrate how the application would eventually behave intending to go forward re-writing the JavaScript in an object-oriented nature.</p> <p>...
<p>No, although I personally find OOP more tasty, it is a means to an end, and not an end in itself. There are many cases where procedural programming makes more sense than OOP, an converting for the sake of converting, could be, as you said, overkill.</p>
<p>Treat it as legacy code from now on. When you want to change something, refactor it so the code becomes easier on the mind. If you need a bit of OOP, use it. If you don't, don't.</p> <p>OOP is a hammer, please don't treat a screw-problem as a nail.</p>
20,969
<p>I'm thinking of something smaller than a laptop that i can spend my hours on the way to work doing project euler problems or such. </p> <p>Any ideas?</p>
<p>If you mean a programming platform, you could get a netbook like the ASUS EEE.</p> <p>Or if you meant smallest programmable device, check out a PIC microcontroller:</p> <p><a href="http://en.wikipedia.org/wiki/PIC_microcontroller" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/PIC_microcontroller</a></p>
<p><a href="http://en.wikipedia.org/wiki/Netbook" rel="nofollow noreferrer">Netbooks</a> are smaller than your typical laptop and have plenty of power.</p>
34,694
<p>When using ASP.NET protected configuration, how can I encrypt the config with just the public key?</p> <p>I can export a public key file. I would like to then use this public key to encrypt the configuration files on another server for later deployment. However, I can't figure out how to get aspnet_regiis to use ...
<p>Sorry to repost, but After re-reading you post, I think that you might be better off with templating. I've attached some samples in VB</p> <p>Window.xaml</p> <pre><code>&lt;Window x:Class="Window1" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winf...
<p>You need to create a DependencyProperty in your CircleInSquare class. Do some googling on that. The concept of using the property for your circle class like below is called AttachedProperties, and you will probably need to handle the CircleColorChanged event to do what you need.</p> <pre><code>&lt;Ellipse app:Cir...
46,744
<p>I have a wcf application hosted in a windows service running a local windows account. Do I need to set an SPN for this account? If so, what's the protocol the SPN needs to be set under? I know how to do this for services over HTTP, but have never done it for net.tcp.</p>
<p>By default (i.e. out of the box) net.tcp services are unsecured and don't perform any authentication at all. So you won't need (and in fact can't) set a service principal name. </p> <p>If you need to authenticate, then check the <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.nettcpsecurity.asp...
<p>By default (i.e. out of the box) net.tcp services are unsecured and don't perform any authentication at all. So you won't need (and in fact can't) set a service principal name. </p> <p>If you need to authenticate, then check the <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.nettcpsecurity.asp...
5,974
<p>Does anyone know of a twitter clone written in .NET (or ideally C#)?</p> <p>I wanna experiment with a private twitter network between some friends and work colleagues.</p>
<p><a href="http://www.yonkly.com/" rel="nofollow noreferrer">http://www.yonkly.com/</a>. Done with Asp.net mvc </p>
<p>Have you taken a look at <a href="http://code.google.com/p/wittytwitter/" rel="nofollow noreferrer">Witty</a>? It is a a Twitter client that matches you criteria, I am not aware of any server software though.</p>
42,572
<p>I have a CollapsiblePanelExtender that will not collapse. I have "collapsed" set to true and all the ControlID set correctly. I try to collapse and it goes through the animation but then expands almost instantly. This is in an User Control with the following structure.</p> <pre><code>&lt;asp:UpdatePanel ID="Upda...
<p>I am sorry I do not have time to trouble-shoot your code, so this is from the hip.</p> <p>There is a good chance that this a client-side action that is failing. Make certain that your page has the correct doctype tag if you took it out of your page or masterPage. Furthermore, attempt to set the ClientState as well:...
<p>It is working fine:</p> <pre><code>CollapsiblePanelExtender CpeForControls = (CollapsiblePanelExtender)tbl_Form.FindControl("cpe_controls"); CpeForControls.ClientState = "true"; CpeForControls.Collapsed = true; </code></pre>
4,642
<p>PHP, as we all know is very loosely typed. The language does not require you to specify any kind of type for function parameters or class variables. This can be a powerful feature.</p> <p>Sometimes though, it can make debugging your script a painful experience. For example, passing one kind of object into a method ...
<p>Actually for classes you can provide type hinting in PHP (5+).</p> <pre><code> &lt;?php class UsesBaseClass { function SetObject(InterfaceObject $obj) { } } ?&gt; </code></pre> <p>This will also work correctly with inheritance as you would expect it to.</p> <p>As an aside, don't put the wor...
<p>You can set the error_reporting ini setting in your php.ini file or use error_reporting function to set it in run time</p>
16,610
<p>I'm starting to work with my model almost exclusively in WCF and wanted to get some practical approaches to versioning these services over time. Can anyone point me in the right direction?</p>
<p>There is a good writeup on <a href="http://blogs.msdn.com/craigmcmurtry/archive/2006/07/23/676104.aspx" rel="noreferrer">Craig McMurtry's WebLog</a>. Its from 2006, but most of it is still relevant.</p> <p>As well as a decision tree to walk through the choices, he shows how to implement those changes using Windows ...
<p>While not an instant answer for you, I found the book <a href="https://rads.stackoverflow.com/amzn/click/com/0596101627" rel="nofollow noreferrer" rel="nofollow noreferrer">Learning WCF</a> very useful; in it there's a small section on versioning (which is similar to Craig McMurtry's advice posted by Espo). If you'...
5,762
<p>I have a TextBox control on my Form. I use the Leave event on the control to process user input. It works fine if the user clicks on some other control on the form, but the even doesn't get fired when the user goes straight to the main menu. Any ideas which event should I use to get it fired everytime?</p>
<p>I found a reasonable workaround, I set the focus on the main menu manually:</p> <p>EDIT: As suggested by @TcKs, I changed the event from ItemClicked to MenuActivate. Thanks very much for help!</p> <pre><code> private void menuStrip1_MenuActivate( object sender, EventArgs e ) { menuStrip1.Focus(); ...
<p>you need a label 1 pixel per 1 pixel</p> <pre><code>Private Sub TextBox1_Leave(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.Leave MsgBox("yes") End Sub Private Sub MenuStrip1_MenuActivate(ByVal sender As Object, ByVal e As System.EventArgs) Handles MenuStrip1.MenuActivate CType(sen...
42,875
<p>I'm a front-end developer and I was looking for opinions about the best all-round online documentation for javascript/css/html/xhtml/dom/browser quirks and support. I've tried Sitepoint, Quirksmode, W3Schools but all of these seem to be lacking in certain aspects and have been using them in combination.</p>
<p>I like <strike>gotapi.com</strike> (Update 2: Site is apparently offline -- Use another resource such as <a href="https://developer.mozilla.org/en-US/" rel="nofollow noreferrer">MDN</a>)</p> <p><strong>Update:</strong> the original answer was from 2008 -- today I would say to check out <a href="https://developer.mo...
<p>I tend to go to <a href="http://msdn.microsoft.com/" rel="nofollow noreferrer">http://msdn.microsoft.com/</a> first.</p>
8,938
<p>I have a Perl module that I would like to use from Java. Is there a way to call this code using either ActiveState Perl on Windows or the generic Perl that comes with Linux? I have found references to JPL but it doesn’t appear to be maintained anymore.</p>
<p><a href="http://search.cpan.org/~patl/Inline-Java-0.52/Java.pod" rel="noreferrer">Inline-Java</a> is the usual library to call java from Perl, and this <a href="http://www.piersharding.com/blog/archives/2004/04/calling_perl_fr.html" rel="noreferrer">post propose a <strong>org.perl.java</strong></a> module which shou...
<p>I don't know how stable will that be ,or how well maintained it is, so, another option would be to write a script that does something your application will need and then execute that script from Java. Not the most elegant way, but it works.</p>
34,629
<p>I have a Excel Sheet(Say OG.xls) which has some data already in it with some 5000 rows with headings in the first row and Upto "AN" Columns. This No of rows(5000) doesn't change for a whole year. Now i have 5 XL files(Say A,B,C,D,E) and the data from these files has to be appended to this OG file just starting from ...
<p>The Thumbs.db file is stored in OLE <a href="http://msdn.microsoft.com/en-us/library/ms693383.aspx" rel="noreferrer">Compound Document</a> format, the same format that many Microsoft Office products use.</p> <p>You could also try to look into <a href="http://www.petedavis.net/MySite/DynPageView.aspx?pageid=31" rel=...
<p>You might find this useful:</p> <p>ThumbsDBLib in C++</p> <p><a href="http://www.windameister.org/blog/index.php/thumbslib-in-cpp" rel="nofollow noreferrer">http://www.windameister.org/blog/index.php/thumbslib-in-cpp</a></p>
28,257
<p>Some of my users are complaining about some odd errors my installers had after downloading them from my web server.</p> <p>This are NSIS installer that when downloaded came crippled or incomplete (usually because of slow Internet connections), the message is very clear "The installer you are trying to use is corrup...
<p>The CRC check runs before you/nsis can access the langstrings, so the only way to change this message is to recompile the source code.</p> <p>The message was changed several versions ago and now includes a URL to the NSIS wiki, one would think your users would be able to run a translator on that page</p>
<p>I haven't done an NSIS package since it was referred to as Super Pimp (great name). See if this helps: <a href="http://nsis.sourceforge.net/Adding_Language_strings_as_resources" rel="nofollow noreferrer">NSIS Language Table</a></p>
20,253
<p>When selecting a block of text (possibly spanning across many DOM nodes), is it possible to extract the selected text and nodes using Javascript?</p> <p>Imagine this HTML code:</p> <pre><code>&lt;h1&gt;Hello World&lt;/h1&gt;&lt;p&gt;Hi &lt;b&gt;there!&lt;/b&gt;&lt;/p&gt; </code></pre> <p>If the user initiated a m...
<p>You are in for a bumpy ride, but this is quite possible. The main problem is that IE and W3C expose completely different interfaces to selections so if you want cross browser functionality then you basically have to write the whole thing twice. Also, some basic functionality is missing from both interfaces.</p> <p>...
<p>There is a much shorter way if you just want the range.</p> <pre><code>function getRange(){ return (navigator.appName=="Microsoft Internet Explorer") ? document.selection.createRange().parentElement() : (getSelection||document.getSelection)().getRangeAt(0).commonAncestorContainer } </code></pre>...
47,126
<p>I just got a weird idea about how to configure environment-dependent parameters. Sort of like parameters you can find in Rails' config/database.yml</p> <p>In my current project I use PHP and Litespeed Web Server (though the same technique applies to PHP + Apache), and I thought... 'why not use mod_rewrite for this?...
<p>I don't believe rewrite rules are a particularly intuitive place to put configuration information like that. Maybe I am misunderstanding something, but is the only difference between the development, staging, and production environments the database connection? Typically the code is also different (at least once c...
<p>If you want to set the environment in the vhost you can do something like</p> <pre><code>php_value ENV "development" </code></pre> <p>And then read it from the <code>$_SERVER</code> array</p>
47,823
<p>I need to do date arithmetic in Unix shell scripts that I use to control the execution of third party programs. </p> <p>I'm using a function to increment a day and another to decrement: </p> <pre><code>IncrementaDia(){ echo $1 | awk ' BEGIN { diasDelMes[1] = 31 diasDelMes[2] = 28 diasDelMes...
<p>Assuming you have <a href="http://www.gnu.org/software/coreutils/manual/coreutils.html#date-invocation" rel="noreferrer">GNU date</a>, like so:</p> <pre><code>date --date='1 days ago' '+%a' </code></pre> <p>And <a href="http://www.gnu.org/software/coreutils/manual/coreutils.html#Date-input-formats" rel="noreferrer...
<p>This works for me:</p> <pre><code>TZ=GMT+6; export TZ mes=`date --date='2 days ago' '+%m'` dia=`date --date='2 days ago' '+%d'` anio=`date --date='2 days ago' '+%Y'` hora=`date --date='2 days ago' '+%H'` </code></pre>
2,820
<pre><code>@Column(name="DateOfBirth") private Date dateOfBirth; </code></pre> <p>I specifically need the above code to create a column named "DateOfBirth," instead Hibernate gives me a column named date_of_birth. How can I change this? Is there a web.xml property? I came across DefaultNamingStrategy and ImprovedNa...
<p>Here is a possible workaround: if you name it <code>dateofbirth</code> the column in the DB would be named like that, but the attribute name should be the same.</p> <p>Hibernate takes the camel case format to create/read database columns.</p> <p>I've had this problem before. I worked with a legacy columns where th...
<p>I'm not 100% sure, but don't you need to annotate the get method and not the private variable?</p>
49,218
<p>I've used SubSonic in a few POC projects, but nothing large. It's so easy to use, and it's possible to abstract away the fact that it uses the active record pattern (can move it toward a more domain driven approach).</p> <p>Has anyone on here used SubSonic on larger applications, and what kind of performance did yo...
<p>We must not fear the goog:</p> <p><a href="http://blog.wekeroad.com/blog/subsonic-scaling/" rel="nofollow noreferrer">http://blog.wekeroad.com/blog/subsonic-scaling/</a></p>
<p>I have only worked with SubSonic a little bit, but the application that I was working on after a while we started to see performance degradation, and in the end we were forced to start migrating to using specific optimized Stored Procedures for some data calls, as the automatic items generated by SubSonic were not m...
26,903
<p>I have a variable of type Number, and i like to obtain the sign (if is '-' i like to have -1 and if '+' i like to have 1). So, i made this:</p> <pre><code>var sign = Math.abs(n) / n; </code></pre> <p>But, there is any other way? Better than this?</p>
<p>You'll be in trouble if n == 0... how about this:</p> <pre><code>var sign = n &lt; 0 ? -1 : 1; </code></pre>
<p>If your number fits in 31 bits then you can use:</p> <pre><code>var sign = 1 + 2*(n &gt;&gt; 31); </code></pre> <p>Would be interesting to know if this is any faster!</p>
20,194
<p>I am currently using Subversion as my Source Control system, mainly because I found ANkhSVN to be a quite nicely integrated into Visual Studio.</p> <p>But many people seem to be using Git or Mercurial and others with great success.</p> <p>Now, I am wondering how to use a system like Git without some sort of IDE in...
<p>I just keep a command line window open at the relevant directory. It's not hard to switch between them to do the git commands. To be honest, as I'm quite new to git there's a lot more mental effort involved in checking that I'm using git correctly than there is in switching windows :)</p> <p>There is a difficulty h...
<p>First, if you are happy with svn and like the client you are using, why change? Second, what's wrong with learning/using a command-line? What are your reasons for wanting to use git? Git actually plays nicely with other source control systems and you can store things in git and svn at the same time without any co...
31,392
<p>So I log into a Solaris box, try to start Apache, and find that there is already a process listening on port 80, and it's not Apache. Our boxes don't have lsof installed, so I can't query with that. I guess I could do:</p> <pre><code>pfiles `ls /proc` | less </code></pre> <p>and look for "port: 80", but if anyone ...
<p>I found this script somewhere. I don't remember where, but it works for me:</p> <pre><code>#!/bin/ksh line='---------------------------------------------' pids=$(/usr/bin/ps -ef | sed 1d | awk '{print $2}') if [ $# -eq 0 ]; then read ans?"Enter port you would like to know pid for: " else ans=$1 fi for f in...
<p>If you have access to <code>netstat</code>, that can do precisely that. </p>
11,649
<p>SOLVED: Nevermind, the links were visited, and the border definition was missing for visited links (as someone pointed out, thanks). As for the color being first place in the border definition, the snippet comes from the IE Developper Toolbar, this is not directly my code. Anyway, thank you guys !</p> <p>Why does t...
<p>You might want to set up the style for Visited link too.</p> <p>And, I do not think you should use <code>*{...}</code></p> <p>It works fine in FF3.</p> <p>Change to that :</p> <pre><code>#main A:link, A:Visited { COLOR: #437fda; BORDER-BOTTOM: #437fda 1px dashed; TEXT-DECORATION: none } </code></pre> <p>And...
<p>Try using just <code>#main a</code>, and add separate a:visited and a:hover selectors if you want to style those differently. </p>
39,543
<p>In a SQL server database, I have a table which contains a TEXT field which is set to allow NULLs. I need to change this to not allow NULLs. I can do this no problem via Enterprise Manager, but when I try to run the following script, <strong>alter table dbo.[EventLog] Alter column [Message] text Not null</strong>, I ...
<p>You can use Enterprise Manager to create your script. Right click on the table in EM and select Design. Uncheck the Allow Nulls column for the Text field. Instead of hitting the regular save icon (the floppy), click an icon that looks like a golden scroll with a tiny floppy or just do Table Designer > Generate Chang...
<p>Off the top of my head, I'd say you need to create a new table with the same structure as the existing table but with your text column set to not null and then run a query to move the records from one to the other. </p> <p>I realize that's sort of a pseudocode answer but I think that's really the only option you'v...
10,838
<p>I have a custom server control that loads data from a web service into a GridView. Works fine on my page. I want to be able to click on a row and pop a popupcontrol with more detail on the clicked row. I am using the client side events of the DevExpress gridview to handle the onclick. And from JavaScript I am cal...
<p>Here's a blind guess: try increasing the maximum heap size available to the forked VM by using a nested <code>&lt;jvmarg&gt;</code> tag to set the <code>-Xmx</code> option.</p>
<p>For the record, I found my problem. We have been using a code obfuscator for this project, and the string encryption portion of that obfuscator was set to "maximum". This slowed down any operation where strings were present.</p> <p>Turning down the string encryption to a faster mode fixed the problem.</p>
14,987
<p>Is there a better way to do this?</p> <pre><code>-(NSDate *)getMidnightTommorow { NSCalendarDate *now = [NSCalendarDate date]; NSCalendarDate *tomorrow = [now dateByAddingYears:0 months:0 days:1 hours:0 minutes:0 seconds:0]; return [NSCalendarDate dateWithYear:[tomorrow yearOfCommonEra] ...
<p>From the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSCalendarDate_Class/Reference/Reference.html" rel="noreferrer">documentation</a>:</p> <blockquote> <p>Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS re...
<p>Convert your current date and time to a Unix date (seconds since 1970) or DOS style (since 1980), then add 24 hours and convert it back. Then reset the hours, minutes and seconds to zero to get to midnight.</p>
21,903
<p>Since there is apparently no <a href="https://stackoverflow.com/questions/295524/website-image-manager-with-copypaste-flash">Flash control that can accept bitmap pastes</a>, I want to think about writing one myself. I'd rather not use Flash though, so I though about using .NET.</p> <p>Now I believe the correct term...
<p>If you're okay with IE only, I like the IE hosted control's security model over Active-X, however, as of 1/1/09, Microsoft deprecates the use of .NET (in process) to extend IE so XBAP is okay, but not in ActiveX controls or IE Hosted controls.</p> <p>Update 7/13: Microsoft has published <a href="http://msdn.microso...
<p>Using ActiveX limits you to IE and Windows only. Better take a look at google docs and/or gmail to see how they handle pasting an image in your email/online document using javascript only. Works OK with most browsers and OS out there.</p>
38,341
<p>Say I have a class with a private dispatch table. </p> <pre><code>$this-&gt;dispatch = array( 1 =&gt; $this-&gt;someFunction, 2 =&gt; $this-&gt;anotherFunction ); </code></pre> <p>If I then call </p> <pre><code>$this-&gt;dispatch[1](); </code></pre> <p>I get an error that the method is not a string. When...
<p>You can store the name of the method in dispatch like:</p> <pre><code>$this-&gt;dispatch = array('somemethod', 'anothermethod'); </code></pre> <p>and then use:</p> <pre><code>$method = $this-&gt;dispatch[1]; $this-&gt;$method(); </code></pre>
<p>The call_user_func*-Family of functions should work like this:</p> <pre><code>$this-&gt;dispatch = array('somemethod', 'anothermethod'); ... call_user_func(array($this,$this-&gt;dispatch[1])); </code></pre>
39,399
<p>I'm having some issues with producing an int matrix without creating memory leaks. I want to be able to make a given (global) matrix into any size dynamically via read_matrix(). But then i want to be able to free the memory later on. So in my main method the second printf should result in a bus error since it should...
<p>Just because the memory has been free'd doesn't mean you can't access it! Of course, it's a <strong>very bad</strong> idea to access it after it's been free'd, but that's why it works in your example.</p> <p>Note that <code>free( *first_matrix )</code> only free's <code>first_matrix[0]</code>, not the other arrays....
<p>You only freed the first row (or column) of first_matrix. Write another function like this:</p> <pre><code>void free_matrix(int **matrix, int rows) { int i; for(i=0; i&lt;rows; i++) { free(matrix[i]); } free(matrix); } </code></pre> <p>You might want to make the matrix into a struct to ...
13,115
<p>This was an interview question. Given Visual Studio 2008 and an icon saved as a .PNG file, they required the image as an embedded resource and to be used as the icon within the title bar of a form.</p> <p>I'm looking for what would have been the model answer to this question, Both (working!) code and any Visual Stu...
<p>Fire up VS, start new Windows Application. Open the properties sheet, add the .png file as a resource (in this example: glider.png ). From hereon, you can access the resource as a Bitmap file as WindowsFormsApplication10.Properties.Resources.glider</p> <p>Code for using it as an application icon:</p> <pre><code> p...
<p>A good resource on the subject in <em><a href="http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/4a10d440-707f-48d7-865b-1d8804faf649/" rel="nofollow noreferrer">C# 2.0 Convert Bitmap to Icon</a></em>.</p>
18,622
<p>Is there a way to describe the module's data in a similar way that a docstring describes a module or a funcion?</p> <pre><code>class MyClass(object): def my_function(): """This docstring works!""" return True my_list = [] """This docstring does not work!""" </code></pre>
<p>To my knowledge, it is not possible to assign docstrings to module data members.</p> <p><a href="http://www.python.org/dev/peps/pep-0224/" rel="noreferrer">PEP 224</a> suggests this feature, but the PEP was rejected.</p> <p>I suggest you document the data members of a module in the module's docstring:</p> <pre><c...
<p>As codeape explains, it's not possible to document general data members.</p> <p>However, it <em>is</em> possible to document <code>property</code> data members:</p> <pre><code>class Foo: def get_foo(self): ... def set_foo(self, val): ... def del_foo(self): ... foo = property(get_foo, set_foo, del_foo, '...
24,019
<p>I have a JSF form that needs to upload a file via an icon click (i.e. without showing the textfield/browse button of the file upload component). </p> <p>Is it possible to trigger the file-open dialog and uploading functionality of the upload component via some other component type? </p>
<p>In my opinion, it's never too late to adopt a better practice - or to drop a worse one - so I'd say "Yes, you should start".</p> <p>However ... (there's always a "but") ...</p> <p>... one of the biggest gains of TDD is that it impacts on your design, encouraging you to keep reponsibilties separate, interactions cl...
<p>Absolutely.</p> <p>Introduce TDD to new code and if time allows, introduce "Comment Driven Design" with your existing code if it's not already tested.</p> <ul> <li>Comment out the block of existing code you need to test</li> <li>Write your test</li> <li>Uncomment your original code one statement at a time (if you ...
37,654
<p>I'm really confused by the various configuration options for .Net configuration of dll's, ASP.net websites etc in .Net v2 - especially when considering the impact of a config file at the UI / end-user end of the chain.</p> <p>So, for example, some of the applications I work with use settings which we access with:</...
<p>Nij, our difference in thinking comes from our different perspectives. I'm thinking about developing enterprise apps that predominantly use WinForms clients. In this instance the business logic is contained on an application server. Each client would need to know the phone number to dial, but placing it in the Ap...
<p>I think your confusion comes from the fact that it looks like your first example is a home-brewed library, not part of .NET. The configurationmanager example is an example of built-in functionality.</p>
8,240
<p>Since MySQL doesn't seem to have any 'boolean' data type, which data type do you 'abuse' for storing true/false information in MySQL?</p> <p>Especially in the context of writing and reading from/to a PHP script.</p> <p>Over time I have used and seen several approaches:</p> <ul> <li>tinyint, varchar fields contain...
<p>For MySQL 5.0.3 and higher, you can use <code>BIT</code>. The manual says:</p> <blockquote> <p>As of MySQL 5.0.3, the BIT data type is used to store bit-field values. A type of BIT(M) enables storage of M-bit values. M can range from 1 to 64.</p> </blockquote> <p>Otherwise, according to the MySQL manual you can use ...
<p>After reading the answers here I decided to use <code>bit(1)</code> and yes, it is somehow better in space/time, <strong>BUT</strong> after a while I changed my mind and I will never use it again. It complicated my development a lot, when using prepared statements, libraries etc (php).</p> <p>Since then, I always u...
36,906
<p>The project I'm working on needs to render an ESRI shape file, which can have a large number of polygons/shapes. When I add all these polygons, lines, points, etc to the canvas I'm using, it gets really slow.</p> <p>To draw the shapes on the map, I'm creating a Path object, and setting it's Data property to a Stre...
<p>No need to resort to GDI, you just need to move down a layer in the WPF API's and combine your geometry into fewer visuals. Pablo Fermicola has some useful information about <a href="http://www.fernicola.org/loquitor/index.php?/archives/17-WPF-Pick-Your-API-Abstraction.html" rel="noreferrer">picking which layer</a> ...
<p>You are about to discover the motivation behind GPUs and insanely overclocked and cooled-down graphics cards. And double-buffering.</p> <p>And: converting the thing to a bitmap: what's the difference to rendering it?</p> <p>After all you have n objects that /somehow/ have to get rendered (unless you can figure out...
18,094
<p>What is a mathematical way of of saying 1 - 1 = 12 for a month calculation? Adding is easy, 12 + 1 % 12 = 1, but subtraction introduces 0, stuffing things up.</p> <p>My actual requirement is x = x + d, where x must always be between 1 and 12 before and after the summing, and d any unsigned integer.</p>
<p>I'd work internally with a 0 based month (0-11), summing one for external consumption only (output, another calling method expecting 1-12, etc.), that way you can wrap around backwards just as easily as wrapping around forward.</p> <pre><code>&gt;&gt;&gt; for i in range(15): ... print '%d + 1 =&gt; %d' % (i, (i+1)...
<p>You have to be careful with addition, too, since (11 + 1) % 12 = 0. Try this:</p> <pre><code>x % 12 + 1 </code></pre> <p>This comes from using a normalisation function:</p> <pre><code>norm(x) = ((x - 1) % 12) + 1 </code></pre> <p>Substituting,</p> <pre><code>norm(x + 1) = (((x + 1) - 1) % 12 + 1 norm(x + 1) = ...
34,996
<p>So we've been told that one source of <code>TM Enq</code> contention can be unindexed FK's. My question is which one.</p> <p>I have an <code>INSERT INTO Table_B</code> that is recording <code>TM Enq Wait</code>.</p> <p>It contains a <code>PK</code> that is the parent to other tables and it has columns that are <co...
<p>Not sure about Oracle TM Contention, but I'd say normally both sides of a foreign key relation are indexed. Otherwise, the database will have to do table scans.</p> <ul> <li>The index on the parent record is used whenever you insert a new child record, to verify that the parent exists. Often this is a primary key a...
<p>The parent (referenced) column of an enabled foreign key relationship has to be indexed because it has to have an enabled unique or primary key constraint on it. </p> <p>What mode of TM Enqueue are you seeing?</p>
45,747
<p>I'm seeing the following pattern on my Prusa clone:</p> <p><a href="https://i.stack.imgur.com/uskfa.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/uskfa.jpg" alt="Photo of low quality second layer print"></a></p> <p>The first layer prints OK, layer adhesion to the bed is good. The second layer shows the...
<p>I wouldn't describe that as an "OK" first layer. The nozzle is either too far from the bed, or you're underextruding. Underextrusion also looks like the cause of your second layer problems.</p>
<p>Your first layer is horribly misscalibrated as well. </p> <p>You really should do all calibrations over. Including your firmware when your result is this bad. </p> <p>Following. Let's just assume your firmware is set right. And that your flow is right as well. The second layer speaks loudly of overcooked dribbling...
434
<p>Is it better to write many small methods (or functions), or to simply write the logic/code of those small processes right into the place where you would have called the small method? What about breaking off code into a small function even if for the time being it is only called from one spot?</p> <p>If one's choic...
<p>I always break long methods up into logical chunks and try to make smaller methods out of them. I don't <em>normally</em> turn a few lines into a separate method until I need it in two different places, but sometimes I do just to help readability, or if I want to test it in isolation.</p> <p>Fowler's <a href="http...
<p>Personally, I lean significantly in the direction of preferring more, smaller methods, but not to the point of religiously aiming for a maximum line count. My primary criterion or goal is to keep my code DRY. The minute I have a code block which is duplicated (whether in spirit or actually by the text), even if it...
31,136
<p>In my application I have a <code>Customer</code> class and an <code>Address</code> class. The <code>Customer</code> class has three instances of the <code>Address</code> class: <code>customerAddress</code>, <code>deliveryAddress</code>, <code>invoiceAddress</code>.</p> <p><strong>Whats the best way to reflect this ...
<p>If you are 100% certain that a customer will only ever have the 3 addresses you described then this is OK:</p> <pre><code>CREATE TABLE Customer ( ID int not null IDENTITY(1,1) PRIMARY KEY, Name varchar(60) not null, customerAddress int not null CONSTRAINT FK_Address1_AddressID FOREIGN KEY Refere...
<p>My two cents is that de-normalizing the way you describe is <em>OK</em>, if you have a compelling reason. Sometimes that reason can be as simple as a high level of confidence you will never need the normalized form. As Stefan Mai implied, it's much easier to just retrieve and update a single table, if you only ever ...
40,086
<p>How do I get a list of domain user accounts with win32 api? </p> <p>In particular, I can't get this list when the computer is not the domain controller. Instead it is a member of the domain. </p>
<p>The <a href="http://plugins.jquery.com/project/elementReady" rel="nofollow noreferrer">.elementReady() plugin</a> seems to be pretty close to what you're looking for.</p> <p>It operates by using a <code>setInterval</code> loop, that exits as soon as <code>document.getElementById()</code> returns an element for a gi...
<p>That was VERY helpful.</p> <p>To put a little real world to the question.</p> <p>I build with the assumption that JavaScript isn't supported and then override with the JavaScript. The problem is, that when I have to wait for the DOM to load before my overrides kick in the site goes through the flicker stage as it'...
29,882
<p>I am creating a mock database for import export tests (of the algorithm reading and writing complex data structures to our database, not just to test IO operations), and am trying to decide whether to use a DataSet to store the mock tables (by table name) in the faux-database, or Dictionary()</p> <p>In terms of ret...
<p>Actually, <code>Dictionary&lt;,&gt;</code> is often <em>slower</em> than a linear search, due to the inherent complexities of doing the dictionary logic (haches, buckets, etc). In my tests, the cutoff (where <code>Dictionary&lt;,&gt;</code> starts being faster) is often around 150 elements. And since you generally h...
<p>DataSet.Tables is internally implemented using an ArrayList. Looking up a table by name involves a linear search through the tables in the list and a lot of casting. So using a Dictionary, which is hash-based and generic, would almost certainly be faster. (Although you'd need a lot of tables and/or a lot of accesses...
46,285
<p>I have a parent object which has a one to many relationship with an IList of child objects. What is the best way to delete the child objects? I am not deleting the parent. My parent object contains an IList of child objects. Here is the mapping for the one to many relationship:</p> <pre><code>&lt;bag name="Tiers" c...
<p>You are getting the first error because, when you remove the items from the collection, NHibernate's default mode of operation is to simply break the association. In the database, NHibernate tries to set the foreign key column on the child row to null. Since you do not allow nulls in that column, SQL Server raise...
<p>set Not-Null = true in your mapping on the column causing the issue. I'm not sure of the exact syntax though (sorry).</p>
38,885
<p>How can I change a file's extension using PHP?</p> <p>Ex: photo.jpg to photo.exe</p>
<p>In modern operating systems, filenames very well might contain periods long before the file extension, for instance:</p> <pre><code>my.file.name.jpg </code></pre> <p>PHP provides a way to find the filename without the extension that takes this into account, then just add the new extension:</p> <pre><code>function...
<p>I needed this to change all images extensions withing a gallery to lowercase. I ended up doing the following:</p> <pre><code>// Converts image file extensions to all lowercase $currentdir = opendir($gallerydir); while(false !== ($file = readdir($currentdir))) { if(strpos($file,'.JPG',1) || strpos($file,'.GIF',1)...
23,553
<p>I have a problem with the design of a <code>VetoableChangeListener</code>. I implement the <code>VetoableChangeListener</code> interface to listen changes of a property in a model class, so when the model fires </p> <pre><code>vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException </code></pre> <p>…I...
<p>Your "workaround" is not really a workaround but in fact sounds like the proper solution to me: confirming that there is in fact a change for the current state of the object prior to attempting to "change" the persisted version. This will also be much more efficient (database access is expensive). </p>
<p>You should check the Vetoable change before you change the model, not after...</p> <p>ie: if there is a problem, the model is not changed, not revert the model if the change was wrong</p>
14,606
<p>Implementing Equals() for reference types is harder than it seems. My current canonical implementation goes like this:</p> <pre><code>public bool Equals( MyClass obj ) { // If both refer to the same reference they are equal. if( ReferenceEquals( obj, this ) ) return true; // If the other object is null t...
<p>I wrote a fairly comprehensive guide to this a while back. For a start your equals implementations should be shared (i.e. the overload taking an object should pass through to the one taking a strongly typed object). Additionally you need to consider things such as your object should be immutable because of the need ...
<p>It depends on whether you're writing a value type or a reference type. For a sortable value type, I recommend this: <a href="http://msmvps.com/blogs/peterritchie/archive/2006/03/25/a-code-snippet-for-visual-studio-2005-that-implements-a-skeleton-value-type-adhering-to-framework-design-guidelines.aspx" rel="nofollow...
10,016
<p>I know it's possible, and I've seen simple examples in the documentation, but are they being used in the wild? </p> <p>I use attributes at the class and method level all the time, but have never used them on method parameters. What are some real-world examples, and the reasons for the usage?</p> <p>I'm not interes...
<p>You can for example create a ValidatorAttribute for every parameter, then before calling the method, you can reflect the parameter attributes and do parameter validation. Then call the method if all ok.</p>
<p>Unit test frameworks use them extensively:</p> <p>To do anything in nUnit or MSTest, you have to decorate methods with a [TestFixture] or [TestClass] attribute. </p> <p>My favorite? MbUnit's [DataFixture] attribute: lets you seed test cases with specific test data either within the attribute directly or an exte...
16,914
<p>I have a couple of triggers on a table that I want to keep <strong><em>separate</em></strong> and would like to priortize them.</p> <p>I could have just one trigger and do the logic there, but I was wondering if there was an easier/logical way of accomplishing this of having it in a pre-defined order ?</p>
<p>Use sp_settriggerorder. You can specify the first and last trigger to fire depending on the operation.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms186762.aspx" rel="noreferrer">sp_settriggerorder on MSDN</a></p> <p>From the above link:<br> <b>A. Setting the firing order for a DML trigger</b><br> The...
<p>See <a href="https://stackoverflow.com/questions/94103/sql-server-triggers-order-of-execution#94162">here</a>.</p>
12,056
<p>I've been trying to create a custom control that works exactly like the Panel control except surrounded by a few divs and such to create a rounded box look. I haven't been able to find a decent example of how to do this. </p> <p>I need to be able to place text and controls inside the control and access it directly ...
<p>There are two ways to do this. One is to implement <code>INamingContainer</code> on your control, and it takes a lot of effort.</p> <p>The other way is to inherit from Panel, and override the RenderBeginTag and RenderEndTag methods to add your custom markup. This is easy.</p> <pre><code>public class RoundedCornersPa...
<pre><code>public class myCustomPanel : Panel { public override void RenderBeginTag(HtmlTextWriter writer) { writer.AddAttribute(HtmlTextWriterAttribute.Class, "top_left_corner"); writer.RenderBeginTag(HtmlTextWriterTag.Div); base.RenderBeginTag(writer); } public override vo...
39,402
<p>How do I create an asp:Menu that has a horizontal submenu rather then a vertical one while keeping the top menu horizontal?</p>
<p>You may want to look into using the <a href="http://www.codeplex.com/cssfriendly" rel="nofollow noreferrer">CSS Friendly Adapters</a>. The Menu adapter will render the asp:Menu control using semantic HTML (in this case an unordered list) instead of tables, which makes it much easier to apply CSS to make it do whatev...
<p>The asp.net menu just generates a table. Do something like this:</p> <pre><code>&lt;div id="nav"&gt;&lt;asp:menu .... /&gt;&lt;/div&gt; </code></pre> <p>And in your style sheet do something like this:</p> <pre><code>#nav table { display: inline-block } #nav tr { display: inline-block } #nav td { display: inline...
49,071
<p>When posting example code or filing bug reports based on a real production app, it would be helpful to have some way to change the table and column names to not potentially give away information about the internals of the app. Doing it by hand without breaking things is time consuming. Does anything automatic exis...
<p>As long as you don't use real data, I don't see what the issue is. Most apps are fairly obvious based on the requirements. ie CRM system = (customer name, address, etc...) or (customer name, addressid, etc.. with some address table with parts of the address, etc...). By knowing your schema I have no idea how you ...
<p>I agree that there's no real need to do so, but if you feel that way, take a look at anonymizers, usually used to protect the data and not the schemas, but you could easily apply those approaches to schemas as well.</p> <p>See <a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.105.711&amp;rep=rep1&am...
31,617