instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I recently heard that the 3D printing lab at my college can do fused-deposition with ABS and PLA, but I would like to use TPU, for greater flexibility.</p>
<p>Is it possible to feed a TPU filament into the same machine built for ABS/PLA? Or is there no difference? Assume the diameters of the filaments are the same.... | <blockquote>
<p>Is it possible to feed a TPU filament into the same machine built for ABS/PLA? Or is there no difference? Assume the diameters of the filaments are the same.</p>
</blockquote>
<p>The question is not what the machine is <em>built for</em> but <em>how</em> it is built. Let's break stuff down some into why... | <p>Most printers can print most filaments. However, some more exotic filaments are not suitable for all printers:</p>
<ul>
<li><p>To print a flexible filament such as TPU, the filament path from the extruder needs to be well-constrained. A bowden extruder is generally less good at handling flexible filaments than a di... | 1,680 |
<p>I am making a simple game in order to learn a new language. I am in the process of collecting some music for the game and would like to use the MIDI format so that I can control the flow of the track (i.e., I would like to have an introduction that only plays once and does not play again when the song loops.)</p>
... | <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=6E938A6E-B383-466B-A3EE-5A655BF5DB8C&displaylang=en" rel="nofollow noreferrer">DirectMusicProducer</a> is probably your best free option if you are playing using DirectMusic. I don't believe the MIDI record feature will include control changes, bu... | <p>try looking in the <a href="http://www.midi.org/about-midi/specinfo.shtml" rel="nofollow noreferrer">Midi 1.0 spec</a></p>
<p>Here's a table of the <a href="http://www.midi.org/about-midi/table3.shtml" rel="nofollow noreferrer">control change messages</a> though it looks like you're looking for a way to do this in ... | 5,420 |
<p>I have a MS SQL DB with various tables, and one field in particular is causing me grief.</p>
<p>The Data type is set to varchar(100), however the field is limited to 60 characters.</p>
<p>If I try to put any string with more than 60 characters into the field I get an exception,
"String or binary data would be trun... | <p>Perhaps you need NVARCHAR(100) or rather NVARCHAR(60).</p>
<p>Single character in the NVARCHAR is double the size of VARCHAR. You would use NVARCHAR if your input data is unicode</p>
<p><strong>EDIT:</strong></p>
<p>Based on your comments it looks like using nvarchar is not necessary a solution to the problem, an... | <p>Perhaps you need NVARCHAR(100) or rather NVARCHAR(60).</p>
<p>Single character in the NVARCHAR is double the size of VARCHAR. You would use NVARCHAR if your input data is unicode</p>
<p><strong>EDIT:</strong></p>
<p>Based on your comments it looks like using nvarchar is not necessary a solution to the problem, an... | 44,212 |
<p>I am currently publishing code behind .aspx in SharePoint. I can automatically publish the .dll to the bin folder of the virtual directory, but I cannot figure out how to push the .aspx pages and images to the server without manually using SharePoint Designer.</p>
<p>Where does the folder exist?</p>
<p>Or do I nee... | <p>If both servers would be on Linux you could use <a href="http://samba.anu.edu.au/rsync/" rel="noreferrer">rsync</a> for any kind of files (php, xml, html, binary, etc). Even if one of them will be Windows there are rsync ports to Windows.</p>
| <p>I had some similar situation.
After some tries, I did some thing different</p>
<p>We have 2 servers,
a (that have the original files)
b (files should moved to it)</p>
<p>And for sure the data is NOT sensitive</p>
<p>Now in server a I made a file to do the following when called:
1. Choose the file to move
2. Zip ... | 30,353 |
<p>I've got a bunch of unit tests built using Visual Studio 2005's built-in unit testing functionality. For the last little while, it's been taking absolutely <i>forever</i> to start the tests... Everything just sits there at "Pending" for two minutes or more. Now Visual Studio's decided to take things to a new level... | <p>Is your computer name UPPERCASE? change it to lower case and try it again.</p>
| <p>Let me say this MS TEST is not a professional product and should be avoided whenever possible. If you want to use a good testing framework then use MBUnit with TestDriven.NET. MBUnit comes with many new attributes including RollBack and RowTest , Row. </p>
<p>Also, TestDriven.NET will allow you to debug your unit t... | 22,938 |
<p>I have a simple "accordion" type page containing a list of H3 headers and DIV content boxes (each H3 is followed by a DIV). On this page I start with all DIVs hidden. When a H3 is clicked the DIV directly below (after) is revealed with jQuery's <a href="http://jquery.com/api/#slideDown" rel="nofollow noreferrer">"... | <p>You can use the !important clause in CSS. This will override the inline style.</p>
<p>So if you setup a print media stylesheet - you can do something like</p>
<pre><code>div.accordian { display:block !important; }
</code></pre>
| <p>Yes.</p>
<p>On load add a class (e.g. "hideme") to all relevant DIVs like so:</p>
<pre><code>$('div#accordion> div').addClass('hideme');
</code></pre>
<p><em>NB: This means that the accordion degrades fine when JavaScript is disabled.</em></p>
<p>In this way you can have your regular stylesheet specify the "h... | 22,506 |
<p>I've got a particular SQL statement which takes about 30 seconds to perform, and I'm wondering if anyone can see a problem with it, or where I need additional indexing.</p>
<p>The code is on a subform in Access, which shows results dependent on the content of five fields in the master form. There are nearly 5000 re... | <p>Two things. Since this is an Access database with a SQL Server backend, you may find a considerable speed improvement by converting this to a stored proc.</p>
<p>Second, do you really need to return all those fields, especially in the tabCustomers table? Never return more fields than you actually intend to use and ... | <p>How many rows are in QryAllTransactons?</p>
<p>If your result returns 0 rows then Access may be able to see that immediately and stop, but if it returns even a single row then it needs to pull in the entire resultset of QryAllTransactons so that it can do the join internally. That would be my first guess as to what... | 35,573 |
<p>I'm a bit perplexed by drag and drop in wxPython (but perhaps this questions pertains to drag and drop in other GUI frameworks as well). The frameworks provides a couple of callbacks (OnEnter and OnDragOver) that purportedly allow me to inform the system whether the current mouse position is a valid place to drop wh... | <p>@Geoff- </p>
<p>The system, which has been in production for 8+ years, was architected to use PL/SQL for the CRUDs and <em>most</em> of the business logic. The PL/SQL also generates 90% of the presentation layer (HTML/JavaScript), using <a href="http://www.orafaq.com/wiki/Mod_plsql_FAQ" rel="nofollow noreferrer">... | <p>I wonder why you don't want to bring the data from Oracle into some application code and make JSON there?</p>
| 4,624 |
<p>Wanna write a RegEx to validate a driving license. </p>
<p>if it doesn't start with (US, CA, CN) then it has to be followed with XX and after that with any number of Alpha numeric letters. </p>
<p>So for example if the driving license starts with GB then it has to be followed with XX
GBXX12345363
However if it sta... | <p>Remember not everyone is familiar with that driving license notation, I'm assuming that what follows is the precise specification (you should really try to be very precise when asking for a regex else you'll get things you don't want):</p>
<ul>
<li>Has to start with two capital letters</li>
<li>If those first two l... | <pre><code>/^(?:(?:US|CA|CN)\w+|[[:alpha:]]{2}XX\w+)$/
</code></pre>
<p>I'm not sure if there's more validation that can be done, but this is what I get from what you wrote, not your examples (which seem to imply four letters followed by numbers).</p>
| 30,250 |
<p>I have a simple web page that till now didn't need any login. It is programed with Perl CGIs.</p>
<p>I would like to know the steps to add session support in order to have the login information available.</p>
<p>I don't want very complicated methods, because the web page is very simple.</p>
<p>Also I want some re... | <p>I used CGI::Session many, many moons ago.</p>
<p><a href="http://metacpan.org/pod/CGI::Session" rel="nofollow noreferrer">http://metacpan.org/pod/CGI::Session</a></p>
| <p>I've used <a href="http://metacpan.org/pod/Apache::Session" rel="nofollow noreferrer">Apache::Session</a> for session management:</p>
| 33,226 |
<p>I would like to be able to set "Extend my Windows desktop onto this monitor" via code. A PowerShell script would be ideal. WMI seems the way forward but I have zero knowledge in WMI.</p>
| <p>Windows 7, 8 and 10 are supposed to come with a small program that does exactly this: displayswitch.exe. <a href="http://jeffwouters.nl/index.php/2012/06/switch-your-display-through-the-command-line/" rel="noreferrer">This page</a> lists the following parameters:</p>
<pre><code>displayswitch.exe /internal Disconnec... | <p>I had to made some small modifications to get VonC's script to work on my machine. It is now a little more generic.</p>
<pre><code>;
; — toggle-screen2.au3
;
#include <WinAPI.au3>
; exec cpanel app `display settings`
Run(_WinAPI_ExpandEnvironmentStrings("%windir%") & "\system32\control.exe desk.cpl,@0,3?... | 34,662 |
<p>I would like to update a Windows Forms application to provide the following features:</p>
<ul>
<li>spell checking</li>
<li>limited formatting of text: bold, italics, bulleted lists</li>
</ul>
<p>Ideally the formatted text could be accessed in a plain text way for reporting through tools that don't support the form... | <p>You can add / create a drop-in spell checker for the Window Forms RichTextBox.</p>
<p>A ready to go <a href="http://www.c-sharpcorner.com/UploadFile/scottlysle/SpellCheckCC05152007084528AM/SpellCheckCC.aspx" rel="nofollow noreferrer">richtextbox</a> custom control with spell checking.
An app for <a href="http://ww... | <p>Windows Forms has a RichTextBox also. If you're in a Windows Forms application, it will be easier to incorporate that than incorporate the WPF control.</p>
| 20,588 |
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
namespace ConsoleApplication1
{
public class Class1
{
static void Main(string[] args)
{
List<Car> mylist = new List<Car>();
Car car1... | <p>Everything leppie said - plus:</p>
<pre><code>int index = mylist.FindIndex(p => p.id == 1);
if(index<0) {
mylist.Add(car3);
} else {
mylist[index] = car3;
}
</code></pre>
<p>This just uses the existing FindIndex to locate a car with id 1, then replace or add it. No LINQ; no SQL - just a lambda and <c... | <p>Just one question, why do I have to write a Update function for something that seems so basic for a list? There should be standard methods for Lists like Add(), Delete(), Edit(), Insert(), Replace() ....Find()</p>
| 47,238 |
<p>I'm trying to put several images together into one big image, and am looking for an algorithm which determines the placing most optimally. The images can't be rotated or resized, but the position in the resulting image is not important.</p>
<p>edit: added no resize constraint</p>
| <p>Possibly you are looking for something like this: <a href="http://www.alistapart.com/articles/magazinelayout" rel="nofollow noreferrer">Automatic Magazine Layout</a>.</p>
| <p>You are probably looking for <a href="http://en.wikipedia.org/wiki/Scale-invariant_feature_transform" rel="nofollow noreferrer">SIFT</a></p>
<p><a href="http://www.cs.ubc.ca/~lowe/keypoints/" rel="nofollow noreferrer">http://www.cs.ubc.ca/~lowe/keypoints/</a></p>
<p><a href="http://user.cs.tu-http://www.cs.ubc.ca/... | 15,272 |
<p>As we all know numbers can be written either in numerics, or called by their names. While there are a lot of examples to be found that convert 123 into one hundred twenty three, I could not find good examples of how to convert it the other way around.</p>
<p>Some of the caveats:</p>
<ol>
<li>cardinal/nominal or or... | <p>I was playing around with a PEG parser to do what you wanted (and may post that as a separate answer later) when I noticed that there's a very simple algorithm that does a remarkably good job with common forms of numbers in English, Spanish, and German, at the very least.</p>
<p>Working with English for example, yo... | <p>One place to start looking is the <a href="http://www.gnu.org/software/tar/manual/html_node/Date-input-formats.html" rel="nofollow noreferrer">gnu get_date lib</a>, which can parse <a href="http://php-date.com/#strtotime" rel="nofollow noreferrer">just about any</a> English textual date into a timestamp. While not e... | 9,556 |
<p>How do I use Perl to create graphs?</p>
<p>I'm running scheduled job that creates text reports. I'd like to move this to the next step (for the management) and also create some graphs that go along with this. Is this possible / feasible? It'd be great if I could do this using Office some how.</p>
<h2>update: s... | <p>GD and GD::Graph are probably your best bets, you can use them to create images that you can then embed into whatever you need.</p>
| <p><a href="http://search.cpan.org/dist/Spreadsheet-WriteExcel" rel="nofollow noreferrer">Spreadsheet::WriteExcel</a> will let you just get the data into Excel, then write Excel equations for the graphs.</p>
| 9,009 |
<p>What are the basic differences between a semaphore & spin-lock?</p>
<p>When would we use a semaphore over a spin-lock?</p>
| <p>Spinlock and semaphore differ mainly in four things:</p>
<p><strong>1. What they are</strong><br>
A <em>spinlock</em> is one possible implementation of a lock, namely one that is implemented by busy waiting ("spinning"). A semaphore is a generalization of a lock (or, the other way around, a lock is a special case o... | <p>A "mutex" (or "mutual exclusion lock") is a signal that two or more asynchronous processes can use to reserve a shared resource for exclusive use. The first process that obtains ownership of the "mutex" also obtains ownership of the shared resource. Other processes must wait for for the first process to release it's... | 23,803 |
<p>I have SBCL running on a Ubuntu machine. I want to write a little program that I want to give to a friend who has only Windows running. What is the quickest way to cross-compile it on my machine into a "standalone" windows program (i.e. the usual runtime+core combination)?</p>
| <p>SBCL is able to do a cross-compilation, but due to code being evaluated during the process, you need access to the target architecture. SBCL's build processed is well explained by Christophe Rhodes in <a href="https://research.gold.ac.uk/2336/1/sbcl.pdf" rel="nofollow noreferrer">SBCL: a Sanely-Bootstrappable Common... | <p>Cores are specific to a platform/version combination. Use Luís's method, or distribute with a different Lisp, such as CLisp.</p>
<blockquote>
<p>There is absolutely no binary compatibility of core images between different runtime support programs. Even runtimes built from the same sources at different times are ... | 29,459 |
<p>I am about to write an audio file converter for my side job at the university.<br>
As part of this I would need sample rate conversion. However, my professor said that it would be pretty hard to write a sample rate converter that was <em>both</em> of good quality <em>and</em> fast.</p>
<p>On my research on the subj... | <p>Try Secret Rabbit Code (= SRC = Sample Rate Conversion ) It's GPL, it's fast and it's high quality. <a href="http://www.mega-nerd.com/SRC/license.html" rel="noreferrer">http://www.mega-nerd.com/SRC/license.html</a></p>
| <p>If you're worried about quality, check out <a href="http://src.infinitewave.ca/" rel="nofollow noreferrer">http://src.infinitewave.ca/</a>. Very good comparisons on different resamplers.</p>
| 6,291 |
<p>In Ruby, trying to print out the individual elements of a String is giving me trouble. Instead of seeing each character, I'm seeing their ASCII values instead: </p>
<pre><code>>> a = "0123"
=> "0123"
>> a[0]
=> 48
</code></pre>
<p>I've looked online but can't find any way to get the original "0" ... | <p>Or you can convert the integer to its character value:</p>
<pre><code>a[0].chr
</code></pre>
| <p>I think <code>each_char</code> or <code>chars</code> describes better what you want.</p>
<pre><code>irb(main):001:0> a = "0123"
=> "0123"
irb(main):002:0> Array(a.each_char)
=> ["0", "1", "2", "3"]
irb(main):003:0> puts Array(a.each_char)
0
1
2
3
=> nil
</code></pre>
| 4,917 |
<p>Why do I need two of them? When I have to use one or another?</p>
| <p><a href="https://stackoverflow.com/a/43883/6571020">Quote by @DAC</a></p>
<blockquote>
<p>In short: SID = the unique name of
your DB, ServiceName = the alias used
when connecting</p>
</blockquote>
<p>Not strictly true. SID = unique name of the INSTANCE (eg the oracle process running on the machine). Oracle considers... | <p>As per Oracle Glossary : </p>
<blockquote>
<p>SID is a unique name for an Oracle database instance. ---> To switch
between Oracle databases, users must specify the desired SID <---. The
SID is included in the CONNECT DATA parts of the connect descriptors
in a TNSNAMES.ORA file, and in the definition of t... | 6,549 |
<p>I would love to re-use my failed prints by re-extruding the plastic to be used in the 3D printer once again. One thing that stands in my way is finding an effective way to shred the plastic into smaller bits for the extrude to use. What is a good thing to look for to accomplish this? Maybe a really big 'paper' shred... | <p>there is a project called <code>precious plastic</code> and there is a <a href="https://bazar.preciousplastic.com/en/listings/572981-star-international-shipping-star-shredder-kit" rel="nofollow noreferrer">plastic shredder</a>, but it is a rather expensive solution.</p>
<p>As I am waiting for parts for my <a href="h... | <p>there is a project called <code>precious plastic</code> and there is a <a href="https://bazar.preciousplastic.com/en/listings/572981-star-international-shipping-star-shredder-kit" rel="nofollow noreferrer">plastic shredder</a>, but it is a rather expensive solution.</p>
<p>As I am waiting for parts for my <a href="h... | 899 |
<p>The HR department at the company that I am currently working for has requested that I provide a system for storing employee social security numbers in our company database. The reason for this is to streamline payroll completion, as we use in-house software for employee timesheets but have to integrate with third-pa... | <p>I didn't see it mentioned anywhere, but is it necessary for this information to be online? If not, then you've secured one major avenue of attack by simply having this info stored in a database on a computer that's not connected to the internet. Or, if you can get away with having it stored on your LAN somewhere (so... | <p>Well, you haven't given any information on what you are going to do with these numbers. If you ever need to retrieve an SSN, then basically there's almost no point in doing anything with this - store it in clear. Any form of encryption where you have the ciphertext and key in the same place is going to only slow dow... | 31,805 |
<p>I was wondering if anyone knows of any libraries for programatically creating flash swf files. </p>
<p>Or for creating swf from svg.</p>
| <p>This sounds like a perfect job for <a href="http://swfmill.org/" rel="noreferrer" title="swfmill">swfmill</a> I think you'll find it will allow you to do both, convert SVG to SWF and to create SWF files from code.</p>
| <p>It's an early days project, so there may be some fiddling, but <a href="https://github.com/izb/Swiffotron" rel="nofollow">Swiffotron</a> can load, modify, generate and combine SWF files.</p>
| 24,396 |
<p>Am I missing something or is there truly no alternative (yet, I hope) to SVCUTIL.EXE for generating WCF Web service proxies? </p>
| <p>I would strongly suggest that you look through the auto generated configurations before just using them, the autogenerated stuff is full of garbage.
Try looking at this article by Miquel Castro: <a href="http://www.code-magazine.com/Article.aspx?quickid=0809101" rel="nofollow noreferrer">WCF the Manual Way... the Ri... | <p>If you're looking for a command-line alternative or standalone GUI then no - I don't know of any.</p>
<p>However, if you're wondering about usage while developing in VS, VS2008's add service reference is an alternative that can save you some headache.</p>
| 15,064 |
<p>There is two available Eclipse plugins for Maven :</p>
<ul>
<li><a href="http://www.eclipse.org/proposals/iam/" rel="noreferrer">Eclipse IAM</a> (old name is Q4E)</li>
<li><a href="http://m2eclipse.codehaus.org/" rel="noreferrer">m2eclipse</a></li>
</ul>
<p>m2eclipse seems to be the oldest but the more robust. Is ... | <p>I choose <strong>m2eclipse</strong> since it is stable and have all that I need. Especially ability to resolve dependencies inside workspace.</p>
<p>I tried the other one some time ago and didn't like it. It was to buggy so I gave up quickly.</p>
| <p>I am using m2eclipse ... thats the best and well documented too...</p>
| 39,251 |
<p>Is there a way to specify the font size for a class to be, say, 70% of the inherited font size?</p>
<p>I have a general "button" class that sets up my buttons with the appropriate borders, background, etc. I use it in multiple places, including one where the font size is fairly small and another where the font size... | <p>EMs do work like percentages in that the base font size is always 1em and .7em would be 70% of that (in the same way 1.2em would be equivalent of 120% of base font size). For this to work properly though you need to define a base font-size on the document body. Through experimentation I've found that font-size: 77%;... | <pre><code><input style="font-size: 70%" class="button" type="submit" value="Go">
</code></pre>
<p>?</p>
| 37,690 |
<p>My current view is no, prefer Transact SQL stored procedures because they are a lighter weight and (possibly) higher performing option, while CLR procedures allow developers to get up to all sorts of mischief.</p>
<p>However recently I have needed to debug some very poorly written TSQL stored procs. As usual I fou... | <p>There are places for both well-written, well-thought-out T-SQL and CLR. If some function is not called frequently and if it required extended procedures in SQL Server 2000, CLR may be an option. Also running things like calculation right next to the data may be appealing. But solving bad programmers by throwing in n... | <p>I would add a couple of reasons to use CLR that may not have been mentioned.</p>
<ul>
<li>Replace and extend basic query, non-query, and scalar sql functions.<br>
A) Error reporting and alerts can be integrated based upon defined requirements.
B) Easily define debugging levels.
C) Enable an easier way to interact w... | 8,259 |
<p>I am writing an application that is linked to Active Directory, and I need to store the userPrincipalName in a database table, but I do not know how big the field would need to be.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms680857(VS.85).aspx" rel="noreferrer">On MSDN</a>, no Length is given, and nei... | <p>On Win2k3 SP2 the longest userPrincipleName it allows me to create is 1013 characters long.</p>
| <p>no it's not possible to change the length of characters in Logon Name of Active directory.</p>
| 35,079 |
<p>What is the best design decision for a 'top-level' class to attach to an event to a class that may be '5+ layers down in the callstack?</p>
<p>For example, perhaps the MainForm has spawned an object, and that object has spawned a callstack of several other object calls. The most obvious way would be to chain the e... | <p>If your application isn't based on Composite UI Application Blocks, the easiest solution is to put a "listener" class between Main form and your other components which both classes can easily access. Conceptually, the classes are laid out as follows:</p>
<pre>
---------- ----------------
| MainForm... | <p>My initial intention would be to try and avoid that, so that an object's scope has obvious boundaries. In the particular case of Forms, I would attempt to have the child's parent form manage all required communications withs its ancestors. Can you be more specific about your case?</p>
| 44,928 |
<p>Is it only to allow logical grouping?</p>
| <p>It gives you flexibility. For example, you might have a bunch of constructors, some public, some protected, some private - wouldn't you want them all grouped together?</p>
| <p>My guess is that it is an outgrowth of the C philosophy, which assumes that you know what you are doing and gives you the maximum flexibility. It is like allowing a single = in an if statement.</p>
| 39,930 |
<p>In my understanding of Servlet, the Servlet will be instantiated by the Container, its <code>init()</code> method will be called once, and the servlet will live like a singleton until the JVM shuts down.</p>
<p>I do not expect my servlet to be serialized, since it will be constructed new when the app server recover... | <p>Technically, I believe the servlet container is allowed to "passivate" the servlet object to disk, in a similar way that EJB session beans can be. So you're correct to ask the question if your app will fail due to non-serializable fields.</p>
<p>In practise, I've never heard of a container doing this, so it's reall... | <p><strong>Serializable is used as a <em>marker interface</em> for session's attributes in distributed environment.</strong></p>
<blockquote>
<p><strong>SRV.7.7.2 Distributed Environments (JSR-154)</strong></p>
<p>Within an application marked as <strong>distributable</strong>, all requests that
are part of a ... | 21,686 |
<p>Hopefully (but not necessarily) one that is independent of language or framework?</p>
| <p>construct a normal to the vector (x1,y1)->(x2,y2). place it at the midpoint ((x1+x2)/2,(y1+y2)/2) and go out a distance h.</p>
<p>the normal will look like (-(y2-y1),x2-x1). make this a unit vector (<a href="http://en.wikipedia.org/wiki/Unit_vector" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Unit_vector... | <p>Al I can remember is that an isosceles triangle will have sides of equal length, and equal angles at the base. If you have the height, then you have the final coordinate because this will be the point of intersection, right?</p>
| 45,313 |
<p>In JavaScript is it wrong to use a try-catch block and ignore the error rather than test many attributes in the block for null?</p>
<pre><code>try{
if(myInfo.person.name == newInfo.person.name
&& myInfo.person.address.street == newInfo.person.address.street
&& myInfo.person.address.z... | <p>Yes. For one, an exception could be thrown for any number of reasons besides missing arguments. The catch-all would hide those cases which probably isn't desired.</p>
| <p>For the example given I would say it was bad practice. There are instances however where it may be more <strong>efficient</strong> to simply trap for an <strong>expected</strong> error. Validating the format of a string before <a href="https://stackoverflow.com/questions/104850/c-test-if-string-is-a-guid-without-thr... | 17,091 |
<p>I'm trying to come up with a way to determine how "hot" certain threads are in a forum. What criteria would you use and why? How would these come together to give a hotness score?</p>
<p>The criteria I'm thinking of include:</p>
<ul>
<li>how many replies</li>
<li>how long since the last reply</li>
<li>average time... | <p>Jeff Atwood has <a href="https://meta.stackexchange.com/questions/11602/what-formula-should-be-used-to-determine-hot-questions">a nice question</a> about this with a ton of information on other "hot" algorithms. I suggest using one of those and adapting it to your liking.</p>
| <p>I was thinking you could probably model it with diminishing waves here, using amplitude (or root mean square) to measure hotness. As time goes, the wave diminishes, and so a late reply will only cause a little stir.</p>
<p>In practice, I think this requires a lot of calculation. You could make good use of caching... | 49,952 |
<p>When a pointer goes out of scope, its memory is freed, so why are <code>destructor</code>s created in c++?</p>
| <p>If you're asking why C++ classes have destructors, some classes have requirements other than just freeing memory. You may have an object that's allocated a socket connection that needs to be shut down cleanly, for example.</p>
<p>Also, 'unscoping' a pointer does <em>not</em> free the memory that it points to since ... | <p>When ever there is a pointer(exist as class member),there should be a destructor for that class that should delete the object pointed by the pointer member.
If you have smart_pointer in place of pointer in class then there is no need of destructor.</p>
<p>below qn will help u understand better.
<a href="https://sta... | 47,667 |
<p>What is the best way to pass data between a C server to a Java applet? Currently it's done by using a buffer and copying bytes to it using memcpy, but if the object ever changes I have to hunt down every instance of where it's being sent to the applet and have it changed.</p>
<p>Is there a better way to pass object... | <p>You might want to take a look at <a href="http://code.google.com/p/protobuf/" rel="nofollow noreferrer">Protocol Buffers</a></p>
<p>They let you define structured data, then generate the code to read and write messages in any of the supported languages. The only catch is I think they only support C++ for now, thoug... | <p>I would have opened a socket connection between the two applications. You could serialize the object to an array of bytes and have the Java servlet deserialize it into a Java object with the same value. This way if the class definition changes, you only have to change the code in two places.</p>
| 35,734 |
<p>As we know that, with compute function of datatable we can get sum of columns.
But I want to get sum of a row of datatable.
I will explain with a example:</p>
<p>I have a datatable like image below: With compute function we can get the sum of each column (product). Such as for product1, 2 + 12 + 50 + 13= 77.</p>
... | <p><strong>LINQ to the rescue:</strong></p>
<pre><code>DataTable dt = WhateverCreatesDataTable();
DataRow dr = dt.Rows[0];
int sum = dt.Columns.Cast<DataColumn>().Sum(dc=>(int)dr[dc]);
</code></pre>
<p>For those still dragging their knuckles in the stone ages (aka pre-.Net 3.5 and LINQ):</p>
<pre><code>Data... | <p>We can use Datatable's Compute() function for the following purpose:</p>
<ul>
<li>To find sum.</li>
<li>To find max value.</li>
<li>To find min value.</li>
<li>To calculate average.</li>
</ul>
<p>Below links have detailed explaination of Datatable's compute() function:</p>
<p><a href="http://codevariation.blogspo... | 44,767 |
<p>The reason for me asking this question is:-</p>
<p>I get a real buzz out of discovering features in Visual Studio 2008 that end up saving me oodles of time every day. Recently found a blog by Sara Ford who grinds out a tip each day on her blog. </p>
<p>Am wondering what is the biggest time saving tip you can give ... | <p>A lot of features have been mentioned <a href="https://stackoverflow.com/questions/100420/hidden-features-of-visual-studio-2005-2008">here</a>... Especially <a href="http://blogs.msdn.com/saraford/archive/tags/Visual+Studio+2008+Tip+of+the+Day/default.aspx" rel="nofollow noreferrer">this</a> blog has loads of useful... | <p>Just the <strong>refactoring</strong> on context-menu alone...</p>
<p>edit: ++conditional breaks if that wasn't obvious</p>
| 43,221 |
<p>Is it possible to configure two separate web apps (WAR) in a J2EE application (EAR) to access a shared session context?</p>
<p>Further info:</p>
<p>I ended up creating a shared class from the EAR which stored the required information in static members. This did the trick, even if it seemed like a dirty hack.</p>
| <p>Not directly. Most containers put each WAR in a separate classloader with the EAR classloader as their parent. Each app's sessions are separate. You can put something provided by the parent EAR in each session. If you need them to share something, make it a EAR function.</p>
| <p>There is no "standard" solution to this. However, many application servers have their own extensions for this. WebSpere has a "Shared session context" option for example.</p>
<p>See here: <a href="http://publib.boulder.ibm.com/infocenter/wasinfo/v6r0/index.jsp?topic=/com.ibm.websphere.base.doc/info/aes/ae/tprs_shar... | 32,613 |
<p>I am a support engineer and our company's product allows XSLT transforms to customize outputs.</p>
<p>I made a xsl transform for this purpose. It works well for source files of typical size (several 100k), but occasionally a really huge (10M) source file will come by. In such case, the output is not generated even ... | <p>I'm not familiar with the .NET implementations, but there are a few things you can do in general to speed up processing of large documents:</p>
<ul>
<li>Avoid using "//" in Xpath expressions unless absolutely necessary.</li>
<li>If you only need the first or only element that matches an Xpath expression, use the "[... | <p>Upon looking up your problem, I found a KB at Microsoft about that. You can see it <a href="http://support.microsoft.com/kb/324478" rel="nofollow noreferrer">here</a>.</p>
<p>They say that the XSLT transform in .NET 1 has some issues with the performance and that they can offer a quick fix. </p>
<p>If you want to ... | 28,108 |
<p>I started out with a generic interface called ILogin. The interfaces requires that you implement two properties: UserID and Password. I have many login-type classes that implement this interface. As my project grew and grew, I found that many classes repeated the UserID and Password code. Now I decide that I nee... | <p>Definitely. Let's think of a concrete example.</p>
<p>Say we have an abstract class <code>Animal</code>.
Say, we make some subclasses <code>Cat</code>, <code>Dog</code>, <code>Mosquito</code>, and <code>Eagle</code>. We can implement its <code>Eat()</code>, <code>Breathe()</code>, <code>Sleep()</code> methods of th... | <p>I would always advise that you use interfaces. Abstract classes have the advantage that you can add in default functionality, but requiring that a user use their single inheritance is pretty aggressive.</p>
<p>Microsoft class libraries favour abstract classes over interfaces in a number of cases because it enables... | 33,486 |
<p>I have a JQueryDialog with a text field, an OK button and a cancel button.</p>
<p>I want to be able to hit the enter key after filling in the text fields and have it do the same action as when I click the OK button.</p>
| <p>In your dialog, call <code>getRootPane().setDefaultButton(okButton)</code>.</p>
| <p>The code is almost correct. I would change the if comparison and use the correct method as noted below.</p>
<pre><code>if (KeyEvent.VK_ENTER == event.getKeyCode()) {
yourButton.doClick();
}
</code></pre>
| 44,881 |
<p>Is it possible using StAX (specifically woodstox) to format the output xml with newlines and tabs, i.e. in the form:</p>
<pre>
<element1>
<element2>
someData
</element2>
</element1>
</pre>
<p>instead of:</p>
<pre><element1><element2>someData</element2></element1></pre>
<p>If this i... | <p>There is com.sun.xml.txw2.output.IndentingXMLStreamWriter</p>
<pre><code>XMLOutputFactory xmlof = XMLOutputFactory.newInstance();
XMLStreamWriter writer = new IndentingXMLStreamWriter(xmlof.createXMLStreamWriter(out));
</code></pre>
| <p>With Spring Batch this requires a subclass since this <a href="https://jira.springsource.org/browse/BATCH-1867" rel="nofollow">JIRA BATCH-1867</a></p>
<pre><code>public class IndentingStaxEventItemWriter<T> extends StaxEventItemWriter<T> {
@Setter
@Getter
private boolean indenting = true;
@Ove... | 37,006 |
<p>I've had this problem before and found that basically I've got a connection that I'm not closing quickly enough (leaving connections open and waiting for garbage collection isn't really a best practice).</p>
<p>Now I'm getting it again but I can't seem to find where I'm leaving my connections open. By the time is s... | <p>The error you are providing doesnt really point to a connection that is left open; it is more likely that there is a query that is taking longer than the application expects.
you can increase the time it waits for a response, and you could use Sql to find which queries are the most taxing.</p>
| <p>Hopefully you have one data access layer class, instead of a whole bunch of classes, each one creating its own connection, right? What language are you using? If your using C#, the biggest cause of this problem is DataReaders and returning these objects to the upper layers. Most likely some client class is not clos... | 44,829 |
<p>The <code>datepicker</code> function only works on the first input box that is created.</p>
<p>I'm trying to duplicate a datepicker by cloning the <code>div</code> that is containing it.</p>
<pre><code><a href="#" id="dupMe">click</a>
<div id="template">
input-text <input type="text" value="... | <p>I use a CSS class instead:</p>
<pre><code><input type="text" id="BeginDate" class="calendar" />
<input type="text" id="EndDate" class="calendar" />
</code></pre>
<p>Then, in your <code>document.ready</code> function:</p>
<pre><code>$('.calendar').datepicker();
</code></pre>
<p>Using it that way for m... | <p>The html I am cloning has multiple datepicker inputs.</p>
<p>Using Ryan Stemkoski's answer and Alex King's comment, I came up with this solution:</p>
<pre><code>var clonedObject = this.el.find('.jLo:last-child')
clonedObject.find('input.ui-datepicker').each(function(index, element) {
$(element).removeClass('ha... | 5,515 |
<p>Sometimes IE6 will render the text of a <code><ul></code> list the same color as the background color. If you select it, they show back up, or if you scroll the page up and back down.</p>
<p>It is obviously a rendering bug, but I was wondering if anyone knows of a workaround to make it reliable?</p>
| <p>try giving it hasLayout with</p>
<pre class="lang-css prettyprint-override"><code>zoom: 1
</code></pre>
| <p>Have you tried explicitly setting a line-height? For some reason this seems to be the solution to a great many IE6 rendering bugs!</p>
<p>e.g.</p>
<pre class="lang-css prettyprint-override"><code>.mylist {
line-height: 1.6em;
}
</code></pre>
| 6,378 |
<p>When I process a cube in Visual Studio 2005 I get following message:</p>
<blockquote>
<p>Process succeeded. Trace information
is still being transferred. If you do
not want to wait for all of the
information to arrive press Stop.</p>
</blockquote>
<p>and no trace info is displayed. Cube is processed OK by ... | <p>I get the same message when I process a cube, but if I wait for a few seconds the trace information arrives. Are you dealing with a very large quantity of data or a very complex cube? Maybe this is a silly question, but have you tried waiting a few minutes?</p>
| <p>how are you processing the cube? through XMLA or through the GUI? If you do it in XMLA then you should see the results as they come in the output window</p>
| 3,361 |
<p>I'm trying to write a custom WPF ValidationRule to enforce that a certain property is unique within the context of a given collection. For example: I am editing a collection of custom objects bound to a ListView and I need to ensure that the Name property of each object in the collection is unique. Does anyone know ... | <p>First, I'd create a simple DependencyObject class to hold your collection: </p>
<pre><code>class YourCollectionType : DependencyObject {
[PROPERTY DEPENDENCY OF ObservableCollection<YourType> NAMED: BoundList]
}
</code></pre>
<p>Then, on your ValidationRule-derived class, create a property:</p>
<pre><... | <p>I would only create a custom dependency object if there were other properties I wanted to bind to the rule. Since in this case all we're doing is attaching a single collection of values to check against, I made my <code><UniqueValueValidationRule.OtherValues></code> property a <code><CollectionContainer>... | 5,517 |
<p>So right now my project has a few custom dialogs that do things like prompt the user for his birthday, or whatever. Right now they're just doing things like setting a <code>this.Birthday</code> property once they get an answer (which is of type <code>DateTime?</code>, with the null indicating a "Cancel"). Then the c... | <p>I would say exposing properties on your custom dialog is the idiomatic way to go because that is how standard dialogs (like the Select/OpenFileDialog) do it. Someone could argue it is more explicit and intention revealing to have a ShowBirthdayDialog() method that returns the result you're looking for, but following... | <p>I've always done it exactly the way you're describing. I'm curious to see if there's a more accepted approach.</p>
| 5,760 |
<p>I am at a school with several Makerbot Replicator+ – a total of 9 of them.</p>
<p>So, they seem to print fine and I can hook up to two of them to one laptop (they are some Lenovo models from a few years back) using Makerbot Print. Well and good.</p>
<p>But I wanted to hook them up to my MacBook Pro (2020, OS X Catal... | <p><em><strong>It would seem that the printer control board doesn't use a CH340 (see bottom of this answer) and therefore this answer should be ignored.</strong></em></p>
<hr />
<h3>CH340 and OS X incompatibility</h3>
<p>The reason your Mac might not see the printers <em>could</em> be down to the USB interface <em><str... | <blockquote>
<p>what do you mean by SD card approach? The Makerbots take flash drives, but my attempts to print off of one were unsuccessful (it seems to be rather hard to make the right kind of file, it won't work with STLs and I gave up figuring out how to make them .makerbot files)</p>
</blockquote>
<p>This sounds l... | 2,049 |
<p>Is there a commercially available fume and nano particle extractor for a 3D printer, like the Ultimaker3 extended? I'm looking for a safe solution, to use at home, for around $800. </p>
| <p>Following on from Harvey Lim's <a href="https://3dprinting.stackexchange.com/questions/3771/commercially-available-3d-printer-fume-and-ufp-extractor#answer-3977">answer</a>, to give a concrete example of a DIY filter, which uses active carbon, see <a href="https://web.archive.org/web/20200514160332/http://www.3dprin... | <p>To try to answer your question, I found these enclosures on <a href="https://www.3dprintclean.com/store-1/" rel="nofollow noreferrer">3DPrintClean</a>, by browsing the Ultimaker forum. I'm not sure it fits your needs since you did not give any details about which Ultimaker you have, nor the amount of money you are w... | 552 |
<p>i have a class with a static public property called "Info".
via reflection i want to get this properties value, so i call:</p>
<pre><code>PropertyInfo pi myType.GetProperty("Info");
string info = (string) pi.GetValue(null, null);
</code></pre>
<p>this works fine as long as the property is of type string. but actu... | <p>Could you create a short but complete program that demonstrates the problem?</p>
<p>Given that you're talking about plugins, my <em>guess</em> is that you've got the problem of having IPluginInfo defined in two different assemblies. See if <a href="http://pobox.com/~skeet/csharp/plugin.html" rel="nofollow noreferre... | <p>Um, first of all I'd implement that property a little differently:</p>
<pre><code>private static PluginInfo _PluginInfo = null;
public static IPluginInfo PluginInfo
{
get
{
if (_PluginInfo == null)
{
_PluginInfo = new PluginInfo();
_PluginInfo.Name = "PluginName";
... | 25,264 |
<p>The heater cartridge on my CR10 V2 broke so I ordered a new one(12V). After replacing it the new one heats of very quickly past the target temperature and the slowly decreases to the target. Once it hits the target temp it goes up and down by 10 °C or so during prints. During the prints there is under extru... | <p>This sounds as if you have bought an incorrect heater element, e.g. one for 12 V instead of 24 V. The CR-10 uses 24 V. The 12 V cartridge has a lower resistance, so when powered by 24 V, the current is much higher and therefore also the heating power (<span class="math-container">$ {(\frac{2... | <p>funny I have the opposite worry, I have a CR10s5 and relaxed the whole hot end with the CR10v2 one and now I get a thermal error at 170 degrees and it shuts off, should I just replace the cartridge, or do I need to replace the fans tooo</p>
| 1,636 |
<p>I have this java code:</p>
<pre><code><script src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.2.6");
$("a#more").click(function() {
$("#info_box").show("blind", { direction: "vertical" }, 800);
});
</script>
</code></pre>
<p>And this l... | <p>You may use the <code>ready()</code> function and <code>display: none</code> in the initial CSS</p>
<p>Working HTML:</p>
<pre><code><html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript"&... | <p>I had the exact same problem. You need to load the jQuery ui plugin as well as normal Jquery to use the format you have there.</p>
| 37,736 |
<p>Not sure if the title is quite right for the question but I can't think of any other way to put it..</p>
<p>Suppose you wanted to create multiple different web apps, but you wanted a user who was logged into one app to be able to go straight to your other app without re-logging in (assuming they have perms to look ... | <p>What you're looking for is called <a href="http://en.wikipedia.org/wiki/Single_sign-on" rel="nofollow noreferrer">Single Sign On</a>. If you follow the link you'll find several implementations.</p>
<p>Open ID as others have mentioned is not such a scheme as it requires a seperate login for each site. Open ID is mer... | <p>As mentioned you can use something like OpenId or similar to make the process simple. Otherwise if you roll your own you could use a cookie to store the login, then basically ALL applications must have an entry point that mimics the base url.</p>
<p>Google for example uses mail.google.com to as a pipline into Gmai... | 21,737 |
<p>I have a flex client that makes service calls to a tomcat server running BlazeDS. I would like to gracefully handle server session timeouts in this environment.</p>
<p>I do have security constraints on the service, so the client authenticates against a remote object by initializing a ChannelSet based on the destin... | <p>We wrote a custom component for the client capturing Keystrokes and mouse events and then handle timeouts on the client.</p>
| <p>Look at the docs and see if an event is fired when the connection is disconnected. I would imagine that there is. If not, use try/catch around your connections and catch any connection related issues. If you do, redirect your app and notify the user. You will probably need to play with it to find the exact error... | 35,644 |
<p>I switched from Perl to Python about a year ago and haven't looked back. There is only <i>one</i> idiom that I've ever found I can do more easily in Perl than in Python:</p>
<pre><code>if ($var =~ /foo(.+)/) {
# do something with $1
} elsif ($var =~ /bar(.+)/) {
# do something with $1
} elsif ($var =~ /baz(.+)... | <p>Using named groups and a dispatch table:</p>
<pre><code>r = re.compile(r'(?P<cmd>foo|bar|baz)(?P<data>.+)')
def do_foo(data):
...
def do_bar(data):
...
def do_baz(data):
...
dispatch = {
'foo': do_foo,
'bar': do_bar,
'baz': do_baz,
}
m = r.match(var)
if m:
dispatch[m.gr... | <p>My solution would be:</p>
<pre><code>import re
class Found(Exception): pass
try:
for m in re.finditer('bar(.+)', var):
# Do something
raise Found
for m in re.finditer('foo(.+)', var):
# Do something else
raise Found
except Found: pass
</code></pre>
| 14,872 |
<p>Is it possible to call a class's static property to set the navigateurl property?</p>
<blockquote>
<pre><code><asp:HyperLink ID="hlRegister" NavigateUrl="<%= SomeClass.Property %>" runat="server" />
</code></pre>
</blockquote>
<p><b>without using codebehind ofcourse!</b></p>
| <p>You don't need code behind. You can just try it, like i just did. I created a simple page with exactly the code you have, and then created a class called SomeClass with a property named Property. It worked fine for me the way that you have it set up above. </p>
<p>Edit: Ok, it didn't compile with an error.. but ... | <p>sure, in the code behind:</p>
<pre><code>hl.NavigateUrl = Class.Static().ToString();
</code></pre>
| 25,207 |
<p>It is discouraged to simply catch <code>System.Exception</code>. Instead, only the "known" exceptions should be caught.</p>
<p>Now, this sometimes leads to unnecessary repetitive code, for example:</p>
<pre><code>try
{
WebId = new Guid(queryString["web"]);
}
catch (FormatException)
{
WebI... | <p>Catch <code>System.Exception</code> and switch on the types</p>
<pre><code>catch (Exception ex)
{
if (ex is FormatException || ex is OverflowException)
{
WebId = Guid.Empty;
return;
}
throw;
}
</code></pre>
| <p>In c# 6.0,Exception Filters is improvements for exception handling</p>
<pre><code>try
{
DoSomeHttpRequest();
}
catch (System.Web.HttpException e)
{
switch (e.GetHttpCode())
{
case 400:
WriteLine("Bad Request");
case 500:
WriteLine("Internal Server Error");
... | 16,469 |
<p>Is there a particular scenario where a <code>WriteOnly</code> property makes more sense then a method? The method approach feels much more natural to me. </p>
<p>What is the right approach?</p>
<p><strong>Using Properties</strong>:</p>
<pre class="lang-vb prettyprint-override"><code>Public WriteOnly Property MyPr... | <p>I think a property indicates something that can be read-only or read/write. The behaviour of a write-only property is not obvious so I avoid creating them.</p>
<p>As an example, setting a list of values in a drop-down on a view and accessing the selected item:</p>
<pre><code>public interface IWidgetSelector
{
vo... | <p>However I've seen the .Net Framework itself use ReadOnly Properties, the first one that comes to mind is: </p>
<pre><code>System.Net.Mail.MailMessage.To
</code></pre>
<p>For which you have to call a method to write to: </p>
<pre><code>System.Net.Mail.MailMessage.To.Add(Recipient As String)
</code></pre>
| 41,798 |
<p>Are there any html helpers for page navigation. eg. if i have 1000 records to display, i want to display the Previous 1 2 3 4 ... etc Next link stuff under the filtered collection.</p>
<p>Anyone know of anything out there?</p>
| <p>Checkout <a href="http://blogs.taiga.nl/martijn/Default.aspx" rel="nofollow noreferrer">Paging with ASP.NET MVC</a>,<a href="http://www.squaredroot.com/post/2008/07/08/PagedList-Strikes-Back.aspx" rel="nofollow noreferrer">PageList Strikes Back</a> and <a href="http://weblogs.asp.net/stephenwalther/archive/2008/09/1... | <p>I have a paging grid in my <a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=18764" rel="nofollow noreferrer">Dynamic Data for MVC sample application</a>, but the grid is hand rendered. The data is using PagedList, which came from Rob Conery (who in turn I think got it from ScottGu).</p>... | 29,985 |
<p>Visually both of the following snippets produce the same UI. So why are there 2 controls..<br>
<strong>Snippet1</strong> </p>
<pre><code><TextBlock>Name:</TextBlock>
<TextBox Name="nameTextBox" />
</code></pre>
<p><strong>Snippet2</strong></p>
<pre><code><Label>Name:</Label>
<Tex... | <p>The WPF Textblock inherits from <strong>FrameworkElement</strong> instead of deriving from <strong>System.Windows.Control</strong> like the Label Control. This means that the Textblock is much more lightweight. The downside of using a textblock is no support for Access/Accerelator Keys and there is no link to other ... | <p>Label can be used as an alternative to TextBlock for situations where minimal text support is required such as the label for a control. Using Label can be advantageous because it requires even less resources (lighter weight) then a TextBlock. </p>
| 8,355 |
<p>It seems like the classical way to handle transactions with JDBC is to set auto-commit to false. This creates a new transaction, and each call to commit marks the beginning the next transactions.
On multithreading app, I understand that it is common practice to open a new connection for each thread.</p>
<p>I am wri... | <p>Yes, in general you need to create a new connection for each thread. You don't have control over how the operating system timeslices execution of threads (notwithstanding defining your own critical sections), so you could inadvertently have multiple threads trying to send data down that one pipe.</p>
<p>Note the s... | <p>It's uncommon practice to open a new connection for each thread.
Usually you use a connection pool like <a href="http://sourceforge.net/projects/c3p0" rel="nofollow noreferrer">c3po</a> library.</p>
<p>If you are in an application server, or using Hibernate for example, look at the documentation and you will find h... | 36,797 |
<p>I need to suppress autoplay for the mass storage devices.
This needs to be achieved programatically through a service/deamon running in the background.</p>
<p>I know it can be done by an application which opens a window and handles the "queryCancelAutoPlay" message sent by windows.</p>
<p>Can this be done without ... | <p>Sure. You can create a message-only window. That gives you a HWND without those annoying WM_PAINT messages etc. The other way is to use COM, <a href="http://msdn.microsoft.com/en-us/library/bb761373.aspx" rel="nofollow noreferrer">IQueryCancelAutoplay</a></p>
| <p>There is a registry entry that controls AutoRun:</p>
<pre><code>HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer
</code></pre>
<p>This can be set to disable AutoRun on specific device types, from <a href="http://www.microsoft.com/technet/prodtechnol/windows2000serv/reskit/regentry/93502.mspx?mfr=t... | 35,514 |
<p>I open gmail, click on an inbox item, and look at source of the page. It doesn't look like there isn't any proper html to relate to what is shown on the actual page.</p>
<p>How is the source getting processed into the actual page? Is there some javascript processing this information?</p>
| <p>GMail uses a large amount of java script to make its pages work. This javascript is manipulating the HTML DOM.</p>
<p>If you look at the page source you aren't seeing the current contents of the DOM. You need to use a tool that will show you the HTML DOM. I use Opera Dragonfly, but there are plenty of others for ot... | <p>In IE you get a blank page if you right-click and "View Source". If you use the Page menu > View Source, you see the actual page source. As Steve mentioned, in Firefox you see the actual source both from right-click "View Page Source" and from View menu > Page Source.</p>
<p>I suspect they're taking advantage of ... | 31,436 |
<p>What I can think of is pre-populating certain form input elements based on the user's geographical information.</p>
<p>What are other ways can you think of to speed up user input on long application forms?</p>
<p>Or at least keep them focus on completing the application form?</p>
| <p>If you have a long form, try to prune it down. Don't ask them to fill in fields that you don't really need.</p>
<p>If the form spans several pages, give the user some feedback as to how many more pages there are. We users hate clicking on the continue button wondering if this will be the last page.</p>
<p>Never ... | <p>use Ajax to populate and update the controls asynchronously.It will speedup the filling of long application forms.</p>
| 28,774 |
<p>I am trying to increase the flow rate on my Ender 3 from 100 to 108 % but every time I start a new print it reverts back to the old 100 % flow rate. I have clicked through the settings and pressed the "store settings" button but it still reverts back at the start of every print. I don't want to do this in my slicer ... | <p>Changing the <strong>flow rate</strong> during a print can <strong>not</strong> be saved. There simply is no way. It is usually meant to be a fix with filament inconsistencies or to look for the right extrusion factor for a new filament batch.</p>
<h2>Slicer</h2>
<p>The only way to consistently increase the flow rat... | <p>You should be able to add a global override to the flow percentage on Marlin firmware printers.</p>
<p>Add this line somewhere in your start code:</p>
<p><code>M221 S97 ; Flow Percentage hard set.</code></p>
<p>In Cura, edit the printer's machine settings. The <code>S</code> is the percentage. In my case, 97 % works... | 1,506 |
<p>I'd like to do something like the following in C#:</p>
<pre><code> class Container {
//...
public void ForEach(Action method) {
foreach (MyClass myObj in sequence) myObj.method();
}
}
//...
containerObj.ForEach(MyClass.Method);
</code></pre>
<p>In C++ I would use... | <p>This ought to work, in C# 3.0:</p>
<pre><code>class Container
{
//...
public void ForEach(Action<MyObj> method)
{
foreach (MyClass myObj in sequence) method(myObj);
}
}
//... containerObj.ForEach( myobj => myObj.Method() );
</code></pre>
| <p>Assuming that:</p>
<pre><code> public void ForEach(Action method) {
foreach (MyClass myObj in sequence) method(myObj);
</code></pre>
<p>is no good for you, then I think you're stuck with reflection.</p>
| 45,970 |
<p>I'd like to to associate a file extension to the current executable in C#.
This way when the user clicks on the file afterwards in explorer, it'll run my executable with the given file as the first argument.
Ideally it'd also set the icon for the given file extensions to the icon for my executable.
Thanks all.</p>
| <p>There doesn't appear to be a .Net API for directly managing file associations but you can use the Registry classes for reading and writing the keys you need to.</p>
<p>You'll need to create a key under HKEY_CLASSES_ROOT with the name set to your file extension (eg: ".txt"). Set the default value of this key to a un... | <p>There are two cmd tools that have been around since Windows 7 which make it very easy to create simple file associations. They are <a href="https://technet.microsoft.com/en-us/library/cc770920(v=ws.11).aspx" rel="nofollow noreferrer">assoc</a> and <a href="https://technet.microsoft.com/en-us/library/cc771394(v=ws.11... | 9,515 |
<p>I have a site I'm working on that has an event page. The owner wants to be able to edit the event page weekly. Would it be easier to teach the site owner how to edit this one page and upload it or use a CMS just for this one page??</p>
<p>Apart from a contact form that posts to an email addy, the rest of the site... | <p>It depends on the complexity of the page. If it's a fixed structure where the client won't want to add links of photos you may want to give them the ability to edit a simple data file (not the page itself). Then read in the data file. I like to use a simple JSON format for this type of thing.</p>
<p>At least with a... | <p>Personally, I would not want to deal with software installation & database setup to edit a single page.</p>
<p>You might consider an FTP-based CMS. This would give you access to a nice web-based WYSIWYG editor and any changes you make would be transferred via FTP to your web host.</p>
<p>Here are a couple of ... | 27,028 |
<p>I have code that sends HTML emails to users. To accommodate users who dont have/ want HTML email, the email contains 2 alternate views, View(0) is HTML, View(1) is Plain text. </p>
<p>The HTML view has a header and footer graphics, but the style is done inline and not via css file. The text view is only the text; n... | <p>Ideally, as recommended by W3C, you should be encoding using UTF8.</p>
<p>This may do the trick.</p>
| <p>I had this kind of problem after my PC did a Windows update automatically. I guess some set up changed. So I went to the Mail format and looked for the Editor Option --> Proofing --> Autocorrect Option and unchecked the "Straight quotes" with "Smart quoted" which is under -AutoFormat As You Type- Tab. Then I compar... | 48,104 |
<p>I'm currently creating a website for a client that will basically involve selling various files. This is obviously a really common thing to do, which is making me feel kind of foolish for not thinking of a method for doing it.</p>
<p>Once the purchase has been made the customer should be taken to a page containing ... | <p>You basically don't give the users the direct URL to the file. Server based permissions have nothing to do here.</p>
<p>Say you have the required file(s) saved in /data/files/file.pdf (good practice to store files out of your web root).
You can provide the users a link to download which looks something like /downlo... | <p>A lot of download urls I've seen that are based on purchase tend to use some guid and other dynamic information as part of the url to not make it as simple as guessing one id. You could end up with guid/datetimepurchased/id or something like that as part of the path. </p>
<p>An additional option would be to ensur... | 25,860 |
<p>I just want a simple tool that will help me quickly write scripts/packages that I can schedule to run. My transform requirements are pretty simple (changing column names, merging/splitting tables, and date conversions). I'll sacrifice flexibility for speed of development on this one.</p>
<p>Any come to mind?</p>
| <p>SQL Server 2005? SSIS (but I wouldn't call it simple, but then again out of the list of things you gave, only the naming is really simple)</p>
<p>You can actually script package creation using C# (.NET/whatever, presumably even PowerShell).</p>
<p>Resources <a href="http://blogs.conchango.com/jamiethomson/archive/... | <p>Some SQL development tools, like <a href="http://www.advancedquerytool.com" rel="nofollow noreferrer">Advanced Query Tool</a> (AQT), let you do lightweight ETL and schedule with command files...
We have Informatica, but I used AQT to write from Oracle to files, for a short term request..</p>
| 20,797 |
<p>When using PNG files (made with Paint.NET) as background images on my web site, IE7 is changing the colors and actually displaying a darker version of my images, as seen <a href="http://twitpic.com/bud1" rel="noreferrer" title="IE7 dithering">here</a>. In this image, the dark background and background image should b... | <p>IE has a known bug with PNG gamma info, though I thought they had fixed it in version 7 :-?</p>
<p>I remove the gamma info from PNG files using "PNG Crush". I've created a right-click shortcut in Windows explorer. Further info: <a href="http://www.weirdlooking.com/blog/64" rel="nofollow noreferrer">using pngcrush i... | <p>Additional resource on this issue: <a href="http://www.modernblue.com/web-design-blog/tweak-that-gamma/" rel="nofollow noreferrer">http://www.modernblue.com/web-design-blog/tweak-that-gamma/</a></p>
| 10,160 |
<p>I need to store large amounts of data on-disk in approximately 1k blocks. I will be accessing these objects in a way that is hard to predict, but where patterns probably exist.</p>
<p>Is there an algorithm or heuristic I can use that will rearrange the objects on disk based on my access patterns to try to maximize... | <p>Depending on what you mean by "hard to predict", I can think of a few options:</p>
<p>If you always seek based on the same block field/property, store the records on disk sorted by that field. This lets you use <a href="http://en.wikipedia.org/wiki/Binary_search" rel="nofollow noreferrer">binary search</a> for O(lo... | <p>That's an interesting challenge. Unfortunately, I don't know how to solve this out of the box, either. Corbin's approach sounds reasonable to me.</p>
<p>Here's a little optimization suggestion, at least: Place the most-accessed items at the <em>center</em> of your disk (or unfragmented file), not at the start of en... | 44,733 |
<p>In a web application like wiki or forums or blogging software, it is often useful to store your data in a relational database. Since many hosting companies offer a single database with their hosting plans (with additional databases costing extra) it is very useful for your users when your database objects (tables, v... | <p>I've now researched what it takes to do this in both Entity Framework and LINQ to SQL and <a href="http://theruntime.com/blogs/jacob/archive/2008/08/27/changing-table-names-in-an-orm.aspx" rel="nofollow noreferrer">documented the steps required in each</a>. It's much longer than answers here tend to be so I'll be co... | <p><a href="https://www.mindscape.co.nz/products/LightSpeed/default.aspx" rel="nofollow noreferrer">LightSpeed</a> allows you to specify an <em>INamingStrategy</em> that lets you resolve table names dynamically at runtime.</p>
| 3,283 |
<p>I'm using IdeaMaker for slicing my print objects. IdeaMaker start strings have a >T0< standing alone on one line and then >T1< on the next line. What does this accomplish?</p>
| <p>T stands for <a href="https://en.wikipedia.org/wiki/G-code#Letter_addresses" rel="nofollow noreferrer">"Tool"</a> and has its origin in the origins of <a href="https://en.wikipedia.org/wiki/G-code#Letter_addresses" rel="nofollow noreferrer"><code>.gcode</code></a> being for other automated machine controls. Dependin... | <p>I'm not sure what it's doing in your case, but the "T" code is there to select the extruder number. T0 would be the first and T1 would be the second extruder in a multi-extruder setup. I found the information at the end of <a href="http://www.makeit-3d.com/wp-content/uploads/RepRapGcodeCheatSheet.pdf" rel="nofollow ... | 1,246 |
<p>Is it possible to open an HTML page using navigateToURL and specifying a named frame in your HTML document? For instance, if you have an iframe on the page called "Steven", can you call</p>
<pre><code>navigateToURL("someURL","Steven");
</code></pre>
<p>instead of something like</p>
<pre><code>navigateToURL("someU... | <p>Did you test this on local files saved to your hard drive? If so, then there are some security restrictions that you may be running in to. See the security note <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/net/package.html#navigateToURL()" rel="nofollow noreferrer">here</a>.</p>
<p>But i... | <p>I'm not sure, but you can use JavaScript:</p>
<pre><code>navigateToURL("javascript:loadFrame(someURL)");
</code></pre>
<p>Then in your HTML page:</p>
<pre><code>function loadFrame(url) {
documents.frames[1].src=url
}
</code></pre>
| 21,213 |
<p>Has anyone used <a href="http://web.archive.org/web/20090803092709/http://www.aptana.com:80/Jaxer" rel="nofollow noreferrer">Jaxer</a> in a production environment, I am curious as to how it holds up compared to something like php, ruby, etc. and if anyone knows of any pitfalls to using it that are well known.</p>
| <p>@Stu: Not necessarily, maybe there's a bunch of people using it and having no issues. I love the concept having to only write validations once, using one language for everything both client and server side sounds like a interesting approach.</p>
| <p>I'll add this <a href="http://www.ibm.com/developerworks/web/library/wa-aj-jaxer/index.html?ca=dgr-jw64wa-aj-jaxer&S_TACT=105AGY46&S_CMP=GRsitejw64" rel="nofollow noreferrer">Url</a> to my post I found it today, it has some information regarding the subject but no real "performance" information.</p>
| 3,149 |
<p>Is output buffering enabled by default in Python's interpreter for <code>sys.stdout</code>?</p>
<p>If the answer is positive, what are all the ways to disable it?</p>
<p>Suggestions so far:</p>
<ol>
<li>Use the <code>-u</code> command line switch</li>
<li>Wrap <code>sys.stdout</code> in an object that flushes aft... | <p>From <a href="http://mail.python.org/pipermail/tutor/2003-November/026645.html" rel="nofollow noreferrer">Magnus Lycka answer on a mailing list</a>:</p>
<blockquote>
<p>You can skip buffering for a whole
python process using <code>python -u</code>
or by
setting the environment variable
PYTHONUNBUFFERED.</p>
<p>You c... | <p>One way to get unbuffered output would be to use <code>sys.stderr</code> instead of <code>sys.stdout</code> or to simply call <code>sys.stdout.flush()</code> to explicitly force a write to occur.</p>
<p>You could easily redirect everything printed by doing:</p>
<pre><code>import sys; sys.stdout = sys.stderr
print ... | 13,314 |
<p>I feel like this is a stupid question because it seems like common sense . . . but no google search I can put together seems to be able to give me the answer! </p>
<p>I know how to get data OUT of a sqlite3 database using the .dump command. But now that I have this ASCII file titled export.sqlite3.sql . . . I can't... | <pre><code>cat dumpfile.sql | sqlite3 my_database.sqlite
</code></pre>
<p><a href="http://www.sqlite.org/sqlite.html" rel="noreferrer">This is modified from the sqlite3 getting started guide.</a></p>
| <p>Use this for unix flavors.</p>
<p>press Ctrl+alt+T and write</p>
<pre><code>sqlite3 /home/ubuntu/output.sqlite < /home/ubuntu/input.sql
</code></pre>
<p>It restore your database from input file.</p>
| 40,167 |
<p>Is there a limit with the number of SSL connections?</p>
<p>We are trying to connect through SSL with 2000 sessions. We have tried it a couple of times but it always dies at 1062nd. Is there a limit?</p>
| <p>Your operating system will have a limit on the number of open files if you are on linux
ulimit -a will show your various limits.</p>
<p>I imagine yours is set to 1024 and some of the sessions just happened to have closed allow the figure of 1062 (this last bit is a guess)</p>
| <p>Yes, everything has a limit. As far as I'm aware, there is no inherit limit with "SSL".. it is after all just a protocol.</p>
<p>But, there is a limited amount of memory, ports, CPU on the machine you are connected to, from and every single one in between.</p>
<p>The actually server you are connected to may have a... | 6,767 |
<p>I’m trying to debug a memory leak problem. I’m using <a href="http://www.gnu.org/software/libc/manual/html_node/Tracing-malloc.html#Tracing-malloc" rel="noreferrer">mtrace()</a> to get a malloc/free/realloc trace. I’ve ran my prog and have now a huge log file. So far so good. But I have problems interpreting the fil... | <p>The function that is allocating the memory is being called more than once. The caller address points to the code that did the allocation, and that code is simply being run more than once.</p>
<p>Here is an example in C:</p>
<pre><code>void *allocate (void)
{
return (malloc(1000));
}
int main()
{
mtrace();
... | <p>One possible explanation is that the same function is allocating different buffer sizes? One such example is strdup.</p>
<p>For the second question, it is possible that the runtime is allocating some "static" scratch area which is not intended to be freed until the process is terminated. And at that point, the OS ... | 18,598 |
<p>Has anybody any useful links that can be used to consume a web service using flex?
The easier the solution the better</p>
<p>Thanks</p>
| <p>Try <a href="http://livedocs.adobe.com/flex/3/langref/mx/rpc/soap/mxml/WebService.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/langref/mx/rpc/soap/mxml/WebService.html</a> for SOAP services. You just have to specify the WSDL location and the event handlers and call the service.</p>
<p>Flex Build... | <p>Flex Builder 3 comes with code generation tools that let you build the actionscript objects that correspond to the server side transfer object exposed by the eb service wsdl. It can make your life easier when working with web services. Here is a <a href="http://www.flexlive.net/?p=79" rel="nofollow noreferrer">good ... | 13,618 |
<p>I'm using the command line compiler for builds. One problem I see is that the paths mentioned there seem to need to be the short versions of the filenames such that they don't contain any spaces. I don't know so much about this even though I have used it for some time.</p>
<p>I recently upgraded to d2009 and the ... | <p>You could try to put the paths in quotes, that's the standard way of handling path-/filenames with spaces in Windows, though I never tried that in Delphi DCUs.</p>
<p>So, instead of </p>
<pre><code>$(BDS)\Lib\Indy10
</code></pre>
<p>try</p>
<pre><code>"$(BDS)\Lib\Indy10"
</code></pre>
<p>You could also try</p>
... | <p>Is the $(BDS) environment variable set when you're compiling the program from the command-line? If not, that might be the problem.</p>
<p>Putting quotes around paths containing spaces will likely solve the problem with spaces. This has worked for me:</p>
<p>-U"C:\Path to libraries\First library;C:\Path to librarie... | 37,151 |
<p>My coworker and I have encountered a nasty situation where we have to use an active X control to manipulate a web camera on a page. </p>
<p>Is it possible to assign a javascript event handler to a button in the active x control so that it would fire an action on the page when clicked, or do we have to create a butt... | <p><em>Please</em> just use an existing ActiveX control. Like Flash or Silverlight. Flash has built-in webcam support and is controllable via JavaScript. Silverlight doesn't have built-in camera support, but it's JavaScript integration is fantastic.</p>
<p>If you must write your own then fret not, it is trivial to get... | <p>Yes! You can throw events in C++/ActiveX land which makes the JavaScript code run an event handler function. I was even able to make an entire invisible ActiveX control (same color as page background) with no buttons or visual feedback that did all of its GUI work through JavaScript and CSS.</p>
<p>edit: Frank's ad... | 4,608 |
<p>JavaScript allows functions to be treated as objects--if you first define a variable as a function, you can subsequently add properties to that function. How do you do the reverse, and add a function to an "object"?</p>
<p>This works:</p>
<pre><code>var foo = function() { return 1; };
foo.baz = "qqqq";
</code></p... | <p>It's easy to be confused here, but you can't (easily or clearly or as far as I know) do what you want. Hopefully this will help clear things up.</p>
<p>First, every object in Javascript inherits from the Object object.</p>
<pre><code>//these do the same thing
var foo = new Object();
var bar = {};
</code></pre>
<... | <blockquote>
<p>JavaScript allows functions to be
treated as objects--you can add a
property to a function. How do you do
the reverse, and add a function to an
object?</p>
</blockquote>
<p>You appear to be a bit confused. Functions, in JavaScript, <em>are</em> objects. And <strong>variables <em>are</em> vari... | 15,130 |
<p>I would like to have both Eclipse and Netbeans (with JUnit) installed on one system, so I can be somewhat familiar with both.</p>
<p>Besides GUI development (see "<a href="https://stackoverflow.com/questions/174308/using-both-eclipse-and-netbeans">Using both Eclipse and Netbeans</a>"), are there any other issues wi... | <p>We regularly use both Netbeans and Eclipse. We switch back and forth, between Vista, WinXP, and multiple versions of Fedora of the 32- and 64-bit variety, with no problems. Keeping the project files in version control makes keeping them in sync much easier. We even keep the launch files in the project directory a... | <p>Maven is a very good way to keep both IDEs in sync (as suggested). In my experience though, you have to create an Ant build for any given project for the sake of developers not using IDEs. Since NetBeans's build system is based on Ant, it's pretty trivial to just base the entire NetBeans project off of that base b... | 22,839 |
<p>I have a <code>char* p</code>, which points to a <code>\0</code>-terminated string. How do I create a C++ <code>string</code> from it in an exception-safe way?</p>
<p>Here is an unsafe version:</p>
<pre><code>string foo()
{
char *p = get_string();
string str( p );
free( p );
return str;
}
</code></pre>
<... | <p>You can use <code>shared_ptr</code> from <a href="http://en.cppreference.com/w/cpp/memory/shared_ptr" rel="noreferrer">C++11</a> or <a href="http://www.boost.org/libs/smart_ptr/" rel="noreferrer">Boost</a>:</p>
<pre><code>string
foo()
{
shared_ptr<char> p(get_string(), &free);
string str(p.get());... | <p>We commonly use <a href="http://www.ddj.com/cpp/184403758" rel="nofollow noreferrer">ScopeGuard</a> for these cases:</p>
<pre><code>string foo()
{
char *p = get_string();
ScopeGuard sg = MakeGuard(&free, p);
string str( p );
return str;
}
</code></pre>
| 30,588 |
<p>We have a hosted application that manages pages of content. Each page can have a number of customized fields, and some standard fields (timestamp, user name, user email, etc).</p>
<p>With potentially hundreds of different sites using the system -- what is an efficient way to handle filtering/searching? Picture a gr... | <p>Solr or grassyknoll both provide slightly more abstract interfaces to Lucene. </p>
<p>That said: Yes. If you are a primarily content driven site, providing fulltext searching over your data, there is something in play beyond LIKE. While MySql's FULLTEXT indexies aren't perfect, it might be an acceptable placeholder... | <p>Don't write-off MySQL so readily!</p>
<p>Implement it using the database e.g. a select with a 'like' in the where-clause or whatever.</p>
<p>Profile it, add indexes if necessary. Roll out a beta, so you get real numbers from user's actual data patterns - not all columns might be equally asked after, etc.</p>
<p>... | 38,879 |
<p>I hear people writing these programs all the time and I know what they do, but how do they actually do it? I'm looking for general concepts.</p>
| <p>Technically, screenscraping is any program that grabs the display data of another program and ingests it for it's own use.</p>
<p>Quite often, screenscaping refers to a web client that parses the HTML pages of targeted website to extract formatted data. This is done when a website does not offer an RSS feed or a R... | <blockquote>
<p>Screen scraping is what you do when nobody's provided you with a reasonable machine-readable interface. It's hard to write, and brittle.</p>
</blockquote>
<p>Not quite true. I don't think I'm exaggerating when I say that most developers do not have enough experience to write decents APIs. I've worke... | 18,883 |
<p>I am currently coding a simple Data Access Layer, and I was wondering which type I should expose to the other layers.</p>
<p>I am going to internally implement the Data as a List<>, but I remember reading something about not exposing the List type to the consumers if not needed.</p>
<pre><code>public List<Us... | <p>Usually it's best to expose the least powerful interface that the user can still meaningfully work with. If the user just needs some enumerable data, return <code>IEnumerable<User></code>. If that's not enough because the user needs to be able to modify the list (attention! shouldn't often be the case), return... | <p>Definitely an ISomething. Using an interface will reduce coupling and make it easier to change details of your data layer's implementation down the road. Which interface depends on the circumstances. IList is good, but sometimes you may need ICollection functionality or want to specify values that are ReadOnly.</... | 24,650 |
<p>I try to migrate a Windows SVN Server to Linux.<br>
I have configured Apache to validate against AD for Useraccess so only AD Users can logon.<br>
Now i have to set permissions for repositories with authz files.<br>
When i set permission with AD username it works, but AD groups it doesn't.</p>
<p>The authz file loo... | <p>You can't automatically use AD groups inside the authz files.</p>
<p>A possibile solution could be writing a script that query the AD for the groups and their member users and writes the correct authz file, defining also the groups themselves.</p>
<p>The final output shuold be something like:</p>
<pre><code>[grou... | <p>You can't automatically use AD groups inside the authz files.</p>
<p>A possibile solution could be writing a script that query the AD for the groups and their member users and writes the correct authz file, defining also the groups themselves.</p>
<p>The final output shuold be something like:</p>
<pre><code>[grou... | 41,860 |
<p>In situation, when I need a webservice client, which will be used by some action controllers, how should it be implemented? As it will have some constant values (addres, parameters names) and session key, refreshed every 30 minutes, I guess model stored in database isn't the best solution. What is the best practice?... | <p>Built the web service consumer as a library and place it in your /lib directory.</p>
<p>I would also recommend <a href="http://railstips.org/2008/7/29/it-s-an-httparty-and-everyone-is-invited" rel="nofollow noreferrer">HTTParty</a> for very simple consumption of web services. You could easily build a library to ha... | <p>Rails 1.x used to have "actionwebservices" builtin but it has been removed from Rails 2.x. The last time I did this was to build an SSO server implemented as classes using XML-RPC. The code is not public unfortunately (done internally for my employer) but was under 1k LOC incl. comments... Plain Ruby.</p>
<p>Now,... | 43,911 |
<p>I am looking to use/connect to a different database for one of my controllers and one model. I posted this hear since on the forums of CI I am getting no response.</p>
<p>I added this in database.php:</p>
<pre><code>$db['tdb']['hostname'] = "localhost";//localhost
$db['tdb']['username'] = "username";//root
$db['... | <p>Your issue here isn't with the use of CodeIgniter's database functions, but with variable scoping in classes. When you load your model you're connecting to the database and assigning the result to a local variable in the model's constructor. When any function finishes, the local variables are discarded. Later you... | <p>Have you tried loading $tdb inside the FInsert function? Looks like $tdb may be a local variable and not accessible by FInsert...</p>
| 40,277 |
<p>I am creating a secure web based API that uses HTTPS; however, if I allow the users to configure it (include sending password) using a query string will this also be secure or should I force it to be done via a POST?</p>
| <p>Yes, it is. <strong>But using GET for sensitive data is a bad idea</strong> for several reasons:</p>
<ul>
<li>Mostly HTTP referrer leakage (an external image in the target page might leak the password[1])</li>
<li>Password will be stored in server logs (which is obviously bad)</li>
<li>History caches in browsers </... | <p>You can send password as MD5 hash param with some salt added. Compare it on the server side for auth.</p>
| 41,828 |
<p>I'm trying to update a variable in APC, and will be many processes trying to do that.</p>
<p>APC doesn't provide locking functionality, so I'm considering using other mechanisms... what I've found so far is mysql's GET_LOCK(), and php's flock(). Anything else worth considering?</p>
<p>Update: I've found sem_acquir... | <pre><code>/*
CLASS ExclusiveLock
Description
==================================================================
This is a pseudo implementation of mutex since php does not have
any thread synchronization objects
This class uses flock() as a base to provide locking functionality.
Lock will be released in following case... | <p>What I've found, actually, is that I don't need any locking at all... given what I'm trying to create is a map of all the class => path associations for autoload, it doesn't matter if one process overwrites what the other one has found (it's highly unlikely, if coded properly), because the data will get there eventu... | 42,203 |
<p>I got this error today when trying to open a Visual Studio 2008 <strong>project</strong> in Visual Studio 2005:</p>
<blockquote>
<p>The imported project "C:\Microsoft.CSharp.targets" was not found.</p>
</blockquote>
| <p>Open your csproj file in notepad (or notepad++)
Find the line: </p>
<pre><code><Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</code></pre>
<p>and change it to</p>
<pre><code><Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
</code></pre>
| <p>I deleted the obj folder and then the project loaded as expected.</p>
| 2,755 |
<p>I have a problem with a Delphi 2009 project : It can't initialize Indy 10 !
This code worked fine before in Delphi 2007 (although we might have been using an older revision of Indy, but I suspect that has not much to do with it);</p>
<p>The initial call to IdWinsock2.InitializeWinSock(), raises this exception (with... | <p>I finally found an answer to this : The affected applications contained a bit of code-hooking that randomly damaged parts of System.dcu! (FYI : We're using a Delphi 2009 beta version of madshi's madCodeHook library). As soon as we switched to another code-hooking library, these symptoms disapeared... I guess that's ... | <p>This may be overly simplistic, but have you tried changing the order in which the relevant units are listed in your uses clause? Sometimes this helps in these situations.</p>
| 24,976 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.