instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have an xslt sheet with some text similar to below:</p> <pre><code>&lt;xsl:text&gt;I am some text, and I want to be bold&lt;/xsl:text&gt; </code></pre> <p>I would like some text to be bold, but this doesn't work.</p> <pre><code>&lt;xsl:text&gt;I am some text, and I want to be &lt;strong&gt;bold&lt;strong&gt;&lt...
<p>You don't. <code>xsl:text</code> can only contain text nodes and <code>&lt;strong&gt;</code> is an element node, not a string that starts with less-than character; XSLT is about creating node trees, not markup. So, you have to do </p> <pre><code>&lt;xsl:text&gt;I am some text, and I want to be &lt;/xsl:text&gt; &lt...
<p>XSL-FO formatting should be able to do that, see the W3Schools <a href="http://w3schools.com/xslfo/default.asp" rel="nofollow noreferrer">tutorial</a>.</p>
10,433
<p>I've been seeing so much recently about functional programming and Clojure looks particularly interesting. While I 'understand' the basic description of what it is, I can't figure out how I would use it on a day to day basis as a web developer, if I can at all. A lot of what I have read focuses on the maths side of ...
<p>A few examples off the top of my head:</p> <ul> <li>Yahoo! Store is powered by Lisp (originally named <a href="http://en.wikipedia.org/wiki/Viaweb" rel="noreferrer">Viaweb</a> prior to acquisition)</li> <li><a href="http://reddit.com" rel="noreferrer">Reddit</a> was fully prototyped in Lisp, although they <a href="...
<p>You probably won't use it and shouldn't use it but when you say that someone will always find an exception to the rule (Viaweb, etc.). Basically there is no "super language" there are only working lines of code, usually in "Blub." Even Paul Graham says that the main (in fact only) benefit to a Lisp is one's ability ...
37,258
<p>I've got a website (currently in development for a third party, I'm sorry I can't show) that requires users to confirm their contact information by, clicking on a link sent to their email address, upon registration for the website.</p> <p>It's a pretty standard practice, not very technical or unique, which is why I...
<p>Make sure you have <a href="http://www.openspf.org/" rel="nofollow noreferrer">SPF records</a> for your domain, and that they are set correctly. This will go a long way.</p> <p>Email deliverability is a complex topic. At a previous gig, I was a member of the <a href="http://www.espcoalition.org/" rel="nofollow nore...
<p>My friend had a notification system that he has his PHP code send the notifications using a SMTP. So his notiifications were really sent from his Gmail account. He did this to prevent hotmail/etc from auto blocking the emails.</p> <p>I don't know if this helps</p>
47,798
<p>If user input is inserted without modification into an SQL query, then the application becomes vulnerable to <a href="https://stackoverflow.com/a/332367/">SQL injection</a>, like in the following example:</p> <pre class="lang-php prettyprint-override"><code>$unsafe_variable = $_POST['user_input']; mysql_query("IN...
<p>The <em>correct</em> way to avoid SQL injection attacks, no matter which database you use, is to <strong>separate the data from SQL</strong>, so that data stays data and will <strong>never be interpreted</strong> as commands by the SQL parser. It is possible to create an SQL statement with correctly formatted data p...
<p>I've written this little function several years ago:</p> <pre><code>function sqlvprintf($query, $args) { global $DB_LINK; $ctr = 0; ensureConnection(); // Connect to database if not connected already. $values = array(); foreach ($args as $value) { if (is_string($value)) { ...
8,501
<p>TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics?</p>
<p>Yes, there are many .NET Framework collection, that does not implement generic IEnumerable. </p> <p>I think that's because after 2.0 there was no (at least not so match) development of the core part of FW.</p> <p>Meanwhile I suggest you to make use of following workaround:</p> <pre><code>using System.Linq; ... ...
<p>Yes, Windows Forms dates back to before generics in .Net</p>
5,838
<p>I'm using <a href="https://tablelayout.dev.java.net/" rel="nofollow noreferrer">TableLayout</a> for my swing GUI. Initially only some basic labels, buttons and text fields where required which I could later on access by:</p> <pre><code>public Component getComponent(String componentName) { return getComponent(co...
<p>Have you recently moved this file out of a PHP parsed file (i.e. .phtml/.php) and into a .js file? Note that any PHP you expect to be executed must be parsed by the PHP parser before delivery to the client. If it was originally in a .php file, then it would have been parsed/ executed, and worked fine.</p> <p>Howeve...
<p><strong>Make sure you are running the page from the webserver</strong> like such: <code>http://localhost/yourpage.php</code> and not directly from the file itself like such: <code>file://yourpage.php</code></p>
48,068
<p>How do I let Microsoft know about a problem I've found in one of their core library routines? Do they have a central repository to report these things?</p> <p>I am not a member of Microsoft Development Network (MSDN).</p> <p>Or should I even bother?</p>
<p>There is no official way to report bugs to Microsoft for an end-user. If you are participating in a beta program for an upcoming release, the beta program includes a bug-reporting channel. Otherwise, if the bug causes problems that you want to get resolved, you can call Microsoft support, and they will help you solv...
<p>If it's a documentation bug (or if the documentation should call it out), you can get good results with the Feedback links in MSDN library. You can report bugs in Microsoft developer tools (among other things) by signing up at connect.microsoft.com.</p> <p>If you're sure you've found a bug in a core library routine...
34,813
<p>I tried to import mechanize module to my python script like this,</p> <pre><code>from mechanize import Browser </code></pre> <p>But, Google appengine throws HTTP 500 when accessing my script.</p> <p>To make things more clear, Let me give you the snapshot of my package structure,</p> <pre><code>root ....mechanize(wh...
<p>The mechanize main page says:</p> <blockquote> <p>mechanize.Browser is a subclass of mechanize.UserAgentBase, which is, in turn, a subclass of urllib2.OpenerDirector</p> </blockquote> <p>My understanding is that urllib2 is one of the sandboxed modules in GAE, with its functionality being replaced by the Google-p...
<p>When GAE throws a 500, you can see the actual error in the logs on your admin console. If that doesn't help, paste it here and we'll help further.</p> <p>Also, does it work on the dev_appserver?</p>
34,790
<p>In my asp.net mvc app I want to check if a certain url returns a valid response. Therefor I send the url to a method that tests the HttpWebRequest.GetResponse()</p> <p>On my dev server (vs2008) it works just fine. When deployed on production server however, it returns a Bad Request. The method is never hit and my a...
<p>For those who ever read this in the future: I remove the http:// part and used HttpUtility.UrlPathEncode to encode the path and put a route up that takes the last part as {*uri}. This enables me to use a / in the parameter.</p> <p>Then the checkUri I recreate the uri by adding the http:// and then check if the Host...
<p>Perhaps you are running into the <a href="http://msdn.microsoft.com/en-us/library/system.web.configuration.pagessection.validaterequest.aspx" rel="nofollow noreferrer">ValidateRequest</a> feature of ASP.NET? You can disable this for the page in question by modifying the first line in the aspx file to have the Valida...
24,962
<p>There's alot of information out there on setting up LAMP stacks on a single box, or perhaps moving MySQL onto it's own box, but growing beyond that doesn't seem to be very well documented.</p> <p>My current web environment is having capacity issues, and so I'm looking for <strong>best-practices</strong> regarding <...
<p>The schoolbook way of doing it would be to identify the bottlenecks with real empirical data.</p> <p>Is it the <a href="http://www.theserverside.com/news/thread.tss?thread_id=49368" rel="nofollow noreferrer">database</a>, apache, network, cpu, memory,io? Do you need more ram, <a href="http://www.chasingsparks.com/2...
<p>I would also recommend as a first step in terms of scalability, off-load your content to a CDN like Edgecast. Use your current two content servers as additional web servers.</p>
13,383
<p>What I'd like to do is something like the following:</p> <pre><code>FooClass.prototype.method = function():String { return "Something"; } var foo:FooClass = new FooClass(); foo.method(); </code></pre> <p>Which is to say, I'd like to extend a generated class with a single method, not via inheritance but via th...
<p>Yes, such a thing is possible.</p> <p>In fact, your example is very close to the solution.</p> <p>Try</p> <pre><code>foo["method"](); </code></pre> <p>instead of</p> <pre><code>foo.method(); </code></pre>
<p>@aib is unfortunately incorrect. Assuming strict mode (the default compiler mode) it is not possible to modify the prototype of non-dynamic class types in ActionScript 3. I'm not even sure that it's possible in non-strict mode.</p> <p>Is wrapping an option? Basically you create a class that takes one of the objects...
2,882
<p>If I declare a temporary auto deleted character buffer using</p> <pre><code>std::auto_ptr&lt;char&gt; buffer(new char[n]); </code></pre> <p>then the buffer is automatically deleted when the buffer goes out of scope. I would assume that the buffer is deleted using delete.</p> <p>However the buffer was created usin...
<p>The behaviour of calling delete on a pointer allocated with new[] is <a href="https://isocpp.org/wiki/faq/freestore-mgmt#delete-array" rel="nofollow noreferrer">undefined</a>. As you assumed, auto_ptr <a href="http://www.gotw.ca/conv/001.htm" rel="nofollow noreferrer">does call delete</a> when the smart pointer goes...
<p>This seems awful complex for a very simple solution. What's wrong with you using</p> <pre><code> char *c=new char[n] </code></pre> <p>here, and then deleting it? Or, if you need a bit more dynamic solution, </p> <pre><code>vector&lt;char&gt; c </code></pre> <p>Occam's Razor, man. :-)</p>
32,668
<p>Is there a way I can set up callbacks on (or automataically log) method parameters, entries, and exits without making explicit calls within each method? I basically want to log this information to my logger class (which is static) without having to do it manually for each method.</p> <p>Right now I have to call Log...
<p>use a wrapper class. this method has the following benefits:</p> <ul> <li>no need to change your underlying class structure / method signatures</li> <li>change logging? just update this class</li> <li>update object calls vs inserting code into every class you want to log</li> </ul> <p>.</p> <pre><code>class LogWa...
<p>you could use the magic function <code>__call</code>. It gets called when no functions match that name. Rename your methods to be prefixed with something, (eg: underscore), and optionally set them to private/protected.</p> <pre><code>class TestClass { public function __call($function, $args) { Logger::l...
36,780
<p>Right now, I have a SQL Query like this one:</p> <pre><code>SELECT X, Y FROM POINTS </code></pre> <p>It returns results like so:</p> <pre><code>X Y ---------- 12 3 15 2 18 12 20 29 </code></pre> <p>I'd like to return results all in one row, like this (suitable for using in an HTML &lt;AREA&gt; tag):</...
<p>Thanks for the quick and helpful answers guys!</p> <p>I just found another fast way to do this too:</p> <pre><code>SELECT STUFF(( SELECT ',' + X + ',' + Y FROM Points FOR XML PATH('') ), 1, 1, '') AS XYList </code></pre> <p>Credit goes to this guy:</p> <p>...
<pre><code>DECLARE @s VarChar(8000) SET @s = '' SELECT @s = @s + ',' + CAST(X AS VarChar) + ',' + CAST(Y AS VarChar) FROM POINTS SELECT @s </code></pre> <p>Just get rid of the leading comma</p>
21,720
<p>I have a serial hardware device that I'd like to share with multiple applications, that may reside on different machines within or spanning multiple networks. A key requirement is that the system must support bi-directional communication, such that clients/serial device can exist behind firewalls and/or on differen...
<p>You really need to provide a bit more detail... do the clients need guaranteed delivery? What about offline delivery? Is this part of a larger system? Do you need encryption? Security?</p> <p>If you want the smallest footprint possible, then should transmit data using SocketServer, Sockets, and serialization. But t...
<p>I ended up using XMPP via the Smack API. What led me to this decision was its native support for presence (is the client online/offline) and robust connection handling (it automatically reconnects if a the underlying connection breaks). Another benefit of XMPP is that it's compatible with Google Talk, so I don't n...
12,104
<p>Without local access to the server, is there any way to duplicate/clone a MySQL db (with content and without content) into another without using <code>mysqldump</code>?</p> <p>I am currently using MySQL 4.0.</p>
<p>I can see you said you didn't want to use <code>mysqldump</code>, but I reached this page while looking for a similar solution and others might find it as well. With that in mind, here is a simple way to duplicate a database from the command line of a windows server:</p> <ol> <li>Create the target database using My...
<p>Mysqldump isn't bad solution. Simplest way to duplicate database:</p> <p><code>mysqldump -uusername -ppass dbname1 | mysql -uusername -ppass dbname2</code></p> <p>Also, you can change storage engine by this way:</p> <p><code>mysqldump -uusername -ppass dbname1 | sed 's/InnoDB/RocksDB/' | mysql -uusername -ppass d...
4,539
<p>I am using Java 1.4 with Log4J. </p> <p>Some of my code involves serializing and deserializing value objects (POJOs). </p> <p>Each of my POJOs declares a logger with</p> <pre><code>private final Logger log = Logger.getLogger(getClass()); </code></pre> <p>The serializer complains of org.apache.log4j.Logger not be...
<p>How about using a static logger? Or do you need a different logger reference for each instance of the class? Static fields are not serialized by default; you can explicitly declare fields to serialize with a private, static, final array of <code>ObjectStreamField</code> named <code>serialPersistentFields</code>. <a ...
<p>If you want the Logger to be per-instance then yes, you would want to make it transient if you're going to serialize your objects. Log4J Loggers aren't serializable, not in the version of Log4J that I'm using anyway, so if you don't make your Logger fields transient you'll get exceptions on serialization.</p>
10,780
<p>I am attempting to start a new Wordpress blog. I am seeing funny characters in some browsers but not others instead of single quotes, double quotes and ellipses. Things I already thought of:</p> <ul> <li>The HTML template page for output itself is set to UTF-8</li> <li>The admin page is UTF-8</li> <li>The MySQL d...
<p>It could be some problem with the used font. Perhaps the Windows font cannot display the used codepoints correctly (happens with some freeware fonts that just don't include the whole UTF-8 spectrum) while the OS X font has these codepoints included.</p> <p>What font is used?</p> <p>Can you check the page output w...
<p>It may be worth trying to view your blog through <a href="http://browsershots.org/" rel="nofollow noreferrer">Browsershots</a>. It's a free service that allows you to see your website in multiple operating systems and browsers. If the same issue appears on all of the Browsershot samples, then you know it's a WordPre...
27,199
<p>how do i define a named_scope to return all the records that were created within the last 7 days, and then how do i use that named scope in a controller?</p>
<p>I would recommend watching the <a href="http://railscasts.com/episodes/108" rel="noreferrer">Railscast Episode on named_scope</a>.</p> <p>Ideally, the code you're looking for would be:</p> <pre><code> named_scope :recent, lambda { |*args| {:conditions =&gt; ["created_at &gt; ?", (args.first || 7.days.ago)]} } ...
<p>You need to pass named_scope a proc so it will be evaluated every time the call to named_scope is run. Otherwise if you specify Time.now it will run once (on first call) and be "cached" until the app is restarted.</p> <pre><code> named_scope \ :this_week, :conditions =&gt; [ %created_at &gt; :time!...
41,128
<p>In asp.net 3.5, I'm rewriting the url</p> <p><a href="http://www.abc.com/archive/1108/harpersdecember" rel="nofollow noreferrer">http://www.abc.com/archive/1108/harpersdecember</a></p> <p>to the following</p> <p><a href="http://www.abc.com/article.aspx?docId=78" rel="nofollow noreferrer">http://www.abc.com/articl...
<p>You may need to create a wildcard mapping in IIS on the remote server so that all requests are processed by ASP.Net. If you do not do this any URLs without .ASPX on the end will not run through your URL rewriting code.</p> <p>There is a good explanation of this (and other reasons you might use it) on <a href="http:...
<p>Sounds to me like the production server does not have a default aspx page, ie: default.aspx. If it did, it would reroute the request to your handler.</p> <p>Easy way to verify this, would be to create a directory and place a default.aspx file in it and try to request it using only the dir name, ie: server.com/newdi...
41,373
<p>I'm using the following code, using the <a href="http://www.sharpziplib.com/" rel="noreferrer">SharpZipLib</a> library, to add files to a .zip file, but each file is being stored with its full path. I need to only store the file, in the 'root' of the .zip file.</p> <pre><code>string[] files = Directory.GetFiles(fo...
<p>My solution was to set the <code>NameTransform</code> object property of the <code>ZipFile</code> to a <code>ZipNameTransform</code> with its <code>TrimPrefix</code> set to the directory of the file. This causes the directory part of the entry names, which are full file paths, to be removed.</p> <pre><code>public ...
<p>The MSDN entry for <code>Directory.GetFiles()</code> states that <em>The returned file names are appended to the supplied path parameter.</em> (<a href="http://msdn.microsoft.com/en-us/library/07wt70x2.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/07wt70x2.aspx</a>), so the strings you are ...
24,152
<p>Currently I am saving a UIImage to the photos album using UIImageWriteToSavedPhotosAlbum, which works fine.</p> <p>Is there a way to then open the Photos app showing the just-saved photo? (I assume my app must close before opening Photos, which is fine.)</p> <p>Simply opening the Photos app to the Saved Photos Alb...
<p>No, it's not possible using the SDK. If this is something you think is needed, you should <a href="http://bugreporter.apple.com" rel="nofollow noreferrer">file an enhancement request</a>.</p>
<p>No, it's not possible using the SDK. If this is something you think is needed, you should <a href="http://bugreporter.apple.com" rel="nofollow noreferrer">file an enhancement request</a>.</p>
47,031
<p>So I've been poking around with C# a bit lately, and all the Generic Collections have me a little confused. Say I wanted to represent a data structure where the head of a tree was a key value pair, and then there is one optional list of key value pairs below that (but no more levels than these). Would this be suitab...
<p>There is an actual Data Type called KeyValuePair, use like this</p> <pre><code>KeyValuePair&lt;string, string&gt; myKeyValuePair = new KeyValuePair&lt;string,string&gt;("defaultkey", "defaultvalue"); </code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/xfhwa508.aspx" rel="nofollow noreferrer">Dictionary Class</a> is exactly what you want, correct.</p> <p>You can declare the field directly as Dictionary, instead of IDictionary, but that's up to you.</p>
3,030
<p>Ok, so, my visual studio is broken. I say this NOT prematurely, as it was my first response to see where I had messed up in my code. When I add controls to the page I can't reference all of them in the code behind. Some of them I can, it seems that the first few I put on a page work, then it just stops. </p> <p>I f...
<p>try clearing your local VS cache. find your project and delete the folder. the folder is created by VS for what reason I honestly don't understand. but I've had several occasions where clearing it and doing a re-build fixes things... hope this is all that you need as well.</p> <p>here</p> <pre><code>%Temp%\VWDWebC...
<p>For me, deleting/renaming the files in the following location worked:</p> <pre><code>C:\Windows\Microsoft.NET\Framework\v4.0.30319\Temporary ASP.NET Files\myvirtualwebsite\e331e0a9 </code></pre>
5,961
<p>I'm preparing to send mass email to customers which is in html + images. What are general rules to do make it display correctly in most popular mail clients?</p> <p>EDIT:</p> <p>Well it's for my customers - about few k clients.</p> <p>My question is - how to code this email that it will display correctly in cus...
<p>These two references are great places to start</p> <ul> <li><a href="http://www.alistapart.com/articles/cssemail/" rel="nofollow noreferrer">http://www.alistapart.com/articles/cssemail/</a></li> <li><a href="http://www.campaignmonitor.com/css/" rel="nofollow noreferrer">http://www.campaignmonitor.com/css/</a></li> ...
<p>HTML email type. Your images need to be hosted somewhere on the internet, and then included in the HTML as links.</p> <p>You generate your HTML code, and that is the message body. The type of the mail message is HTML!</p> <p>Everyone does this, there are a million examples out there.</p>
46,877
<p>When double-probing, sometimes the BLTouch will hit the bed before the z-axis goes down:</p> <ol> <li>The BLTouch deploys </li> <li>The bed goes up</li> <li>The sensor triggers</li> <li>The BLTouch stows</li> <li>The BLTouch deploys and crashes the bed before the z-axis goes down for the second probe</li> </ol> <p...
<p>First, make sure to check if stow, deploy and the trigger are working correctly.</p> <p>Second, check the pins files to make sure you put it in the correct pins. Black and White probe pin might need to go to Z-min or probe pin depending on. Make sure to check that.</p> <p>Third, add "BLTOUCH delay". It might be tr...
<p>This sounds like the firmware setting for your BLtouch is not set up properly. Look at the line in Config H where it deploys the BLtouch. make sure nothing is commented out and that the 2nd deploy is shown. </p>
1,224
<p>A Java version of this question was just answered, and, well, I don't know how to do this in .net. </p> <p>So how do you calculate the display width of a string in C# / .net?</p>
<p>You've got the same problem in this question as was present in the Java question - not enough information! It will differ between WinForms and WPF.</p> <p>For WinForms: <a href="http://msdn.microsoft.com/en-us/library/6xe5hazb.aspx" rel="noreferrer">Graphics.MeasureString</a></p> <p>For WPF I'm not sure, but I sus...
<p>Graphics.MeasureString([text to measure],[font being used to measure text]);</p> <p>The resulting object will provide the following:</p> <p><img src="https://i.stack.imgur.com/1Y39l.png" alt="properties available"></p> <p>Other overloads of MeasureString also available.</p>
33,010
<p>What is the best way to return XML from a controller's action in ASP.NET MVC? There is a nice way to return JSON, but not for XML. Do I really need to route the XML through a View, or should I do the not-best-practice way of Response.Write-ing it?</p>
<p>Use <a href="http://www.codeplex.com/MVCContrib" rel="noreferrer">MVCContrib</a>'s XmlResult Action.</p> <p>For reference here is their code:</p> <blockquote> <pre><code>public class XmlResult : ActionResult { private object objectToSerialize; /// &lt;summary&gt; /// Initializes a new instance of the ...
<p>Here is a simple way of doing it:</p> <pre><code> var xml = new XDocument( new XElement("root", new XAttribute("version", "2.0"), new XElement("child", "Hello World!"))); MemoryStream ms = new MemoryStream(); xml.Save(ms); return File(new MemoryStre...
16,338
<p>Jeff Atwood wrote about this <a href="https://blog.codinghorror.com/who-needs-stored-procedures-anyways/" rel="noreferrer">here</a>, and while I understand the theoretical performance boost a stored procedure could offer, it does seem like a tremendous pain.</p> <p>What types of queries would you see the most perfo...
<p>The stored proc/no stored procs argument has become a religious issue. For every person that emphasizes optimized execution plans for procs, another points out common dynamic queries are cached and optimized in most modern DBMSes. For anyone that points out the security a proc might offer, another explains that dyna...
<p>The idea behind Stored Procedures being faster is that they can store cached query plans, kinda like precompiling the stored procedure. So if the procedure is very complex with lots of joins between lots of tables you may see a speed benefit.</p> <p>I think stored procs are desired for more than their speed, they ...
34,569
<p>With jQuery, how do I find out which key was pressed when I bind to the keypress event?</p> <pre><code>$('#searchbox input').bind('keypress', function(e) {}); </code></pre> <p>I want to trigger a submit when <kbd>ENTER</kbd> is pressed.</p> <p><strong>[Update]</strong></p> <p>Even though I found the (or better: ...
<p>Actually this is better:</p> <pre><code> var code = e.keyCode || e.which; if(code == 13) { //Enter keycode //Do something } </code></pre>
<p>Try this:</p> <pre><code>jQuery('#myInput').keypress(function(e) { code = e.keyCode ? e.keyCode : e.which; if(code.toString() == 13) { alert('You pressed enter!'); } }); </code></pre>
38,783
<pre><code>grant { permission java.security.AllPermission; }; </code></pre> <p>This works.</p> <pre><code>grant file:///- { permission java.security.AllPermission; }; </code></pre> <p>This does not work. Could someone please explain to me why?</p>
<p>The syntax should be:</p> <pre>grant codeBase "file:///-" { ... };</pre> <p>See <a href="http://java.sun.com/javase/6/docs/technotes/guides/security/PolicyFiles.html" rel="nofollow noreferrer">the docs</a>. Note the semicolon.</p> <p>Be very careful assigning permissions to code.</p> <p>Are you sure the code...
<p>The directive "grant { permission }" means grant the permission to all code no matter where it came from. In other words, when there is no codebase specified, the code could be loaded from the network or the file system. </p> <p>The second directive (if it worked) would only apply to the local file system. It woul...
19,269
<p>The number is bigger than <code>int</code> &amp; <code>long</code> but can be accomodated in <code>Decimal</code>. But the normal <code>ToString</code> or <code>Convert</code> methods don't work on <code>Decimal</code>.</p>
<p>I believe this will produce the right results where it returns anything, but may reject valid integers. I dare say that can be worked around with a bit of effort though... (Oh, and it will also fail for negative numbers at the moment.)</p> <pre><code>static string ConvertToHex(decimal d) { int[] bits = decimal....
<p>I've got to agree with James - do it manually - but don't use base-16. Use base 2^32, and print 8 hex digits at a time.</p>
27,245
<p>What are the best methods for tracking and/or automating DB schema changes? Our team uses Subversion for version control and we've been able to automate some of our tasks this way (pushing builds up to a staging server, deploying tested code to a production server) but we're still doing database updates manually. ...
<p>In the Rails world, there's the concept of migrations, scripts in which changes to the database are made in Ruby rather than a database-specific flavour of SQL. Your Ruby migration code ends up being converted into the DDL specific to your current database; this makes switching database platforms very easy. </p> <p...
<p>There is a command-line <a href="http://bitbucket.org/stepancheg/mysql-diff/" rel="nofollow noreferrer">mysql-diff</a> tool that compares database schemas, where schema can be a live database or SQL script on disk. It is good for the most schema migration tasks.</p>
2,393
<p>The default 64 MB max heap memory can be small for a large Java application. Are there any applet parameter to increment this for a signed applet?</p> <p>For a Java program this is a simple command line parameter but how this work for an applet in the browser.</p>
<p>The <a href="http://www.oracle.com/technetwork/java/javase/plugin2-142482.html#COMMAND_LINE_ARGS" rel="nofollow noreferrer">new plugin architecture in JDK6u10</a> supports this. Prior to that, the only way to do it was in the Java control panel.</p>
<p>Not that I know for certain, it's been a long time since I wrote applets, but I don't think you can set this from the applet.</p> <p>Apparently, you can set the JVM's heap size for the browser's JVM from the Java plug-in control panel, but that's something the user has to do before starting your applet.</p> <p>You...
12,750
<p>So far, I've only used Rational Quantify. I've heard great things about Intel's VTune, but have never tried it!</p> <p>Edit: I'm mostly looking for software that will instrument the code, as I guess that's about the only way to get very fine results.</p> <hr /> <h3>See also:</h3> <p><a href="https://stackoverflow.co...
<p>For linux development (although some of these tools might work on other platforms). These are the two big names I know of, there's plenty of other smaller ones that haven't seen active development in a while.</p> <ul> <li><a href="http://valgrind.org/" rel="noreferrer">Valgrind</a></li> <li><a href="http://www.cs.u...
<p>Let me give a plug for EQATEC... just what I was looking for... simple to learn and use and gives me the info I need to find the hotspots quickly. I much prefer it to the one built in to Visual Studio (though I haven't tried the VS 2010 one yet, to be fair).</p> <p>The ability to take snapshots is HUGE. I often g...
4,620
<p>Is there anywhere on the web free vista look and feel theme pack for java?</p>
<p>I'm guessing that what you want is to use the system look and feel regardless on whatever platform your application is started. This can be done with</p> <pre><code>UIManager.setLookAndFeel( UIManager.getSystemLookAndFeelClassName() ); </code></pre> <p>on the main() method (you have to handle possible exceptions o...
<p>If you use SWT it has a native vista look and feel built in. However, if you are using swing I honestly do not know.</p>
14,553
<p>Our site has multiple "wizards" where various data is collected over several pages, and cannot be committed to the database until the last step.</p> <p>What is the best/correct way to make a wizard like this with ASP.Net MVC</p> <p>edit: My boss is now saying "no javascript" - any thoughts on how to get around tha...
<p>I don't believe there is a best/correct way, but the way I'd do it is...</p> <p>Each wizard gets its own page. Each step gets its own div. All steps are in the same form.</p> <p>The previous/next buttons would essentially hide/show the div in each step of the process. The last step's submit button submits the e...
<p>You can use the simple component MVCWizard.Wizard available on NuGet. The WizardController allows you to create a wizard using partial view. There is also the AutoWizardController that renders the entire wizard in a single view. All these components operate with the session to store the model state.</p>
38,012
<p>This is probably a really simple jQuery question, but I couldn't answer it after 10 minutes in the documentation so...</p> <p>I have a list of checkboxes, and I can get them with the selector <code>'input[type=checkbox]'</code>. I want the user to be able to shift-click and select a range of checkboxes. To accompli...
<p>The following selector should also work in jQuery: <code>input:checkbox</code>.</p> <p>You can then string the <code>:gt(index)</code> and <code>:lt(index)</code> filters together, so if you want the 5th to 7th checkboxes, you'd use <code>input:checkbox:gt(4):lt(2)</code>.</p> <p>To get the index of the currently ...
<p>Thanks for the answer, samjudson.</p> <p>After further experimentation, I found that you can even use just <code>$(':checkbox')</code> to select them. It's interesting that you can use the <code>.slice()</code> function to get the range, but you also have the option of doing it in the selector with <code>:gt</code>...
6,542
<p>I have made a small project in Oracle, by using the oracle forms builder - how do I create an installer (<code>setup.exe</code>) for my project (one that would setup the application on MS Windows?)</p> <p>Please... help me, and thanks a lot</p>
<p>Up to Forms 6i you can have a Forms runtime client installed on the target PC. That target PC also needs connectivity to the database. You don't need a license for the runtime client.</p> <p>From 6i onwards, the Forms component can run through an application server with the client accessing it through a Java applet...
<p>What version of oracle forms are you using?<br> In my last job we used Forms v4.5 (Developer 2000) - and for that version (which is quite old now) the Forms Runtime software had to be installed on the client computers.<br> Then, when the user double clicked on an .FMX file the Forms runtime (F45run32.exe) would load...
40,271
<p>I have to run a local shell script (windows/Linux) on a remote machine.</p> <p>I have SSH configured on both machine A and B. My script is on machine A which will run some of my code on a remote machine, machine B.</p> <p>The local and remote computers can be either Windows or Unix based system.</p> <p>Is there a wa...
<p>If Machine A is a Windows box, you can use Plink (part of <a href="http://www.chiark.greenend.org.uk/~sgtatham/putty/" rel="noreferrer">PuTTY</a>) with the -m parameter, and it will execute the local script on the remote server.</p> <pre><code>plink root@MachineB -m local_script.sh </code></pre> <p>If Machine A is...
<p>First, copy the script over to Machine B using scp</p> <blockquote> <p>[user@machineA]$ scp /path/to/script user@machineB:/home/user/path</p> </blockquote> <p>Then, just run the script</p> <blockquote> <p>[user@machineA]$ ssh user@machineB "/home/user/path/script"</p> </blockquote> <p>This will work if you h...
39,223
<p>I want to extend <strong>all</strong> my CR-10S wires. I have two long wire types: 22 and 18 AWG wires. I've done some research and found the following:</p> <ul> <li>Extruder heating element: 22 AWG or lower.</li> <li>Extruder thermistor sensor: 22 AWG or lower (Doesn't really need much amp).</li> <li>Fans: 24 A...
<p>To answer your question directly, the PTFE tube (or a separate thin walled PTFE tube for the bottom part of the heatbreak) <em>generally</em> always is outside the nozzle, so yes (unless you have an all-metal hotend, then there is no PTFE tube up to the nozzle). But as read from your question, your setup has the tub...
<p>Yes, you can use a direct drive hotend with a bowden tube, but it won't just plug together. You just need a way to secure the end of the bowden tube to be centered above and as close the the hotend mouth as possible. In a pinch, you can spin a 4mm nut onto the tube and secure it down against the hotend mount with zi...
1,105
<p>I'm looking for a benchmark (and results on other PCs) which would give me an idea of the development performance gain I could get by upgrading my PC, also the benchmark could be used to justify the upgrade to my boss.</p> <p>I use Visual Studio 2008 for my development, so I'd like to get an idea of by what factor ...
<p>Sorry, I don't know of any benchmarks for the IDE specifically.</p> <p>However, Vista-64 won't run VS any faster than Vista-32 because VS is 32-bit. If anything it will run slightly slower on Vista-64. To run any 32-bit application on Vista x64, the OS uses a translation layer called WOW64:</p> <p><a href="http://...
<p>I don't know of any benchmarks that compare Visual Studio.... but I can tell you this; the biggest bang for your buck would be buying a faster harddrive (like the 300GB Velociraptor) and making sure you have sufficient RAM.</p>
45,451
<p>How can two classes in separate projects communicate between one another?</p> <p>If ClassA references ClassB I can access methods of ClassB in ClassA... How can I make use of Interfaces to access methods of ClassA in ClassB?</p> <p>Indeed do the classes even need to be linked if I make use of Interfaces?</p> <p>C...
<p>I assume you mean assemblies, not classes.</p> <p>You have two options, either you use System.Reflection namespace (dirty way) and then you don't even need to have any interfaces, just invoke methods via reflection.</p> <pre><code>System.Reflection.Assembly.LoadFile("MyProject.dll").GetType("MyProject.TestClass")....
<p>You can access function of Class A from B via interface using interface polymorphism.</p> <pre><code>class B { Public sub DoSomethingOnA(IA a ) { a.DoSomething(); } } Interface IA { void DoSomething(); } Class A : IA { void DoSomething() { // } } </code></pre>
47,995
<pre><code>&lt;style type="text/css"&gt; html, body { background: #fff; margin: 0; padding: 0; } #nav { font-family: Verdana, sans-serif; height: 29px; font-size: 12px; padding: 0 0 0 10px; /* this is used for something else */ background-color: #456; } #nav ul, #nav ul li { list-s...
<p>This works on my machine:</p> <pre><code>&lt;style type="text/css"&gt; html, body { background: #fff; margin: 0; padding: 0; } #nav { font-family: Verdana, sans-serif; height: 29px; font-size: 12px; padding: 0 0 0 10px; /* this is used for something else */ background-color: #456; }...
<p>have you tried:</p> <pre><code>#nav ul li a { color: #FFF; text-decoration: none; padding: 0px 0 0 20px; height: 29px; line-height: 29px; } </code></pre>
28,797
<p>I've just started working with ASP.NET MVC now that it's in beta. In my code, I'm running a simple LINQ to SQL query to get a list of results and passing that to my view. This sort of thing:</p> <pre><code>var ords = from o in db.Orders where o.OrderDate == DateTime.Today select o; return Vie...
<p>Can you pass it to the view? Yes, but your view won't be strongly typed. But the helpers will work. For example:</p> <pre><code>public ActionResult Foo() { return View(new {Something="Hey, it worked!"}); } //Using a normal ViewPage &lt;%= Html.TextBox("Something") %&gt; </code></pre> <p>That textbox should ren...
<p>you may be able to pass an Object and use reflection to get your desired results. Have a look at ObjectDumper.cs (included in csharpexamples.zip) for an example of this.</p>
27,630
<p>How does Stackoverflow implement the resizable textarea?</p> <p>Is that something they rolled themselves or is it a publicly available component that I can easily attach to textareas on my sites? </p> <p>I found this question and it doesn't quite do what I want.</p> <p><a href="https://stackoverflow.com/question...
<p>StackOverflow uses a jQuery plugin to accomplish this: <a href="http://plugins.jquery.com/project/TextAreaResizer" rel="nofollow noreferrer">TextAreaResizer</a>.</p> <p>It's easy enough to verify this - just pull <a href="http://sstatic.net/js/wmd.js" rel="nofollow noreferrer">the JS</a> files from the site.</p> <...
<p>Using AngularJS:</p> <pre><code>angular.module('app').directive('textarea', function() { return { restrict: 'E', controller: function($scope, $element) { $element.css('overflow-y','hidden'); $element.css('resize','none'); resetHeight(); adjustHeight(); function resetHeight()...
18,007
<p>So I just got a Da-Vinci 3-in-1 Junior Pro 3D Printer, and was excited to start printing my first model.</p> <p>When I open my .STL File in the XYZWare that comes with the printer, and click print, it says that the cartridge inserted into my printer in not genuine, and that it won't print until I order a genuine ca...
<p>A <a href="https://www.google.nl/search?q=Da-Vinci+3-in-1+Junior+Pro+3D+does+not+recognise+genuine+cartridge&amp;rlz=1C1GCEA_en&amp;oq=Da-Vinci+3-in-1+Junior+Pro+3D+does+not+recognise+genuine+cartridge&amp;aqs=chrome..69i57.13982j0j7&amp;sourceid=chrome&amp;ie=UTF-8" rel="noreferrer">quick search on the internet</a>...
<p>A <a href="https://www.google.nl/search?q=Da-Vinci+3-in-1+Junior+Pro+3D+does+not+recognise+genuine+cartridge&amp;rlz=1C1GCEA_en&amp;oq=Da-Vinci+3-in-1+Junior+Pro+3D+does+not+recognise+genuine+cartridge&amp;aqs=chrome..69i57.13982j0j7&amp;sourceid=chrome&amp;ie=UTF-8" rel="noreferrer">quick search on the internet</a>...
1,107
<p>I'm experimenting with VS 2008 Express edition and when I hit f1 on a keyword or class name I seem to get the Information Not Found page more than 90% of the time.</p> <p>Is this a configuration problem? Is it because this is the "free-as-in-beer" Express edition? Did Microsoft move their online documentation since...
<p>Keep in mind that the <em>full</em> MSDN Library for Visual Studio is massive - at the current time it is 2GB - so for this reason it's offered as a separate download.</p> <p>There appears to be an <em>abriged</em> version which is 300MB, although I would suggest that you'd see the "Information Not Available" messa...
<p>Did you install the MSDN Libary with the express edition? You need to :)</p> <p>And you can also download the full version of the MSDN Documentation if you just want EVERYTHING.</p> <p>The documentation is absolutely free. </p> <p>What version do you have of express, then I can redirect you to a link to the full ...
13,661
<p>I have designed my site with a 900 x 600 fixed background image. On the computer it looks fine. How will it look on a PDA device? Will I have to design it separately for PDA?</p> <p>How should check whether my site can be browsed effectively from mobile phone?</p> <p>What should I do?</p>
<ul> <li><p>Try using <a href="http://www.opera.com/" rel="nofollow noreferrer">Opera</a>'s "small screen" view (View > Small Screen). This does a pretty decent job of simulating a mobile screen. Try it on Opera's own site. Note that they use a "handheld" type stylesheet that kicks-in when you're viewing on a handheld ...
<p>Well, you could always throw some detection javascript in there to check the type of browser, then redirect to a different site that is formatted for mobile devices. This seems to be the norm for most sites.</p> <p>Examples: </p> <ul> <li>Digg.com </li> <li>Twitter.com</li> <li>Google.com</li> </ul>
34,127
<p>How would I invert .NET regex matches? I want to extract only the matched text, e.g. I want to extract all IMG tags from an HTML file, but only the image tags.</p>
<p>That has nothing to do with inverting the Regexp. Just search for the relevant Text and put it in a group.</p>
<p>Not sure what you mean. Are you talking about <a href="http://www.regular-expressions.info/brackets.html" rel="nofollow noreferrer">capturing groups</a>?</p>
16,051
<p>How can I use Cron on Google App Engine?</p>
<p>Google has officially enabled cron in the AppEngine, for more details check:</p> <p>Cron for Python: <a href="http://code.google.com/appengine/docs/python/config/cron.html" rel="nofollow noreferrer">http://code.google.com/appengine/docs/python/config/cron.html</a></p> <p>Cron for Java: <a href="http://code.google....
<p>Here's a tutorial on using a Google App Engine Cron Job to send an automated email:</p> <p><a href="http://www.fishbonecloud.com/2010/11/automated-email-using-google-app-engine.html" rel="nofollow">http://www.fishbonecloud.com/2010/11/automated-email-using-google-app-engine.html</a></p>
17,559
<p>I have never worked with web services and rails, and obviously this is something I need to learn. I have chosen to use hpricot because it looks great. Anyway, _why's been nice enough to provide the following example on the <a href="http://code.whytheluckystiff.net/hpricot/" rel="nofollow noreferrer">hpricot website<...
<p>Model, model, model, model, model. Skinny controllers, simple views.</p> <p>The RedHandedHomePage model does the parsing on initialization, then call 'def render' in the controller, set output to an instance variable, and print that in a view.</p>
<p>I'd probably go for a REST approach and have resources that represent the different entities within the XML file being consumed. Do you have a specific example of the XML that you can give?</p>
4,845
<p>I have a 3D print where there are 5 holes with a diameter of 4 mm in a cup, and I would like liquid to flow through all 5 holes at once while slowly draining the cup (by slowly I mean: just take a few seconds and not drain instantly). Therefore the holes can not be very large.</p> <p>When I fill water in the cup it ...
<p>What you encounter there is a combination of Adhesion, Cohesion, and Capillary Force.</p> <p>Cohesion is what holds the water together. Adhesion is the force to retain water against a wall or hanging from a pen's end, it is proportional to the surface wetted. Capillary Force is the resulting effect where water moves...
<p>If it is possible to add a downward pointing thin needle (hair, AWG-40 wire etc.) to the edge of (each) hole, do it. The droplets will smoothly glide along it to its end, where the needle circumference becomes so tiny that surface tension cannot hold the droplet anymore. Surface tension won't have a chance!</p> <p>W...
1,762
<p>How do you get/set the absolute position of a MovieClip in Flash/AS3? And by absolute, I mean its position relative to the stage's origo.</p> <p>I currently have this setter:</p> <pre><code>class MyMovieClip extends MovieClip { function set xAbs(var x:Number):void { this.x = -(this.parent.localToGlobal(new...
<p>Two things:</p> <p>Why the substractions?</p> <pre><code>var x=this.parent.localToGlobal(new Point(this.x,0)).x; </code></pre> <p>should give the proper result already. If the parent clip is scaled, your calculation will be off by the scaling factor...</p> <p>Just a shot in the dark, but you could add a <code>g...
<p>i couldnt use localToGlobal so as an alternative solution is to get the position of the mouse in the scope you want :</p> <pre><code>mynestesprite.addEventListener (MouseEvent.MOUSE_OVER, myover) function myover(e:MouseEvent){ // e.target.parent.parent .... trace ( e.target.parent.parent.mouseX, e.target.p...
44,016
<p>In OpenGL I'm trying to rotate a camera around a point, with camera being distance r from the point and facing the point when it rotates. In other words, I want the camera to move along the circumference of a circle at a radius r from the center, with the camera facing the center at any point along the circumferen...
<p>You need to either:</p> <ul> <li>rotate the camera around the origin and then translate it (*)</li> </ul> <p>or:</p> <ul> <li>use <code>gluLookAt</code> to keep the camera pointing at the center of the circle</li> </ul> <p>(*) rotation functions normally rotate about the origin. To rotate around another point <...
<p>I find problems like this much easier to solve with gluLookAt(). You define a path for the camera (a circle is easy!) and keep the "center" point fixed (i.e. the thing you're looking at).</p> <p>The only possible trick is defining a good up vector--but not usually too much work. If the path and the target point a...
36,602
<p>Is there any framework for querying XML SQL Syntax, I seriously tire of iterating through node lists. <hr> Or is this just wishful thinking (if not idiotic) and certainly not possible since XML isn't a relational database?</p>
<p><a href="http://www.w3schools.com/xquery/default.asp" rel="nofollow noreferrer">XQuery</a> and XPath... XQuery is more what you are looking for if a SQL structure is desirable.</p>
<p>SQL Server 2005 supports <a href="http://msdn.microsoft.com/en-us/library/ms177454.aspx" rel="nofollow noreferrer">XML DML</a> on it's native <code>xml</code> data type.</p>
17,024
<p>There's a part in my apps that displays the file path loaded by the user through OpenFileDialog. It's taking up too much space to display the whole path, but I don't want to display only the filename as it might be ambiguous. So I would prefer to show the file path relative to the assembly/exe directory.</p> <p>For...
<p>.NET Core 2.0 has <code>Path.GetRelativePath</code>, else, use this.</p> <pre><code>/// &lt;summary&gt; /// Creates a relative path from one file or folder to another. /// &lt;/summary&gt; /// &lt;param name="fromPath"&gt;Contains the directory that defines the start of the relative path.&lt;/param&gt; /// &lt;para...
<pre><code> public static string ToRelativePath(string filePath, string refPath) { var pathNormalized = Path.GetFullPath(filePath); var refNormalized = Path.GetFullPath(refPath); refNormalized = refNormalized.TrimEnd('\\', '/'); if (!pathNormalized.StartsWith(refNormalized)) ...
34,751
<p>How can I convert a uniform distribution (as most random number generators produce, e.g. between 0.0 and 1.0) into a normal distribution? What if I want a mean and standard deviation of my choosing?</p>
<p>The <a href="http://en.wikipedia.org/wiki/Ziggurat_algorithm" rel="noreferrer">Ziggurat algorithm</a> is pretty efficient for this, although the <a href="http://en.wikipedia.org/wiki/Box-Muller_transform" rel="noreferrer">Box-Muller transform</a> is easier to implement from scratch (and not crazy slow).</p>
<pre><code>function distRandom(){ do{ x=random(DISTRIBUTION_DOMAIN); }while(random(DISTRIBUTION_RANGE)&gt;=distributionFunction(x)); return x; } </code></pre>
10,127
<p>We currently have an application that works with Outlook 2003. In order to get the owner of a shared contact folder, we simply call: Redemption.RDOSessionClass.GetFolderFromID() and then took that folder and got the RDOFolder.Store.Name property.</p> <p>However, when trying this with a shared contact folder in Outl...
<p>Short answer, it is a technique that you can use to express systems with concrete states (as opposed to quantum states / probability distributions).</p> <p>Quoting the <a href="http://en.wikipedia.org/wiki/Finite_state_machine" rel="nofollow noreferrer">Wikipedia article</a>:</p> <blockquote> <p>A finite state m...
<p>Yes! You could look it up!</p> <p><a href="http://en.wikipedia.org/wiki/Finite_state_machine" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Finite_state_machine</a></p>
47,548
<p>I want to react when somebody shakes the iPhone. I don't particularly care how they shake it, just that it was waved vigorously about for a split second. Does anyone know how to detect this?</p>
<p>In 3.0, there's now an easier way - hook into the new motion events.</p> <p>The main trick is that you need to have some UIView (not UIViewController) that you want as firstResponder to receive the shake event messages. Here's the code that you can use in any UIView to get shake events:</p> <pre><code>@implementa...
<p>To enable this app-wide, I created a category on UIWindow:</p> <pre><code>@implementation UIWindow (Utils) - (BOOL)canBecomeFirstResponder { return YES; } - (void)motionBegan:(UIEventSubtype)motion withEvent:(UIEvent *)event { if (motion == UIEventSubtypeMotionShake) { // Do whatever you want here...
18,131
<p>I have source in a bunch of subdirectories like:</p> <pre><code>src/widgets/apple.cpp src/widgets/knob.cpp src/tests/blend.cpp src/ui/flash.cpp </code></pre> <p>In the root of the project I want to generate a single Makefile using a rule like:</p> <pre><code>%.o: %.cpp $(CC) -c $&lt; build/test.exe: build/wid...
<p>The reason is that your rule</p> <pre><code>%.o: %.cpp ... </code></pre> <p>expects the .cpp file to reside in the same directory as the .o your building. Since test.exe in your case depends on build/widgets/apple.o (etc), make is expecting apple.cpp to be build/widgets/apple.cpp.</p> <p>You can use VPATH ...
<p>Usually, you create a Makefile in each subdirectory, and write in the top-level Makefile to call make in the subdirectories. </p> <p>This page may help: <a href="http://www.gnu.org/software/make/" rel="nofollow noreferrer">http://www.gnu.org/software/make/</a></p>
28,625
<p>Take the following C# class:</p> <pre><code>c1 { event EventHandler someEvent; } </code></pre> <p>If there are a lot of subscriptions to <code>c1</code>'s <code>someEvent</code> event and I want to clear them all, what is the best way to achieve this? <strong>Also consider that subscriptions to this event could b...
<p>From within the class, you can set the (hidden) variable to null. A null reference is the canonical way of representing an empty invocation list, effectively.</p> <p>From outside the class, you can't do this - events basically expose "subscribe" and "unsubscribe" and that's it.</p> <p>It's worth being aware of wha...
<p>Instead of adding and removing callbacks manually and having a bunch of delegate types declared everywhere:</p> <pre><code>// The hard way public delegate void ObjectCallback(ObjectType broadcaster); public class Object { public event ObjectCallback m_ObjectCallback; void SetupListener() { ...
18,540
<p>I have wondered for some time, what a nice, clean solution for joining an array of strings might look like. Example: I have ["Alpha", "Beta", "Gamma"] and want to join the strings into one, separated by commas – "Alpha, Beta, Gamma".</p> <p>Now I know that most programming languages offer some kind of join method f...
<p>The most elegant solution i found for problems like this is something like this (in pseudocode)</p> <pre><code>separator = "" foreach(item in stringCollection) { concatenatedString += separator + item separator = "," } </code></pre> <p>You just run the loop and only after the second time around the separat...
<p>The following is no longer language-agnostic (but that doesn't matter for the discussion because the implementation is easily portable to other languages). I tried to implement Luke's (theretically best) solution in an imperative programming language. Take your pick; mine's C#. Not very elegant at all. However, (wit...
8,278
<p>i've been programming a while in D <a href="http://www.digitalmars.com/d/" rel="nofollow noreferrer">(http://www.digitalmars.com/d/)</a> now. I prefer it to Java because it is faster. However, i have not found an Editor that supports Code-Completion and Debugging (Step-Over, Step-Into, Breakpoints,...).</p> <p>Do y...
<p><a href="http://www.dsource.org/projects/descent" rel="nofollow noreferrer">Descent</a>, the Eclipse plugin, should support both (if you have a D supporting debugger installed). I have to admit I haven't tried it in a long time though, and when I did, debugging did <em>not</em> work, using gdb.</p> <p>See also <a h...
<p>I use descent as well. I don't use it's debugger bit but that is because I'm editing on a windows desktop and building/running/debugging on a Linux server.</p>
11,730
<p>I have what I imagine to be a pretty standard web-interface.</p> <p>There are 4 different ListViews (grid controls) which are accessed by a series of Tabs on the top. </p> <p>I have implemented this as follows:</p> <p><a href="http://img402.imageshack.us/img402/1530/pagedu8.jpg" rel="nofollow noreferrer">alt tex...
<p>Frames are an absolute no-no. There is no benefit to frames that can't be achieved using other techniques.</p> <p>Does that mean you must use AJAX? Not necessarily. AJAX is a perfectly good solution if you feel the need to provide a rich, seamless interface, but it's not strictly necessary.</p> <p>You could use se...
<p>DO NOT uses frames (or iframes for that matter) unless you <em>absolutely</em> must...</p> <p>The only valid reasons I can think of to use (i)frames is file upload controls in fact, and I am not sure it's valid there either...</p>
31,569
<p>I'm an Information Architect and JavaScript developer by trade nowadays, but recently I've been getting back into back-end coding again. And, whilst trying to get an HTML prototype integrated and working with our C#-based CMS, I've come to blows with our programmers over the HTML ID attributes being arbitrarily rew...
<p>The short answer is no, with webforms the id can always be rewritten depending on the nesting of the element. You can get access to the id through the ClientID property, so you could set the ids into variables in a script at the end of the page/control then put them into jQuery. </p> <p>something like this:</p> ...
<p>If you're using jQuery then you have loads of <a href="http://docs.jquery.com/Selectors" rel="nofollow noreferrer">CSS selectors and jQuery custome selectors</a> at your disposal to target elements on your page. So rather than picking out a submit button by it's id, you could do something like:</p> <pre><code>$('fi...
6,001
<p>I'm working on porting a Visual C++ application to GCC (should build on MingW and Linux).</p> <p>The existing code uses <code>__try { ... } __except(1) { ... }</code> blocks in a few places so that almost nothing (short of maybe out of memory type errors?) would make the program exit without doing some minimal logg...
<p>try { xxx } catch(...) { xxx } would be more portable but might not catch as much. It depends on compiler settings and environments.</p> <p>Using the default VC++ settings, asynchronous (SEH) errors are not delivered to the C++ EH infrastructure; to catch them you need to use SEH handlers (__try/__except) instead....
<p>One way that is easy to use, portable, and barely use any resources would be to catch empty classes. I know this may sound odd at first, but it can be very useful.</p> <p>Here is an example I made for another question that applies for your question too: <a href="https://stackoverflow.com/questions/556255/how-to-thr...
6,027
<p>Is it currently possible to translate C# code into an Abstract Syntax Tree?</p> <p>Edit: some clarification; I don't necessarily expect the compiler to generate the AST for me - a parser would be fine, although I'd like to use something "official." Lambda expressions are unfortunately not going to be sufficient giv...
<p>The <a href="http://msdn.microsoft.com/en-us/roslyn" rel="noreferrer">Roslyn</a> project is in Visual Studio 2010 and gives you programmatic access to the <a href="http://msdn.microsoft.com/en-us/hh543916" rel="noreferrer">Syntax Tree</a>, among other things. </p> <pre><code>SyntaxTree tree = SyntaxTree.ParseCompil...
<p>Please see the R# project (sorry the docs are in Russian, but there are some code examples). It allows AST manipulations on C# code.</p> <p><a href="http://www.rsdn.ru/projects/rsharp/article/rsharp_mag.xml" rel="nofollow noreferrer">http://www.rsdn.ru/projects/rsharp/article/rsharp_mag.xml</a></p> <p>Project's SV...
26,234
<p>I have a function that looks like this</p> <pre><code>class NSNode { function insertAfter(NSNode $node) { ... } } </code></pre> <p>I'd like to be able to use that function to indicate that the node is being inserted at the start, therefore it is after <em>nothing</em>. The way I think about that is...
<p>sure, just set a default "null"</p> <pre><code>function(NSNode $node = null) { // stuff.... } </code></pre> <p>result being:</p> <pre><code>$obj-&gt;insertAfter(); // no error $obj-&gt;insertAfter(new NSNode); // no error $obj-&gt;insertAfter($somevar); // error expected NSNode </code></pre>
<p>No, you can't pass something else to the function as that defeats the purpose of the static typing. In this situation, something like C# nullable would be nice i.e. NSNode?</p> <p>I'd suggest creating NSNode::insertFirst() although I think that you have it the wrong way round, why is a node inserting itself, shoul...
21,865
<p>I'm using firefox3 to run a Java Applet (on Linux). normally, when the JVM launches the Java Console window opens so I can see output from the Applet (stack traces etc.).</p> <p>However, if I <em>close</em> the console there appears to be no way of getting it back short of restarting Firefox (I have to close the co...
<p>I have the Web developer add-on, so pressing Ctrl-Shift-O opens the Java console. (Firefox 3 on Ubuntu)</p>
<p>I also have the Web Developer add-on, but I couldn't get it to open the Java Console, so now I right click the Java icon in the task bar and click "Open Console" and that does it for me.</p>
10,611
<p>What are the best open source (open source and commercial) reporting tools for ASP.NET similar to Crystal Reports for ASP.NET?</p>
<p>Microsoft Reporting Services, <strong>free</strong> and included with SQL Server 2005 and 2008.</p> <p>Of course, this is great if you need a separation of report design and application, which for Enterprise applications is a huge plus.</p> <p>However, if what you want is to be able to create "in application" dash...
<p>As much as I despise Crystal Reports (we describe digging deep into it the seven layers of Crystal hell) -- it seems to be the best/most-flexible tool for the job. I hope someone comes along and knocks them off the block though. </p> <p>Microsoft Reporting Services is an alternative, but didn't have the features we...
4,352
<p>How can I prevent the user from being able to resize an image in designMode? (disable the handles when image is clicked)</p>
<p>Say you turn contentEditable on like this:</p> <pre><code>document.body.contentEditable = true; </code></pre> <p>All you have to do is turn it off for all (or some) images.</p> <pre><code>var imgs = document.getElementsByTagName("IMG"); for (var i = 0; i &lt; imgs.length; ++i) { imgs[i].contentEditable = fals...
<p>I cannot comment and vote yet so... according to nmb.ten's answer, you have to use:</p> <pre><code>document.execCommand("enableObjectResizing", false, false); </code></pre> <p><strong>But</strong> it works <strong>only after</strong> your content is filled in (I mean if you have to edit some text saved before).</p...
36,856
<p>I want to export the contents of several tables from MSAccess2003. The tables contain unicode Japanese characters. I want to store them as tilde delimited text files.</p> <p>I can do this manually using File/Export and, in the 'Advanced' dialog selecting tilde as Field Delimiter and the Unicode as the Code Page.</...
<p>I have eventually solved this. (I am now using Access 2007 but had the same problems as with Access 2003.)</p> <p>First, what didn't work:</p> <p>TransferText would only make the Header Row unicode and tilde delimited, even with a correctly formatted schema.ini. (No, I didn't put it all on one line, that was just ...
<p>I've got part of the answer:</p> <p>I'm writing a schema.ini file with VBA, then doing my TransferText. This is creating an export format on the fly. The only problem is, although my schema.ini contains:</p> <pre><code>ColNameHeader = True CharacterSet = Unicode Format = Delimited(~) </code></pre> <p>Only the hea...
19,408
<p>I have started printing about a month ago on an Ender 5 (using mostly PLA but recently also PETG) and it seems it's about time to give the print bed a more thorough cleaning than what I usually do after most prints. I'm using the flexible magnetic mat that came with the printer which has a slightly rough surface, bu...
<p>I have the WhamBam system which uses a PEX layer over flex steel (which sticks to a magnetic sheet on the printer bed). To clean old material off, I use a "brass sponge" intended for cleaning soldering iron tips to remove the old plastic, then give it a wipe with a paper towel with some isopropyl alchohol (I have 99...
<p>I have the WhamBam system which uses a PEX layer over flex steel (which sticks to a magnetic sheet on the printer bed). To clean old material off, I use a "brass sponge" intended for cleaning soldering iron tips to remove the old plastic, then give it a wipe with a paper towel with some isopropyl alchohol (I have 99...
1,396
<p>I'm getting some really wierd linking errors from a class I wrote. I am completely unable to find anything that will describe what is happening. </p> <p>Visual Studio (Windows XP)</p> <blockquote> <p>players.obj : error LNK2019: unresolved external symbol "public: __thiscall TreeNode::TreeNode(void)" (??0?$TreeN...
<p>When you define your template in a .cpp file, you have to explicitly instantiate it with all the types / template parameters known the template will be used beforehand like this (put it in the .cpp file):</p> <pre><code>template class TreeNode&lt;Player&gt;; </code></pre> <p>If you don't know with which template p...
<p>Are you forgetting to link the object file containing the function bodies for your class functions?</p> <p>E.g. you'd have something like this in a .cpp:</p> <pre><code>TreeNode::TreeNode() : /* initializers here */ { // ... } TreeNode::~TreeNode() { // ... } </code></pre>
40,223
<p>Is there a way to resize a <code>std::vector</code> to lower capacity when I no longer need previously reserved space?</p>
<p>Effective STL, by Scott Meyers, Item 17: Use the <code>swap</code> trick to trim excess capacity.</p> <pre><code>vector&lt;Person&gt;(persons).swap(persons); </code></pre> <p>After that, <code>persons</code> is "shrunk to fit".</p> <p>This relies on the fact that <code>vector</code>'s copy constructor allocates o...
<p>You're looking for an equivalent of <a href="http://doc.qt.io/qt-4.8/qvector.html#squeeze" rel="nofollow noreferrer">QVector::squeeze</a> and I'm afraid it doesn't exist explicitely in the STL. Go for Sébastien's answer if it is correct for your STL implementation.</p>
31,552
<p>I have an Internet Explorer only web application.</p> <p>I'm exploring what we can do to automate the testing. </p> <p>Selenium looks like a good tool, but to be able to activate links etc. I need to tell it where they are. The application wasn't built with this kind of testing in mind, so there generally aren't <...
<p>I would use bookmarklets. I have one XPath related, but I don't know if it works in IE. I gotta go but I will test it and give it if it works on IE.</p> <p>Two bookmarklet sites for Web developers from my bookmarks: <a href="http://subsimple.com/bookmarklets/collection.asp" rel="noreferrer" title="My bookmarklets">...
<p>Since bookmarklet use puzzled Paul, I though I should add a little introduction to their usage. I do it in a separate message to avoid mixing stuff.</p> <p>Bookmarklets (also called favlets) are little JavaScript scripts (sic) designed to be pasted in the address bar of the browser (like any other URL) and thus to ...
26,412
<p>I've just started tinkering with XML manipulation with PHP, and i've stumbled into something unexpected. Here's the XML i'm using as a test input:</p> <pre><code>&lt;list&gt; &lt;activity1&gt; running &lt;/activity1&gt; &lt;activity2&gt; swimming &lt;/activity2&gt; &lt;activity3&gt; soccer &lt;/activity...
<p>The first <em>node</em> is the text (in this case whitespace) between the opening list tag and activity1 tag, the next <em>node</em> is the activity1 <em>element</em>. elements are not the same as nodes.</p>
<p>A note on Czimi's answer: removing whitespace-only nodes will not prevent you from having to check the type of node (whether it is an element, a text node, a comment...). In general if you're interested in only selecting element nodes, you'll want to do something like this:</p> <pre><code>while($nodeInQuestion-&gt;...
23,518
<p>I have a ClickOnce environment like this:</p> <p><code>\\Fileserver\ClickOnceApps\App1.application</code></p> <p><code>C:\Documents and Settings\user\Start Menu\Programs\publisher\app1.appref-ms</code></p> <p>My understanding is the .apppref-ms file is a glorified link to the app.application file. Does it do anythin...
<p>If you open the appref-ms file in a text editor you'll see it contains the Url for the application, culture, processor architecture and key used to sign the application, so yes, it's just a link.</p> <p>The difference between those "Application Reference" files and shortcuts (.lnk) is that the application reference...
<p>If you open it and then open task manager then right click the task, open file location and it'll take you (most times) directly to the actual .exe </p>
35,575
<p>Any suggestions? Using visual studio in C#.</p> <p>Are there any specific tools to use or methods to approach this?</p> <h3>Update:</h3> <p>Sorry, I should have been a little more specific. I am using ASP.Net 2.0 and was looking more for a tool like jUnit for Java. I took a look at NUnit and NUnitAsp and that looks...
<p>Boy, that's a pretty general question. I'll do my best, but be prepared to see me miss by a mile.</p> <p>Assumptions</p> <ol> <li>You are using ASP.NET, not plain ASP</li> <li>You don't really want to test your web pages, but the <strong>logic</strong> behind them. Unit testing the actual .ASPX pages is rather pa...
<p>There was a screencast series a year or so ago on Polymorphic Podcast that did a pretty good intro walkthrough of an MVP implementation in ASP.NET. Implemented this way, unit tests fall into place much more naturally.</p> <p><a href="http://polymorphicpodcast.com/shows/mv-patterns/" rel="noreferrer">http://polymor...
2,637
<p>I'd like to automatically login to VSS when I open it, and skip the login prompt altogether. Is this possible?</p>
<p>Yes, you can append the -Y command line switch:</p> <p><a href="http://msdn.microsoft.com/en-us/library/edy95zhk(VS.80).aspx" rel="noreferrer">MSDN Documentation</a></p>
<p>If your user-login name is the same as your "network" name (in my case, my Windows user name), my experience is that I don't have to be prompted for the log in. My VSS 6.0 server machine has an account for my name, and my VSS 6.0 client machine has the same (non-administrative) account from which I do development. ...
42,671
<p>For example in C# or in JavaScript documents.<br> If not, is there point in using <a href="http://en.wikipedia.org/wiki/Javadoc" rel="nofollow noreferrer">Javadoc</a> comments in ASP.NET programming?</p>
<p>I'm pretty sure the answer to that is no, it won't. Why would you use Javadoc style comments rather than the XML comments? The XML comments will be automatically displayed by the Intellisense engine and also allow you to create external docs through tools like SandCastle.</p>
<p>Scott is correct, you should use the native XML comments to get the intellisense you are looking for. As far as Javascript intellisense, I think you need to create a special .js file (either manually or dynamically) with xml comments for this and then reference it within your .js files. Most .js libraries include ...
26,935
<p>I'm trying to dynamically hide certain DIV's when a print (or print preview) occurs from the browser.</p> <p>I can easily differentiate statically by having two style sheets, one for normal and one for print media: </p> <p>But I need to go one step further and hide some elements dynamically when the print style s...
<p>Not all browsers allow you to capture the print event. I've seen this tackled by adding a 'print this page' link and then using that click event to accomplish what you need.</p>
<p>There's an <a href="http://msdn.microsoft.com/en-us/library/ms536906(VS.85).aspx" rel="nofollow noreferrer">onbeforeprint</a> event in IE. It doesn't appear to be supported by other major browsers. (I tested Firefox 3.0.3 and Safari 3.1.2.)</p>
23,189
<p>I've got a rails application where users have to log in. Therefore in order for the application to be usable, there must be one initial user in the system for the first person to log in with (they can then create subsequent users). Up to now I've used a migration to add a special user to the database.</p> <p>Afte...
<p>Try a rake task. For example:</p> <ol> <li>Create the file <strong>/lib/tasks/bootstrap.rake</strong></li> <li>In the file, add a task to create your default user:</li> </ol> <pre><code> namespace :bootstrap do desc "Add the default user" task :default_user => :environment do User.create( ...
<p>Some of the answers are outdated. Since Rails 2.3.4, there is a simple feature called Seed available in <code>db/seed.rb</code> :</p> <pre><code>#db/seed.rb User.create( :name =&gt; 'default', :password =&gt; 'password' ) Comment.create( :title =&gt; 'Title', :body =&gt; 'First post!' ) </code></pre> <p>It provide...
8,756
<p>I have a form that kicks off a Response.Redirect to download a file once complete. I also want to hide the form and show a 'thank you' panel before the redirect takes place, however it seems the asp.net engine just does the redirect without doing the 2 tasks before in the following code:</p> <pre><code>if (success...
<p>You need some client side code to do the redirect.</p> <p>My preference would be to embed some javascript to do the redirect.</p> <p>So, hide the form, display the message, and (at the crudest level) use a literal control to add some text like this to the page.</p> <pre><code>&lt;script&gt; location.href = "h...
<pre><code>if (success) { lblSuccessMessage.Text = _successMessage; showMessage(true); } else { lblSuccessMessage.Text = _failureMessage; showMessage(fa...
25,541
<p>I'm curious as to the best route (more looking towards simplicity, not speed or efficiency) to sort a DropDownList in C#/ASP.NET - I've looked at a few recommendations but they aren't clicking well with me.</p> <p>Edit: Folks, I do not have control over how the data comes into the DropDownList - I cannot modify t...
<p>If you get a DataTable with the data, you can create a DataView off of this and then bind the drop down list to that. Your code would look something like...</p> <pre><code>DataView dvOptions = new DataView(DataTableWithOptions); dvOptions.Sort = "Description"; ddlOptions.DataSource = dvOptions; ddlOptions.DataText...
<p>You may not have access to the SQL, but if you have the DataSet or DataTable, you can certainly call the <code>Sort()</code> method.</p>
27,463
<p>I have two services and am sending pretty chunky messages between them (~100kb). Though the previously mentioned value is typical of the size of the message, it is possible for it to fluctuate greatly (in both positive and negative directions).</p> <p>Thus, to deal with such situations where i have to transport a sw...
<p>well this problem seems to have resolved itself (suddenly after never complaining before, WCF started getting upset about a certain value in the app.config, changed that and it seemed to work then!)</p> <p>however now i have an equally strange problem! for somre reason it refuses to accept that i have configured me...
<p>There are ocassional problems with WCF that will cause it to fail "silently" (i.e. no exception) which can be hard to debug. Sounds like this might be the case you're seeing.</p> <p>In this case, <a href="http://msdn.microsoft.com/en-us/library/ms733025.aspx" rel="nofollow noreferrer">enabling the tracing options</...
48,207
<p>How can I achieve a cool looking photo gallery page? I don't know Flash, but can learn, and thought about a random collage that 'pulls out' a photo that you hover over.</p> <p>It's for a photographer, so no thumbnails, grids, etc.</p>
<p>If you're looking for a tool that's pretty flexible and will support itself later on as you can just train the user to work with it check out <a href="http://jalbum.net/" rel="nofollow noreferrer">JAlbum</a>.</p> <p>To work on integrating this yourself you can check out <a href="http://www.aspphotogallery.net/" rel...
<p>There are dozens of off the shelf apps available. Gallery, Wordpress (after configuration), and a few ASP.Net based ones. Flash is certainly not required.</p> <p>That said, in order to learn a bit about Pylons, I wrote my own <a href="http://photo.krazyyak.com" rel="nofollow noreferrer">basic photo blog</a>. If you...
34,309
<p>Below is a stored procedure to check if there is a duplicate entry in the database based upon checking all the fields individually (don't ask why I should do this, it just has to be this way). </p> <p>It sounds perfectly straightforward but the SP fails. The problem is that some parameters passed into the SP may ha...
<p>I think you need something like this for each possibly-null parameter:</p> <pre><code>AND (aCode = @aCode OR (aCode IS NULL AND @aCode IS NULL)) </code></pre>
<p>I would first add a check to see if all of the parameters were null at run time, i.e., </p> <pre><code>IF(COALESCE(@userId, @noteType, @aCode, @bCode, @cCode) IS NULL) BEGIN -- do something here, log, print, return, etc. END </code></pre> <p>Then after you've validated that the user passed something i...
49,914
<p>So I wrote buggy code that occasionally crash ... and creates a stackdump file.</p> <p>Using <a href="https://man7.org/linux/man-pages/man1/addr2line.1.html" rel="nofollow noreferrer">addr2line</a> I can figure out how the program got to the crash point by decoding the addresses from the stackdump one by one. Is the...
<p>You can instruct Cygwin to start your gdb debugger just in time when an fault occurs. To achieve this, add <code>error_start=action</code> to the Cygwin environment variable:<br> <code>export CYGWIN="$CYGWIN error_start=gdb -nw %1 %2"</code></p> <p>Else you can have Cygwin generate a real core dump.<br> <code>expor...
<p>Firstly, make sure you build with source debugging enabled (the using -g option):</p> <pre><code>gcc -g -o myfile myfile.c </code></pre> <p>Then Load the dump into gdb after the crash (or insight, or ddd)</p> <pre><code>gdb myfile core </code></pre>
41,385
<p>I'm writing a string containing some XML via System.Xml.XmlWriter. I'm stuck using WriteString(), and from the documentation:</p> <blockquote> <p>WriteString does the following: The characters &amp;, &lt;, and > are replaced with &amp;amp;, &amp;lt;, and &amp;gt;, respectively.</p> </blockquote> <p>I'd like t...
<p>Try wrapping your real content between the CDATA tags:</p> <p>&lt;![CDATA[ <strong>it's my content</strong> ]]&gt;</p>
<blockquote> <p>I'm stuck using WriteString(),</p> </blockquote> <p>I think that's the root of your problem. Can you explain more about your reason you're stuck using WriteString? My gut is you're using the wrong method for what you want to do</p>
9,199
<p>I've got a Perforce server set up, and installed the P4V client. I've created a new depot and a new workspace. Per the documentation, I've mapped the workspace to the depot. So far so good.</p> <p>I now have a .SQL script that was created by an external application that I wish to check in for the first time. I ...
<p>I think your problem is likely to be with the mappings. This is a reasonably common issue.</p> <p>Taking your details</p> <pre><code>Workspace root: C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666 File dir under root: C:\Documents and Settings\wtansill\Perforce\wtansill_localhost_1666\tunnel_...
<p>Are you sure your filespec includes the directory you have added your file in?</p> <p>Perhaps you could post your ClientSpec, and the directory in which your file is located?</p>
33,513
<p>When beginning a new web project, i'm always a bit worried about removing pieces of the web.config. It seems there are more entries than ever with Net 3.5 SP1.</p> <p>Which bits of the .config do you delete for the following scenarios:</p> <ul> <li>WCF Web Service, no Javascript support</li> <li>Simple MVC Websit...
<p>I usually just delete items from the web.config until things break -- a process of trial and error.</p> <p>It's astonishing how much of web.config you can remove without affecting anything. It's gotten quite crufty in .NET 3.5.</p>
<p>Largely agree with Jeff that it is a process of trial and error as to what you can remove from the file. </p> <p>In terms of tweaking the runtime and the http pipeline, it can often be a process of adding things to the web.config, in order to turn things off.</p> <p>The out of the box configuration adds a lot of m...
33,536
<p>Let's say I have an integer that I need to convert to a string (I might be displaying the value to the user by means of a TextBox, for example.</p> <p>Should I prefer <code>.ToString()</code> or <code>Convert.ToString()</code>. They both do the same thing (don't they?).</p> <pre><code>int someValue = 4; // You ca...
<p>One test is </p> <pre><code>//This will set the variable test to null: string test = Convert.ToString(ConfigurationSettings.AppSettings["Missing.Value"]); //This will throw an exception: string test = ConfigurationSettings.AppSettings["Missing.Value"].ToString(); </code></pre> <p>Got the above ready example from ...
<p>With its large number of overloads, Convert.ToString() is useful as a catch-all for all sorts of input types, handy when you are dealing with a potential range of types. If you know that your input is definitely an "int", I would use the ToString() method on it directly (that's what Convert.ToString() is going to b...
42,242
<p>How do I make a backup of a PLSQL db?</p>
<p>The question is do you really want to do it from PL/SQL?</p> <p>Assuming you are using an oracle DB they have commands that will dump your DB into a file. It is dumped in such a way that the DB (tables and all) can be re-created from scratch (so you can re-create a secondary backup [not that I would recommend this ...
<p>When I do physical backups I use RMAN, not PL/SQL, since it's THE tool for this kind of job. However, here's a link that maybe can help you. <a href="http://psst0101.wordpress.com/2008/01/23/move-a-tablespace/" rel="nofollow">http://psst0101.wordpress.com/2008/01/23/move-a-tablespace/</a></p>
47,735
<p>How would you go about producing reports by user selected date ranges in a rails app? What are the best date range pickers? </p> <p>edit in response to patrick : I am looking for a bit of both widget and active record advice but what I am really curious about is how to restfully display a date ranged list based on...
<p>Are we asking an interface question here (i.e. you want a widget) or an ActiveRecord question?</p> <h1>Date Picking Widgets</h1> <p>1) <strong>Default Rails Solution</strong>: See <code>date_select</code> documentation <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/DateHelper.html" rel="noreferrer...
<p>It's not an unRESTful practice to have URL parameters control the range of selected records. In your index action, you can do what Patrick suggested and have this: </p> <pre><code> #initialize start_date and end_date up here, by pulling from params probably @models = SomeModel.find(:all, :conditions =&gt; ['date...
16,767
<p>Internet Explorer 8 breaks what must be every 3rd page I look at. The point of this early release was, I presume, to give website owners the chance to update their sites so it wouldn't be such a hassle for the final release.</p> <p>Has anyone actually done this?</p> <p>Is anyone even planning on doing this?</p> <...
<p>I've developed a site with IE8 compatibility as a requirement, and it wasn't a problem as long as I tested in IE8 from the beginning. IE8's standards are very close to most other standards compliant browsers at this point.</p> <p>If you can't (or won't) do that, you can usually get your page or site working in IE8 ...
<p>Well, stadards are pretty much a myth. Ther is no one true standard. If you don't believe me, then just read <a href="http://www.joelonsoftware.com/items/2008/03/17.html" rel="nofollow noreferrer">Joel's article</a> on the subject.</p>
13,812
<p>I am considering creating my own website using Java and am trying to decide what framework to use. However, doing a quick search for Java frameworks returns more than 50 to choose from!</p> <p>My website is just going to be for my own enjoyment of building it in the beginning, but if it becomes popular, it would be...
<p>I've used <a href="http://tapestry.apache.org/tapestry3/" rel="noreferrer">Tapestry 3</a>, <a href="http://wicket.apache.org/" rel="noreferrer">Wicket</a>, <a href="http://echo.nextapp.com/site/" rel="noreferrer">Echo</a>, and <a href="http://www.oracle.com/technetwork/java/javaee/javaserverfaces-139869.html" rel="n...
<p>Can't believe no one has mentioned GWT</p>
4,423
<p>What is the practical benefit of using HTTP GET, PUT, DELETE, POST, HEAD? Why not focus on their behavioral benefits (safety and idempotency), forgetting their names, and use GET, PUT or POST depending on which behavior we want?</p> <p><strong>Why shouldn't we only use GET, PUT and POST (and drop HEAD, DELETE)?</st...
<p>The [REST][1] approach uses POST, GET, PUT and DELETE to implement the CRUD rules for a web resource. It's a simple and tidy way to expose objects to requests on the web. It's web services without the overheads.</p> <p>Just to clarify the semantic differences. Each operation is rather different. The point is to...
<p>The web server war from the earlier days probably caused it.</p> <p>In <a href="https://www.rfc-editor.org/rfc/rfc1945#section-8" rel="nofollow noreferrer">HTTP 1.0 written in 1996, there were only GET, HEAD, and POST</a>. But as you can see in <a href="https://www.rfc-editor.org/rfc/rfc1945#appendix-D.1" rel="nofol...
17,723
<p>How can I get all implementations of an interface through reflection in C#?</p>
<p>The answer is this; it searches through the entire application domain -- that is, every assembly currently loaded by your application.</p> <pre><code>/// &lt;summary&gt; /// Returns all types in the current AppDomain implementing the interface or inheriting the type. /// &lt;/summary&gt; public static IEnumerable&...
<p>Do you mean all interfaces a Type implements?</p> <p>Like this:</p> <pre><code>ObjX foo = new ObjX(); Type tFoo = foo.GetType(); Type[] tFooInterfaces = tFoo.GetInterfaces(); foreach(Type tInterface in tFooInterfaces) { // do something with it } </code></pre> <p>Hope tha helpts.</p>
10,568