instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Is it possible to send a list of IDs to a stored procedure from c#?</p> <pre><code>UPDATE Germs SET Mutated = ~Mutated WHERE (GermID IN (ids)) </code></pre>
<p>This may be a dirty hack, but you can create a temp table and then join to it from within your stored procedure (assuming they are accessed during the same connection). For example:</p> <pre><code>CREATE TABLE #ids (id int) INSERT INTO #ids VALUES ('123') -- your C# code would generate all of the inserts -- From ...
<p>Yep, you can use a chunk of XML to build your list of ID's. Then you can use OPENXML and select from that record set.</p> <p>Look up OPENXML, sp_preparexmldocument, sp_removexmldocument</p>
22,121
<p>Please bear with me: this isn't a language debate or a flame. It's a real request for opinions.</p> <p>Occasionally, I have to help educate a traditional text coder in how to think in LabVIEW (LV). Often during this process, I get to hear about how LV sucks. Rarely is this insight accompanied by rational observa...
<p>LabVIEW makes <em>implementing</em> concurrency/parallel programming easier, true. It does <em>not</em>, however, make debugging, testing, or <em>thinking</em> about concurrency/parallelism any easier. You can still write buggy, concurrent code in LabVIEW, and (as with <em>any</em> language, platform, or toolset) th...
<p>In Labview I can't find the callers of VI if they are not opened first.</p>
48,698
<p>I'm developing an object-oriented PHP website right now and am trying to determine the best way to abstract database functionality from the rest of the system. Right now, I've got a DB class that manages all the connections and queries that the system uses (it's pretty much an interface to MDB2). However, when using...
<p>Having the SQL pulled out into separate functions is a decent start. Some other things you can do:</p> <ul> <li>Create separate classes for database access code. This will help make sure you don't have SQL functions scattered around in all of your PHP files.</li> <li>Load the SQL from external files. This comple...
<p>Another option is to think of the queries as data and store them in the database. For instance, you can create one table that stores the query with a name and another table that stores the parameters for that query. Then create a function in PHP that takes the name of the query and an array of params and executes th...
36,362
<p>I have a scenario. (Windows Forms, C#, .NET)</p> <ol> <li>There is a main form which hosts some user control.</li> <li>The user control does some heavy data operation, such that if I directly call the <code>UserControl_Load</code> method the UI become nonresponsive for the duration for load method execution.</li> <l...
<p>As per <a href="https://stackoverflow.com/questions/142003/cross-thread-operation-not-valid-control-accessed-from-a-thread-other-than-the#142108">Prerak K's update comment</a> (since deleted):</p> <blockquote> <p>I guess I have not presented the question properly.</p> <p>Situation is this: I want to load data into a...
<p>There are two options for cross thread operations.</p> <pre><code>Control.InvokeRequired Property </code></pre> <p>and second one is to use </p> <pre><code>SynchronizationContext Post Method </code></pre> <p>Control.InvokeRequired is only useful when working controls inherited from Control class while Synchroni...
17,167
<p>I'm just learning C with Kernighan and Ritchie's book; I'm in the basics of the fourth chapter (&quot;Functions and Program Structure&quot;). The other day I became curious about the <code>sleep()</code> function, so tried to use it like this:</p> <pre><code>#include &lt;stdio.h&gt; #include &lt;unistd.h&gt; int ma...
<p><code>printf()</code> writes to <code>stdout</code> (the default output stream) which is usually line buffered. The buffer isn't flushed by the time <code>sleep</code> is called so nothing is displayed, when the program exits all streams are automatically flushed which is why it prints right before exiting. Printi...
<p>I implemented time encounter as following;</p> <pre><code>for (int i = 1; i &lt;= 60; i++) { printf("%02d", i); fflush(stdout); sleep(1); printf("\b\b"); } </code></pre>
43,909
<p>As part of improvements to our build process, we are currently debating whether we should have separate project/solution files on our CI production environment from our local development environments.</p> <p>The reason this has come about is because of reference problems we experienced in our previous project. On ...
<p>In our largest project (a system comprising of many applications) we have the following structure</p> <blockquote> <p>/3rdPartyAssemblies<br/> /App1<br/> /App2<br/> /App3<br/> /.....</p> </blockquote> <p>All external assemblies are added to 3rdPartyAssemblies/Vendor/Version/...</p> <p>We have a CoreBuild.sln fi...
<p>Usually, you would be creating Build projects/scripts in some form or another for your Production, and so putting together another Solution file doesn't come in the picture.</p> <p>It would be easier to train everyone to use project references, and create a directory under the project file structure for external as...
3,547
<p>I get this error:</p> <p>System.Reflection.TargetException: Object does not match target type.</p> <p>when trying to bind a <code>List&lt;IEvent&gt;</code> where an IEvent can be an appointment, a birthday, or a few other calendar related event types.</p>
<p>ChanChan, GridView does <strong>not</strong> support binding to a collection of interfaces, Try redisigning your application to ensure binding only to a collection of concreate classes. The only workaround for this is to use base class (in your case Event) and bind to a collection of events.</p> <pre><code> ...
<p>This cannot be done, don't use a gridview if you need this functionality, is the only way I can get around it.</p>
43,178
<p>I'm looking for a good Java obfuscator.</p> <p>I've done initial research into the following Java obfuscators: proguard, yguard, retroguard, dasho, allatori, jshrink, smokescreen, jobfuscate, marvin, jbco, jode, javaguard, jarg, joga, cafebabe, donquixote, mwobfu, bbmug, zelix klassmaster, sandmark, jcloak, thicket...
<p>I use <a href="http://proguard.sourceforge.net" rel="noreferrer">ProGuard</a> heavily for all my release builds and I have found it is excellent. I can't recommend it enough!</p> <p>I <em>have</em> encountered obscure bugs caused by it's optimizations on several occasions and I now disable optimizations across the...
<p>We are using Zelix Klassmaster for couple years and I can recommend it.</p>
40,008
<p>I come from a background of MoM. I think I understand ESB conceptually. However, I'm not too sure about the practical differences between the two when it comes to making a choice architecturally.</p> <p>Here is what I want to know</p> <p>1) Any good links online which can help me in this regard.</p> <p>2) Can som...
<p>Messaging tends to concentrate on the reliable exchange of messages around a network; using queues as a reliable load balancer and topics to implement publish and subscribe.</p> <p>An ESB typically tends to add different features above and beyond messaging such as orchestration, routing, transformation and mediatio...
<p>ESB with web services in its true form provides Application loose coupling by sending the data through one the elements of the message.</p> <p>MOM provides not only Application Loose coupling but process loose coupling along.</p> <p>ESB comes with additional features supporting Governance centric approach.</p> <p...
39,856
<p>I've learned in College that you always have to free your unused Objects but not how you actually do it. For example structuring your code right and so on. Are there any general rules on how to handle pointers in C++? </p> <p>I'm currently not allowed to use boost. I have to stick to pure c++ because the framework...
<p>I have worked with the embedded Symbian OS, which had an excellent system in place for this, based entirely on developer conventions.</p> <ol> <li>Only one object will ever own a pointer. By default this is the creator.</li> <li>Ownership can be passed on. To indicate passing of ownership, the object is passed as a...
<ul> <li>When you have to use manage memory manually, make sure you call delete in the same scope/function/class/module, which ever applies first, e.g.:</li> <li>Let the caller of a function allocate the memory that is filled by it, do not return new'ed pointers.</li> <li>Always call delete in the same exe/dll as you c...
4,709
<p>I'm trying to implement search result highlighting for pdfs in a web app. I have the original pdfs, and small png versions that are used in search results. Essentially I'm looking for an api like:</p> <pre><code>pdf_document.find_offsets('somestring') # =&gt; { top: 501, left: 100, bottom: 520, right: 150 }, { ... ...
<p><a href="http://search.cpan.org/dist/CAM-PDF/" rel="nofollow noreferrer">CAM::PDF</a> can do the geometry part quite nicely, but has some trouble with the string matching sometimes. The technique would be something like the following lightly-tested code:</p> <pre><code>use CAM::PDF; my $pdf = CAM::PDF-&gt;new('my....
<p>I think you can do this using the Adobe Acrobat SDK, a Linux version of which can be <a href="http://www.adobe.com/devnet/acrobat/index.html?navID=downloads" rel="nofollow noreferrer">downloaded for free from Adobe</a>. You can use this to <a href="http://livedocs.adobe.com/acrobat_sdk/9/Acrobat9_HTMLHelp/wwhelp/wwh...
23,912
<p>I have a table with a "Date" column. Each Date may appear multiple times. How do I select only the dates that appear &lt; k number of times?</p>
<pre><code>select dates from table t group by dates having count(dates) &lt; k ; </code></pre> <p>Hopefully, it works for ORACLE. HTH</p>
<p>You may not be able to count directly on the datefield if your dates include times. You may need to convert to just the year/month/day format first and then do the count on that.</p> <p>Otherwise your counts will be off as usually there are very few records withthe exact same time.</p>
13,058
<p>I am currently in the look for a 3D printer and one major issue I find it the fumes/VOCs that printing can emit. I am not planning to do ABS or similar but I've read from studies that PLA also may emit VOCs. I live in an apartment and I plan to put the printer in my office, in which I work remotely, so I spend 8+ ho...
<p>The VOC issue is overblown. Unless you print constantly, you don't need any air treatment. Often that kind of treatment is installed by people who like DIY for the fun of it, not because it's really needed.</p> <p><a href="https://www.sciencedirect.com/science/article/pii/S0360132319304196" rel="nofollow noreferrer"...
<p>An enclosure without ventilation would definitely not be enough to contain VOCs from my experience with ABS and HIPS (both have relatively strong smells). The fumes will simply seep out of the openings in the enclosure.</p> <p>I put my 3d printer in a bathroom with an exhaust fan. The fan's outlet is IP-controllable...
1,984
<p>I am trying to convert all DateTime values in a DataTable to strings. Here is the method I use:</p> <pre><code>private static void ConvertDateTimesToStrings(DataTable dataTable) { if (dataTable == null) { return; } for (int rowIndex = 0; rowIndex &lt; dataTable.Rows.Count; rowIndex++ ) ...
<p>This simply won't work, because you haven't changed the underlaying data type.</p> <p>You have a DataTable, with a column which has data type DateTime.</p> <p>You can assign a String to it, but it will convert back to DateTime.</p> <p>Why do you want to change it to a formatted string? Can't you format only when ...
<p>It won't work beacuse the DataType of the column is still DateTime and it'll convert the string back to datetime. I'd suggest to format the date to string when generating your API message. If you still need to generate a string column for datetime values</p> <pre><code>foreach (DataColumn column in dataTable.Column...
25,015
<p>Let's say I want a way to display just the the center 50x50px of an image that's 250x250px in HTML. How can I do that. Also, is there a way to do this for css:url() references? <p> I'm aware of <em>clip</em> in CSS, but that seems to only work when used with absolute positioning.</p>
<p>One way to do it is to set the image you want to display as a background in a container (td, div, span etc) and then adjust background-position to get the sprite you want. </p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-css lang-css prettyprint-override"><code>div{ width: 50px; height: 50px; background: no-repeat -100px -100px/500% url("https://qce.quantum.ieee.org/2022/wp-content/uploa...
8,208
<p>I had this idea for bulky parts for just printing the shell (PLA) then pouring in some kind of filler in to make up the bulk/strength.</p> <p>Printing bulk .2mm at a time line by line is slow and subject to warping!</p> <p>So I though precision print a shell and fill it with 'something' - has this been done by any...
<p>I've looked into doing something similar to this before and love the idea, never had the chance to follow through on it yet. This is sort of a hybrid method between cast molding and 3D printing. </p> <p>The accepted answer to a question I had a while back had some very good points by fred_dot_u</p> <p><a href="ht...
<p>Not exactly the same, but MakerBot Industries is making improvements to their programs by allowing users to do away with standard infill practices (patterned infill). Their approach is to treat infill similarly to how they treat outer support structures, the "infill" only exists in the interest of supporting roofs.<...
573
<p>In the quest for localization I need to find all the string literals littered amongst our source code. I was looking for a way to script this into a post-modification source repository check. (I.E. after some one checks something in have a box setup to check this stat) I'll probably use NAnt and CruiseControl or som...
<p>Visual Studio 2010 and earlier: </p> <ol> <li>Find In Files (CTRL+SHIFT+F)</li> <li>Use: Regular Expressions</li> <li>Find: <strong><code>:q</code></strong> (quoted string)</li> <li>Find All</li> </ol> <p>Find Results window will now contain a report of all files, with line numbers and the line itself with the qu...
<p>There's a <a href="http://www.codeplex.com/csparser" rel="nofollow noreferrer">C# parser on CodePlex</a> that you can probably use.</p>
19,875
<p>Is there a Maven archetype that will generate the same scaffolding as <code>maven-archetype-quickstart</code>, but will in addition create the basic project site layout generated by <code>maven-archetype-site</code>? Or do I always have to run each in sequence?</p>
<p>I think <a href="http://appfuse.org/" rel="nofollow noreferrer">AppFuse</a> is very often the right tool to use when beginning a new Java project. See the <a href="http://appfuse.org/display/APF/AppFuse+QuickStart" rel="nofollow noreferrer">QuickStart for samples.</a></p> <p>I don't think the site will be generated...
<p>I know only 2 maven archetypes for site:</p> <ul> <li>maven-archetype-site</li> <li>maven-archetype-simple</li> </ul> <p>I wonder what template they use in Apache.</p>
25,955
<p>I printed <a href="https://www.thingiverse.com/thing:53451" rel="nofollow noreferrer">Planetary Gears</a> and the top looks great<a href="https://i.stack.imgur.com/Oq5DB.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Oq5DB.jpg" alt="top"></a> but the bottom doesn't<a href="https://i.stack.imgur.c...
<p><strong>Your nozzle is too far from your bed.</strong> The first layer isn't squished down sufficiently, resulting in these gaps. If your first layer looks like this, you should cancel your print and adjust the bed. Alternatively, you can adjust the initial height of the Z-axis in G-code (for instance, <code>G0 Z-0....
<p><strong>@TomvanderZanden was correct</strong></p> <p><strong>My nozzle was too far from your bed</strong> (sort of)</p> <p>Since my printer is manually leveled I have to use a sheet of paper to check each leveling point. This means the nozzle is about 0.1mm off the bed at home. In Cura, I had <code>Initial Layer...
634
<p>I'm creating a .net custom control and it should be able to load multiple text files. I have a public property named ListFiles with those properties set : </p> <pre><code> [Browsable(true), Category("Configuration"), Description("List of Files to Load")] public string ListFiles { get { return m_oList; } ...
<p>You can do this by adding a <a href="http://msdn.microsoft.com/en-us/library/ms171839.aspx" rel="noreferrer">UITypeEditor</a>.</p> <p><a href="http://web.archive.org/web/20090218231316/http://www.winterdom.com/weblog/2006/08/23/ACustomUITypeEditorForActivityProperties.aspx" rel="noreferrer">Here is an example</a> o...
<p>Here's another example comes with customizing File Dialog :</p> <p><strong>CustomFileEditor.cs</strong></p> <pre><code>using System.Windows.Forms; using System.Windows.Forms.Design; namespace YourNameSpace { class CustomFileBrowser : FileNameEditor { protected override void InitializeDialog(OpenFi...
20,601
<p>I'm attemping my first print where I pause the print, change the filament, and resume to achieve a two-color print. My first attempt failed when the printer resumed printing over a centimeter away from where it should have on the X axis. My second attempt was much better, but still resumed about 1.5mm off-target.<...
<p>You are out of luck:</p> <p>Print gcode is written in relative coordinates. If you move the printhead manually, the printer does not know this, and will just follow its relative path from the new position - which is what commonly is called layer-shifting.</p> <p>To try to mitigate this, there are ways, but they ar...
<p>You may have moved the nozzle in the X or Y direction a bit. Instead of resuming right away (that is, after step 5), send it to the X/Y home.</p> <p>Additionally, if you have a removable build plate like in Prusas, you can remove the print, send the model to the X/Y/Z home, raise the nozzle very high, then replace ...
1,128
<p>I have a problem perplexing me to no end. When I run the following query against an access database:</p> <pre><code>SELECT * FROM PreferredSpacer INNER JOIN SpacerThickness ON PreferredSpacer.SpacerTypeID = SpacerThickness.SpacerTypeID ORDER BY PreferredSpacer.UnitTypeID DESC </code></pre> <p>(UnitTypeID field i...
<p>I figured it out. The tool our customer was using to generate the access DB in question was incorrectly turning varchar fields in SQL to memo fields in access (instead of text, as our tools do), and the memo field does not sort correctly. It seems odd to me that Access will just silently go along with it however, ...
<p><a href="http://support.jodohost.com/showpost.php?s=c5de8ca4a52b460e8c78b60c68f84f88&amp;p=14985&amp;postcount=3" rel="nofollow noreferrer">Google</a> says:</p> <blockquote> <p>You can not perform an ORDER BY on a text, ntext, or image field (those fields are actually pointers).</p> </blockquote> <p>Its about MS...
26,948
<p>I'd like to store a simple key/value string dictionary in my web config file. Visual Studio makes it easy to store a string collection(see sample below) but I'm not sure how to do it with a dictionary collection.</p> <pre><code> &lt;ArrayOfString xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:x...
<p>Why reinvent the wheel? The <a href="http://www.odetocode.com/Articles/345.aspx" rel="noreferrer">AppSettings</a> section is designed for exactly the purpose of storing dictionary-like data in your config file.</p> <p>If you don't want to put too much data in your AppSettings section, you can group your related val...
<p>I'm not sure how to store a Dictionary directly but you could easily use an array of strings to store a dictionary. For every key, value pair you save out the key as the first string and the value as the second. Then when rebuilding the dictionary you can undo this encoding.</p> <pre><code>static Dictionary&lt;st...
43,900
<p>In my SQL database, I have a one-to-many relationship, something like this:</p> <pre> Teacher Student John Alex John Mike John Sean Bob Jack Gary George Gary Paul </pre> <p>I'd like to display a table listing each teacher, with their students as a comma-delimited list, like this:</p> <pr...
<p>I've found a simpler, straight-forward method to do this -- add an expression as follows:</p> <pre><code>=Join(LookUpSet(Fields!TeacherName.Value, Fields!TeacherName.Value, Fields!StudentName.Value, "YourTeacherDataSet"), ",") </code></pre>
<p>This StackOverflow answer presents one technique for accomplishing this:</p> <p><a href="https://stackoverflow.com/a/977763/16911">String aggregation in SSRS 2005</a></p> <p>The downside to this technique is that it uses shared variables in a code module, which may cause concurrency issues if the report is hosted ...
25,114
<p>I am using Adobe Captivate 3 and am having trouble disabling the typing noise when using a recording. Sometimes when I have this 'feature' disabled and make a recording, it doesn't make the typing sound, but when I publish the project, the typing sound returns. Also, I have other projects I am working on where the...
<p>I've introduced it into our code base because we needed a bettor malloc to use when we moved to a 16 core machine. With 8 and under it wasn't a significant issue. It has worked well for us. We plan on using the fine grained concurrent containers next. Ideally we can make use of the real meat of the product, but that...
<p>Have you looked at <a href="http://www.boost.org/" rel="nofollow noreferrer">boost</a> library with its <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/thread.html" rel="nofollow noreferrer">thread API</a>? </p>
13,244
<p>Python 3.0 is in beta with a final release coming shortly. Obviously it will take some significant time for general adoption and for it to eventually replace 2.x.</p> <p>I am writing a tutorial about certain aspects of programming Python. I'm wondering if I should do it in Python 2.x or 3.0? (not that the differe...
<p>Start with 2.x. Most existing libraries will be on 2.x for a long time. Last year, <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=211200" rel="nofollow noreferrer">Guido himself said that it would be "two years"</a> until you needed to learn 3.0; there's still another year left. Personally, I think it...
<p>It depends on your audience. If it's a general audience, and you plan to leave it posted for a long time, I'd suggest looking forward and going with 3.0. On the other hand if it's for a project or group that's going to be doing work in the near future, Python 2 probably make more sense.</p>
25,765
<p>I need a portable C/C++ solution, so I'm looking for a C/C++ client library for Memcached that work on both Windows and Unix. Any suggestions?</p>
<p>There's libmemcached in C. Should be most portable :)</p>
<p><a href="http://people.freebsd.org/~seanc/libmemcache/" rel="nofollow noreferrer">http://people.freebsd.org/~seanc/libmemcache/</a></p> <p>HTH</p>
44,662
<p>Are there any tools that will spider an asp.net website and create a static site?</p>
<p><a href="http://www.httrack.com/" rel="nofollow noreferrer">http://www.httrack.com/</a><br> Have used for this purpose a few times, may need to do a little tidying up of urls, and some css linked images might not make it, depends on how good a job you want to do.<br> If you have dreamweaver, you can use that to mana...
<p>Another solution is <a href="http://www.devarticles.com/c/a/Web-Services/Website-Mirroring-With-wget/1/" rel="nofollow noreferrer">wget</a>.</p>
6,629
<p>I am working on a web application where I want the content to fill the height of the entire screen.</p> <p>The page has a header, which contains a logo, and account information. This could be an arbitrary height. I want the content div to fill the rest of the page to the bottom.</p> <p>I have a header <code>div</c...
<h3>2015 update: the flexbox approach</h3> <p>There are two other answers briefly mentioning <a href="https://developer.mozilla.org/en-US/docs/Web/Guide/CSS/Flexible_boxes" rel="noreferrer">flexbox</a>; however, that was more than two years ago, and they don't provide any examples. The specification for flexbox has de...
<p>it <strong>never worked for me in other way then with use of the JavaScript</strong> as NICCAI suggested in the very first answer. I am using that approach to rescale the <code>&lt;div&gt;</code> with the Google Maps. </p> <p>Here is the full example how to do that (works in Safari/FireFox/IE/iPhone/Andorid (works ...
11,558
<p>I am using FxCop and I would like to find all the methods or variables without an access modifier explicitly defined. For example:</p> <pre><code>class MyClass { int myInt = 0; internal MyClass() { } } </code></pre> <p>I would like FxCop to warn me that I didn't specify what access modifier will be ap...
<p>FxCop analyses the compiled code, which has access modifiers applied. You need to use a tool like <a href="http://code.msdn.microsoft.com/sourceanalysis" rel="nofollow noreferrer">StyleCop</a> to detect coding syntax issues such as not explicitly declaring access modifiers.</p>
<p>Using FxCop I beleive the only way to do this would be to write your own custom rule. This <a href="http://blogs.msdn.com/fxcop/archive/2004/01/09/writing-custom-rules-in-fxcop-amp-fxcop-visual-studio-integration-jeffrey-van-gogh.aspx" rel="nofollow noreferrer">blog post</a> is a good place to start.</p> <p>You may...
41,076
<p>In graph theory, what is the distinction between minimal distance (which Dijkstra's algorithm finds), and minimal path (which I'm not sure what it is)?</p>
<p>Minimal path is the set of edges which when traversed cover the least amount of distance between two edges. Minimal distance is the sum of the distance between the edges of a minimal path.</p>
<p>Minimal distance is the same as minimal path. </p>
36,686
<p>E3D hotends use a thermistor whose legs are insulated with glass fiber sleeving and clamped down with a screw and washer:</p> <p><a href="https://i.stack.imgur.com/IAJDy.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/IAJDy.jpg" alt="enter image description here"></a></p> <p>This solution enables the pri...
<p>I like the mounting method on my Mk9 extruder: there's a small hole drilled into the heat block, parallel to the heater hole. B3 Innovations sells a thermistor packaged into a small spring. The whole assembly goes in the hole, and a setscrew (gently!) secures it. You could just as well put a bare thermistor into a s...
<p>I have now purchased a hot-end block from <a href="https://www.3dprinterspares.eu/heat-block-upgrade-kit-for-prusa-i3--compatiable-3d-printers-73-p.asp" rel="nofollow noreferrer">here</a>, that has a "cartridge style" cylindrical thermistor that fits into a drilled hole of the hot-end block, and is fixed by an addit...
149
<p>I'm designing a database table and asking myself this question: <em>How long should the firstname field be?</em></p> <p>Does anyone have a list of reasonable lengths for the most common fields, such as first name, last name, and email address?</p>
<p>I just queried my database with millions of customers in the USA.</p> <ul> <li><p>The maximum <strong>first name</strong> length was 46. I go with 50. (Of course, only 500 of those were over 25, and they were all cases where data imports resulted in extra junk winding up in that field.)</p></li> <li><p><strong>Las...
<p>it is varchar right? So it then doesn't matter if you use 50 or 25, better be safe and use 50, that said I believe the longest I have seen is about 19 or so. Last names are longer</p>
4,133
<p>I'm trying to create a table under SQL Server 2008 containing a <strong>GEOMETRY</strong> column and a calculated variation thereof.</p> <p>Considering the following table where the calculated column returns a buffered geometry:</p> <pre><code>CREATE TABLE [dbo].[Test] ( [Geometry] GEOMETRY NOT NULL, ...
<p>I guess you could use a trigger to calculate it and store it to the [BufferedGeometry] field</p>
<p>Whoever is still having such problem: SQL Server 2012 now allows it</p>
28,590
<p>I'm a confused newbie and hobbyist programmer trying to get a grip on this, so forgive me if my question is a little off or doesn't make much sense.</p> <p>I see a lot of questions on SO revolving around the use of design patterns, and I'm wondering if anyone has a good resources for learning about, and implementin...
<p><a href="http://books.google.com/books?id=LjJcCnNf92kC&amp;dq=head+first+design+patterns&amp;pg=PP1&amp;ots=_9_-4Ck6wX&amp;source=bn&amp;sig=7ccZxDrVEEsIq-s9D3hhJTx1I4U&amp;hl=en&amp;sa=X&amp;oi=book_result&amp;resnum=7&amp;ct=result" rel="nofollow noreferrer">Head First Design Patterns</a> </p> <p><img src="https:...
<p>It does not make too much sense to me for someone with very little experience to delve too far deeply into design patterns. It is great to know they exist, but at this point you should focus more on other things rather than just learning about design patterns. </p> <p>They are useful in context of a problem - as ...
30,347
<p>I'm writing a Linux module and getting:</p> <pre><code>Unable to handle kernel NULL pointer dereference </code></pre> <p>What does it mean?</p>
<p>Sounds like a pointer which currently has the NULL value (zero) is being dereferenced. Assign an address to the pointer before dereferencing it.</p> <p>e.g.</p> <pre><code>int x = 5; int * x_ptr = NULL; x_ptr = &amp;x; // this line may be missing in your code *x_ptr += 5; //can't dereference x_ptr here if x_ptr ...
<p>The kernel tries to read from address <code>0</code>, which your kernel apparently treats specially (good thing!). As the kernel has no way to just kill itself like we know from user mode applications (those would have received a <a href="http://en.wikipedia.org/wiki/Segmentation_fault" rel="nofollow noreferrer">Seg...
44,378
<p>I have heard that uploading your website with FTP is now for n00bs, but it's the only way I've known how for the 8 or so years I've been building websites. Apparently all the buzz now is using a version control system, like SVN or Git, and somehow using SSH to upload only the files that have changed (if I understan...
<p>You've got things mixed up a bit. A version control system is used <em>internally</em> to keep track of your code during development. With centralized systems like SVN, you regularly upload your code to a SVN server, which keeps track of what has changed, makes sure conflicting changes are merged correctly, and keep...
<p>There is no problem using ftp to upload. The only disadvantage is that the password is transferred as plain text.</p> <p>It would be good to have a local version control system, that would allow you to easily see changes between versions, and quickly revert to an older version, and much more...</p> <p>I don't thin...
43,879
<p>I know you can use C++ keyword 'explicit' for constructors of classes to prevent an automatic conversion of type. Can you use this same command to prevent the conversion of parameters for a class method?</p> <p>I have two class members, one which takes a bool as a param, the other an unsigned int. When I called t...
<p>No, you can't use explicit, but you can use a templated function to catch the incorrect parameter types.</p> <p>With <strong>C++11</strong>, you can declare the templated function as <code>delete</code>d. Here is a simple example:</p> <pre><code>#include &lt;iostream&gt; struct Thing { void Foo(int value) { ...
<p>You could also write an int version that calls the bool one.</p>
21,164
<p>I cannot seem to debug my JavaScript code with Firebug. The play button is greyed out. I use FireFox 3.0.4 and Firebug 1.2.1.</p> <p>Are there any known issues?</p> <p>This is the script I want to debug:</p> <p>(breakpoints set on <code>&lt;img onclick&gt;</code> and function <code>say()</code>), the code execute...
<p>Check if you have "support for script debugging" enabled in Console. Its disabled by default for performance reasons.</p>
<p>I usually see this behavior if I forget to set a break point, or I have set the break points in places that don't get executed (so execution never stops, so the play button would never do anything).</p>
40,239
<p>I have a new Creality Ender 3.</p> <p>I suspect that I have not adjusted the eccentric nuts correctly, on the X-axis head carriage mounts. </p> <p>Even after a glass bed upgrade, using the Level Corners routine of the TH3D firmware, I can get the head to scrape a sheet of paper all 4 corners but that same sheet o...
<p>This seems to be a common problem with ender-3 and cr-10 printers from Creality. Mine is the same way but not enough to keep prints from adhering. </p> <p>Typically the aluminum bed is not perfectly flat. If it’s not the glass may be able to flex enough that it can make a difference. There are a few ways to try to ...
<p>I had the same exact issue, you have to make sure all of your printer is leveled, start with the base, than the poles that hold your x axis gantry. there are numerous youtube videos on how to do that.. make sure it's all leveled and try again.. this tip helped a few people already</p>
1,317
<p>Has anyone tried a solution to host ASP classic pages on something else than IIS/Windows? I'm wondering if it would be a good idea to try one of the solutions for that problem. I know about Sun Java System Active Server Pages (or Chilisoft) but haven't tried it. Is there any big problems with those solutions? Does t...
<p>You could try with <a href="http://apache-asp.org./" rel="nofollow noreferrer">Apache::ASP</a> in your Linux, but I'll use it just for the meantime until can migrate the application to other language with better support (PHP, Perl, Python, Java, Ruby... even .Net with Mono).</p> <p>Note that Apache:ASP can't manage...
<p>I think you'll get in troubles trying that ... :(</p> <p>If it was ASP.NET I'd encourage you to use Mono, but for classic ASP I don't think there are that many solutions, but I <em>could</em> be wrong :)</p>
42,897
<p>How do you parse a CSV file using gawk? Simply setting <code>FS=","</code> is not enough, as a quoted field with a comma inside will be treated as multiple fields.</p> <p>Example using <code>FS=","</code> which does not work:</p> <p>file contents:</p> <pre><code>one,two,"three, four",five "six, seven",eight,"nin...
<p>The short answer is "I wouldn't use gawk to parse CSV if the CSV contains awkward data", where 'awkward' means things like commas in the CSV field data.</p> <p>The next question is "What other processing are you going to be doing", since that will influence what alternatives you use.</p> <p>I'd probably use Perl a...
<p>Here's what I came up with. Any comments and/or better solutions would be appreciated.</p> <pre><code>BEGIN { FS="," } { for (i=1; i&lt;=NF; i++) { f[++n] = $i if (substr(f[n],1,1)=="\"") { while (substr(f[n], length(f[n]))!="\"" || substr(f[n], length(f[n])-1, 1)=="\\") { f[n] = sprintf("%...
40,558
<p>So basically I've been having a problem with my Micro+. It will not level / calibrate itself and I can't fix it. The reason I'm here is that I've been using Cura, and somehow it destroyed my bed. (See image)</p> <p><a href="https://i.stack.imgur.com/Qe8cA.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgu...
<p>In general I would use <a href="https://github.com/rcarlyle/StepperSim" rel="nofollow noreferrer">https://github.com/rcarlyle/StepperSim</a> which takes into account more parameters.</p> <p>You can play with voltage and current to see which combination gives you the best results for your motor.</p> <p>Or you can cha...
<p>I was considering buying a Fl3xdrive but had this exact fear, that the speed (rotation) required for retractions was too much.</p> <p>I stumbled upon this post while looking for a project for a step-up gearbox. I found a <a href="https://www.thingiverse.com/thing:3714978" rel="nofollow noreferrer">Nema 17 Gearbox &q...
1,895
<p>Is it possible to cast an object in Java to a combined generic type?</p> <p>I have a method like:</p> <pre><code>public static &lt;T extends Foo &amp; Bar&gt; void doSomething(T object) { //do stuff } </code></pre> <p>Calling this method is no problem if I have a class that implements both interfaces (Foo &am...
<p>Java 8 introduces the possibility of <a href="http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.16">casting with additional bounds</a>. You can cast an <code>Object</code> as a <code>class</code> with multiple <code>interfaces</code> (or just as multiple <code>interfaces</code>).</p> <p>So this:</...
<p>As a workaround, you could define another interface FooBar that extends Foo and Bar and have your class implement that. It doesn't even have to be a top-level interface - you can declare it private if you don't want to clutter up or retrofit the rest of your code:</p> <pre><code>private interface FooBar extends Foo...
41,119
<p>Every example I've seen of CGI/Perl basically a bunch of print statements containing HTML, and this doesn't seem like the best way to write a CGI app. Is there a better way to do this? Thanks.</p> <p>EDIT: I've decided to use CGI::Application and HTML::Template, and use the following tutorial: <a href="http://doc...
<p>Absolutely (you're probably looking at tutorials from the 90s). You'll want to pick a framework. In Perl-land these are the most popular choices:</p> <ul> <li><a href="http://search.cpan.org/perldoc?CGI::Application" rel="nofollow noreferrer">CGI::Application</a> - very lightweight with lots of community plugins</l...
<p>You can also separate presentation out from code and just use a templating system without needing to bring in all the overhead of a full-blown framework. <a href="http://www.tt2.org/" rel="nofollow noreferrer">Template Toolkit</a> can be used by itself in this fashion, as can <a href="http://www.masonhq.com/" rel="...
40,608
<p>Can you use calculated fields in Excel 2007 pivot tables when the data source is an SSAS data cube?</p> <p>I am connecting to a SQL Server 2005 data cube with Excel 2007 and viewing the data though a pivot table. I want to create calculated fields in my pivot table, but the "Formulas" button is grayed out. </p> <p...
<p>Looks like you can't. This is the answer I got from MSDN: </p> <p><em>Not possible. All of the aggregations are handled by Analysis Services. Since XL is not in charge of the aggregations it has no ability to do custom calculations.HTH... Jim Thomlinson</em></p>
<p>additionally, you can use 'Office Web Components' instead of Excel. OWC supports client-side formulas against OLAP cubes.. I can't believe that they removed that feature from native Excel.</p>
11,023
<p>Is there a csh script/command to list all the files in source source tree which have line endings that show up as "^M" in emacs (under linux).</p> <p>Thanks!</p>
<p>Based on my answer to <a href="https://stackoverflow.com/questions/204765/elegant-way-to-search-for-utf-8-files-with-bom#211855">another question</a>:</p> <pre><code>fgrep -rl `echo -ne '\r'` . </code></pre>
<pre><code>find . -type f -exec grep $'\r' {} + </code></pre> <p>The <code>$'\r'</code> probably requires bash to function correctly.</p>
31,545
<p>Let's say I want a web page that contains a Flash applet and I'd like to drag and drop some objects from or to the rest of the web page, is this at all possible?</p> <p>Bonus if you know a website somewhere that does that!</p>
<p>This one intrigued me. I know jessegavin posted some code while I went to figure this out, but this one is tested. I have a super-simple working example that lets you drag to and from flash. It's pretty messy as I threw it together during my lunch break.</p> <p>Here's the <a href="http://enobrev.github.io/DragSW...
<p>If the whole site is one big embedded flash file then yes it's possible.</p> <p>I don't think that you can acheive it any other way</p>
10,825
<p>I want completely automated integration testing for a Maven project. The integration tests require that an external (platform-dependent) program is started before running. Ideally, the external program would be killed after the unit tests are finished, but is not necessary. </p> <p>Is there a Maven plugin to acc...
<p>You could use the <a href="http://maven.apache.org/plugins/maven-antrun-plugin/" rel="nofollow noreferrer">antrun</a> plugin. Inside you would use ant's <strike><a href="http://ant.apache.org/manual/Tasks/exec.html" rel="nofollow noreferrer">exec</a></strike> <a href="http://ant.apache.org/manual/Tasks/apply.html" r...
<p>Do you want to start an application server ? Have a look at <a href="http://cargo.codehaus.org/" rel="nofollow noreferrer">Cargo</a> and its <a href="http://cargo.codehaus.org/Maven2+plugin" rel="nofollow noreferrer">Maven plugin</a>.</p>
21,160
<p>When a web form is submitted and takes the user to another page, it is quite often the case that the user will click the Back button in order to submit the form again (the form is an advanced search in my case.)</p> <p>How can I reliably preserve the form options selected by the user when they click Back (so they d...
<p>I'd put it in the session.<br> It's going to be the most reliable and even if they don't go straight "back", it'll still have their search options there. Putting it in the cookie would also work, but wouldn't be recommended unless it's a very small form.</p>
<p>You would basically have to store it on your server in some way (probably in session variables, as suggested) after the POST. You also have to setup Javascript on the form page to execute on load to issue an AJAX call to get the data from your server (in, say, JSON format) and prefill the form fields with the data....
30,753
<p>I am a beginner in c++ and I have a small problem:</p> <p>my code displays a simple menu to the user providing three options:</p> <pre><code>cout &lt;&lt; "\nQuadratic equation: a*X^2 + b*X + c = 0 main menu: "; cout &lt;&lt; "\n &lt;r&gt; Give new coefficients"; cout &lt;&lt; "\n &lt;c&gt; Calculate equations...
<p>To get past the "cbbb" being accepted as 'c', you'll have to read in a line using getline() instead. Then you can check that only one character was entered, and then check which character that was.</p> <p>If you use cin to read a char, it will only read the first character available in the input stream.</p>
<p>Change this line:</p> <pre><code>cout&lt;&lt;"Enter choice : " &lt;&lt; std::endl; // ^^^^^^^^^^^^^^^ </code></pre> <p>This print '\n' then forces the buffer to flush to the output so it can be read.</p> <p>If you just want to flush the buffer:</p> <pre><code>cout&lt;&lt;"Enter choice : " &lt...
29,249
<p>one of the most frequent requests I get is to create XY report for YZ App. These apps are normally built on PHP, so far I have manually created most of this reports, and while I enjoy the freedom of building it as I want, it usually becomes pretty tedious to calculate subtotals, averages, exporting to different form...
<p>The problem you're facing is solved by so-called Business Intelligence software. This software tends to be bloated and expensive, but if you know your way around them you will be able to crank out such reports in no time at all. </p> <p>I'm only familiar with one particular proprietary solution, which isn't too g...
<p>It depends on what kind of reports you're talking about. For example... site stats... you could install google analytics and the client could export whatever format they wanted.</p>
9,162
<p>I would like to access the contacts field on an email message (Email options) in outlook. Normally this field ties an email to a contact. Since it is a freeform text field available from the options dialog box, I am trying to use it to store a "next action" for my email message. I would like to set the next action b...
<p>I think this will answer it: the field is buried in a semi-generic 'Links' property, with a type of olContact. To test the following code, open a new email, put something in the contacts field, and then run the code:</p> <p><pre><code>Sub ShowContactsField() Dim objApp As Outlook.Application Dim ActiveMailItem...
<p>Hmm, I also couldn't figure out how to access the Contacts field but from your description it sounds like you're not intending to use it for its intended purpose at all but rather just have the need to associate some arbitrary string data with an email item. If that is correct, I would recommend adding fields to the...
47,867
<p>So, I'm having this problem where almost anything I print with a section(s) that is not directly connected to something below it breaks when I try to pull the small filaments meant to hold it up during printing off. For example, I 3D-printed a Rayquaza(<a href="https://www.myminifactory.com/object/rayquaza-23624" re...
<p>The small filaments you remove that hold the parts up are called supports. The one model I located on Thingiverse clearly requires a number of supports, as the model is not easily designed for 3d printing with FDM printers. It would be better printed with SLS, but that's not the focus of your question.</p> <p>You d...
<p>Depends how small your printing, if it's the one i see on thingiverse then it don't see why it would break unless:</p> <ol> <li>it's super small</li> <li>too many or strong support that's hard to pull off?</li> <li>Not calibrated for the filament - eg temperature too low or too much fan and the layer's aren't prope...
387
<p>I'm trying to show/hide a movieclip (or graphic) symbol that is on a layer of a button symbol using actionscript 2. Here's what I tried</p> <p>in the actions for the button:</p> <pre><code>on (release) { this.button_name.movieclip_name._alpha = 0; trace(this.button_name.movieclip_name); } </code></pre> <p>and t...
<p>For AS2, it's not a good idea to put MovieClips inside buttons. The easiest and most direct approach is to restructure things so that your button and the movieclip you had inside it are at the same level, perhaps within a new MC created to contain them. You should think of the Button symbol as a thing that only prov...
<p>found: <a href="http://www.actionscript.org/forums/archive/index.php3/t-99018.html" rel="nofollow noreferrer">this</a>...</p> <p>They talk about some 'other way' (other than using button symbols?) Maybe you can use a movieclip symbol as a button?</p>
24,081
<p>I know two approaches to Exception handling, lets have a look at them.</p> <ol> <li><p>Contract approach.</p> <p>When a method does not do what it says it will do in the method header, it will throw an exception. Thus the method &quot;promises&quot; that it will do the operation, and if it fails for some reason, it ...
<p>I favor what you call the "contract" approach. Returning nulls or other special values to indicate errors isn't necessary in a language that supports exceptions. I find it much easier to understand code when it doesn't have a bunch of "if (result == NULL)" or "if (result == -1)" clauses mixed in with what could be...
<p>I believe that if you are building a class which will be used by an external program (or will be reused by other programs) then you should use the contract approach. A good example of this is an API of any kind.</p>
4,595
<p>Django comes with <a href="https://github.com/brosner/django-csrf/blob/master/django_csrf/middleware.py" rel="noreferrer">CSRF protection middleware</a>, which generates a unique per-session token for use in forms. It scans all incoming <code>POST</code> requests for the correct token, and rejects the request if the...
<p>If you know you're going to need the CSRF token for AJAX requests, you can always embed it in the HTML somewhere; then you can find it through Javascript by traversing the DOM. This way, you'll still have access to the token, but you're not exposing it via an API.</p> <p>To put it another way: do it through Django...
<p><strong>Cancel that, I was wrong. (See comments.)</strong> You can prevent the exploit by ensuring your JSON follows the spec: Always make sure you return an object literal as the top-level object. (I can't guarantee there won't be further exploits. Imagine a browser providing access to the failed code in its window...
17,448
<p>I am a single developer just getting started with open source web dev (Python/Django). I signed up for a free Assembla.com account but I really don't know whether to use Trac ticketing or Assembla integrated ticketing. I have setup spaces for both to try them out, but it seems like I would need to use them for a whi...
<p>I'm not qualified to discuss "best", which is what a request for recommendations boils down to.</p> <p>Trac has an extensive (and IMHO well-architected) plugin infrastructure; if you're a heavy Python developer and are interested in customizing your ticketing system (or if you aren't, and find any of the <A HREF="h...
<p>It depends. Just for trying littl this - littl that any hosted solution would do. If it turns out you are a real geek - for misc. reasons you would want to run your very own VPS (e.g. from slicehost, which i love). I've been using Trac for quite some time and it's a great choice if you have a single project and need...
24,161
<p>I'm developing a Mac App in Java that logs into any one of our client's databases. My users want to have several copies of this program running so they can log into a couple clients at the same time, rather than logging out and logging back in.</p> <p>How can I allow a user to open several copies of my App at once...
<p>You've probably already gotten enough code that you don't want to hear this, but you should really not be starting up two instances of the same application. There's a reason that you're finding it so difficult and that's because Apple doesn't want you to do it.</p> <p>The OSX way of doing this is to use the <strong...
<p>From the Terminal (or in a script wrapper): </p> <pre><code>/Applications/TextEdit.app/Contents/MacOS/TextEdit &amp; </code></pre> <p>Something like that should work for you.</p> <p>To do this in Java:</p> <pre><code> String[] cmd = { "/bin/sh", "-c", "[shell commmand goes here]" }; Process p = Runtime.getRunt...
14,202
<p>What is the best online forum site about project management? It must cover PM-related news, articles, case studies and discussion boards.</p>
<p><strong>Edit</strong></p> <p>How fast things change? I just heard about <a href="http://www.thepmpodcast.com/index.php?option=com_content&amp;task=view&amp;id=20&amp;Itemid=35" rel="nofollow noreferrer">Cornelius Fichtner's</a> new project: <a href="http://www.project-management-opinions.com/" rel="nofollow norefer...
<p>In the earlier days, <a href="http://www.joelonsoftware.com" rel="nofollow noreferrer">Joel's site</a> had more of a project management lean.</p> <p>Browse the archive <a href="http://www.joelonsoftware.com/Archive.html" rel="nofollow noreferrer">here</a>.</p>
33,850
<p>I'm trying to find the latitude and longitude of the corners of my map while in birdseye view. I want to be able to plot pins on the map, but I have hundreds of thousands of addresses that I want to be able to limit to the ones that need to show on the map.</p> <p>In normal view, VEMap.GetMapView().TopLeftLatLong ...
<p>Here's the code for getting the Center Lat/Long point of the map. This method works in both Road/Aerial and Birdseye/Oblique map styles.</p> <pre><code>function GetCenterLatLong() { //Check if in Birdseye or Oblique Map Style if (map.GetMapStyle() == VEMapStyle.Birdseye || map.GetMap...
<p>According to <a href="http://dev.live.com/virtualearth/sdk/" rel="nofollow noreferrer">http://dev.live.com/virtualearth/sdk/</a> this should do the trick:</p> <pre><code>function GetInfo() { alert('The latitude,longitude at the center of the map is: '+map.GetCenter()); } </code></pre>
5,258
<p>I want to use git to allow me to work on several features in a module I'm writing concurrently. I'm currently using SVN, with only one workspace, so I just have the workspace on my PYTHONPATH. I'm realizing this is less than ideal, so I was wondering if anyone could suggest a more 'proper' way of doing this.</p> <p...
<p><a href="http://www.python.org/doc/2.5.2/tut/node8.html#SECTION008420000000000000000" rel="nofollow noreferrer">Relative imports</a> (<a href="http://www.python.org/dev/peps/pep-0328/" rel="nofollow noreferrer">PEP 328</a>) might help:</p> <pre><code>eggs/ __init__.py foo.py bar.py # foo.py from __future__ i...
<p>"say I have a module 'eggs', with sub-modules 'foo' and 'bar'. Components in 'bar' use code in foo, so eggs/bar/a.py may 'import eggs.foo'."</p> <p>This may not be the best structure. I suggest you have some other modules struggling to get out.</p> <p>You have <code>eggs.bar.a</code> depending on <code>eggs.foo</...
44,671
<p>Up until recently, I've been storing multiple values into different hashes with the same keys as follows:</p> <pre><code>%boss = ( "Allan" =&gt; "George", "Bob" =&gt; "George", "George" =&gt; "lisa" ); %status = ( "Allan" =&gt; "Contractor", "Bob" =&gt; "Part-time", "George" =&gt; "...
<p>This is the standard way, as per <a href="http://perldoc.perl.org/perldsc.html" rel="noreferrer" title="Perl Data Structure Cookbook">perldoc perldsc</a>.</p> <pre><code>~&gt; more test.pl %chums = ( "Allan" =&gt; {"Boss" =&gt; "George", "Status" =&gt; "Contractor"}, "Bob" =&gt; {"Boss" =&gt; "Peter", "S...
<p>%chums = ( "Allan" => {"Boss" => "George", "Status" => "Contractor"}, "Bob" => {"Boss" => "Peter", "Status" => "Part-time"} );</p> <p>works great but is there a faster way to enter the data?</p> <p>I am thinking of something like</p> <p>%chums = (qw, x)( Allan Boss George Status Contractor Bob Boss Pet...
23,110
<p>We have a web application that uses SQL Server 2008 as the database. Our users are able to do full-text searches on particular columns in the database. SQL Server's full-text functionality does not seem to provide support for hit highlighting. Do we need to build this ourselves or is there perhaps some library or kn...
<p>Expanding on Ishmael's idea, it's not the final solution, but I think it's a good way to start. </p> <p>Firstly we need to get the list of words that have been retrieved with the full-text engine: </p> <pre><code>declare @SearchPattern nvarchar(1000) = 'FORMSOF (INFLECTIONAL, " ' + @SearchString + ' ")' declare ...
<p>You might be missing the point of the database in this instance. Its job is to return the data to you that satisfies the conditions you gave it. I think you will want to implement the highlighting probably using regex in your web control.</p> <p>Here is something a quick search would reveal.</p> <p><a href="http...
9,454
<p>I'm trying to add a special markup to Python documentation strings in emacs (python-mode).</p> <p>Currently I'm able to extract a single line with:</p> <pre><code>(font-lock-add-keywords 'python-mode '(("\\(\"\\{3\\}\\.+\"\\{3\\}\\)" 1 font-lock-doc-face prepend))) </code></pre> <p>This works now:</p> <pre...
<pre><code>"\\(\"\\{3\\}\\(.*\n?\\)*?\"\\{3\\}\\)" </code></pre> <p>The "*?" construct is the non-greedy version of "*".</p>
<p>A newline in emacs regexps is entered by C-q C-j so just stick a group containing . and C-q C-j into your regexp. As I use regexp-tool to build them, mine isn't fully quoted as yours, but I hope the changes are obvious. </p> <p><code>\("\{3\}\(.\|</code>C-qC-j<code>\)+"\{3\}\)</code></p> <p>Sorry I can't format it...
41,478
<ul> <li>What exactly is a learning curve?</li> <li>And why is it wrong to use the term "steep learning curve" for something which has high entry barriers and takes quite some time to get into?</li> </ul> <p>As to the why-ness of this question:</p> <ul> <li>The terms are used often and inconsistently on Stack Overflo...
<p>It's a curve of time versus proficiency.</p> <p>Steep for hard is wrong because it'd mean that you get very proficient in very little time</p> <pre> proficiency | __ | | | | Proficient in little time (steep = easy) | | |_/____________ time proficiency | | Proficient in lots of ...
<p>Learning curve is the rate at which knowledge can can acquired. A new developer on a complex system will likely experience a steep learning curve as they will have a lot to learn before they can become productive. By implication an experienced developer may experience a shallow learning curve if they are familiar wi...
35,037
<p>This may be a matter of style, but there's a bit of a divide in our dev team and I wondered if anyone else had any ideas on the matter...</p> <p>Basically, we have some debug print statements which we turn off during normal development. Personally I prefer to do the following:</p> <pre><code>//---- SomeSourceFile....
<p>My initial reaction was <em><code>#ifdef</code>, of course</em>, but I think <code>#if</code> actually has some significant advantages for this - here's why:</p> <p>First, you can use <code>DEBUG_ENABLED</code> in preprocessor <em>and</em> compiled tests. Example - Often, I want longer timeouts when debug is enable...
<p>Alternatively, you can declare a global constant, and use the C++ if, instead of the preprocessor #if. The compiler should optimize the unused branches away for you, and your code will be cleaner.</p> <p>Here is what <a href="http://books.google.com/books?id=L5ZbzVnpkXAC&amp;pg=PA69&amp;lpg=PA69&amp;dq=C%2B%2B+got...
16,360
<p>I need to be able to compile firefox and bundle it with a few extensions so when people download it the extensions are already there.</p> <p>I was wondering if anyone can point me to some documentation. I have been searching for hours and can't seem to find anything like that.</p> <p>Thanks,</p> <p>Sebastian</p>
<p>If you don't need to specifically 'compile' Firefox and are using Windows, you can create a simple batch (.bat) file to execute the Firefox installer and then the extensions installers in order. Alternatively, you can also use a Powershell (.ps1) script.</p>
<p>you might want to check out CCK or something like it. </p>
30,760
<p>Icon I set in properties is visible in taskbar and when on application window, but application icon in explorer is different.</p>
<p>Could it be that the application icon you have set has different images at different icon sizes and this is why you are seeing a difference in explorer?</p> <p>To test this, open your icon in Visual Studio. The different resolutions are listed (on my screen to the left). If you don't want to create all resolutions,...
<p>If you're using Visual Studios, this can be set in the Application Properties (the Project menu, I believe). This is the same place you set your resources, target .net, etc.</p>
43,331
<p>How can I change the color of a DataGridView border when BorderStyle = FixedSingle?</p>
<p>You cannot change the border color, it is system defined. </p> <p>Instead you could try turning off the border setting and then placing the DataGridView inside a Panel. Where the DataGridView is set to Dock.Fill and the Panel has a Padding of 1 pixel on all edges. Then setting the background color of the Panel will...
<p>You could change the border if you make your own DataGridView and override the OnPaint() method. Be sure to call base.OnPaint(e) before you do your own magic.</p> <p>Also, you could add a property "GridBorderColor" which set color, your own painting would use.</p>
19,523
<p>I'm using AspectJ to advice all the public methods which do have an argument of a chosen class. I tried the following:</p> <pre><code>pointcut permissionCheckMethods(Session sess) : (execution(public * *(.., Session)) &amp;&amp; args(*, sess)); </code></pre> <p>This is working wonderfully for methods with at ...
<p>Oh well... I worked that around with this nasty trick. Still waiting for someone to show up with an "official" pointcut definition.</p> <pre><code>pointcut permissionCheckMethods(EhealthSession eheSess) : (execution(public * *(.., EhealthSession)) &amp;&amp; args(*, eheSess)) &amp;&amp; !within(it.___.secu...
<pre><code>@Before(value = "execution(public * *(.., org.springframework.data.domain.Pageable , ..))") private void isMethodPageable () { log.info("in a Aspect point cut isPageableParameterAvailable()"); } </code></pre>
33,311
<p>Say for example you're getting a web app project that interacts with a database. </p> <p>How do you start your development? Do you start by designing your database, drawing simple ERD and writting a create scripts? Do you start by designing the look of your of web app, maybe using photoshop, then create a master pa...
<p>You start by deciding which way you start. No but really, it depends on too much factors to have a general answer. Do you develop using concepts of agile development, are there specified functional designs, did the client give you strict requirements, what is your own experience etc..</p> <p>Generally we start by d...
<p>Figure out how the users need to interact with your site first. What are they needing to achieve? </p> <p>Let this define you ERD and the database model will quickly follow.</p> <p>Then, when you actually start coding you'll be heading in the right direction.</p> <p>Many will also say, write your Unit Tests first...
14,538
<p>I just finished a medium sized web site and one thing I noticed about my css organization was that I have a lot of hard coded colour values throughout. This obviously isn't great for maintainability. Generally, when I design a site I pick 3-5 main colours for a theme. I end up setting some default values for para...
<p>That's exactly what you should do. </p> <p>The more centralized you can make your css, the easier it will be to make changes in the future. And let's be serious, you will want to change colors in the future. </p> <p>You should almost never hard-code any css into your html, it should <strong>all</strong> be in t...
<p>You could have a colours.css file with just the colours/images for each tag in. Then you can change the colours just by replacing the file, or having a dynamically generated CSS file, or having different CSS files available and selecting based upon website URL/subfolder/property/etc.</p> <p>Or you can have colour t...
12,834
<p>I have a folder, <code>c:\websites\test</code>, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the subfolders and files? </p> <p>I know I could simply delete the <code>.svn</code> folder, but there are ...
<p>Also, if you are using TortoiseSVN, just export to the current working copy location and it will remove the .svn folders and files.</p> <p><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-export.html#tsvn-dug-export-unversion" rel="noreferrer"><a href="http://tortoisesvn.net/docs/release/Tortois...
<p>On Windows 10, we need to go to <code>Windows Explorer</code>, and then go to <code>View</code> and check the checkbox for <code>View hidden files</code>.</p> <p>Then navigate to the folder that has the SVN linked on Windows Explorer and delete the <code>.svn</code> folder/file.</p>
18,732
<p>I'm writing a web page in ASP.NET. I have some JavaScript code, and I have a submit button with a click event.</p> <p>Is it possible to call a method I created in ASP with JavaScript's click event?</p>
<p>Well, if you don't want to do it using Ajax or any other way and just want a normal ASP.NET postback to happen, here is how you do it (without using any other libraries):</p> <p><em>It is a little tricky though... :)</em></p> <p>i. In your code file (assuming you are using C# and .NET 2.0 or later) add the followi...
<p>This reply works like a breeze for me thanks cross browser:</p> <blockquote> <p>The __doPostBack() method works well.</p> </blockquote> <p>Another solution (very hackish) is to simply add an invisible ASP button in your markup and click it with a JavaScript method.</p> <pre><code>&lt;div style="display: none;"&...
2,576
<p>I'm using this code, and I get the stack trace that is listed below. I've got this working with just https and with basic authentication, but not ntlm.</p> <pre><code>HttpClient client = null; HttpMethod get = null; try { Protocol myhttps = new Protocol("https", ((ProtocolSocketFactory) new EasySSLProtocolSocketF...
<p>HttpClient does not fully support NTLM. Please have a look at <a href="http://hc.apache.org/httpclient-3.x/authentication.html#Known_limitations_and_problems" rel="nofollow noreferrer">Known limitations and problems</a>. The HttpClient documentation regarding NTLM is a bit confusing, but the bottom line is that they...
<p>Have a look at the utility posted <a href="http://nodsw.com/blog/leeland/2006/12/06-no-more-unable-find-valid-certification-path-requested-target" rel="nofollow noreferrer">here</a>.</p> <p>It solves different problem, namely the absence of the certificate, whereas you have invalid certificate installed, but probab...
24,276
<p>I was hoping to automate some tasks related to SubVersion, so I got SharpSvn. Unfortunately I cant find much documentation for it. </p> <p>I want to be able to view the changes after a user commits a new revision so I can parse the code for special comments that can then be uploaded into my ticket system.</p>
<p>If you just want to browse SharpSvn you can use <a href="http://docs.sharpsvn.net/current/" rel="nofollow noreferrer"><a href="http://docs.sharpsvn.net/" rel="nofollow noreferrer">http://docs.sharpsvn.net/</a></a>. The documentation there is far from complete as the focus is primarily on providing features. Any help...
<p>I wonder whether subversion hooks (at the svn server) might not be another approach here? I have not tried it, but <a href="http://haacked.com/archive/2006/07/27/IntroducingCaptainHookASubversionHookFrameworkFor.NET.aspx" rel="nofollow noreferrer">CaptainHook</a> appears to offer svn->.NET hook integration.</p>
37,468
<p>The net is overflowing with explanations of the <a href="http://en.wikipedia.org/wiki/Diamond_problem" rel="nofollow noreferrer">"dreaded diamond problem"</a>. So is StackOverflow. I think I understand that bit, but I fail to translate that knowledge into comprehending something similar yet different.</p> <p>My qu...
<p>I <strong>think</strong> the issue with your COM example is that by adding the virtual keyword you are saying that all the IOle* interfaces share a common IUnknown implementation. In order to implement this the compiler has to create multiple v-tables, hence you different 'this' values depending on the derived clas...
<p>It's a bit dated now, but the best reference I have ever come across that concerns C++ internals is Lippman's Inside The C++ Object Model. The exact implementation details may not match your compiler's output, but the understanding it provides is extremely valuable.</p> <p>Around page 96 there is an explanation of ...
38,389
<p>What exactly does null do performance and storage (space) wise in MySQL?</p> <p>For example:</p> <p>TINYINT: 1 Byte TINYINT w/NULL 1 byte + somehow stores NULL?</p>
<p>It depends on which storage engine you use.</p> <p>In MyISAM format, each row header contains a bitfield with one bit for each column to encode NULL state. A column that is NULL still takes up space, so NULL's don't reduce storage. See <a href="https://dev.mysql.com/doc/internals/en/myisam-introduction.html" rel=...
<p><a href="http://dev.mysql.com/doc/refman/5.0/en/is-null-optimization.html" rel="nofollow">dev.mysql.com/doc/refman/5.0/en/is-null-optimization.html</a> </p> <p>MySQL can perform the same optimization on col_name IS NULL that it can use for col_name = constant_value. For example, MySQL can use indexes and ranges to ...
28,367
<p>Is there any plugins for Eclipse for portlet design and deployment? I have never designed portlets so are there any good tutorials on the web as well?</p>
<p>You do have a <a href="http://struts.apache.org/2.x/docs/developing-a-portlet-using-eclipse.html" rel="nofollow noreferrer">tutorial</a> about portlet development (not portlet deployment though, that would be through an appropriate <a href="http://wiki.oss-watch.ac.uk/PlutoNotes" rel="nofollow noreferrer">eclipse-ma...
<p>You can try <a href="http://sourceforge.net/projects/portlet-eclipse/" rel="nofollow">http://sourceforge.net/projects/portlet-eclipse/</a></p> <p>Also, you can try IBM Rational Application Developer, which is IBM's Eclipse based IDE. It's Portlet and portal wizards are good... but R.A.D is not opensource.</p>
36,720
<p>I want to draw kossel delta corner in fusion 360 for 2040 aluminium extrusion like on picture below, but cant find a way to actualy start, I draw 3 side polygon and 20x40mm rectangle but cant go from there, so do you have any suggestion?</p> <p><a href="https://i.stack.imgur.com/hxAR4.jpg" rel="nofollow noreferrer"...
<p>I attempted to create your drawing but discovered that an important set of parameters is missing. You have to have either the intersection point of the legs (73.34) from each side or the angle between the legs (73.34) and the base (106.41) to create construction lines. Once you have either of those items, you can co...
<p>I attempted to create your drawing but discovered that an important set of parameters is missing. You have to have either the intersection point of the legs (73.34) from each side or the angle between the legs (73.34) and the base (106.41) to create construction lines. Once you have either of those items, you can co...
702
<p>Is there a way in .net to refer to a control generically (so that if the control name changes, etc.) you don't have a problem.</p> <p>I.e., the object level version of the "me" keyword.</p> <p>So, I'd like to use something generic instead of RadioButton1 in the example below.</p> <pre><code>Private Sub RadioButto...
<p>Yes, the "sender" parameter is the control that triggered the event.</p>
<p>You can choose the name of the event. You can do it with the Event windows (next to the Property Windows) or inside the code. You choose the name all the time. You can simply use "checkedEvent".</p> <pre><code>this.checkbox.EventXYZ += new EventXZY(checkedEvent); </code></pre> <p>Inside this method you can use sen...
42,981
<p>When I try to print a Unicode string in a Windows console, I get an error .</p> <p><code>UnicodeEncodeError: 'charmap' codec can't encode character ....</code></p> <p>I assume this is because the Windows console does not accept Unicode-only characters. What's the best way around this? Is there any way I can make Pyt...
<p><strong>Note:</strong> This answer is sort of outdated (from 2008). Please use the solution below with care!!</p> <hr> <p>Here is a page that details the problem and a solution (search the page for the text <em>Wrapping sys.stdout into an instance</em>):</p> <p><a href="http://wiki.python.org/moin/PrintFails" rel...
<p>James Sulak asked,</p> <blockquote> <p>Is there any way I can make Python automatically print a ? instead of failing in this situation?</p> </blockquote> <p>Other solutions recommend we attempt to modify the Windows environment or replace Python's <code>print()</code> function. The answer below comes closer to ...
2,732
<p>OK so that title sucks a little but I could not think of anything better (maybe someone else can?).</p> <p>So I have a few questions around a subject here. What I want to do is create a program that can take an object and use reflection to list all its properties, methods, constructors etc. I can then manipulate th...
<p>Try looking at <a href="http://www.codeplex.com/cracknetproject/Release/ProjectReleases.aspx?ReleaseId=19002" rel="noreferrer">Crack.NET</a>. It is used to do runtime manipulation and interrogation on WPF/WinForms but the source is available and might be a good start if it already doesn't meet your needs. </p>
<p>See this answer on how to build a <a href="https://stackoverflow.com/questions/1353022/reflection-support-in-c/1353133#1353133">"reflection engine".</a></p> <p>All you need to do is to drop that set of machinery in the your set of available runtime libraries and it does what you want, I think. (It might not be as e...
38,039
<p>I have a web service that loads an unmanaged .dll made from VC++ 6. In Vista and Windows Server 2008, I can get applications using this to work by putting them in Win98 Compatibility mode. Is there a similar way I can do this with my web service, so it will run?</p>
<p>It depends on your unmanaged DLL. I have successfuly deployed unmanaged DLLs that were exposing COM interfaces. After registering those COM components on the target machine (read web server) my managed web application (ASP.NET) were able to call those COM components.</p>
<p>I believe all .dll's prior to VS.NET were "unmanaged". Do you have access to the source code for this .dll you are referring too?</p>
18,064
<p>I am wondering if it is possible to extract the index position in a given string where a Regex failed when trying to match it? </p> <p>For example, if my regex was "abc" and I tried to match that with "abd" the match would fail at index 2.</p> <p>Edit for clarification. The reason I need this is to allow me to s...
<p>I agree with Colin Younger, I don't think it is possible with the existing Regex class. However, I think it is doable if you are willing to sweat a little:</p> <ol> <li>Get the Regex class source code (e.g. <a href="http://www.codeplex.com/NetMassDownloader" rel="nofollow noreferrer">http://www.codeplex.com/NetMas...
<p>I don't believe it's possible, but I am intrigued why you would want it.</p>
13,286
<p>Is there any way to do the equivalent of the following in a JSP without using scriptlet?</p> <pre><code>&lt;% response.setContentType("text/plain"); %&gt; </code></pre> <p>I can't simply use</p> <p>because I need to set the content-type in 2 places (each in a different branch of a ) and the JSP compiler will o...
<pre><code>&lt;%@ page language="java" contentType="text/plain" %&gt; </code></pre> <p>Edit:</p> <p>If you need to set the MIME type conditionally, you could use</p> <pre><code>&lt;% if( branch condition ) { response.setContentType("text/plain"); } else { response.setContentType("text/html"); } %&gt; </code><...
<p>A text/plain-response and a text/html-response sound like two very different responses with very little in common.</p> <p>Create 2 JPS's, and branch in the servlet in stead.</p> <p>If they do have common elements, you can still use includes.</p>
31,819
<p>I have a simple C++ program that reads <code>stdin</code> using <code>scanf</code> and returns results to <code>stdout</code> using <code>printf</code>:</p> <pre><code> #include &lt;iostream&gt; using namespace std; int main() { int n, x; int f=0, s=0, t=0; scanf("%d",&n); scanf("%d",&x); for(int...
<p>The end of line chars are:</p> <pre><code>System Hex Value Type Mac 0D 13 CR DOS 0D 0A 13 10 CR LF Unix 0A 10 LF </code></pre> <p>For a end of line on each system you can:</p> <pre><code>printf("%c", 13); printf("%c%c", 13, 10); printf("%c", 10); </code></pre> <p>You ca...
<p>More information is needed here, as timhon asked, which environment are you working under? Linux, Windows, Mac? Also, what text editor are you using which displays these extra spaces?</p>
45,683
<p>When designing tables, I've developed a habit of having one column that is unique and that I make the primary key. This is achieved in three ways depending on requirements:</p> <ol> <li>Identity integer column that auto increments.</li> <li>Unique identifier (GUID)</li> <li>A short character(x) or integer (or other...
<p>I follow a few rules:</p> <ol> <li>Primary keys should be as small as necessary. Prefer a numeric type because numeric types are stored in a much more compact format than character formats. This is because most primary keys will be foreign keys in another table as well as used in multiple indexes. The smaller your k...
<p>We do a lot of joins and composite primary keys have just become a performance hog. A simple int or long takes care of many problems even though you are introducing a second candidate key, but it's a lot easier and more understandable to join on one field versus three.</p>
43,794
<p>I'm trying to teach myself how to use <strong>Modern Persistence Patterns</strong> (OR/M, Repository, etc) and development practices (TDD, etc). </p> <p>Because the best way (for me) to learn is by doing, I'd like to build some sort of demo application for myself. The problem is, I've got no idea what sort of appli...
<p>There are innumerable community-service organizations with little or no web presence.</p> <p>Pick a service organization -- any one -- Literacy Volunteers, Food Pantries, Home Furnishings Donations, Alcoholics Anonymous -- anything. The grass-roots community organizations benefit the most from involvement; they of...
<p>Of course you could spend 6 monthes to choose an open source project and start little by little to be accepted and understands how the contribution system works.</p> <p>But the best way is still to start your own project, with your own standards, that will probably be a faillure. You need to try, fail, and learn fr...
15,739
<p>I've seen a number of people claim that you should specifically name each column you want in your select query.</p> <p>Assuming I'm going to use all of the columns anyway, why would I not use <code>SELECT *</code>?</p> <p>Even considering the question *<a href="https://stackoverflow.com/questions/128412/sql-query-...
<p>The essence of the quote of not prematurely optimizing is to go for simple and straightforward code and <strong>then</strong> use a profiler to point out the hot spots, which you can then optimize to be efficient.</p> <p>When you use select * you're make it impossible to profile, therefore you're not writing clear ...
<p>because "select * " will waste memory when you don't need all the fields.But for sql server, their performence are the same.</p>
41,583
<p>I've written an experimental function evaluator that allows me to bind simple functions together such that when the variables change, all functions that rely on those variables (and the functions that rely on those functions, etc.) are updated simultaneously. The way I do this is instead of evaluating the function i...
<p>I've had a similar problem to this in the past. My solution was to push variable names onto a stack as I recursed through the expressions to check syntax, and pop them as I exited a recursion level.</p> <p>Before I pushed each variable name onto the stack, I would check if it was already there. If it was, then this...
<p>In reply to the comment on answer two:</p> <p>(Sorry, just messed up my openid creation so I'll have to get the old stuff linked later...)</p> <p>If you switch "flag" for "push" and "unflag" for "pop", it's pretty much the same thing :) The only advantage of using the stack is the ease of which you can provide det...
41,694
<p>I found <a href="http://www.microsoft.com/sql/technologies/reporting/rsfeatures.mspx" rel="nofollow noreferrer">this</a> extremely old document which appears to say that many of the web client features are not availiable when running on express edition--scheduling, subscription, etc--as well as no access to the repo...
<p>Subscriptions and scheduling are indeed absent in both MSSQLEx2005 and MSSQLEx2008, but I have never found this to be much of a problem. The underlying platform has a scheduler and the web service will do all the rendering, so you can recreate the missing elements without too much trouble.</p> <p>The report builder...
<p>I've caught somewhere the idea about rich text in SSRS 2008. As I see it will allow me to make such static text </p> <p>"Some test with some text in <strong>bold</strong> and some <em>italic</em> text"</p> <p>with a single text box which was impossible in RS 2005. (even don't know good way to make it there)</p> ...
23,511
<p>How can you change the <code>href</code> attribute (link target) for a hyperlink using jQuery?</p>
<p>Using</p> <pre><code>$("a").attr("href", "http://www.google.com/") </code></pre> <p>will modify the href of all hyperlinks to point to Google. You probably want a somewhat more refined selector though. For instance, if you have a mix of link source (hyperlink) and link target (a.k.a. "anchor") anchor tags:</p> <p...
<h1>Change the HREF of the Wordpress Avada Theme Logo Image</h1> <p>If you install the ShortCode Exec PHP plugin the you can create this Shortcode which I called myjavascript</p> <pre><code>?&gt;&lt;script type="text/javascript"&gt; jQuery(document).ready(function() { jQuery("div.fusion-logo a").attr("href","tel:303-...
21,679
<p>Lately I've been seeing a lot of talk regarding PHP's lack of late static binding until 5.3. </p> <p>From what I've read proper implementations of stuff like ActiveRecord are not possible until the language has this feature.</p> <p>So, I'm curious about:</p> <ul> <li>Which languages do support it, specifically th...
<p>If you want a work around, that admittedly is a little time consuming, yet will be easily removed when php 5.3 becomes available and mainstreamed, you can try the following code.</p> <pre><code>class Specific_Model extends Model{ public static function GetAll($options = null){ parent::GetAll($options,...
<p>I completely misunderstood the what late static binding is. Here's what <a href="http://en.wikipedia.org/wiki/Name_binding" rel="nofollow noreferrer">Wikipedia</a> says.</p> <blockquote> <p>Late static binding is a variant of [name] binding somewhere between static and dynamic binding. Consider the followin...
47,952
<p>The code at the end produces a compile error:</p> <pre><code>NotApplicable.java:7: run() in cannot be applied to (int) run(42); ^ 1 error </code></pre> <p>The question is why? Why does javac think I am calling run(), and does not find run(int bar)? It correctly called foo(int bar...
<p>The explanation for the behavior of your code sample is that <code>this</code> is defined to be the class that you are currently "most" inside of. In this case, you are "most" inside the anonymous inner class that subclasses runnable and there is no method which matches <code>run(int)</code>. To broaden your sea...
<p>This is because <code>run</code> is being re-declared when you enter the <code>new Runnable() {}</code> scope. All previous bindings to run become inaccessible. It's as if you were doing this:</p> <pre><code>import java.util.*; public class tmp { private int x = 20; public static class Inner { private ...
31,434
<p>I have 2 different webapps (package into different war files) which needs to share some data via a cache (ehcache). I want to test out this idea with you to see if it works.</p> <p>My idea is to create a service that bootstraps/accesses the ehcache and package that inside a jar. Then package that jar into the two w...
<p>You need to create a separate jar(s) with all classes (and all their dependencies) which instances you plan to cache and then deploy this jar as well as ehcache.jar as a library (depending of what application server you use the procedure might be different), in case of Tomcat 6 that means just copy jars to lib folde...
<p>The problem of your configuration is that each war will be loaded with separate ClassLoader and there will be two instances of your ehcache-service - each web application has it's own copy of service. You can implement your caching service as a Web-Service (for example) and use it from war1 and war2.</p>
49,340
<p>I want to offer credit card payment on my website and was wondering whats the best (or prefered) way to do so?</p> <p>I know I could use Google checkout, paypal, etc. but this is not what i am looking for. I am looking for a simple basic CC payment which supports all the different credit cards only.</p>
<p>There are a lot of solutions out there. A couple to start with: <a href="http://www.authorize.net" rel="nofollow noreferrer">Authorize.net</a> and <a href="http://www.paymentech.com/" rel="nofollow noreferrer">Payment Tech</a></p>
<p>There's a lot of complexity in accepting credit cards, which is why PayPal and Google Checkout are so popular -- they take care of much of the complexity for you.</p> <p>Another company that offers even more than PayPal is <a href="http://www.kagi.com/sell.php" rel="nofollow noreferrer">Kagi</a>. I strongly recomm...
24,253
<p>Is there a good tool to compare <em>specifically</em> web.config files to find specifically which settings are different values and which file has settings that don't appear in both.</p> <p>XML comparison should do the trick, or an XSLT might work. There must be a tool for web.config settings out there?</p>
<p><a href="https://github.com/CameronWills/FatAntelope">https://github.com/CameronWills/FatAntelope</a> This tool will compare two web.config files and generate a web.config transform from the difference.</p> <p>Disclaimer: I wrote it... I wanted to compare two web.config files and generate a transform. But I couldn...
<p><strong>Use diff</strong></p> <p>It will neatly point out the exact lines and text that is different.</p> <p><a href="http://www.gnu.org/software/diffutils/diffutils.html" rel="nofollow noreferrer">Diff Utilities</a> are available for windows as well. <a href="http://gnuwin32.sourceforge.net/packages/diffutils.htm...
43,660
<p>How can I send email using Perl through my Gmail account? The one CPAN library (Mail::Webmail::Gmail) that I tried didn't work and I don't see much activity with it.</p> <p>At the moment I really only need to send a message. However, the advanced functionality of getting my contacts, acting when a new email is re...
<p>Did you try <a href="http://search.cpan.org/dist/Email-Send-Gmail" rel="noreferrer">Email::Send::Gmail</a>?</p>
<p>I have extended WWW::Contact::GoogleContactsAPI to get all the contact fields. See:</p> <p><a href="https://stackoverflow.com/questions/831535/is-there-a-perl-module-to-interface-to-google-contacts-api">Is there a Perl module to interface to Google Contacts API?</a></p>
35,363