instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>We are using popup windows in a Silverlight 2 application; these can be moved in the standard way by clicking on the title bar and dragging. If the title bar is dragged out of site behind the browser chrome, the window can no longer be moved.</p>
<p>We have users that consider this problematic and I was wondering ... | <p>After digging a bit I discovered that there is no standard dragging mechanism for pop-ups but that a colleague had implemented it. It was easy to expand the code to constrain the pop-up to the host window. It behaves a bit strangely though. Slow and smooth dragging allows the popup to move right up to the edge of... | <p>The best way to deal with this would be to prevent the user from dragging it outside of the browser window. To do this you could get the Width and Height of the <a href="http://msdn.microsoft.com/en-us/library/system.windows.application.host(VS.95).aspx" rel="nofollow noreferrer">Silverlight host control</a>. Once y... | 38,713 |
<p>I have at my SQL Server 2000 Database a column with type <strong>Image</strong>. How can I map it into NHibernate?</p>
| <p>We used BinaryBlob on the mapping config file, and byte[] on the property.</p>
| <p>NHibernate 3.x does all the magic it self.</p>
<p>Sql: </p>
<pre><code>Create table tblCompany (..., Logo image);
</code></pre>
<p>NHibernate-Mapping (important to set length!!!):</p>
<pre><code><class name="Company"
table="tblCompany">
...
<property name="_logo"
column... | 43,839 |
<p>I am getting ready to start a new asp.net web project, and I am going to LINQ-to-SQL. I have done a little bit of work getting my data layer setup using some info I found by <a href="http://mikehadlow.blogspot.com/" rel="nofollow noreferrer" title="Mike Hadlow">Mike Hadlow</a> that uses an Interface and generics to ... | <p>You should not create a repository for every table.<br>
Instead, you should create a repository for every 'entity root' (or aggregate root) that exists in your domain model. You can learn more about the pattern and see a working example here: </p>
<p><a href="http://deviq.com/repository-pattern/" rel="nofollow">htt... | <p>I'd be tempted to suggest that whether you use concrete types or not shouldn't matter, as if your using dependency injection (castle?) to create the repositories (so you can wrap them with different caches etc) then your codebase will be none the wiser whichever way you've done it.</p>
<p>Then just ask your DI for ... | 12,775 |
<p>this is probably a newbie ruby question. I have several libraries and apps that I need to deploy to several different hosts. All of the apps and libs will share some common settings for those hosts-- e.g. host name, database server/user/pass, etc.</p>
<p>My goal is to do something like:</p>
<pre><code>cap host1 st... | <p>I just experimented with it a little more and what I discovered is that you have to:</p>
<pre><code>load 'config/my_module'
</code></pre>
<p>I can put all of my common definitions here and just load it into my deploy.rb.</p>
<p>It appears from the docs that load loads and executes the file. Alternatively, require... | <p>Jon has it right, that's the simplest way to go, just save it in a separate file and use <code>require 'filename'</code>. You could also use something fancy like <a href="http://labs.peritor.com/webistrano" rel="nofollow noreferrer">Webistrano</a> for deployment which also supports this in the form of Capistrano '<... | 31,177 |
<p>I have a form with a textbox and a button. IE is the only browser that will not submit the form when Enter is pressed (works in FF, Opera, Safari, Chrome, etc.). I found this javascript function to try to coax IE into behaving; but no avail:</p>
<pre><code>function checkEnter(e){
var characterCode
if (e &a... | <p>The other thing I have done in the past is wrap the form area in a Panel and set the DefaultButton attribute to the submit button you have. This effectively maps the enter key to the submission as long as you have a form element in focus in the panel area.</p>
| <p>Does it use a GET instead of a POST? Is the URL too long? I've seen that...</p>
| 33,997 |
<p>Is there a way to deactivate the <a href="http://download.oracle.com/docs/cd/E11035_01/wls100/cluster/load_balancing.html#wp1026599" rel="nofollow noreferrer">optimization for collocated objects</a> that Weblogic uses by default for a specific EJB ?</p>
<p>EDIT: Some context :</p>
<p>We have a scheduler service th... | <p>Supposing you are trying to call a remote EJB (load balancing on local ejbs can only be obtained through an indirection trick like Patrick mentioned) you will have to create a new InitialContext using the address of the cluster instead of a particular server. This new IC will provide stubs as if you were a foreign c... | <p>Not being too familiar with guts of weblogic but reading their material I would say you cannot, without some amount of trickery.</p>
<p>It does seem though that you can put a JMS (MDB) facade in front of your EJB that does not abide by the collocated object optimization.</p>
<p>OR</p>
<p>If your scheduler is serv... | 18,536 |
<p>I'm working in Java with XML and I'm wondering; what's the difference between an element and a node?</p>
| <p>The Node object is the primary data type for the entire DOM.</p>
<p>A node can be an element node, an attribute node, a text node, or any other of the node types explained in the "Node types" chapter.</p>
<p>An XML element is everything from (including) the element's start tag to (including) the element's end tag.... | <p>node & element are same. Every element is a node , but it's not that every node must be an element.</p>
| 16,073 |
<p>For most GUI's I've used, when a control that contains text gets the focus, the entire contents of the control are selected. This means if you just start typing, you completely replace the former contents.</p>
<p>Example: You have spin control that is initialized with the value zero. You tab to it and type "1" ... | <p>When I've needed this in the past, I've created subclasses of the components I wanted to add "auto-clearing" functionality too. eg:</p>
<pre><code>public class AutoClearingTextField extends JTextField {
final FocusListener AUTO_CLEARING_LISTENER = new FocusListener(){
@Override
public void focusLost... | <p>The only way I know is to create a FocusListener and attach it to your component. If you want it this FocusListener to be global to all components in your application you might consider using Aspect Oriented Programming (AOP). With AOP is possible to code it once and apply your focus listener to all components insta... | 9,197 |
<p>I just acquired a new Creality Ender 5 Pro. It was assembled very easily. Today I tried my first print - the Dog demo that came on the MicroSD just to see how it worked. It is a 2.5 hour print.</p>
<p>While I was preheating there was a thermal runaway error while I was feeding the filament up through the tube. I res... | <p>Since I have been unable to find a way to fix the E3D V6 clone hotend I have instead replaced it with a Creality Mk 8 that I had on-hand, which has so far worked flawlessly.</p>
<p>I am assuming that the improved performance is related to the use of a shorter nozzle and/or the Bowden tube butting directly against th... | <p>I had issues with my all metal hot-end where I got heat creep. I ended up doing e-steps, PID tune, and ensuring my speed wasn't too slow either. Is your printer in an enclosure? I found that mine being in an enclosure caused the hotend to not cool sufficiently, so I had to lower the hot bed temp by 10 degrees and th... | 2,170 |
<p>I am a little confused as to the definition of classes as Models or Views in the Sketch example AppKit application (found at /Developer/Examples/AppKit/Sketch). The classes SKTRectangle, SKTCircle etc. are considered Model classes but they have drawing code. </p>
<p>I am under the impression that Models should be f... | <p>The developer of Sketch outlines his/her rationale a bit in the ReadMe file:</p>
<hr>
<p><strong>Model-View-Controller Design</strong></p>
<p>The Model layer of Sketch is mainly the SKTGraphic class and its subclasses. A Sketch Document is made up of a list of SKTGraphics. SKTGraphics are mainly data-bearing cl... | <p>I'm not aware of the particular example that you're refering to, but here's my guess on the reason for that design:</p>
<p>Perhaps the <strong>Models (the SKTRectangle, SKTCircle that you mention) know enough to draw themselves</strong> but not enough to actually perform the drawing to the screen. The drawing to th... | 43,601 |
<p>Is there an official C# guideline for the order of items in terms of class structure?</p>
<p>Does it go:</p>
<ul>
<li>Public Fields</li>
<li>Private Fields</li>
<li>Properties</li>
<li>Constructors</li>
<li>Methods<br>
?</li>
</ul>
<p>I'm curious if there is a hard and fast rule about the order of items? I'm kind... | <p>According to the <a href="https://github.com/DotNetAnalyzers/StyleCopAnalyzers/blob/master/documentation/SA1201.md" rel="noreferrer">StyleCop Rules Documentation</a> the ordering is as follows.</p>
<p>Within a class, struct or interface: (SA1201 and SA1203)</p>
<ul>
<li>Constant Fields</li>
<li>Fields</li>
<li>Co... | <p>I have restructured the accepted answer, as to what I think is a better layout:</p>
<p>Within a class, struct or interface:</p>
<ul>
<li>Constant Fields</li>
<li>Readonly Fields</li>
<li>Fields</li>
<li>Events</li>
<li>Properties</li>
<li>Indexers</li>
<li>Constructors</li>
<li>Finalizers (Destructors)</li>
<li>Inte... | 18,136 |
<p>I'm working on a Java library and would like to remove some functions from it. My reasons for this is public API and design cleanup. Some objects have setters, but should be immutable, some functionality has been implemented better/cleaner in different methods, etc.</p>
<p>I have marked these methods 'deprecated', ... | <p>Set a date and publicize it in the @deprecated tag. The amount of time given to the removal depends on the amount of users your code has, how well connected you are with them and the the reason for the change.</p>
<p>If you have thousands of users and you barely talk to them, the time frame should probably be in th... | <p>too bad you are not using .Net :(</p>
<p>The built in <a href="http://msdn.microsoft.com/en-us/library/22kk2b44(VS.80).aspx" rel="nofollow noreferrer">Obsolete</a> attribute generates compiler warnings.</p>
| 18,358 |
<p>I can remember <em>Convert</em> class in .net which is named not in accordance with the guide lines. Any more examples?</p>
| <p>In Java, <code>java.lang.System.arraycopy</code> - note the lowercase second c.</p>
<p>Also <code>NullPointerException</code> in Java is better as <code>NullReferenceException</code> in .NET.</p>
<p><code>AppDomain</code> violates the convention of <em>normally</em> not using abbreviations.</p>
<p><code>Control.I... | <pre><code>java.util.Hashtable
</code></pre>
<p>If it's <code>HashSet</code>, and <code>HashMap</code>, then it should be <code>HashTable</code>.</p>
<p>Not a violation of the guidelines, but I've always hated <code>UndoableEdit</code></p>
<p>My mind seems to parse that as "<em>Un(doable) edit</em>", meaning an edit... | 43,869 |
<p>I want to create a regexp in Emacs that matches exactly 3 digits. For example, I want to match the following:</p>
<pre><code>123
345
789
</code></pre>
<p>But not</p>
<pre><code>1234
12
12 23
</code></pre>
<p>If I use <code>[0-9]+</code> I match any single string of digits. I thought <code>[0-9]{3}</code> wou... | <p>If you're entering the regex interactively, and want to use <code>{3}</code>, you need to use backslashes to escape the curly braces. If you don't want to match any part of the longer strings of numbers, use <code>\b</code> to match word boundaries around the numbers. This leaves:</p>
<pre><code>\b[0-9]\{3\}\b
</... | <p>It's pretty simple:</p>
<pre><code>[0-9][0-9][0-9]
</code></pre>
| 9,495 |
<p>You can set the HcDynamicCompressionLevel anywhere from 0-10. I've heard 10 is bad (high CPU usage), but what's the magic number that works the best? </p>
| <p>Settings of 5 to 9 for dynamic compression <em>DO</em> in fact hammer CPU load. Static compression occurs only once (until a file is re-cached) and you can set static compression high.</p>
<p>This in-depth article recommends <strong>4 for dynamic compression</strong> and <strong>7 to 9 for static compression</stron... | <p>It seems to me that this would really depend on your situation. If you're serving a lot of large files and have some CPU power to spare, then a higher number would be better. However, as you have more concurrent connections, smaller files, and a less powerful CPU, a smaller number is better.</p>
| 35,801 |
<p>From MSDN: </p>
<blockquote>
<p>The <a href="http://msdn.microsoft.com/en-us/library/ms681985.aspx" rel="nofollow noreferrer">CancelWaitableTimer</a> function does not change the signaled state of the timer. It stops the timer before it can be set to the signaled state and cancels outstanding APCs. Therefore, thr... | <p>Can you just call SetWaitableTimer with some very large time which isn't ever going to happen? And then call it again once you know the real time.</p>
<p>Update: <em>Hack or not, the docs are pretty clear that a m-r waitable timer "remains in the signalled state until SetWaitableTimer is called". Seems to me that... | <p>If you make the waitable timer auto-reset then it will reset automatically as soon as the wait for that timer completes.</p>
<p>However, from MSDN:</p>
<blockquote>
<p>If multiple objects become signaled, the function returns the index of the first handle in the array whose object was signaled.</p>
</blockquote>... | 31,270 |
<p>I need to join two binary files with a <code>*.bat</code> script on Windows.</p>
<p>How can I achieve that?</p>
| <p>Windows <code>type</code> command works similarly to UNIX <code>cat</code>.</p>
<p><strong>Example 1:</strong></p>
<pre><code>type file1 file2 > file3
</code></pre>
<p>is equivalent of:</p>
<pre><code>cat file1 file2 > file3
</code></pre>
<p><strong>Example 2:</strong></p>
<pre><code>type *.vcf > all... | <p>If you have to use a batch script and have python installed here is a <a href="http://en.wikipedia.org/wiki/Polyglot_%28computing%29" rel="nofollow noreferrer">polyglot</a> answer in batch and python:</p>
<pre><code>1>2# : ^
'''
@echo off
python "%~nx0" " %~nx1" "%~nx2" "%~nx3&q... | 8,507 |
<p>Basically, something better than this:</p>
<pre><code><input type="file" name="myfile" size="50">
</code></pre>
<p>First of all, the <code>browse</code> button looks different on every browser. Unlike the <code>submit</code> button on a form, you have to come up with some <a href="http://www.quirksmode.org/... | <p>File upload boxes is where we're currently at if you don't want to involve other technologies like Flash, Java or ActiveX.</p>
<p>With plain HTML you are pretty much limited to the experience you've described (no progress bar, double submits, etc). If you are willing to use some javascript, you can solve some of th... | <p>It is true, the file upload control is definitely behind the times. Hopefully this will be addressed in a future asp.net version.</p>
<p>Though it costs some money, I have found the <a href="http://www.telerik.com/products/aspnet-ajax/controls/upload/overview.aspx" rel="nofollow noreferrer">Telerik upload control</... | 3,308 |
<p>For the better part of 10 years + we have relied on various network mapped drives to allow file sharing. One drive letter for sharing files between teams, a seperate file share for the entire organization, a third for personal use etc. I would like to move away from this and am trying to decide if an ECM/Sharepoin... | <p>SharePoint is very good at document sharing.</p>
<p>Documents generally follow a process for approval, have permissions, live in clusters... and these things lend themselves well to SharePoints document libraries.</p>
<p>However there are somethings that don't lend themselves well to living inside SharePoint... do... | <p>Definetely, use a tool. </p>
<p>The main benefit here is version control. Being able to jump easily to a previous version, diff'ing and seeing who modified what (see most VCS' blame/annotate tool- it prints out a text file showing when/who modified each line in the text file).</p>
<p>Second, you can probably benef... | 42,256 |
<p>I have a SEAM app with some JPA/Hibernate entities. And I now wonder where to put my query, persistence methods.</p>
<p>The default choice seems to put them in a session bean layer with injected </p>
<pre><code>@PersistenceContext(...) @Inject EntityManager entityManager;
</code></pre>
<p>But I think I would rath... | <p>I have no experience with SEAM, but from my experience with Java projects, I found it easiest to keep beans clear of persist methods. What we usually do:</p>
<ul>
<li>Have beans for business objects (like "User" and "Setting" for example)</li>
<li>Have a DAO layer which can persist and retrieve these beans (simple ... | <p>Yes, that is also what I have done before.</p>
<p>In general, I think, EJB is insanely verbose and boilerplate'y, but SEAM actually helps a bit, so that is why, in my current project, the extra layer of session beans just to query and persist annoys me. I have the feeling that I could make a reasonably concise app ... | 22,164 |
<p>I'm developing an ASP.NET 2.0 application that includes Crystal Reports (version 10, included with VS 2005). Originally, the reports were working properly, both when run from my machine using the ASP.NET development web server, and also when deployed to an IIS server.</p>
<p>I made some changes to the reports and ... | <p>You can parameterize <em>each</em> value, so something like:</p>
<pre><code>string[] tags = new string[] { "ruby", "rails", "scruffy", "rubyonrails" };
string cmdText = "SELECT * FROM Tags WHERE Name IN ({0})";
string[] paramNames = tags.Select(
(s, i) => "@tag" + i.ToString()
).ToArray();
string inClause ... | <p>Create a temp table where names are stored, and then use the following query:</p>
<pre><code>select * from Tags
where Name in (select distinct name from temp)
order by Count desc
</code></pre>
| 43,824 |
<p>I am creating a program that will be installed using the .net installer project. The program writes to settings files to its directory in the Program Files dir. It believe there are some active directory settings that will prevent the application from righting to that directory if a limited user is running the progr... | <p>Writing to the Program Files folder is a really bad idea, you should assume that this location is "read only" once installed. </p>
<p>Saving user settings in Program Files causes problems if more than two people use the computer at once (eg. Terminal Services) who's settings should be saved, do you want other users... | <p>You can write a custom installer class which can change the security permissions of the folder. This would assume the installation is done by a user who has permission to change file/directory security.</p>
<p>The best option is to not write to directories under Program Files at all.</p>
| 3,921 |
<p>I've got a System.Generic.Collections.List(Of MyCustomClass) type object.</p>
<p>Given integer varaibles pagesize and pagenumber, how can I collect only any single page of <code>MyCustomClass</code> objects?</p>
<p>This is what I've got. How can I improve it?</p>
<pre><code>'my given collection and paging parame... | <p>Generic.List should provide the Skip() and Take() methods, so you could do this:</p>
<pre><code>Dim PageObjects As New System.Collections.Generic.List(Of MyCustomClass)
PageObjects = AllOfMyCustomClassObjects.Skip(pagenumber * pagesize).Take(pagesize)
</code></pre>
<hr>
<p>If by "without Linq" you meant on the 2.... | <p>You use GetRange on your IEnuramble implementing collection:</p>
<pre><code>List<int> lolInts = new List<int>();
for (int i = 0; i <= 100; i++)
{
lolInts.Add(i);
}
List<int> page1 = lolInts.GetRange(0, 49);
List<int> page2 = lilInts.GetRange(50, 100);
</code></pre>
<p>I trust you c... | 4,148 |
<p>Is there a medium-sized Clojure sample application that could be used as a "best-practices" example, and a good way to see what such an application would look like in terms of code and code organization? A web application would be particularly interesting to me, but most important is that the program do something co... | <p>I recommend <a href="http://github.com/briancarper/cow-blog" rel="noreferrer">cow-blog</a> by Brian Carper. According to the author it was written with your purpose in mind.</p>
| <p>Clojure is still too young and a moving target to have medium sized applications with available source code yet.</p>
| 42,665 |
<p>Can I use Xpath node set function position() in Delphi's function selectNodes() to select only a certain number of element from a node list? If I do like this: </p>
<pre><code>selectNodes('Item[1]')
</code></pre>
<p>its all fine and I get the element with index 1, but when I try </p>
<pre><code>selectNodes('Item... | <p>This is not really a Delphi question I think, but an MSXML one. Check the <a href="http://msdn.microsoft.com/en-us/library/ms763742(VS.85).aspx" rel="nofollow noreferrer">MSXML docs</a> or rather the <a href="http://msdn.microsoft.com/en-us/library/ms256115(VS.85).aspx" rel="nofollow noreferrer">MS XPath docs</a>.</... | <p>selectNodes requires a string, so you should try:</p>
<pre><code>selectNodes('Item[position()<10]')
</code></pre>
<p>Or whatever xpath query.</p>
| 36,944 |
<p>I have a large int[] array and a much smaller int[] array. I want to fill up the large array with values from the small array, by repeat copying the small array into the large array until it is full (so that large[0] = large[13] = large[26] ... = small[0] etc.). I already have a simple method:</p>
<pre><code>int ... | <p>Some threads do background tasks, like sending keepalive packets, or performing periodic garbage collection, or whatever. These are only useful when the main program is running, and it's okay to kill them off once the other, non-daemon, threads have exited.</p>
<p>Without daemon threads, you'd have to keep track of... | <p><strong>Create a Daemon thread when:</strong></p>
<ul>
<li>You want a low-priority thread</li>
<li>Your Thread does background-specific tasks, and more importantly,</li>
<li>When you want this thread to die as soon as all user threads accomplish their tasks.</li>
</ul>
<p><strong>Some Examples of Daemon Thread Servi... | 23,058 |
<p>I'd like to upload a photo from my iphone to an arbitrary ftp. How can I do this with Cocoa / Xcode ?</p>
<p>Thanks!</p>
| <p>You'll want to look into <a href="https://developer.apple.com/iphone/library/documentation/CoreFoundation/Reference/CFFTPStreamRef/Reference/reference.html" rel="nofollow noreferrer">CFFTPStream</a> in regard to the iPhone</p>
| <p>There's a nice framework out there called <a href="http://opensource.utr-software.com/connection/" rel="nofollow noreferrer">ConnectionKit</a>. I haven't used it personally, but I've heard it's good.</p>
| 15,621 |
<p>Currently, I'm using:</p>
<pre><code>DataTable dt = CreateDataTableInSomeWay();
List<DataRow> list = new List<DataRow>();
foreach (DataRow dr in dt.Rows)
{
list.Add(dr);
}
</code></pre>
<p>Is there a better/magic way?</p>
| <p>If you're using .NET 3.5, you can use <a href="http://msdn.microsoft.com/en-us/library/system.data.datatableextensions.asenumerable.aspx" rel="noreferrer"><code>DataTableExtensions.AsEnumerable</code></a> (an extension method) and then if you really need a <code>List<DataRow></code> instead of just <code>IEnum... | <p><strong>This worked for me:</strong>
Need at least .Net Framework 3.5,
<em>Code below displays DataRow turned to Generic.IEnumerable, comboBox1 has been used for a better illustration.</em> </p>
<pre><code>using System.Linq;
DataTable dt = new DataTable();
dt = myClass.myMethod();
Lis... | 25,586 |
<p>I assume that most of the analyzing and tracking is done based on the data gathered from browser actions like page requests. Tools like AWStats, Google Analytics and Omniture take place in this.</p>
<p>But there is also good amount of data available in databases or service level logs. For example GWT based applicat... | <p>Have a look at the <strong>Refreshing UpdatePanel Content</strong> section here: <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx" rel="nofollow noreferrer">UpdatePanel Class</a>.</p>
<p>But what I would do, personally, is just create the UserControl without the UpdatePanel, and then ... | <p>The easiest way to just 'turn off' your UpdatePanel is to set EnablePartialRendering to false in the ScriptManager. I'm not sure that this is the best solution. I would recommend adding your controls to an update panel in your codebehind Page_Load event handler based on a boolean flag.</p>
<pre><code>void Page_Lo... | 28,566 |
<p>I've got an iPhone app with icon file Icon.png.</p>
<p>This icon shows up properly when the app is on the phone itself, but it doesn't show up in the applications pane in iTunes.</p>
<p>What do I need to do to get it to show up properly?</p>
| <p>The cleanest way to do this is described in the official Apple documentation, in a section called <a href="http://developer.apple.com/iphone/library/documentation/Xcode/Conceptual/iphone_development/145-Publishing_Applications_for_Testing/user_testing.html#//apple_ref/doc/uid/TP40007959-CH10-SW7" rel="noreferrer">Pu... | <p>The application icon only shows up in iTunes if your app is distributed through the app store. </p>
<p>I assume you are asking about a developer or ad hoc build. Those get the default black "A" icon.</p>
| 20,871 |
<p>What is the best way to resolve a conflict when doing a <code>git svn rebase</code>, and the git branch you are on becomes "(no-branch)"?</p>
| <p>While doing a <code>git svn rebase</code>, if you have merge conflicts here are some things to remember:</p>
<p><strong>1)</strong> If anything bad happens while performing a rebase you will end up on a <code>(no-branch)</code> branch.</p>
<p><strong>2)</strong> If you run <code>git status</code>, you'll see a <co... | <p>You can use <code>git mergetool</code> to view and edit the conflicts in the usual fashion. Once you are sure the conflicts are resolved do <code>git rebase --continue</code> to continue the rebase, or if you don't want to include that revision do <code>git rebase --skip</code></p>
| 13,792 |
<p>Over at <a href="https://stackoverflow.com/questions/38664/can-you-modify-text-files-when-committing-to-subversion">Can you modify text files when committing to subversion?</a> <a href="https://stackoverflow.com/questions/38664/can-you-modify-text-files-when-committing-to-subversion#38666">Grant</a> suggested that I... | <p><strong><a href="https://stackoverflow.com/questions/38746/how-to-detect-file-ends-in-newline#39185">@Konrad</a></strong>: tail does not return an empty line. I made a file that has some text that doesn't end in newline and a file that does. Here is the output from tail:</p>
<pre class="lang-none prettyprint-overrid... | <p>The <code>read</code> command can not read a line without newline.</p>
<pre class="lang-sh prettyprint-override"><code>if tail -c 1 "$1" | read -r line; then
echo "newline"
fi
</code></pre>
<p>Another answer.</p>
<pre class="lang-sh prettyprint-override"><code>if [ $(tail -c 1 "$1" | od -An -b) = 012 ]; then
... | 5,969 |
<p>Erm - what the question said. It's something I keep hearing about, but I've not got round to looking into it yet.</p>
<hr>
<p>(updated) I could look up the definition... but why not (as pointed out by @erikson) get insight into your real experiences and anecdotes. Community Wiki'd incase that helps folks vote up t... | <p>Short answer, it is a technique that you can use to express systems with concrete states (as opposed to quantum states / probability distributions).</p>
<p>Quoting the <a href="http://en.wikipedia.org/wiki/Finite_state_machine" rel="nofollow noreferrer">Wikipedia article</a>:</p>
<blockquote>
<p>A finite state m... | <p>Yes! You could look it up!</p>
<p><a href="http://en.wikipedia.org/wiki/Finite_state_machine" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Finite_state_machine</a></p>
| 47,547 |
<p>How do you debug <strong>PHP</strong> scripts?</p>
<p>I am aware of basic debugging such as using the Error Reporting. The breakpoint debugging in <strong>PHPEclipse</strong> is also quite useful.</p>
<p>What is the <strong>best</strong> (in terms of fast and easy) way to debug in phpStorm or any other IDE?</p>
| <p>Try <a href="https://eclipse.org/pdt/" rel="noreferrer">Eclipse PDT</a> to setup an Eclipse environment that has debugging features like you mentioned. The ability to step into the code is a much better way to debug then the old method of var_dump and print at various points to see where your flow goes wrong. When a... | <p>+1 for print_r(). Use it to dump out the contents of an object or variable. To make it more readable, do it with a pre tag so you don't need to view source. </p>
<pre><code>echo '<pre>';
print_r($arrayOrObject);
</code></pre>
<p>Also var_dump($thing) - this is very useful to see the type of subthings</p>
| 2,332 |
<p>I have a set of five boolean values. If more than one of these are true I want to excecute a particular function. What is the most elegant way you can think of that would allow me to check this condition in a single if() statement? Target language is C# but I'm interested in solutions in other languages as well (as ... | <p>How about</p>
<pre><code> if ((bool1? 1:0) + (bool2? 1:0) + (bool3? 1:0) +
(bool4? 1:0) + (bool5? 1:0) > 1)
// do something
</code></pre>
<p>or a generalized method would be... </p>
<pre><code> public bool ExceedsThreshold(int threshold, IEnumerable<bool> bools)
{
int trueCnt =... | <p>I was recently having this same issue, where I had three boolean values, which I needed to check that only 1 of them was true at a time. For this I used the xor operator as follows:</p>
<pre><code>bool a = true;
bool b = true;
bool c = false;
if (a || b || c)
{
if (a ^ b ^ c){
//Throw Error
}
}
</c... | 49,506 |
<p>In a bunch o' places in my code, I have something like this: </p>
<pre><code>public Class mySpecialMethod() {
return MySpecialClass.class;
}
</code></pre>
<p>which causes the warning </p>
<blockquote>
<p>Class is a raw type. References to
generic type Class should be
parameterized.</p>
</blockquote>
<p>B... | <p>It's the correct thing to do only if there really is no common base class or interface that the Class object needs to represent.</p>
<p>Also <code>Class<?></code> is effectively the same as <code>Class<? extends Object></code>.</p>
| <p>Not really a Java programmer here, but read some good papers about generics. </p>
<p>Yes, you should add some wildcard or the exact type (<code>Class<MySpecialClass></code>) to add safety. The reason is that Class is a generic. So, <code>Class<Bar></code> and <code>Class<Foo></code> are the same a... | 48,417 |
<p>[continued from <a href="https://stackoverflow.com/questions/323289">Is there a way to tell whether two COM interface references point at the same instance?</a>]</p>
<p>I've got references to <code>Inspector</code> objects from two different sources and need to be able to tell which item from one source corresponds... | <p>I now found that comparing <code>Inspector.CurrentItem.CreationTime</code> was sufficiently reliable for me.</p>
| <p>You could also use the <strong>Is</strong> operator to see if two object references are referring to the same object.</p>
<p>Ex:</p>
<pre><code>Debug.Print InspectorObj1 Is InspectorObj2
</code></pre>
<p>This will print <strong>True</strong> to the Immediate Window if both references refer to the same Inspector.<... | 42,177 |
<p>I have a List of beans, each of which has a property which itself is a List of email addresses.</p>
<pre><code><c:forEach items="${upcomingSchedule}" var="conf">
<div class='scheduled' title="${conf.subject}" id="scheduled<c:out value="${conf.id}"/>">
...
</div>
</c:forEach>... | <p>Figured out a somewhat dirty way to do this:</p>
<pre><code><c:forEach items="${upcomingSchedule}" var="conf">
<c:set var="title" value="${conf.subject}: "/>
<c:forEach items="${conf.invitees}" var="invitee">
<c:set var="title" value="${title} ${invitee}, "/>
</c:forEa... | <p>I think this is what you want:</p>
<pre><code><c:forEach var="tab" items="${tabs}">
<c:set var="tabAttrs" value='${tabAttrs} ${tab.key}="${tab.value}"'/>
</c:forEach>
</code></pre>
<p>In this case, I had a hashmap with tab ID (key) and URL (value). The tabAttrs variable isn't set prior to this.... | 37,900 |
<p>My printer is calibrated for a certain clearance from the heated bed, which is chosen based on PLA.</p>
<p>I would like to try to increase it for the first layer for PETG, so that adhesion is reduced. The printer has M5 screws with 4000 steps/mm, so the resolution clearly allows that. </p>
<p>I don't want to modif... | <p>Maybe you would be better off with TPU or some other type of flexible material...</p>
<p>I have been able to print PLA and have it flex quite a bit, but that was an ~0.2mm single layer print, I guess maybe up to 0.3-0.4mm should still be a little bit flexible, but not much. Also since you want it to wipe things, ma... | <p>You can not 3D print that because there is no nozzle or method for producing filaments of the required size. A few microns at least. You might be able to spin molten pla like cotton candy and it might absorb; but I doubt it.</p>
<p><a href="https://phys.org/news/2010-05-cotton-candy-machine-tiny-nanofibers.html" re... | 1,627 |
<p>I'm using NuSOAP on PHP 5.2.6 and I'm seeing that the max message size is only 1000 bytes (which makes it tough to do anything meaningful). Is this set in the endpoint's WSDL or is this something I can configure in NuSOAP?</p>
| <p>Regarding the FUD about a "1000 bytes limit"... I looked up the nusoap_client sourcecode and found that the limit is only effective for <strong>debug output</strong>.</p>
<p>This means all data is processed and passed on to the webservice (regardless of its size), but only the first 1000 bytes (or more precisely: c... | <p>I think message size will be limited rather by a PHP memory limit, than by some hardcoded value. At least I could send a 6.5MB string without any problems. When I tried to send a 8MB string I got an out of memory exception inside nusoap.php (my server has 64MB limit for PHP).</p>
| 28,640 |
<p>I have an Epax X1, I have just purchased the 2nd and 3rd bottle of resin, but I don't know what are the best settings.</p>
<p>What is the best way to find the best settings for a new resin?</p>
<p>Is it possible to print a calibration object that starts with some settings and changes as it goes? For example starts... | <p>It ended up I had like super cheap endstops that were actually shorting VCC to GND, as suspected by r_ahlskog. Just bought other ones and now it's working fine.</p>
| <p>It ended up I had like super cheap endstops that were actually shorting VCC to GND, as suspected by r_ahlskog. Just bought other ones and now it's working fine.</p>
| 1,493 |
<p>I need some basic CMS functionality with rich text editing. On stack overflow there is a regular textarea edit control, with support for Markdown style syntax formatting. That would be beyond my users, so I want something like a rich edit control that you can type into on the web site. I know it is possible, as load... | <p><a href="http://tinymce.moxiecode.com/" rel="nofollow noreferrer">TinyMCE</a> is probably one of the more popular versions of this sort of thing. You can customize it to fit your needs, in terms of what functionality you want to offer your viewers. a few alternatives (tend to be lighter weight than a full TinyMCE in... | <p>Yahoo's <a href="http://developer.yahoo.com/yui/editor/" rel="nofollow noreferrer">YUI Rich Text Editor</a> is now out of beta and proves to be well supported across browsers.</p>
| 32,411 |
<p>I'm looking for a way to add a close button to a .NET ToolTip object similar to the one the NotifyIcon has. I'm using the tooltip as a message balloon called programatically with the Show() method. That works fine but there is no onclick event or easy way to close the tooltip. You have to call the Hide() method some... | <p>You could try an implement your own tool tip window by overriding the existing one and customizing the onDraw function. I never tried adding a button, but have done other customizations with the tooltip before.</p>
<pre><code> 1 class MyToolTip : ToolTip
2 {
3 public MyToolTip()
4 ... | <p>You can try to override CreateParams method in your implementation of ToolTip class...
i.e.</p>
<pre><code> protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.Style = 0x80 | 0x40; //TTS_BALLOON & TTS_CLOSE
return ... | 30,399 |
<p>I've been looking into report definition customization extensions (RDCE) in SQL2K8 recently and I've been at a loss to find much documentation or even chatter on the internet about it.</p>
<p>MSDN has a brief overview: <a href="http://msdn.microsoft.com/en-us/library/cc281022.aspx" rel="nofollow noreferrer">http://... | <p>You have to code it all yourself -- Poppler only handles the PDF part, you have to write the GUI. Look at the code to <a href="http://www.gnome.org/projects/evince/" rel="nofollow noreferrer">Evince</a> for a good example. </p>
| <p>If you are making a app in GLib, then there is good documentation here. <a href="http://developer.gnome.org/poppler/unstable/index.html" rel="nofollow">http://developer.gnome.org/poppler/unstable/index.html</a></p>
<p>If you can compile this documentations by doxygen, Just checkout the code. :) </p>
| 10,580 |
<p>Sometimes, in PL SQL you want to add a parameter to a Package, Function or Procedure in order to prepare future functionality. For example:</p>
<pre><code>create or replace function doGetMyAccountMoney( Type_Of_Currency IN char := 'EUR') return number
is
Result number(12,2);
begin
Result := 10000;
IF char ... | <p>I believe that this is controlled by the parameter PLSQL_WARNINGS, documented for 10gR2 here: <a href="http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams166.htm#REFRN10249" rel="nofollow noreferrer">http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/initparams166.htm#REFRN10249</a>... | <p>Well, are you sure you have the name and the right in the correct order in that declaration?</p>
<p>It complains about a parameter named 'Currency', but you aren't actually using it, are you?</p>
<p>On the other hand, you are using something called <em>char</em>, what is that?</p>
<p>Or perhaps my knowledge of PL... | 11,017 |
<p>This seems like it should be easy but I'm stumped. In WPF, I'd like a TextBox that stretches to the width of it's parent, but only to a maximum width. The problem is that I want it to be left justified within its parent. To get it to stretch you have to use HorizontalAlignment="Stretch", but then the result is cente... | <p>You can set <code>HorizontalAlignment</code> to Left, set your <code>MaxWidth</code> and then bind <code>Width</code> to the <code>ActualWidth</code> of the parent element:</p>
<pre><code><Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/... | <p>I would use <code>SharedSizeGroup</code></p>
<pre class="lang-xml prettyprint-override"><code><Grid>
<Grid.ColumnDefinition>
<ColumnDefinition SharedSizeGroup="col1"></ColumnDefinition>
<ColumnDefinition SharedSizeGroup="col2"></ColumnDefinition>
</Gr... | 35,444 |
<p>I wish to find all rows in a table where one column is a substring of another column.</p>
<p>In other words, suppose I have a table (called people) with two columns: firstname and lastname, and I want to find all people like "rob robinowitz" and "jill bajillion".</p>
<p>Is there a way to do something like "select ... | <p>You were close</p>
<pre><code>select * from people where lastname like '%' + firstname + '%'
</code></pre>
<p>Alternative way (may be even faster)</p>
<pre><code>select * from people where charindex(firstname,lastname)>0
</code></pre>
| <p>If you are using MySQL you could</p>
<pre><code>SELECT * FROM people WHERE INSTR(lastname, firstname) <> 0
</code></pre>
| 40,871 |
<p>I'm trying to use <code>tasklist</code> to find out which process is consuming more than X percent of my CPU (to later kill it with <code>taskkill</code>.) </p>
<p>How do I know what percent a time format represents?</p>
<p>The documentations says:</p>
<pre><code>TASKLIST options
/FI filter
</c... | <p>It doesn't look like there's an easy way to do this with tasklist, so I would suggest either doing this in VBscript or another scripting language, or using a different approach. If you're constrained to batch files then you could use the <a href="http://technet.microsoft.com/en-us/library/bb742610.aspx" rel="norefer... | <p>Tasklist's CPUTime is a measure of how much CPU time (cycles) have been used since the start of the process, so to convert that to a percent, it would be </p>
<pre><code> (TotalProcessRuntime / CpuTime) / 100
</code></pre>
<p>At least, thats what I gather :)</p>
| 25,342 |
<p>I have a table which has a field <code>sort_id</code>. In this field there are numbers from 1 to n, that define the order of the data sets.
Now I want to delete some elements and afterwards I want to reorder the table. Therefore I need a query that "finds" the gaps and changes the <code>sort_id</code> field accordin... | <p>Mladen and Arvo have good ideas, but unfortunately in MySQL you can't <code>SELECT</code> and <code>UPDATE</code> the same table in the same statement (even in a subquery). This is a known limitation of MySQL.</p>
<p>Here's a solution that uses MySQL user variables:</p>
<pre><code>SET @i := 0;
UPDATE mytable
SET ... | <p>for sql server 2005:
this is how you get the new sequence:</p>
<pre><code>SELECT row_number() over(order by sort_id) as RN
FROM table
</code></pre>
<p>updating the table means you should join that select to your update:</p>
<pre><code>update t1
set sort_id = t2.RN
FROM table t1
join (SELECT row_number() ove... | 37,050 |
<p>Some have suggested that filament costs are asymptotically approaching a baseline cost - others that costs are linearly decreasing. Does anyone know where to find the trending costs on a single class of filament over the past decade or more?</p>
<p>Part of the reason we are asking is to get enough longitudinal data... | <p>I'm not clear as to the intent of your question, but I would like to provide some insight. Typically, the biggest differentiating factor between a mediocre data scientist, and a good one, is based on the hypothesis they put forth. Therefore, understanding where the cost of filament is derived from is much more impor... | <p>You could have a look though the various price trackers for Amazon (like <a href="http://uk.camelcamelcamel.com/Kg-Yellow-MakerGear-Ultimaker-THING-O-MATIC-Universal/product/B00MVKOSM8?context=browse" rel="nofollow">ccc</a> and <a href="https://thetracktor.com/detail/B010P3EE6W/" rel="nofollow">thetractor</a>), for ... | 265 |
<p>I maintain an old PC-only application written in Delphi 7. Although Delphi has served me very well in the past I now only use it for this one application and find my skills with the language diminishing. Its syntax is too different from my 'day job' languages of Java/Ruby so it takes me longer to get into the groove... | <p>I am not aware of any automated tools for making that conversion. Personally I would suggest you stick with Delphi, maybe just upgrade to a new version. I have seen a couple code DOM's that attempt to convert from Delphi to C#, but that doesn't address the library issue. </p>
<p>CodeGear (formally Borland) has a... | <blockquote>
<p>Many of my users are moving to Vista
which may run the app in compatibility
mode or may have GPF problems
depending on how their PC is
configured by their IT department, so
I have to do some maintenance on the
application. I'm wondering if I should
jump to a more familiar stack.</p>
</bl... | 8,418 |
<p>I have a HashMap that I am serializing and deserializing to an Oracle db, in a BLOB data type field.
I want to perform a query, using this field.
Example, the application will make a new HashMap, and have some key-value pairs.
I want to query the db to see if a HashMap with this data already exists in the db.
I do ... | <p>Here's an article for you to read: <a href="http://weblogs.asp.net/alex_papadimoulis/archive/2005/05/25/408925.aspx" rel="nofollow noreferrer">Pounding a Nail: Old Shoe or Glass Bottle</a></p>
<p>I haven't heard much about your application's underlying architecture, but I can tell you immediately that there is <em>... | <p>I haven't had the need to compare BLOBs, but it appears that it's supported through the <code>dbms_lob</code> package. </p>
<p>See <code>dbms_lob.compare()</code> at <a href="http://www.psoug.org/reference/dbms_lob.html" rel="nofollow noreferrer">http://www.psoug.org/reference/dbms_lob.html</a></p>
| 48,639 |
<p>I want create a drop shadow around the canvas component in flex. Technically speaking it will not be a shadow, as I want it to wrap around the component giving the component a floating look. I may be able to do it with glow, but can anyone drop an line or two who has already done it?</p>
<p>Thanks in advance.</p>
| <p>I actually solved it by doing this:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<mx:Canvas xmlns:mx="http://www.adobe.com/2006/mxml"
width="780" height="100%" borderStyle="solid" borderColor="gray"
creationComplete="init();" backgroundColor="white">
<mx:Script>
... | <p>If you want to define it outside of the canvas, you can do this:</p>
<pre><code><mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
width="780" height="100%">
<mx:Canvas filters="[dropShadow]" width="200" height="200" backgroundColor="white"/>
<mx:DropShadowFilter id="dropShadow... | 29,998 |
<p>I am new to c# and VS, but I am getting it. The application is this: A program in which the end result will draw a spider from options in which the user will define. Lets say there are 100s of options: size and number of body parts, color, connections points to the body, etc.</p>
<p>First question: Should I try to ... | <p>Hmm.</p>
<p>This is truly a rough question, not because I don't know how to do it, but because it can often be so ridiculously daunting for beginners. If you use the "standard" Windows Forms C# method of doing it, you'll end up asking yourself, "What the #*(&! is WM_PAINT?" or "Why does my program totally get ... | <p>Here is a link to some examples of how to draw things with C#:</p>
<p><a href="http://www.geekpedia.com/tutorial50_Drawing-with-Csharp.html" rel="nofollow noreferrer">http://www.geekpedia.com/tutorial50_Drawing-with-Csharp.html</a></p>
<p>This example uses just the built-in graphics methods of .NET, so you won't n... | 49,777 |
<p>What's the accepted way of storing quoted data in XML?</p>
<p>For example, for a node, which is correct?</p>
<ul>
<li>(a) <name>Jesse "The Body" Ventura</name></li>
<li>(b) <name>Jesse \"The Body\" Ventura</name></li>
<li>(c) <name>Jesse &quot;The Body&quot; Ventura</name&g... | <p>Your correct answer is A & C as the <code>"</code> is not a character that must be encoded in element data.</p>
<p>You should always be XML encoding characters such as <code>></code>, <code><</code>, and <code>&</code> to ensure that you don't have issues if they are NOT inside a CDATA section. These... | <p>The correct answer is 'C'.</p>
<p>Single quotes don't really cause a problem, but you need to be careful of ampersands and left angle brackets.</p>
| 18,128 |
<p>I'm having trouble coming up with the correct regex string to remove a sequence of multiple ? characters. I want to replace more than one sequential ? with a single ?, but which characters to escape...is escaping me.</p>
<p>Example input:</p>
<blockquote>
<p>Is this thing on??? or what???</p>
</blockquote>
<p>D... | <pre><code>preg_replace('{\?+}', '?', 'Is this thing on??? or what???');
</code></pre>
<p>That is, you only have to escape the question mark, the plus in "\?+" means that we're replacing every instance with one or more characters, though I suspect "\?{2,}" might be even better and more efficient (replacing every insta... | <p>Have you tried the pattern</p>
<pre><code>[?]+
</code></pre>
<p>with the replacement of <code>?</code> ?</p>
| 16,536 |
<p>I have found <a href="http://www.sitepoint.com/dustmeselectors/" rel="nofollow noreferrer">http://www.sitepoint.com/dustmeselectors/</a> which does about the opposite of what I want, identifying selectors in CSS that aren't used in HTML.</p>
<p>I want a tool that will find elements that have a class attribute but t... | <p>If the CSS file is correctly linked within your page and a part your project, then in VS.NET 2008 it'll give you a the standard little squiggle warning.</p>
| <p>No tools that I know of. </p>
<p>Seems like a good candidate for a short program, since you probably don't need to do this terribly often. </p>
<p>I'd regex out the <code>class="someclass"</code> from my source html, use the Web Developer's Toolbar in Firefox to get a concatenation of all my CSS, and regex out `.... | 49,723 |
<p>I am trying to write a regular expression to strip all HTML with the exception of links (the <code><a href</code> and <code></a></code> tags respectively. It does not have to be 100% secure (I am not worried about injection attacks or anything as I am parsing content that has already been approved and publi... | <pre><code><(?!\/?a(?=>|\s.*>))\/?.*?>
</code></pre>
<p>Try this. Had something similar for p tags. Worked for them so don't see why not. Uses negative lookahead to check that it doesn't match a (prefixed with an optional / character) where (using positive lookahead) a (with optional / prefix) is follow... | <p>How about</p>
<pre><code><[^a](.|\n)+?>
</code></pre>
<p>?</p>
| 6,570 |
<p>we are dealing with a legacy application built on MySQL 5.0 (MyISAM). I need to know in <b>real-time</b> when an update, delete, or insert happens to a particular table. The 'gotcha' is that I can't change the db (i.e. write triggers) in any way. I have to use the bin log, replication or something else which is s... | <p>check <a href="http://forge.mysql.com/wiki/MySQL_Proxy" rel="noreferrer">MySQL Proxy</a>. it lets you tap right in the command/response stream, and it's fully programmable in Lua. you can even modify commands in real time, if you want</p>
| <p>I am experimenting with using mysqlbinlog -R -t to get the feed in realtime, it works until the end, then you need to find the last position read, and continue there, combined with a query for log files this should give you all the files one after another.... am experimenting with this..</p>
| 28,650 |
<p>I've just installed two TMC2208 drivers on my RAMPS board. I followed a very good step by step tutorial and after some issues, I got it nearly to work.</p>
<p>One problem I still have is that when I tell the printer to lift the Z axis by 5 mm, it lifts it by 10 cm.</p>
<p>I haven't changed anything regarding the ste... | <p>I don't have these controllers, but I read that with default settings the TMC2208 will interpolate the microsteps set by the I/O configuration pins to
256 microsteps. Please look into how you set up the dip switches / jumper caps on your board, it seems that only 2 are used (MS1 and MS2). Furthermore, can't you just... | <p>Most likely your issue is related to the PDN_UART pin on TCM2208 Driver board, on some manufacturers boards the jumper is not set to UART mode by default, so most likely u need to solder jumper to right configuration. Look at datasheet of your driver board.
for example
<a href="https://github.com/bigtreetech/BIGTR... | 904 |
<p>I recently downloaded Rob Conery's excellent <a href="http://blog.wekeroad.com/mvc-storefront/" rel="noreferrer">ASP.NET Storefront reference application</a> and am finding it incredibly instructive. One question that comes to mind is where one should place the Model classes (and the Data classes upon which they de... | <p>It really depends on the size of the project. There's no inherent value in having a separate "models" assembly, as you can unit test a Web Application project (including MVC projects).</p>
| <p>Separate assemblies != loose coupling.</p>
| 34,724 |
<p>We have one web application (sharepoint) that collects information from disparate sources. We would like to be able to link users to the main websites of those various sources and have them pre-authenticated. I.E. they enter their credentials for the other sources (which are a number of different types LDAP, AD and ... | <p>Office Server has a Single-Sign-On api as a builtin feature. you may want to look into that. It enables you to register user credentials securely, and to access it at runtime.</p>
| <p>You need to act as a web browser acts to different sites with storing credentials (usually in cookies) locally. Use therefore a a proper client library with cookie support. This could go probably for most of sites. There are sites using HTTP authentication, which are also easier to access from appropriate client li... | 42,954 |
<p>I'm working on a configuration script for a JNI wrapper. One of the configuration parameters is the path to <code>jni.h</code>. What's a good quick-and-dirty Autoconf test for whether this parameter is set correctly for C++ compilation? You can assume you're running on Linux and <code>g++</code> is available.</p>
<... | <p>Checking for headers is easy; just use <code>AC_CHECK_HEADER</code>. If it's in a weird place (i.e., one the compiler doesn't know about), it's entirely reasonable to expect users to set <code>CPPFLAGS</code>.</p>
<p>The hard part is actually locating <code>libjvm</code>. You typically don't want to link with this;... | <p>FYI - the patch below against the latest ax_jni_include_dir.m4 works for me on Macos 11.1.</p>
<pre><code>--- a/m4/ax_jni_include_dir.m4
+++ b/m4/ax_jni_include_dir.m4
@@ -73,13 +73,19 @@ fi
case "$host_os" in
darwin*) # Apple Java headers are inside the Xcode bundle.
- macos_... | 19,795 |
<p>Here's the deal. I have a hash map containing data I call "program codes", it lives in an object, like so:</p>
<pre><code>Class Metadata
{
private HashMap validProgramCodes;
public HashMap getValidProgramCodes() { return validProgramCodes; }
public void setValidProgramCodes(HashMap h) { validProgramCod... | <h2>Use Volatile</h2>
<p>Is this a case where one thread cares what another is doing? Then the <a href="http://www.cs.umd.edu/~pugh/java/memoryModel/jsr-133-faq.html#reordering" rel="noreferrer">JMM FAQ</a> has the answer:</p>
<blockquote>
<p>Most of the time, one thread doesn't
care what the other is doing. But ... | <p>I think it's risky. Threading results in all kinds of subtly issues that are a giant pain to debug. You might want to look at <a href="http://commons.apache.org/collections/api/org/apache/commons/collections/FastHashMap.html" rel="nofollow noreferrer"><code>FastHashMap</code></a>, which is intended for read-only thr... | 38,491 |
<p>In my project I programmatically create a web part page and add a web part to it using SPLimitedWebPartManager. I also want to set some properties for the web part and save it into the web part personalization scope. How can I access the personalization store for the web part. </p>
| <p>Use the method SaveChanges on SPLimitedWebPartManager after change your properties to set them.</p>
| <p>Please refer following post for adding web part programmatically:</p>
<p><a href="http://www.etechplanet.com/post/2009/03/18/AddingRemoving-web-part-programmatically-in-SharePoint-website-using-C-Code.aspx" rel="nofollow noreferrer">http://www.etechplanet.com/post/2009/03/18/AddingRemoving-web-part-programmatically... | 49,567 |
<p>Can my webmethod only return strings like I see in all the asp.net site examples?</p>
| <p>asp.net Webmethods can return any serializable data type.</p>
| <p>As far as I know, you can pretty much return any .NET class, including anonymous types. I've returned custom objects representing my business entities, including generic collections of children entities. Guids, ints, strings, etc. Anything that can be serialized into a string basically.</p>
| 35,695 |
<p>In JavaScript, the "this" operator can refer to different things under different scenarios. </p>
<p>Typically in a method within a JavaScript "object", it refers to the current object.</p>
<p>But when used as a callback, it becomes a reference to the calling object.</p>
<p>I have found that this causes problems i... | <p>Quick advice on best practices before I babble on about the magic <em>this</em> variable. If you want Object-oriented programming (OOP) in Javascript that closely mirrors more traditional/classical inheritance patterns, pick a framework, learn its quirks, and don't try to get clever. If you want to get clever, lea... | <p>I believe this may be due to how the idea of [closures](<a href="http://en.wikipedia.org/wiki/Closure_(computer_science)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Closure_(computer_science)</a> work in Javascript.</p>
<p>I am just getting to grips with closures myself. Have a read of the linked wikip... | 10,550 |
<p>I am using the following servlet-mapping in my <code>web.xml</code> file:</p>
<pre><code><servlet>
<servlet-name>PostController</servlet-name>
<servlet-class>com.webcodei.controller.PostController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>... | <p>Two options come to mind:</p>
<p>1) Typically, in web app like this, the "action" URLs that are handled by a servlet, are given either a sub-directory like "<code>/actions/*</code>" or are given an extension like "<code>*.action</code>" or "<code>*.do</code>" (this is what Struts does). This way it's clear which UR... | <p>Jetty interprets web.xml as you're expecting it to. I exposed this problem recently when I moved an application from jetty to tomcat, and all of a sudden couldn't see my static resources anymore. Very frustrating.</p>
| 37,620 |
<p>I just don't get it. Tried on VC++ 2008 and G++ 4.3.2</p>
<pre><code>#include <map>
class A : public std::multimap<int, bool>
{
public:
size_type erase(int k, bool v)
{
return erase(k); // <- this fails; had to change to __super::erase(k)
}
};
int main()
{
A a;
a.erase(... | <p>When you declare a function in a class with the same name but different signature from a superclass, then the name resolution rules state that the compiler should <em>stop looking</em> for the function you are trying to call once it finds the first match. After finding the function by name, <em>then</em> it applies ... | <p>To replace __super in a portable way, define a typedef at the top of your class like this:</p>
<pre><code>typedef std::multimap<int, bool> parent;
public:
size_type erase(int k, bool v)
{
return parent::erase(k);
}
</code></pre>
<p>It does not need to be "parent" of course. It could ... | 35,652 |
<p>I'm working on a project which uses .NET Remoting for communication between the client application and an object server. For development, the client, server, and MSSQL database are all running on my local development machine. </p>
<p>When I'm working at the office, the responsiveness is just fine. </p>
<p>However,... | <p>Perhaps during development you could use an IPC remoting channel which uses named pipes instead of TCP. If your remoting channels are set up via a config file then you won't even have to recompile.</p>
<p>I found the link below was useful when setting up an IPC channel.</p>
<p><a href="http://www.danielmoth.com/Bl... | <p>I worked on a project last summer that required some pretty heavy modifications to .NET Remoting. I don't remember all the specifics, but if we had more than one network interface, we couldn't get the out-of-the-box Remoting implementation to reliably detect which one the Remoting traffic came from, which did horrib... | 2,698 |
<p>I have 2 arrays of 16 elements (chars) that I need to "compare" and see how many elements are equal between the two.</p>
<p>This routine is going to be used millions of times (a usual run is about 60 or 70 million times), so I need it to be as fast as possible. I'm working on C++ (C++Builder 2007, for the record)</... | <p>UPDATE: This answer has been modified to make my comments match the source code provided below.</p>
<p>There is an optimization available if you have the capability to use SSE2 and popcnt instructions.</p>
<p>16 bytes happens to fit nicely in an SSE register. Using c++ and assembly/intrinsics, load the two 16 by... | <p>Is it faster as one statement?</p>
<pre><code>matches += (array1[0] == array2[0]) + (array1[1] == array2[1]) + ...;
</code></pre>
| 14,188 |
<p>How can I get a PL/SQL block to output the results of a <code>SELECT</code> statement the same way as if I had done a plain <code>SELECT</code>?</p>
<p>For example how to do a <code>SELECT</code> like:</p>
<pre><code>SELECT foo, bar FROM foobar;
</code></pre>
<p>Hint :</p>
<pre><code>BEGIN
SELECT foo, bar FROM f... | <p>It depends on what you need the result for.</p>
<p>If you are sure that there's going to be only 1 row, use implicit cursor:</p>
<pre><code>DECLARE
v_foo foobar.foo%TYPE;
v_bar foobar.bar%TYPE;
BEGIN
SELECT foo,bar FROM foobar INTO v_foo, v_bar;
-- Print the foo and bar values
dbms_output.put_line('... | <p>Even if the question is old but i will share the solution that answers perfectly the question :</p>
<pre><code>SET SERVEROUTPUT ON;
DECLARE
RC SYS_REFCURSOR;
Result1 varchar2(25);
Result2 varchar2(25);
BEGIN
OPEN RC FOR SELECT foo, bar into Result1, Result2 FROM foobar;
DBMS_SQL.RETURN_RESULT(R... | 45,764 |
<p>Is there a way to select a parent element based on the class of a child element in the class? The example that is relevant to me relating to HTML output by a nice menu plugin for <a href="http://drupal.org" rel="noreferrer">http://drupal.org</a>. The output renders like this: </p>
<pre><code><ul class="menu"&... | <p>Unfortunately, there's no way to do that with CSS.</p>
<p>It's not very difficult with JavaScript though:</p>
<pre><code>// JavaScript code:
document.getElementsByClassName("active")[0].parentNode;
// jQuery code:
$('.active').parent().get(0); // This would be the <a>'s parent <li>.
</code></pre>
| <p>Another thought occurred to me just now that could be a pure CSS solution. Display your active class as an absolutely positioned block and set its style to cover up the parent li.</p>
<pre><code>a.active {
position:absolute;
display:block;
width:100%;
height:100%;
top:0em;
left:0em;
background-... | 6,680 |
<p>I'm interested in learning Haskell on my own time (not through a course), but I suspect that my math background may be insufficient to grok important language concepts (TBD).</p>
<p>I have had a year of college calculus (single variable), but not discrete math or logic.</p>
<p>Am I going to run into gaps in my mat... | <p>Why don't you just try it and see?</p>
<p>The design of Haskell has borrowed from mathematical ideas in areas like category theory (monads, arrows, transformers), but most Haskell programmers only understand what these are in relation to programming anyway :-)</p>
<p>You don't need any particularly advanced mathem... | <p>Math? Erm, no. You don't need math at all (as in Math in the common sense of the word Algebra,Calculus,Geometry), but you do need a logical(logic==math?) brain to program just like with any other language</p>
| 39,072 |
<p>I get the following error when trying to run the latest Cygwin version of rsync in Windows XP SP2. The error occurs for attempts at both local syncs (that is: source and destination on the local harddisk only) and remote syncs (using "-e ssh" from the openssh package). Any advice on how to fix/workaround it?</p>
<p... | <p>You probably have something blocking rsync. In my case it's NOD32 antivirus. You can check this by running rsync in 'gdb' as follows:</p>
<pre><code>$ gdb --args /usr/bin/rsync -a somedir/ anotherdir
GNU gdb 6.8.0.20080328-cvs (cygwin-special)
.....
(no debugging symbols found)
(gdb) run
</code></pre>
<p>note t... | <p>I have found this to be a winsock error. I confirmed the problem starts with the installation of the ATT Communcations Manager (version 6.12.0046.0) for the Sierra Wireless Aircard (875U). Uninstall the Communications Manager and the rsync error goes away.</p>
| 13,208 |
<p>Is there a way to configure Velocity to use something other than toString() to convert an object to a string in a template? For example, suppose I'm using a simple date class with a format() method, and I use the same format every time. If all of my velocity code looks like this:</p>
<pre><code>$someDate.format('M-... | <p>I have found .NET 2.0-based components like <a href="http://www.html-to-pdf.net/" rel="nofollow noreferrer">ExpertPDF</a> and <a href="http://www.websupergoo.com/products.htm#pd" rel="nofollow noreferrer">ABCpdf</a> do a fairly good job interpreting the CSS styles and aligning the tables properly in PDF. Right now I... | <p>I don't have any solid answers, but I'll give you two directions to explore, both of which I have used before.</p>
<p>1 - use something like <a href="http://www.codeplex.com/htmlagilitypack" rel="nofollow noreferrer">HtmlAgilityPack</a> to cleanse your HTML - you can traverse the DOM and remove styles and classes, ... | 49,079 |
<p>I've got an UberJar with all my java classes, but want to execute this jar with an external persistence.xml file. Per the specification, Hibernate (or any other JPA provider) looks for the persistence.xml file in any META-INF folder that's on the classpath, but I haven't been able to make this work with an UberJar.... | <p>From the <strong>-jar</strong> command line option:</p>
<blockquote>
<p><strong>"-jar"</strong> When you use this option, the JAR file is the source of all user classes, and other user class path settings are ignored</p>
</blockquote>
<p>So, it the seems the direct answer is no.</p>
<p>You could write your own ... | <p>To follow up on how I solved this, I added the persistence.xml file and my jar to the classpath and then specified the main class. I also still had the unarchived classes in my path, which caused them to override the jar settings.</p>
| 21,688 |
<p>I have a messy function that needs refactoring, it has too many nested IF's and it makes me nervous just to look at it!</p>
<p><b>Please ignore what the functions are doing, I'm more concerned with the structure/flow and how it can be refactored so it has less nested IF statements</b></p>
<p>The basic flow is as f... | <p>I would be tempted to go as far as:</p>
<pre><code> private static bool CanMoveToSafeFolder(string filename)
{
return IsValidFileFormat(filename)
&& GetFolderIDFromFilename(filename) > 0
&& HasNoViruses(filename)
&& VerifyFileSize(filenam... | <p>This honors the original conditions under which the file is deleted and is cleaner and more compact. My first answer set folderId, but I then realized it isn't used.</p>
<pre><code>public static void HandleUploadedFile(string filename) {
try {
if(IsValidFileFormat(filename)
&& GetFolde... | 45,347 |
<p>At the moment I am working in a pretty big project and I have been been asked to refactor some old code. Most of the refactoring is setting apart a big class into smaller components and functions.</p>
<p>I've searched and seen some other <a href="https://stackoverflow.com/questions/16167/good-refactoring-support-fo... | <p>I've used WholeTomato's Visual Assist X, they have a free trial but it's $249 for a full version, $99 for a "Personal License".</p>
| <p>There is now a free <a href="http://visualstudiogallery.msdn.microsoft.com/164904b2-3b47-417f-9b6b-fdd35757d194?SRC=Home" rel="nofollow" title="Refactoring Extension">Refactoring Extension</a> for Visual Studio 2013, created by Microsoft. As I write this it's still in its early stages and does Rename refactoring onl... | 31,074 |
<p>If I want to put a form up on SharePoint, is it easier to use InfoPath or build a custom web part in C#? Are there other options that I should consider? </p>
<p>What are the requirements and hurdles for each option?</p>
| <p>Building forms using InfoPath is absolutely the easiest way to publish a form in SharePoint. Notice it has many limitations, and you might find yourself trying to put some problematic logic or need an extra feature.</p>
<p>Programming in C# requires C# knowledge (of course) and a knowledge in SharePoint's APIs. Als... | <p>Can you be more specific about the form and sharepoint version ?</p>
<p>It depends on your version of Sharepoint : if you got 2003, if you want to use InfoPath, it has to be installed on the clients as well. On SharePoint 2007, i <strong>think</strong> it is not required.</p>
<p>If it is a large form with few busi... | 15,771 |
<p>I'm trying to diff two strings to determine whether or not they solely vary in one numerical subset of the string structure; for example,</p>
<pre><code>varies_in_single_number_field('foo7bar', 'foo123bar')
# Returns True, because 7 != 123, and there's only one varying
# number region between the two strings.
</cod... | <p>This might work, it at least passes your demonstration test:
EDIT: I've made some modifications to deal with some string indexing issues. I believe it should be good now.</p>
<pre><code>#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <cctype>
bool... | <p>@Evan Teran: looks like we did this in parallel -- I have a markedly less readable O(n) implementation:</p>
<pre><code>#include <cassert>
#include <cctype>
#include <string>
#include <sstream>
#include <iostream>
using namespace std;
ostringstream debug;
const bool DEBUG = true;
boo... | 33,919 |
<p>I have seen member functions programed both inside of the class they belong to and outside of the class with a function prototype inside of the class. I have only ever programmed using the first method, but was wondering if it is better practice to use the other or just personal preference?</p>
| <p>Assuming you mean C++, it is always better to define functions <em>outside</em> of the class, because if you put it inside the class, compiler may try to inline it, which is not always desirable:</p>
<ol>
<li>Increase in code size (every object file that includes this header might end up with a copy of the function... | <p>I assume you are talking about C++.</p>
<p>Having a nice and clean interface is certainly a good idea. Having a separate implementation file helps to keep your interface clean.</p>
<p>It also reduces compilation time, especially if you are using an <a href="http://en.wikipedia.org/wiki/Opaque_pointer" rel="nofoll... | 19,990 |
<p>In my Winforms application, I want to export the data from my DataGridView to a Excel spreadsheet.</p>
<p>Is it simply a job of looping and outputting the results comma seperated?</p>
| <p><em>Is it simply a job of looping and outputing the results comma seperated?</em> Yes. It is a simpler way without any dependencies. </p>
<p>If you need more control, you can always automate excel from <a href="http://support.microsoft.com/kb/301982" rel="nofollow noreferrer">vb.net</a> or from <a href="http://supp... | <p>Slightly hacky, but Excel will also open a html file saved with a .xls extension. This has the advantage of being able to include formatting.</p>
| 20,204 |
<p>When I add &nbsp; or &eacute; to a text value of a listitem, it display the code of the HTML entity instead of the result (a space or é).</p>
<p>I can add "physical" non-breaking spaces or special chars, but I would like to avoid that if possible. Sometimes the data stored in database is encoded, and I don'... | <p>ListItems are automatically HtmlEncoded.</p>
<p>You can HtmlDecode the list items before hand, so when they are HtmlEncoded you get the proper characters:</p>
<pre><code>DropDownList1.DataSource = new List<string> { Server.HtmlDecode("A&hellip;"), Server.HtmlDecode("B&nbsp;C") };
DropDownList1.DataBi... | <p>Standard drop down lists are very poor at representing treeviews . </p>
<p>They can handle going one level deep if the top level is not selectable (see the <a href="http://www.w3.org/TR/html4/interact/forms.html#edef-OPTGROUP" rel="nofollow noreferrer">optgroup</a> element[1]), but beyond that I suggest taking a re... | 21,416 |
<p>I want to override access to one variable in a class, but return all others normally. How do I accomplish this with <code>__getattribute__</code>?</p>
<p>I tried the following (which should also illustrate what I'm trying to do) but I get a recursion error:</p>
<pre><code>class D(object):
def __init__(self):
... | <p>You get a recursion error because your attempt to access the <code>self.__dict__</code> attribute inside <code>__getattribute__</code> invokes your <code>__getattribute__</code> again. If you use <code>object</code>'s <code>__getattribute__</code> instead, it works:</p>
<pre><code>class D(object):
def __init__(... | <p>Here is a more reliable version:</p>
<pre><code>class D(object):
def __init__(self):
self.test = 20
self.test2 = 21
def __getattribute__(self, name):
if name == 'test':
return 0.
else:
return super(D, self).__getattribute__(name)
</code></pre>
<p>It c... | 48,592 |
<p>I'm trying to start an external application through <code>system()</code> - for example, <code>system("ls")</code>. I would like to capture its output as it happens so I can send it to another function for further processing. What's the best way to do that in C/C++?</p>
| <p>From the popen manual:</p>
<pre><code>#include <stdio.h>
FILE *popen(const char *command, const char *type);
int pclose(FILE *stream);
</code></pre>
| <p>I'm not entirely certain that its possible in standard C, as two different processes don't typically share memory space. The simplest way I can think of to do it would be to have the second program redirect its output to a text file (programname > textfile.txt) and then read that text file back in for processing. Ho... | 15,301 |
<p>I am using an open source client to programmatically process incoming emails (on Windows 2003). The only way to prevent receiving previously read emails is to delete them from the server. This is less than ideal. As far as I know, there is no command in Pop3 to set emails as being read. So how do you go about this? ... | <p>It's the responsibility of the POP3 client to check for this. The most reliable method is to use the <code>UIDL</code> POP3 command to get a unique message ID, and keep track of these on the client side.</p>
| <p>if you do not want to delete, you have to keep track of all the emails already downloaded and do not RETR them again. afaik there is no "mark as read"-like functionality within the standard POP3 protocol (at least not in the <a href="http://www.ietf.org/rfc/rfc1939.txt" rel="noreferrer">rfc</a>)</p>
| 45,873 |
<p>I have a main table that I must get data from. I have a left outer join where the fields will match 40% of the time. And then I have another join where I need to match the data from table A with.</p>
<p>This is the SQL in pseudo code. This query won't work.</p>
<p>-- This is the part I want to do but doesn't wor... | <p>I think you could re-write it like this (but I could be reading your statement wrong)</p>
<pre><code>FROM
TABLE_A A LEFT OUTER JOIN TABLE_B HIST ON
HIST.COL1 = A.COL1
LEFT OUTER JOIN TABLE_D H ON
H.COL3 = A.STATE
LEFT OUTER JOIN TABLE_C B ON H.COL2 = B.COL2
WHERE
A.BRANCH = 'Data'
</code></pre... | <p>What happens if you put the "AND H.COL3 = A.STATE" in your WHERE clause?</p>
| 37,598 |
<p>I'm pretty green with web services and WCF, and I'm using Windows integrated authentication - how do I get the username on the server-side interface? I believe that I'm supposed to implement a custom Behavior, or perhaps something with WCF Sessions? Any clues would be super-handy.</p>
| <p>Try looking at ServiceSecurityContext.Current.WindowsIdentity</p>
| <p>have you tried <code>WindowsIdentity.GetCurrent();</code>?</p>
| 37,287 |
<p>I'm fooling around with <a href="http://pipes.yahoo.com" rel="nofollow noreferrer">Yahoo! pipes</a> and I'm hitting a wall with some regular expression. Now I'm familiar with regular expressions from Perl but the rules just seem to be different in Yahoo! pipes.</p>
<p><a href="https://i.stack.imgur.com/6I6Ok.png" r... | <p>RegEx for the title:</p>
<pre><code>(?i).*?<i>([^<]*).* [ ] g [x] s [ ] m [ ] i
</code></pre>
<p>RegEx for the link:</p>
<pre><code>(?i).*?href="([^"]*).* [ ] g [x] s [ ] m [ ] i
</code></pre>
<p>Somehow the case-insensitive checkbox seems broken. Luckily you can substitut... | <p>One important thing to watch out for with YP is do not trust the debug screen, it has a small quirk of hiding some tags from view that can cause no end of confusion when attempting regexing. To expose any hidden html replace '<' with something like '#'</p>
| 47,052 |
<p>What is the difference in meaning between 'semantics' and 'syntax'? What are they?</p>
<p>Also, what's the difference between things like "semantic website vs. normal website", "semantic social networking vs. normal social networking" etc.</p>
| <p>Syntax is the grammar. It describes the way to construct a correct sentence. For example, <em>this water is triangular</em> is syntactically correct.</p>
<p>Semantics relates to the meaning. <em>this water is triangular</em> does not mean anything, though the grammar is ok.</p>
<p>Talking about the <a href="http:/... | <p>Semantic web sites use the concept of the <a href="http://en.wikipedia.org/wiki/Semantic_web" rel="nofollow noreferrer">semantic web</a>, which aims to bring meaning to web content by using special annotations to identify certain concepts in a page. This makes possible the automatic (by a computer, not a human) reas... | 25,775 |
<p>I've been unsuccessfully searching for a way to install <code>make</code> utility on my CentOS 5.2. I've looked through some RPM repositories and online, with no avail. Installing <code>gcc</code>, <code>gcc-c++</code> didn't help! Package <code>build-essential</code> is not made for CentOS/RHEL. I have RPMFORGE rep... | <pre><code>yum groupinstall "Development Tools"
</code></pre>
<p>or</p>
<pre><code>yum install gcc gcc-c++ kernel-devel
</code></pre>
| <p>This command works for me</p>
<pre><code>yum groupinstall "Development Tools" -y
</code></pre>
| 20,674 |
<p>What are in your opinion the best resources (books or web pages) describing algorithms or techniques to use for collision detection in a 2D environment?</p>
<p>I'm just eager to learn different techniques to make more sophisticated and efficient games.
</p>
| <p>Collision detection is often a two phase process. Some sort of "broad phase" algorithm for determinining if two objects even have a chance of overlapping (to try to avoid n^2 compares) followed by a "narrow phase" collision detection algorithm, which is based on the geometry requirements of your application.</p>
<... | <p>If your objects are represented as points in 2D space you can use line intersection to determine if two objects have collided. You can use similar logic to check if an object is inside another object (and thus they have collided even any of their lines are not currently intersecting). The <a href="http://paulbourke.... | 5,106 |
<p>I work on a program in Delphi that holds a lot of data, and I wonder which method is the best to save it to file. Now we use records and "file of" to save it but I think it should be better methods. I would prefer a system that makes it easy to migrate from the system we use now.</p>
<p>EDIT: The application is a s... | <p>It depends on the data! Common means are databases (rows of lots of records), XML (structured data storage), ini files (simple data) or custom formats (graphic images etc). Delphi is very good with databases, with a range of third party options to allow fully compiled-in code, so for general data they will work well... | <p>Also depends on what you want to do with it once you have saved it... is it just storage of 'archived' data at this point ? Or do you want to search it, retrieving some of the data at some point in the future then saving it back again (potentially changed), or do you load it all in, manipulate it in some way, then ... | 44,193 |
<p>I am looking for an expression for the .hgignore file, to ignore all files beneath a specified folder.</p>
<p>eg: I would like to ignore all files and folders beneath bin</p>
<p>Actually any advice on how the expressions are formed would be great</p>
| <p>Alternately:</p>
<pre><code>syntax: glob
bin/**
</code></pre>
| <p>to ignore .class files </p>
<pre><code>syntax: regexp
?\.class
</code></pre>
| 31,669 |
<p>What's the best way to copy a file from a network share to the local file system using a Windows batch file? Normally, I would use "net use *" but using this approach how can I get the drive letter?</p>
| <p>Can you just use the full UNC path to the file?</p>
<pre><code>copy \\myserver\myshare\myfolder\myfile.txt c:\myfiles
</code></pre>
| <p>You can also use <code>xcopy</code> and <code>robocopy</code>:</p>
<pre><code>xcopy "\\server\share\path" "destination"
</code></pre>
<pre><code>robocopy "\\server\share\path" "destination"
</code></pre>
| 6,879 |
<p>I am running a Solr instance on Jetty and when I search using the Solr admin panel, it returns the entire document. What should I do to get only specified fields from each Solr document returned by the search?</p>
| <pre><code>/?q=query&fl=field1,field2,field3
</code></pre>
| <p>The best way is to run the query from Admin concole. When we run it, it also provides the actuall SQL query executed. Just copy the query and use it.</p>
<p>About the question: select specific fields from the table. In the admin console look for 'FL' text box. write the field names you want to retrieve, comma saper... | 33,190 |
<p>I have a problem whereby I want to display a view differently (a different master page), depending on where it came from, but don't know where to start...</p>
<p>I have several routes which catch various different types of urls that contain different structures.</p>
<p>In the code snippet below, I have a product r... | <p>In your partners controller why don't you set a cookie that indicates which partner you want to show, and then redirects to the wildcard section of the route. That way you can show the same partner layout for all subsequent page views.</p>
<p>I don't know if this is what you're looking for, but it might be an opti... | <p>It may be the devils work but you could put some code in the Partner View's codebehind to look at the URL and then set the master page programmatically in there?</p>
| 29,392 |
<p>I'm building a site which will have a 'Login/Register' link on every page. Whenever someone clicks this link, I want a JavaScript/div based signup form to float on top of the content with a link to 'close' it if they want.</p>
<p>I also want the capability of the div showing up near the position of their mouse, i.e... | <p>Take a look at jQuery Thickbox.</p>
<p><a href="http://jquery.com/demo/thickbox/" rel="nofollow noreferrer">http://jquery.com/demo/thickbox/</a></p>
| <p>You can also possibly show the login page in a new window with the toolbar, address bar etc hidden. You can set the window location using the mouse co-ordinates retrieved from the mouse click event in your main page</p>
| 45,018 |
<p>Is there an easy way to produce MSDN-style documentation from the Visual Studio XML output?<br>
I'm not patient enough to set up a good xslt for it because I know I'm not the first person to cross this bridge. </p>
<p>Also, I tried setting up sandcastle recently, but it really made my eyes cross. Either I was mis... | <p>You're looking for Sandcastle</p>
<p>Project Page: <a href="http://www.codeplex.com/Sandcastle/Release/ProjectReleases.aspx" rel="noreferrer">Sandcastle Releases</a></p>
<p>Blog: <a href="http://blogs.msdn.com/sandcastle/default.aspx" rel="noreferrer">Sandcastle Blog</a></p>
<p><a href="http://ndoc.sourceforge.ne... | <p>Follow <a href="http://saftsack.fs.uni-bayreuth.de/~dun3/archives/integrate-xml-code-comments-into-visual-studio-20052008-using-sandcastle-and-html-help-20/150.html" rel="nofollow noreferrer">this simple 5 step article</a> and you are pretty much done. As a bonus you can use <a href="http://www.helpware.net/mshelp2/... | 2,329 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.