instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>We’re getting the following error message when we click on “Search Settings” for a Shared Services Provider: “Authentication failed because the remote party has closed the transport stream.”</p>
<p>This is a new server environment with two web front ends, one database server, and one index server, all running Windo... | <p>I guess you find this exception in the index server, right?</p>
<p>Are you able to browse to '<a href="https://mushni-sptwb04q:56738/Shared%20Services%20Portal/Search/SearchAdmin.asmx" rel="nofollow noreferrer">https://mushni-sptwb04q:56738/Shared%20Services%20Portal/Search/SearchAdmin.asmx</a>' from the index serv... | <p>Could be an SSL issue.<br>
Do have a look into profiles settings, do you get any error when accessing to the User Profiles settings for that same SSP?</p>
| 11,371 |
<p>I want to send email from a Ruby application. Is there a call in the core language to do this or is there a library I should use? What's the best way to do this?</p>
| <p>If you don't want to use <a href="http://wiki.rubyonrails.org/rails/pages/ActionMailer" rel="nofollow noreferrer">ActionMailer</a> you can use <a href="http://www.ruby-doc.org/stdlib/libdoc/net/smtp/rdoc/index.html" rel="nofollow noreferrer">Net::SMTP</a> (for the actual sending) together with <a href="https://githu... | <p>You might also consider taking a look at the <a href="http://wiki.rubyonrails.org/rails/pages/ActionMailer" rel="nofollow noreferrer">ActionMailer</a> component that ships as part of, but is not dependent on Rails.</p>
| 8,281 |
<p>This might of been asked elsewhere (seems like a useful topic) but searches turned up nothing.</p>
<p>One feature I love in Eclipse when programming Java is that I don't have to worry about putting in the import statements and any missed functions from interfaces that I am implementing them - if I do miss them a si... | <p>you have to pay for this feature. Look at Resharper 4.0 from JetBrains. It is a perfect solution for me.</p>
| <p>you have to pay for this feature. Look at Resharper 4.0 from JetBrains. It is a perfect solution for me.</p>
| 38,666 |
<p>I have built a MS Access 2007 application that can create reports files in various formats (PDF, XLS, CSV, XML).<br>
I would like to allow the creation of these reports to be accessible from a web page where users would just click on a link and get a download of the report produced by my Access application.</p>
<p>... | <p>The first quick and dirty method i could think of would be to call Access from a shell and pass it a few parameters to open as read only and run a macro. </p>
<p>That macro would have to pull it's report parameters from somewhere (possibly env variables), run the report and save it as Excel, PDF or whatever to a u... | <p>This is kind of a round about way to achieve what you're asking. You can utilize the free version of sql server express 2005 or 2008 advance edition which includes the reporting services component. Using the report generation tools you can convert your access 2007 reports to sql server reports and have those repor... | 25,951 |
<p>Is there a good object-relational-mapping library for PHP? </p>
<p>I know of <a href="http://www.php.net/manual/en/intro.pdo.php" rel="noreferrer">PDO</a>/ADO, but they seem to only provide abstraction of differences between database vendors not an actual mapping between the domain model and the relational model. I... | <p>Look into <a href="http://www.doctrine-project.org/" rel="noreferrer">Doctrine</a>.</p>
<p><a href="http://www.doctrine-project.org/projects/orm/1.2/docs/en" rel="noreferrer">Doctrine 1.2</a> implements Active Record. <a href="http://www.doctrine-project.org/projects/orm/2.1/docs/en" rel="noreferrer">Doctrine 2+</a... | <p>Doctrine is probably your best bet. Prior to Doctrine, <a href="http://pear.php.net/package/DB_DataObject/" rel="nofollow noreferrer">DB_DataObject</a> was essentially the only other utility that was open sourced.</p>
| 13,405 |
<p>I've got an MS access database and I would need to create an SQL query that allows me to select all the not distinct entries in one column while still keeping all the values.</p>
<p>In this case more than ever an example is worth thousands of words:</p>
<p>Table:</p>
<pre><code>A B C
1 x q
2 y w
3 y e
4 z r
5 z t... | <pre><code>Select B, C
From Table
Where B In
(Select B From Table
Group By B
Having Count(*) > 1)
</code></pre>
| <p>join the unique values of B you determined with group by b and count > 1 back to the original table to retrieve the C values from the table.</p>
| 33,872 |
<p>During development I have to "clear cache" in Firefox all the time in order to make it use the latest version of JavaScript files.</p>
<p>Is there some kind of setting (about:config) to turn off caching completely for JavaScript files? Or, if not, for all files?</p>
| <p>Enter "about:config" into the Firefox address bar and set:</p>
<pre><code>browser.cache.disk.enable = false
browser.cache.memory.enable = false
</code></pre>
<p>If developing locally, or using HTML5's new manifest attribute you may have to also set the following in about:config -</p>
<pre><code>browser.cache.offl... | <p>After 2 hours of browsing for various alternatives, this is something that worked for me.</p>
<p>My requirement was disabling caching of js and css files in my spring secured web application. But at the same time caching these files "within" a particular session.</p>
<p>Passing a unique id with every request is on... | 36,912 |
<p>I want to ask how other programmers are producing Dynamic SQL strings for execution as the CommandText of a SQLCommand object.</p>
<p>I am producing parameterized queries containing user-generated WHERE clauses and SELECT fields. Sometimes the queries are complex and I need a lot of control over how the different p... | <p>I had the need to do this on one of my recent projects. Here is the scheme that I am using for generating the SQL: </p>
<ul>
<li>Each component of the query is represented by an Object (which in my case is a Linq-to-Sql entity that maps to a table in the DB). So I have the following classes: Query, SelectColumn, Jo... | <p>Out of curiousity, have you considered using an ORM for managing your data access. A lot of the functionality you're trying to implement could already be there. It may be something to look at because its best not to re-invent the wheel.</p>
| 7,503 |
<p>My GPS logger occassionally leaves "unfinished" lines at the end of the log files. I think they're only at the end, but I want to check all lines just in case. </p>
<p>A sample complete sentence looks like:</p>
<pre><code>$GPRMC,005727.000,A,3751.9418,S,14502.2569,E,0.00,339.17,210808,,,A*76
</code></pre>
<p>The... | <p>The minimum of testing shows that this should do it:</p>
<pre><code>grep -Ev "^\$.*\*[0-9A-Fa-f]{2}$" a.txt | grep -v ADVER
</code></pre>
<ul>
<li>-E use extended regexp</li>
<li>-v Show lines that do <strong>not</strong> match</li>
<li>^ starts with</li>
<li>.* anything</li>
<li>\* an asterisk </li>
<li>[0-9A-Fa-... | <p>@Motti: Combining the <code>grep</code>s isn't working, it's having no effect.</p>
<p>I understand that without the trailing <code>$</code> something else may folow the checksum & still match, but it didn't work at all with it so I had no choice...</p>
<p>GNU grep 2.5.3 and GNU bash 3.2.39(1) if that makes any... | 5,735 |
<p>I am currently working on a project with five other developers and we are using subversion for our revision control system. We have established that we have 12 milestones leading up to the first release of our software. We have labeled the milestones using version numbers (0.1 through 0.12) and descriptive labels. F... | <p>I don't think that you can because you have conflicting goals - parallel development and sequential milestones. </p>
<p>Either you hold off making the 0.3 release until 0.1 and 0.2 are completed or you have to think of another way of assigning milestone numbers.</p>
<p>Maybe instead of using 0.1 etc. you could nam... | <p>Since there's no real sequence to the internal milestones, I'd prefer to keep minor version numbers for the external releases, give the branches names that reflect the feature, and add the subversion revision to identify internal releases. Your external releases get nice clean 0.1, 0.2, 0.3 versions, and an internal... | 22,372 |
<p>Our (beloved) designer keeps creating PNG files with transparent backgrounds for use in our applications. I'd like to make sure that this feature of the PNG works in "older" browsers as well. What's the best solution?</p>
<p><em>edits below</em></p>
<p>@mabwi & @syd - Whether or not I agree about the use of a ... | <p>I've found what looks to be a very good solution here: <a href="http://web.archive.org/web/20170521133429/http://labs.unitinteractive.com:80/unitpngfix.php" rel="nofollow noreferrer">Unit Interactive -> Labs -> Unit PNG Fix</a></p>
<p><em>update</em> Unit PNG is also featured on a <a href="http://nettuts.com/v... | <p>I might be mistaken, but I'm pretty sure IE6 and less just don't do transparency with PNG files.</p>
<p>I have two "solutions" that I use. Either create GIF files with transparency and use those everywhere, or just use them for IE 6 and older with conditional style sheets. The second really only works if you are ... | 3,146 |
<p>I am trying to use a business object that I am passing to the report.rdlc. The properties in my object are not directly exposed. The properties I require are embedded within another object inside the top level object. As this is a WCF project I can't control what goes on at the server end. I am just able to request ... | <p>The problem was that the info wasn't at the root level. I worked it out though.</p>
<pre><code>=First(Fields!ClientName.Value.StringValue, "BusinessObject_CustomerInfo")
</code></pre>
<p>I've got a pretty good grip of the ReportViewer component now cheers.</p>
| <p>If you set the data source to the CustomerInfo instance (or list) returned from the service it should work. The ReportViewer control can be a little complicated when you start dealing with object hierarchies, but you don't have to do anything crazy or special if all the information is at the root level.</p>
| 33,166 |
<p>This is a follow-up to <a href="https://stackoverflow.com/questions/43778/sqlite3-ruby-gem-failed-to-build-gem-native-extension">this question</a>.</p>
<p>When I issue the <strong><code>gem update</code></strong> command on Windows, whenever it gets to a
gem whose latest version DOESN'T have Windows binaries, it'll... | <p>Gems, as of <a href="http://blog.segment7.net/articles/2009/04/15/rubygems-1-3-2" rel="nofollow noreferrer">version 1.3.2</a>, will now skip gems that fail to build, so update Rubygems to the latest version and the problem discussed here should be solved.</p>
<pre><code>gem update --system
</code></pre>
<p><strong... | <p>Looking at the <a href="http://rubyforge.org/frs/?group_id=254" rel="nofollow noreferrer">RubyForge file list</a> for sqlite3-ruby reveals that version 1.2.3 has gems that were built using Visual Studio 6 and MinGW (sqlite3-ruby-1.2.3-mswin32.gem & sqlite3-ruby-1.2.3-x86-mingw32.gem). However, version 1.2.4 does... | 16,293 |
<p>When I originally was introduced to Mocks I felt the primary purpose was to mock up objects that come from external sources of data. This way I did not have to maintain an automated unit testing test database, I could just fake it.</p>
<p>But now I am starting to think of it differently. I am wondering if Mocks a... | <p>I recommend you take a look at Martin Fowler's article <a href="http://www.martinfowler.com/articles/mocksArentStubs.html" rel="noreferrer"><em>Mocks Aren't Stubs</em></a> for a more authoritative treatment of Mocks than I can give you.</p>
<p>The purpose of mocks is to unit test your code in isolation of dependenc... | <p>Mock objects are 1) often used as a means to isolate the code under test, BUT 2) as keithb already pointed out, are important to "<a href="http://blog.dannorth.net/2008/09/14/the-end-of-endotesting/#comment-7954" rel="nofollow noreferrer">focus on the relationships between collaborating objects</a>". This article gi... | 8,373 |
<p>Does the size of a .net assembly affect performance at all? How about the number of assemblies in your windows forms/web forms project?</p>
| <p>From Microsoft's Patterns & Practices <a href="http://msdn.microsoft.com/en-us/library/ms998530.aspx" rel="noreferrer">Improving .NET Application Performance and Scalability</a> Chapter 5: </p>
<p><strong>Prefer Single Large Assemblies Rather Than Multiple
Smaller Assemblies</strong> </p>
<p>To help reduce y... | <p>No , it does not affect</p>
| 43,743 |
<p>I'd like to run JSLint4Java as part of my build process. I have about 1000 JS files in a library, and don't really want to add a</p>
<pre><code>/*globals foo, bar, baz */
</code></pre>
<p>header to each of them -- especially since many of them are from an external library (Dojo). If I don't add the header, thoug... | <p>From <a href="http://www.ohloh.net/p/jslint4java" rel="nofollow">http://www.ohloh.net/p/jslint4java</a></p>
<blockquote>
<p>News 2009-12-02. jslint4java 1.3.3 is
released. Noteworthy alterations: Add
support for the predef option, to
allow specifying a list of predefined
global variables.</p>
</blockquote... | <p>You can also use <a href="http://arthurakay.github.io/LintRoller/" rel="nofollow">LintRoller</a> - a Node.js utility for checking entire directories or projects against JSLint, JSHint and other validations.</p>
| 45,927 |
<p>What is the best way to typeset a function with arguments for readibility, brevity, and accuracy? I tend to put empty parentheses after the function name like <code>func()</code>, even if there are actually arguments for the function. I have trouble including the arguments and still feeling like the paragraph is re... | <p>I usually take that approach, but if I feel like it's going to cause confusion, I'll use ellipses like: <code>myFunction(...)</code></p>
<p>I guess if I were good, I would use those <em>any</em> time I was omitting parameters from a function in text.</p>
| <p>I would simply be a little more careful with the name of my variables and parameters, most people will then be able to guess much more accurately what type of data you want to hold in it.</p>
| 2,585 |
<p>How can I detect when an Exception has been thrown anywhere in my application?</p>
<p>I'm try to auto-magically send myself an email whenever an exception is thrown anywhere in my Java Desktop Application. I figure this way I can be more proactive.</p>
<p>I know I could just explicitly log and notify myself whene... | <p>You probobly don't want to mail on any exception. There are lots of code in the JDK that actaully depend on exceptions to work normally. What I presume you are more inerested in are uncaught exceptions. If you are catching the exceptions you should handle notifications there.</p>
<p>In a desktop app there are tw... | <p>In this case I think your best bet might be to write a custom classloader to handle all classloading in your application, and whenever an exception class is requested you return a class that wraps the requested exception class. This wrapper calls through to the wrapped exception but also logs the exception event.</p... | 10,084 |
<p>oOo a highly exciting build issue. Compact framework occasionally goes funny when building. Usually when messing with xmta files but this is the first time i've seen it go awry in this scenario.</p>
<p>I created a abstract base class with an abstract method. Placed this in one of my core dlls. This was fine. I then... | <p>It's an issue with genasm in Visual Studio 2005/2008, that it must instantiate types to generate the asmmeta files, so you can't have public abstract types, unfortunately.</p>
<p>Check this <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=96477&SiteID=1" rel="nofollow noreferrer">MSDN thread</a> w... | <p>Not sure if this will be related but if you include the DesignTimeAttributes.xmta file you get a similar issue.</p>
<p>You'd be getting that DesignTimeAttributes if you were using a base form and inheriting for it. There's a bug in the designer that means you won't see the inherited form at all so this is generated... | 13,924 |
<p>This Question is almost the same as the previously asked <a href="https://stackoverflow.com/questions/122208/get-the-ip-address-of-local-computer">How can I get the IP Address of a local computer?</a> -Question. However I need to find the IP address(es) of a <strong>Linux Machine</strong>.</p>
<p>So: How do I - prog... | <p>I found the ioctl solution problematic on os x (which is POSIX compliant so should be similiar to linux). However getifaddress() will let you do the same thing easily, it works fine for me on os x 10.5 and should be the same below.</p>
<p>I've done a quick example below which will print all of the machine's IPv4 ad... | <pre><code>// Use a HTTP request to a well known server that echo's back the public IP address
void GetPublicIP(CString & csIP)
{
// Initialize COM
bool bInit = false;
if (SUCCEEDED(CoInitialize(NULL)))
{
// COM was initialized
bInit = true;
// Create a HTTP request object
... | 26,119 |
<p>Trying to get my css / C# functions to look like this:</p>
<pre><code>body {
color:#222;
}
</code></pre>
<p>instead of this:</p>
<pre><code>body
{
color:#222;
}
</code></pre>
<p>when I auto-format the code.</p>
| <p><strong>C#</strong></p>
<ol>
<li>In the <em>Tools</em> Menu click <em>Options</em></li>
<li>Click <em>Show all Parameters</em> (checkbox at the bottom left) (<em>Show all settings</em> in VS 2010)</li>
<li>Text Editor</li>
<li>C#</li>
<li>Formatting</li>
<li>New lines</li>
</ol>
<p>And there check when you want new ... | <p>If you're looking for this option within <strong>Visual Studio 2014</strong>, then it's under advanced and is now a 'Brace positions' drop down box:</p>
<p><img src="https://i.stack.imgur.com/QbA8S.png" alt="enter image description here"></p>
| 6,064 |
<p>I'm trying to dynamically generate a gif image of a specified size and color in an HttpHandler. For some reason, the image is being generated with a dithered color pattern rather than the solid color I expected the <strong><em>SolidBrush</em></strong> to create. The following code is the simplest I could find that... | <p>GIF files are limited to 256 colors as far as I know, so it resorts to dithering.
PNG is probably the format you need.</p>
<p>Or you can look <a href="http://www.glennjones.net/Post/799/Highqualitydynamicallyresizedimageswithnet.htm" rel="nofollow noreferrer">here</a> for a solution using a complex quantizer to bui... | <p>IIRC GIF's are limited to a specific pallete on .NET. There are workarounds, but they were above my understanding.</p>
| 36,154 |
<p>Does anyone have a good algorithm for re-sorting an array of values (already pre-sorted) so that they can be displayed in multiple (N) columns and be read vertically? This would be implemented in .Net but I'd prefer something portable and not some magic function.</p>
<p>A good example of it working is the ASP.Net C... | <p>Okay, I'm sorry for my initial statement, but when you want it to work as you described in the comment to my first answer, you need in fact re-sort the data... well somewhat. It could maybe be done without the helper matrix, however the resulting code is probably very complex and as long as the matrix will only use ... | <p>This looks like homework assignments
anyway</p>
<pre><code>array<String^>^ sArray = {"A", "B", "C", "D", "E", "F", "G"};
double Columns = 4;
double dRowCount = Convert::ToDouble(sArray->Length) / Columns;
int rowCount = (int) Math::Ceiling(dRowCount);
int i = 0;
int shift = 0;
int printed = 0;
while (prin... | 21,110 |
<p>Anyway, I'm a little confused about when to propagate an exception and when to wrap it, and the differences.</p>
<p>At the moment, my understanding tells me that wrapping an exception would involve taking an exception like DriveNotFound (in IO) and then wrap it with the general IOException.</p>
<p>But with the con... | <p>No less than 6 questions :-)</p>
<blockquote>
<blockquote>
<p>But with the concept of propagating an exception, is this only something that happens if I have an empty catch clause? </p>
</blockquote>
</blockquote>
<p>An exception will propagate upwards until it is caught by a catch block further up the cal... | <p>This is the best resource I've found for implementing a coherent exception handling strategy in .NET</p>
<p><a href="http://msdn.microsoft.com/en-us/library/cc511522.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc511522.aspx</a></p>
| 24,043 |
<p>What is the best way to dynamically create RDLC xml as input to VS2005 Report Viewer? </p>
<p>I would like to autosize columns based on the data sizes. I would also like to programmatically control what columns are displayed.</p>
| <p><a href="http://spacefold.com/lisa/" rel="nofollow noreferrer">Lisa Nicholls</a> gives a complete answer <a href="http://social.msdn.microsoft.com/Forums/en-US/vsreportcontrols/thread/8cc4f0d5-52b8-482a-bb30-062f91d52626/" rel="nofollow noreferrer">in this thread</a> about dynamically defining a report. You'll want ... | <p>Dan Smith also has a good solution at: <a href="http://csharpshooter.blogspot.com/2007/08/revised-dynamic-rdlc-generation.html" rel="nofollow noreferrer">http://csharpshooter.blogspot.com/2007/08/revised-dynamic-rdlc-generation.html</a></p>
<p>Majid also has a refinement of Dan's solution in the comments to that bl... | 18,115 |
<p>I am working on an automated testing app, and am currently in the process of writing a function that compares values between two XML files that should be identical, but may not be. Here is a sample of the XML I'm trying to process:</p>
<pre><code><?xml version="1.0" encoding="utf-8"?>
<report xmlns="http:... | <p>I'm used to doing this with .NET's XmlDocument objects, but I think the effect is the same here:</p>
<p>If the XML document includes a namespace -- even an unnamed one -- then the Xpath query has to use one as well. So, you'll have to add the namespace to the XMLDoument which you might as well give a name in the c... | <p>I see no reference to a namespace when you're selecting nodes. I'd expect this to be the fundamental problem.</p>
| 36,124 |
<p>I need to parse recipe ingredients into amount, measurement, item, and description as applicable to the line, such as 1 cup flour, the peel of 2 lemons and 1 cup packed brown sugar etc. What would be the best way of doing this? I am interested in using python for the project so I am assuming using the nltk is the be... | <p>I actually do this for my website, which is now part of an <a href="https://github.com/KitchenPC/core">open source project</a> for others to use.</p>
<p>I wrote a blog post on my techniques, enjoy!</p>
<p><a href="http://blog.kitchenpc.com/2011/07/06/chef-watson/">http://blog.kitchenpc.com/2011/07/06/chef-watson/<... | <p>Can you be more specific what your input is? If you just have input like this:</p>
<pre><code>1 cup flour
2 lemon peels
1 cup packed brown sugar
</code></pre>
<p>It won't be too hard to parse it without using any NLP at all. </p>
| 24,918 |
<p>I need a simple window with three input boxes and three labels (login name, password, and server node) and a button to execute the script. I do not want any third party programs that need to be installed on Windows. If it can be installed on Cygwin that would be great.</p>
| <p>You might want to look at Tcl/Tk and the notion of starkits and starpacks. With the latter you can create a single-file windows executable so your end users wouldn't have to install anything other than this program.</p>
<p>By using tk 8.5 you'll also get the benefit of native windows widgets so the GUI can look ver... | <p>A lot of people used to use TCL/TK for this kind of thing (in cygwin). </p>
<p>If it's just for Windows, then any .NET language using Winforms would be simple to use (won't need to distribute .NET unless you have older boxes).</p>
| 40,174 |
<p>I was reviewing some code that a consultant checked in and notice they were using SQLCLR. I don't have any experience with it so thought I would research what it was about. I noticed that they used</p>
<pre><code>Dim cn As New SqlConnection("server=LOCALHOST;integrated security=yes;database=" & sDb)
</code></... | <p>The context connection uses the user's already established connection to the server. So you inherit things like their database context, connection options, etc.</p>
<p>Using localhost will connect to the server using a normal shared memory connection. This can be useful if you don't want to use the user's connect... | <p>Consider a big office phone systems:</p>
<p>My office has an internal phone system. But every phone also has an external phone number (virtual numbers that utilize one of a group of real TELCO lines). I can call another office by dialing their phone extension directly and the call will route through our internal ... | 8,090 |
<p>I'm currently working on an application which requires transmission of speech encoded to a specific audio format.</p>
<pre><code>System.Speech.AudioFormat.SpeechAudioFormatInfo synthFormat =
new System.Speech.AudioFormat.SpeechAudioFormatInfo(System.Speech.AudioFormat.EncodingFormat.Pcm,
... | <p>It's entirely possible that the LH Michael and LH Michelle voices simply don't support 8000 Hz sample rates (because they inherently generate samples > 8000 Hz). SAPI allows engines to reject unsupported rates.</p>
| <p>I have created some classes in my <a href="http://www.codeplex.com/naudio" rel="nofollow noreferrer">NAudio</a> library to allow you to convert your audio data to a different sample rate, if you are stuck with 11025 from the synthesizer. Have a look at <code>WaveFormatConversionStream</code> (which uses ACM) or <cod... | 31,804 |
<p>We need to make our enterprise ASP.NET/NHibernate browser-based application able to function when connected to or disconnected from the customer's server. Has anyone done this? If so, how did you do it? (Technology, architecture, etc.)</p>
<p>Background:</p>
<p>We develop and sell an enterprise browser-based appli... | <p>Maybe you could operate some kind of offline version using a small version database (I hear good things about vistadb - <a href="http://www.vistadb.net/" rel="nofollow noreferrer">http://www.vistadb.net/</a> which I believe does play well with NHibernate). With a syncing tool to copy data in when they are back on li... | <p>Why not couple it with Google Gears? People put their data in while offline, and then they can sync it when they reconnect to the server. </p>
<p>In a modern world, using the HTML5 data store:
<a href="http://www.webreference.com/authoring/languages/html/HTML5-Client-Side/" rel="nofollow noreferrer">http://www.we... | 16,251 |
<p>One of our programs is sometimes getting an <code>OutOfMemory</code> error on one user's machine, but of course not when I'm testing it. I just ran it with JProfiler (on a 10 day evaluation license because I've never used it before), and filtering on our code prefix, the biggest chunk both in total size and number ... | <p>Dump the heap and inspect it.</p>
<p>I'm sure there's more than one way to do this, but here is a simple one. This description is for MS Windows, but similar steps can be taken on other operating systems.</p>
<ol>
<li>Install the JDK if you don't already have it. <a href="http://java.sun.com/javase/6/docs/technote... | <p>If you're getting OOM errors in a garbage collected language, it usually means that there's some memory not being accounted by the collector. Maybe your objects hold non-java resources? if so, then they should have some kind of 'close' method to make sure that resource is released even if the Java object isn't col... | 18,649 |
<p>What is the most efficient way of turning the list of values of a dictionary into an array?</p>
<p>For example, if I have a <code>Dictionary</code> where <code>Key</code> is <code>String</code> and <code>Value</code> is <code>Foo</code>, I want to get <code>Foo[]</code></p>
<p>I am using VS 2005, C# 2.0</p>
| <pre><code>// dict is Dictionary<string, Foo>
Foo[] foos = new Foo[dict.Count];
dict.Values.CopyTo(foos, 0);
// or in C# 3.0:
var foos = dict.Values.ToArray();
</code></pre>
| <p>These days, once you have LINQ available, you can convert the dictionary keys and their values to a single string. </p>
<p>You can use the following code:</p>
<pre><code>// convert the dictionary to an array of strings
string[] strArray = dict.Select(x => ("Key: " + x.Key + ", Value: " + x.Value)).ToArray();
/... | 23,956 |
<p>I need to be able to find the last occurrence of a character within an element.</p>
<p>For example:</p>
<pre><code><mediaurl>http://www.blah.com/path/to/file/media.jpg</mediaurl>
</code></pre>
<p>If I try to locate it through using <code>substring-before(mediaurl, '.')</code> and <code>substring-after... | <p>The following is an example of a template that would produce the required output in XSLT 1.0:</p>
<pre><code><xsl:template name="getExtension">
<xsl:param name="filename"/>
<xsl:choose>
<xsl:when test="contains($filename, '.')">
<xsl:call-template name="getExtension">
... | <p>How about tokenize with "/" and take the last element from the array ?</p>
<pre><code>Example: tokenize("XPath is fun", "\s+")
Result: ("XPath", "is", "fun")
</code></pre>
<p>Was an XSLT fiddler sometime back... lost touch now. But HTH</p>
| 3,534 |
<p>This is related to a <a href="https://stackoverflow.com/questions/343517/how-do-i-work-with-multiple-git-branches-of-a-python-module">previous question</a> of mine.</p>
<p>I understand how to store and read configuration files. There are choices such as <a href="http://www.python.org/doc/2.5.2/lib/module-ConfigParse... | <p>"imports ... require your module to be on your PYTHONPATH"</p>
<p>Right. </p>
<p>So, what's wrong with setting <code>PYTHONPATH</code>?</p>
| <p>require statement from <a href="http://peak.telecommunity.com/DevCenter/PkgResources#basic-workingset-methods" rel="nofollow noreferrer">pkg_resources</a> maybe what you need. </p>
| 44,983 |
<p>How do I call shell commands from inside of a Ruby program? How do I then get output from these commands back into Ruby?</p>
| <p>This explanation is based on a commented <a href="http://gist.github.com/4069" rel="noreferrer">Ruby script</a> from a friend of mine. If you want to improve the script, feel free to update it at the link.</p>
<p>First, note that when Ruby calls out to a shell, it typically calls <code>/bin/sh</code>, <em>not</em> ... | <p>Here's a cool one that I use in a ruby script on OS X (so that I can start a script and get an update even after toggling away from the window):</p>
<pre><code>cmd = %Q|osascript -e 'display notification "Server was reset" with title "Posted Update"'|
system ( cmd )
</code></pre>
| 2,441 |
<p>Suppose we have two stacks and no other temporary variable.</p>
<p>Is to possible to "construct" a queue data structure using only the two stacks?</p>
| <p>Keep 2 stacks, let's call them <code>inbox</code> and <code>outbox</code>.</p>
<p><strong>Enqueue</strong>:</p>
<ul>
<li>Push the new element onto <code>inbox</code></li>
</ul>
<p><strong>Dequeue</strong>:</p>
<ul>
<li><p>If <code>outbox</code> is empty, refill it by popping each element from <code>inbox</code> ... | <pre class="lang-java prettyprint-override"><code>public class QueueUsingStacks<T>
{
private LinkedListStack<T> stack1;
private LinkedListStack<T> stack2;
public QueueUsingStacks()
{
stack1=new LinkedListStack<T>();
stack2 = new LinkedListStack<T>();
}... | 9,463 |
<p>We are currently reviewing how we store our database scripts (tables, procs, functions, views, data fixes) in subversion and I was wondering if there is any consensus as to what is the best approach?</p>
<p>Some of the factors we'd need to consider include:</p>
<ul>
<li>Should we checkin 'Create' scripts or checki... | <p>After a few iterations, the approach we took was roughly like this:</p>
<p>One file per table and per stored procedure. Also separate files for other things like setting up database users, populating look-up tables with their data.</p>
<p>The file for a table starts with the CREATE command and a succession of ALTE... | <p>There is an interesting article with new URL at: <a href="https://blog.codinghorror.com/get-your-database-under-version-control/" rel="nofollow noreferrer">https://blog.codinghorror.com/get-your-database-under-version-control/</a> </p>
<p>It a bit old but the concepts are still there. Good Read!</p>
| 44,259 |
<p>I want to be able to create a file, distribute it to an end-user, but prevent them from making modifications to the file.</p>
<p>Now, obviously, I can't actually stop anybody from modifying the file - so my approach is to detect and reject the file if it's modified.</p>
<p>My intention is to generate a salted hash... | <p>You want append a <a href="http://en.wikipedia.org/wiki/Digital_signature" rel="noreferrer">digital signature</a> to your document. This is an area which has been extensively studied. In short, you can with a fair amount of certainty make sure that the file has not been tampered with, but you can't <strong>prevent</... | <p>Depending on what kind of file you want to protect, you can use some document management tool. Adobe PDF has tools for that.
Furthermore, if you host your application on a application server or webserver, users can't access and modify the code. This way, you could have a database of hashes at the server-side, of fil... | 38,699 |
<p>I have noticed that setting row height in DataGridView control is slow. Is there a way to make it faster?</p>
| <p>What's caused similar layout delays for myself was related to
the <strong>AutoSizeRowsMode</strong> and <strong>AutoSizeColumnsMode</strong></p>
<pre><code>DataGridView1.AutoSizeRowsMode = None
</code></pre>
<p>will likely fix it.</p>
<p>Also try <strong><a href="http://msdn.microsoft.com/en-us/library/system.win... | <p>This works in most cases but I'm not sure if this is what you are looking for...</p>
<p>Try setting up the RowTemplate and use that to set the rows height. </p>
<pre><code> // my test to specify a size for a datagridview row
dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { Name = "ColumnNam... | 12,068 |
<p>Under normal circumstances, a VB.NET application of mine can check the ClientName environmental variable to get the name of the workstation the user is connecting from.</p>
<p>So when WorkstationX RDPs into ServerA:</p>
<ul>
<li>ComputerName=ServerA</li>
<li>ClientName=WorkstationX</li>
</ul>
<p>That works fine.<... | <p>The <a href="http://msdn.microsoft.com/en-us/library/aa383468(VS.85).aspx" rel="nofollow noreferrer">terminal services API</a> might be your answer. I use it in a VB.NET app to log off user sessions on a given server, and to retrieve the names of the workstations connected to those sessions. The code I have has a lo... | <p>If you don't want to deal with the P/Invoke business yourself, you can use <a href="http://cassia.googlecode.com/" rel="nofollow noreferrer">Cassia</a>, which wraps it for you:</p>
<pre><code>New Cassia.TerminalServicesManager().CurrentSession.ClientName
</code></pre>
| 36,232 |
<p>This has been an adventure. I started with the looping duplicate query located in <a href="https://stackoverflow.com/questions/161960">my previous question</a>, but each loop would go over all <strong>17 million records</strong>, <strong>meaning it would take weeks</strong> (just running <code>*select count * from M... | <p>Seeing the QueryPlan would help.</p>
<p>Is this feasible?</p>
<pre><code>SELECT m.*
into #temp
FROM tl_acxiomimport.dbo.tblacxiomlistings m
inner join (SELECT RecordID,
Rank() over (Partition BY BusinessName,
latitude,
... | <p>Other than using truncate as suggested, I've had the best luck using this template for deleting lots of rows from a table. I don't remember off hand, but I think using the transaction helped to keep the log file from growing -- may have been another reason though -- not sure. And I usually switch the transaction l... | 19,634 |
<p>I have a project that is based on the Navigation Based Application template.
In the AppDelegate are the methods <code>-applicationDidFinishLoading:</code> and <code>-applicationWillTerminate:</code>. In those methods, I am loading and saving the application data, and storing it in an instance variable (it is actual... | <p>For variables (usually the model data structure) which I need to access it anywhere in the app, declare them in your AppDelegate class. When you need to reference it:</p>
<pre><code>YourAppDelegate *appDelegate = (YourAppDelegate *)[[UIApplication sharedApplication] delegate];
//and then access the variable by appD... | <h2>Define a macro and use it anywhere!</h2>
<pre><code>#define appDelegateShared ((AppDelegate *)[UIApplication sharedApplication].delegate)
</code></pre>
<p>In My Code:-</p>
<pre><code>UIViewController *rootViewController = appDelegateShared.window.rootViewController;
</code></pre>
| 28,714 |
<p>The Interwebs are no help on this one. We're encoding data in ColdFusion using <code>serializeJSON</code> and trying to decode it in PHP using <code>json_decode</code>. Most of the time, this is working fine, but in some cases, <code>json_decode</code> returns <code>NULL</code>. We've looked for the obvious culprits... | <p>You could try operating in UTF-8 and also letting PHP know that fact.</p>
<p>I had an issue with PHP's <code>json_decode</code> not being able to decode a UTF-8 JSON string (with some "weird" characters other than the curly quotes that you have). My solution was to hint PHP that I was working in UTF-8 mode by inser... | <p>You could try parsing it with another parser, and looking for an error -- I know Python's JSON parsers are very high quality. If you have Python installed it's easy enough to run the text through <a href="http://pypi.python.org/pypi/demjson" rel="nofollow noreferrer">demjson</a>'s syntax checker. If it's a very larg... | 18,853 |
<p>Session variables are normally keept in the web server RAM memory.</p>
<p>In a cluster, each request made by a client can be handled by a different cluster node. right?!</p>
<p>So, in this case... </p>
<ul>
<li>What happens with session variables? Aren't they stored in the nodes RAM memory? </li>
<li>How the oth... | <p>There are 3 ways to store session state in ASP.NET. The first is in process, where the variables are stored in memory. The second is to use a session state service by putting the following in your web.config file:</p>
<pre><code><sessionState
mode="StateServer"
stateConnectionString="tcpip=127.0.0.1:4242... | <p>In ASP.NET you can persist session data to an SQL Server database which is common to all web servers in the cluster.</p>
<p>Once configured (in the web.config for your site), the framework handles all of the persistance for you and you can access the session data as normal.</p>
| 27,670 |
<p>We have one large xslt that renders a whole shop area including products, manifacturers and does filtering based on price and cateogry on top of that.
I'm using sitecore as a CMS and I'm having problems with caching. I have about 9000 items and some pages take as much as 20s to render.
Will it be better to split the... | <p>you probably get a better performance by applying other changes than splitting the XSLT file. Without seeing the XSLT it is hard to spot bottlenecks but you will find some best practices for XSLT performance here:</p>
<p><a href="http://www.dpawson.co.uk/xsl/sect4/N9883.html#d15756e150" rel="nofollow noreferrer">ht... | <p>There are two different issues here:</p>
<ul>
<li>Separating XSLT files for better readability, maintainability and code reuse</li>
<li>Making performance improvements on your XSLT translations</li>
</ul>
<p>The first should be done as a best practice, the latter should take care of the extended rendering times yo... | 46,375 |
<p>Is there a way to programmatically, through a batch file (or powershell script), put all folders in <code>c:\Program Files</code> into the system variable <code>PATH</code>? I'm dependent on the command line and really want to just start a program from the command line.</p>
<p>Yes, I'm jealous of Linux shells.</p>
| <p>Passing in "C:\Program Files" as a parameter into this batch file:</p>
<pre><code>@echo off
FOR /D %%G IN (%1\*) DO PATH "%%G";%path%
</code></pre>
| <p>Passing in "C:\Program Files" as a parameter into this batch file:</p>
<pre><code>@echo off
FOR /D %%G IN (%1\*) DO PATH "%%G";%path%
</code></pre>
| 45,562 |
<p>After discovering <a href="http://clojure.org" rel="noreferrer">Clojure</a> I have spent the last few days immersed in it.</p>
<p>What project types lend themselves to Java over Clojure, vice versa, and in combination?</p>
<p>What are examples of programs which you would have never attempted before Clojure?</p>
| <p>Clojure lends itself well to <a href="http://clojure.org/concurrent_programming" rel="nofollow noreferrer">concurrent programming</a>. It provides such wonderful tools for dealing with threading as Software Transactional Memory and mutable references. </p>
<p>As a demo for the Western Mass Developer's Group, Rich... | <blockquote>
<p><strong>What project types lend themselves to using Java over Clojure, vice
versa, or in combination?</strong></p>
<p>A project where a GUI-building tool
(such as Matisse in Netbeans) is
needed would be a case where Java may
still be required. Anything done in
Java can be done in Cloj... | 21,959 |
<p>If you are creating a 1d array, you can implement it as a list, or else use the 'array' module in the standard library. I have always used lists for 1d arrays.</p>
<p>What is the reason or circumstance where I would want to use the array module instead?</p>
<p>Is it for performance and memory optimization, or am I ... | <p>Basically, Python lists are very flexible and can hold completely heterogeneous, arbitrary data, and they can be appended to very efficiently, in <a href="http://en.wikipedia.org/wiki/Dynamic_array#Geometric_expansion_and_amortized_cost" rel="noreferrer">amortized constant time</a>. If you need to shrink and grow y... | <p>An important difference between numpy array and list is that array slices are views on the original array. This means that the data is not copied, and any modifications to the view will be reflected in the source array.</p>
| 21,203 |
<p>I have a list of changes to a list - Adds and Deletes. The list could be huge - say 10'000 items.</p>
<p><strong>I want to know the state of the list after change 9'000.</strong></p>
<p>I could walk the list from the start all the way to change 9'000. That seems a bit long-winded to me.</p>
<p>I could keep a lis... | <p>If you cache the state of the list every Xth change, then you can do a binary chop to get down to two cached states bounding the change you're looking for, then you walk at most X items to get to the item itself. That's O(log N), more-or-less.</p>
<p>But more generally, reducing big O complexity is the means, not t... | <p>What sort of structure are you working with? There isn't an efficient way to walk a generic data structure, but there are thousands of optimisation methods and efficient methods for specific structures.</p>
<p>And yes, if you have an algorithm that is O(n) time complexity, halving the number of items won't change i... | 24,555 |
<p>What are the <strong>differences</strong> in considerations in respect to designing or developing an <strong>Intranet and an Internet application</strong> ?</p>
| <p>One other thing, in an intranet environment you will generally have a standard client build meaning that you can code to a specific browser & version (ha, IE6 normally). </p>
<p>Out in the wilds of the internet, you have to deal with all sorts of browsers & versions, so your html/css/js needs to handle all ... | <p>Intranet Application are more for internal staffig and knowledge managemnet purposes..</p>
<p>its more moe sensative data to be shared within a network</p>
<p><a href="http://www.dreamznetsolutions.com/intranet_application_development_mumbai.html" rel="nofollow noreferrer">http://www.dreamznetsolutions.com/intrane... | 27,311 |
<p>We are creating a Windows Form application (C# or VB.NET) that needs to reference an Office 2003 or Office 2007 COM object, depending on the version of office installed. What is the best way to handle this scenario and reference the correct COM object at runtime?</p>
| <p>Unless you want to use any of the newly added objects and methods of the Office 2007 object model, it is fine to build referencing the Office 2003 PIAs, just make sure the correct version of the PIAs is deployed on the target system:</p>
<blockquote>
<p>Another way around this problem is to remove the dependency on ... | <p>Would the Primary Interop assemblies for Office not help with this? I don't know for sure as I haven't had to use them in earnest, but I think they would.</p>
| 19,158 |
<p>I would like to know how I can refer to a list item object if I had for example the following html list </p>
<pre><code><div id="subdiv_2">
<div id="subdiv_3">
<ul>
<li><a href="">Item1</a></li>
<li><a href="">Item2</a></li>
&l... | <p>You could get all the children elements of <code>subdiv_3</code> that are <code><li></code>. Then iterate through that loop adding the functions as you go.</p>
<pre><code>div = document.getElementById('subdiv_3');
els = div.getElementsByTagName('li');
for (var i=0, len=els.length; i<len; i++) {
alert... | <p>In reponse to the comment on Benry's Answer By Benry, After using his code, the following proves that each elementLi can be referred to with els[i]</p>
<pre><code>function attachToList(){
div = document.getElementById('menu2');
els = div.getElementsByTagName('li');
for (var i=0, len=els.length; i<len; i++) {
set... | 46,290 |
<p>I'm trying to wrap my head around SharePoint. Why is it good? Why is it bad?</p>
<p>At a glance it appears to offer some incredible collaboration tools. However, the cost looks astronomical and it seems to be rigid & difficult to customize.</p>
<p>To those who've worked with SharePoint; please describe some... | <p>Pros:</p>
<ul>
<li>Document management is its most well-known
function and integrates extremely
well with Office 2007.</li>
<li>Create group calendars that can be
overlayed onto your personal Outlook
and managed on the web.</li>
<li>Notifications in response to certain
actions on the group website</li>
<li>Wiki-typ... | <p>A lot of the cool things in Sharepoint are avaialable in Windows Sharepoint Services 3.0, which is free with windows server 2003/2008. All you need extra is a license for SQL Server 2000 and later, which most mirosoft shops have. In WSS you can do document management, workflows, custom sites, blogs, wiki's, etc. ... | 16,517 |
<pre><code>public void Getrecords(ref IList iList,T dataItem)
{
iList = Populate.GetList<dataItem>() // GetListis defined as GetList<T>
}
</code></pre>
<p>dataItem can be my order object or user object which will be decided at run time.The above does not work as it gives me this error
The type 'T' must... | <pre><code>public void GetRecords<T>(ref IList<T> iList, T dataitem)
{
}
</code></pre>
<p>What more are you looking for?</p>
<p><strong>To Revised question:</strong></p>
<pre><code> iList = Populate.GetList<dataItem>()
</code></pre>
<p>"dataitem" is a variable. You want to specify a type there:<... | <p>You can use Generic with < T > that will accept the type in runtime like you want.</p>
| 31,332 |
<p>In deploying to a new (Solaris 9) environment recently, one of the steps was to copy a set of files and directories to their new location and then to apply the group UID bit (using "chmod -R g+s") to all files in the directory tree giving a mode of -rwxr-s--- to everything. The result was that none of our shell scri... | <p>Setting directories g+s makes all new files created in said directory have their group set to the directory's group.</p>
<p>This can actually be really handy for collaborative purposes if you have the umask set so that files have group write by default.</p>
<p>Note: This is the way it works in Linux, it could wor... | <p>More information about setuid and setgid <a href="http://en.wikipedia.org/wiki/File_system_permissions#Additional_Permissions" rel="nofollow noreferrer">here</a></p>
| 23,195 |
<p>I recently ran into a issue where intermediate link betweeen a TCP server and client was down. The client has the requirement of connecting to a secondary server if the primary server is down. When the primary server is bought down (Ex ..by doing ^C on the terminal), there is TCP shutdown sequence that gets through ... | <p>Keepalive was designed to deal with so-called half-opened connections, when one of the sides (typically the server that receives the requests) is unaware that connection was broken. Client usually knows about it because the attempt to send request to the server will return you error.</p>
<p>Another option is to kee... | <p>You could invent and implement your own keep-alive using TCP's Out-Of-Band feature, but I wouldn't even consider that unless you have some significant issue with the one that's already built for you.</p>
| 45,362 |
<p>I'm working with a combobox in a Swing-based application, and I'm having a hard time figuring out what to do to differentiate between an ItemEvent that is generated from a user event vs one caused by the application. </p>
<p>For instance, Lets say I have a combobox, '<code>combo</code>' and I'm listening for itemSt... | <p>The Action and Reaction law is quite clear :). If you try to react on change there is no need to distinguish between user and application. I can imagine only one use case where you need to "distinguish". The case where application is displaying some data. In this case you have, probably, data model for your applicat... | <p>If you need to tell the events apart, then there is probably something about your design that needs a rethink. The whole point of MVC is to decouple changes to the model from the actual mouse clicks of the user.</p>
<p>Perhaps you should restate the question in terms of <em>why</em> you would ever want to differen... | 21,221 |
<p>I'm wondering, how expensive it is to have many threads in waiting state in java 1.6 x64.</p>
<p>To be more specific, I'm writing application which runs across many computers and sends/receives data from one to another. I feel more comfortable to have separate thread for each connected machine and task, like 1) sen... | <p>For most cases, the resources consumed by a sleeping thread will be its stack space. Using a 2-threads-per-connection-model, which I think is similar to what you're describing, is known to cause great scalability issues for this very reason when the number of connections grow large.</p>
<p>I've been in this situati... | <p>From the tests I've done in C, Lua and Python, you can make your own sleep or wait function with very little lines of codes to make a simple lightweight loop.
Use a local variable with the time in the future you want to reach and then test for the current timestamp in a while loop. If you are in a scope where you wo... | 12,599 |
<p>My Anet A8 frame are broken. I find frame project <a href="https://www.thingiverse.com/thing:2263216" rel="nofollow noreferrer">AM8 - Metal Frame for Anet A8</a>. I like it but I can't find aluminum extrusion needed, like this: <a href="https://us.misumi-ec.com/vona2/detail/110302684350/?Inch=0&CategorySpec=0000... | <p>There are lots of online sources for T-slot aluminum extrusions from <a href="https://www.ebay.com/" rel="nofollow noreferrer">ebay</a> to <a href="https://www.mcmaster.com/#t-slotted-framing/=18c9twv" rel="nofollow noreferrer">McMaster</a>. If you want more options do a <a href="https://www.google.com/search?q=t-s... | <p>Not precisely cheap, but if you look on aliExpress for <em>AM8 3D Printer Extrusion Metal Frame</em> you will find kits build precisely for moving Anet A8 to aluminium frame</p>
| 643 |
<p>The default chart object in the SQL Server (2005) Business Intelligence Development Studio doesn't seem to some have formatting options like :</p>
<ol>
<li>specifying the text direction of labels in the x and y axis</li>
<li>adding a trendline to a bar chart</li>
<li>arbitrarily resizing items in a chart - for exam... | <p>Some colleagues of mine gave up on the stock control and bought <a href="http://www.dundas.com/Products/Chart/RS/index.aspx" rel="nofollow noreferrer">Dundas charts</a></p>
<p>The stock charts are cut down versions of Dundas.</p>
| <p>I'd recommend go with the dundas chart components gbn suggested.
If that's not possible at least this <a href="http://social.msdn.microsoft.com/forums/en-US/sqlreportingservices/thread/97452004-db3a-4c56-9201-1998d984d15a/" rel="nofollow noreferrer">article</a> should solve issue 1. </p>
| 18,806 |
<p>I'd like to install some presentation templates, but don't know where to put them...</p>
<p>Thanks a lot</p>
| <p>Choose Tools > Options > OpenOffice.org > Paths and select the Templates line. There you can click "edit" and see the paths that it uses to search for templates.</p>
| <p>It is not recommended to place templates in /usr/lib/openoffice/... because the contents of that folder can be altered automatically through the process of Debian package management. For site-wide installation I created the folder "/usr/local/share/templates/ooo2/common", placed templates in there, then added the p... | 10,597 |
<p>I'm passing a reference of a form to a class. Within this class I believed I could use <code>formRef->Controls["controlName"]</code> to access properties on the control.</p>
<p>This works for a few labels, but on a button I receive a "Object reference not set to an instance of an object." when I try to change th... | <p>That suggests that the control with the given name wasn't found.</p>
<p>Don't forget that the name of the control isn't necessarily the same as its ID in the designer. Check the actual name against the one you're using to look it up with.</p>
| <p>You could always try static forms ;D</p>
| 38,154 |
<p>I have one question maybe someone here can help me. If i do "ps aux --sort user" on linux console I have one list of users and their processes runing on the machine. My question is how do I remove the users name and print that list like this <strong>in a C program</strong>:</p>
<p>for example:</p>
<pre><code>(…)
-... | <pre><code>ps aux --sort user | perl -npe 's/^(\w+)//g; if ($user ne $1) {$user=$1; print "user: " . uc($user) . "\n";}'
</code></pre>
| <p>Not really an answer to your question, but user names are case-sensitive in unix, so capitalising them all probably isn't a good idea. If you want to make them stand out visually then "USER: apache" would be better.</p>
<p>Apart from that bmdhacks' answer is good (but not quite right). You could do something simila... | 22,147 |
<p>I'm building a GUI class for C++ and dealing a lot with pointers. An example call:</p>
<pre><code>mainGui.activeWindow->activeWidget->init();
</code></pre>
<p>My problem here is that I want to cast the <strong>activeWidget</strong> pointer to another type. <strong>activeWidget</strong> is of type GUI_BASE.... | <p>The problem is that casts have lower precedence than the . -> () [] operators. You'll have to use a C++ style cast or add extra parentheses:</p>
<pre><code>((GUI_TEXTBOX*)mainGui.activeWindow->activeWidget)->function(); // Extra parentheses
dynamic_cast<GUI_TEXTBOX*>(mainGui.activeWindow->activeWid... | <pre><code>((GUI_TEXTBOX*)(mainGui.activeWindow->activeWidget))->function();
</code></pre>
| 43,001 |
<p>What is the best way of working with calculated fields of Propel objects?</p>
<p>Say I have an object "Customer" that has a corresponding table "customers" and each column corresponds to an attribute of my object. What I would like to do is: add a calculated attribute "Number of completed orders" to my object when ... | <p>There are several choices. First, is to create a view in your DB that will do the counts for you, similar to my answer <a href="https://stackoverflow.com/questions/234785/#235267">here</a>. I do this for a current Symfony project I work on where the read-only attributes for a given table are actually much, much wi... | <p>Add an attribute "orders_count" to a Customer, and then write something like this:</p>
<pre><code>class Order {
...
public function save($conn = null) {
$customer = $this->getCustomer();
$customer->setOrdersCount($customer->getOrdersCount() + 1);
$custoner->save();
parent::save();
}
...
}</code>... | 30,579 |
<p>I am developing a specialty application where the end-user needs to operate multiple controls simultaneously. The application is used to "tune" the control parameters of an electronic device to calibrate the unit to its best performance.</p>
<p>Currently, there is a UI with multiple graphical sliders which the ope... | <p>Maybe capture key presses and define a row of pairs as your up/down controllers.</p>
<p>Something like...</p>
<pre><code>A/Z are the up/down keys for slider 1
S/X are the up/down keys for slider 2
D/C are the up/down keys for slider 3
F/V are the up/down keys for slider 4
G/B are the up/down keys for slider 5
</co... | <p>How about a checkbox for each control to bind a group of them together? Then when they adjust one, all the others that are bound together move the same amount. Provide a button to uncheck them all too.</p>
| 25,698 |
<p>Where I work, we maintain an FTP site that needs occasional cleanup.</p>
<p>Are there any tools out there to create a site map of an FTP site? It would greatly simplify clean up tasks.</p>
<p>Thanks!</p>
| <p>I always the the <a href="http://msdn.microsoft.com/en-us/library/system.convert.frombase64string.aspx" rel="nofollow noreferrer">Convert</a> class to convert the string into an array of Byte.</p>
<p>An example:</p>
<pre><code> public static string DeCryptString(string s) {
byte[] b = System.Convert.Fro... | <p>There is no public built-in way to stream from a string, as of .NET 3.5.</p>
<p>You can implement a simple StringStream class that inherits from Stream, which will free you from having to convert the string to an array of bytes.</p>
| 22,676 |
<p>Is there a way to perform an HTTP GET request within a Visual Basic script? I need to get the contents of the response from a particular URL for processing.</p>
| <pre><code>Dim o
Set o = CreateObject("MSXML2.XMLHTTP")
o.open "GET", "http://www.example.com", False
o.send
' o.responseText now holds the response as a string.
</code></pre>
| <pre><code> strRequest = "<soap:Envelope xmlns:soap=""http://www.w3.org/2003/05/soap-envelope"" " &_
"xmlns:tem=""http://tempuri.org/"">" &_
"<soap:Header/>" &_
"<soap:Body>" &_
"<tem:Authorization>" &_
"<tem:st... | 25,072 |
<p>I am designing a crawler which will get certain content from a webpage (using either string manipulation or regex).</p>
<p>I'm able to get the contents of the webpage as a response stream (using the whole httpwebrequest thing), and then for testing/dev purposes, I write the stream content to a multi-line textbox in... | <p>In my opinion you can split the content of the text in words instead of lines:</p>
<pre><code>public int CountOccurences(string searchString)
{
int i;
var words = txtBox.Text.Split(" ");
foreach (var s in words)
if (s.Contains(searchString))
i++;
return i;
}
</code></pre>
<p>No... | <p>I do it this way in an project, there may be a better way to do it, but this works :)</p>
<pre><code>string template = txtTemplate.Text;
string[] lines = template.Split(Environment.NewLine.ToCharArray());
</code></pre>
| 26,796 |
<p><em>What options are there to detect web-crawlers that do not want to be detected?</em></p>
<p>(I know that listing detection techniques will allow the smart stealth-crawler programmer to make a better spider, but I do not think that we will ever be able to block smart stealth-crawlers anyway, only the ones that mak... | <p>See <a href="http://www.projecthoneypot.org/" rel="noreferrer">Project Honeypot</a> - they're setting up bot traps on large scale (and have DNSRBL with their IPs).</p>
<p>Use tricky URLs and HTML:</p>
<pre><code><a href="//example.com/"> = http://example.com/ on http pages.
<a href="page&amp;&#x23... | <p>short answer: if a mid level programmer knows what he's doing you won't be able to detect a crawler without affecting the real user. Having your information publicly you won't be able to defend it against a crawler... it's like the 1st amendment right :)</p>
| 28,863 |
<p>I am new to 3D printing and need to know if I use steel in printing, do I get the same strength (compression and shear) as steel profiles manufactured in a factory?</p>
| <p>A laser sintered part typically uses what could be described as surface bonding, as it does not melt particularly deeply into the powder. It would not have the same strength characteristics as machined steel or otherwise processed metal. A part constructed from 3d printing using feed metal/welding methods would have... | <p>In terms of FFD plastics:</p>
<p>Using metal infused filaments for FFD printing; definitely not. The properties mixed into the filament will have some affect on the final piece, stronger, heavier, etc for BronzeFill, but still the majority of the print material will be plastic.</p>
<p>However, you can use PLA pla... | 248 |
<p>I have a filter in a combobox with a number of entries. Instead of filtering the datagrid with an exact match, I would like to take the selected value and only display records where the selected value is contained in the datafield.
For example: the user selects a value of "New" and the datagrid displays records wher... | <p>Something like this should work:</p>
<pre><code> public function filter(item:Object):Boolean{
var result:Boolean=false;
if (item.name.toUpperCase().indexOf(cbo.selectedLabel.toUpperCase()) >= 0)
result=true;
return result;
}
</code></pre>
<p>This filter function will search... | <p>Something like this should work:</p>
<pre><code> public function filter(item:Object):Boolean{
var result:Boolean=false;
if (item.name.toUpperCase().indexOf(cbo.selectedLabel.toUpperCase()) >= 0)
result=true;
return result;
}
</code></pre>
<p>This filter function will search... | 21,253 |
<p>I've got a LOT of tests written for a piece of software (which is a GREAT thing) but it was built essentially as a standalone test in C#. While this works well enough, it suffers from a few shortcomings, not the least of which is that it isn't using a standard testing framework and ends up requiring the person runn... | <p>If you use NUnit (which you should), you'll need to create a new test method for each of your current test methods. NUnit uses reflection to query the test class for methods marked with the <code>[Test]</code> attribute, which is how it builds its list of the tests that show up in the UI, and the test classes use t... | <p>You're about to live through the idiom of "An Ounce of Prevention is worth a pound of cure". Its especially true in programming. </p>
<p>You make no mention of NUnit(which I think was bought by Microsoft for 2008, but don't hold me to that). Is there a paticular reason you didn't just use NUnit in the first place?<... | 21,829 |
<p>I'm the only developer supporting a website that's a mix of classic asp and .NET. I had to add some .net pages to a classic asp application. This application requires users to login. The login page, written in classic asp, creates a cookie that .net pages use to identify the logged in user and stores information in ... | <p>Using <a href="http://www.fiddlertool.com/fiddler/" rel="nofollow noreferrer">Fiddler</a> is a good way to try to figure out what's going on. You can see the exact Set-Cookie that the browser is getting.</p>
| <p>General rule of cross-platform cookie testing: dump all the cookies to screen so you can see your data. It might not explain exactly why it's happening, but it should tell you what is happening.</p>
| 14,862 |
<p>This seemed like an easy thing to do. I just wanted to pop up a text window and display two columns of data -- a description on the left side and a corresponding value displayed on the right side. I haven't worked with Forms much so I just grabbed the first control that seemed appropriate, a TextBox. I thought using... | <p>If you want, you can translate this VB.Net code to C#. The theory here is that you change the size of a tab in the control.</p>
<pre><code>Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal handle As IntPtr, ByVal wMsg As Integer, _
ByVal wParam As Integer, ByRef lParam As Inte... | <p>Don't the text boxes allow HTML usage? If that is the case, just use HTML to format the text into a table. Otherwise, try adding the text to a datagrid and then adding that to the form.</p>
| 9,781 |
<p>I would like to upload files from java application/applet using POST http event. I would like to avoid to use any library not included in SE, unless there is no other (feasible) option. <br>
So far I come up only with very simple solution. <br>
- Create String (Buffer) and fill it with compatible header (<a href="h... | <p>You need to use the <code>java.net.URL</code> and <code>java.net.URLConnection</code> classes.</p>
<p>There are some good examples at <a href="http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting.html" rel="nofollow noreferrer">http://java.sun.com/docs/books/tutorial/networking/urls/readingWriting... | <p>You need to learn about the chunked encoding used in newer versions of HTTP. The Apache HttpClient library is a good reference implementation to learn from.</p>
| 40,543 |
<p>Inspired by <a href="https://stackoverflow.com/questions/40845/how-do-f-units-of-measurement-work">Units of Measure in F#</a>, and despite asserting (<a href="https://stackoverflow.com/questions/39492/where-can-f-actually-save-time-and-money#71112">here</a>) that you couldn't do it in C#, I had an idea the other day... | <p>You are missing dimensional analysis. For example (from the answer you linked to), in F# you can do this:</p>
<pre><code>let g = 9.8<m/s^2>
</code></pre>
<p>and it will generate a new unit of acceleration, derived from meters and seconds (you can actually do the same thing in C++ using templates).</p>
<p>In... | <p>See Boo Ometa (which will be available for Boo 1.0):
<a href="http://bamboo.github.com/2008/08/05/boo-ometa-and-extensible-parsing-I.html" rel="nofollow noreferrer">Boo Ometa and Extensible Parsing</a></p>
| 45,390 |
<p>I am trying to create a route with a Username...</p>
<p>So the URL would be mydomain.com/abrudtkhul (abrudtkhul being the username)</p>
<p>My application will have public profiles based on usernames (Ex: <a href="http://delicious.com/abrudtkuhl" rel="noreferrer">http://delicious.com/abrudtkuhl</a>). I want to repl... | <p>Here's what you want to do, first define your route map:</p>
<pre><code>routes.MapRoute(
"Users",
"{username}",
new { controller = "User", action="index", username=""});
</code></pre>
<p>What this allows you to do is to setup the following convention:</p>
<ul>
<li>Control... | <p>You could have a route that looks like:</p>
<pre><code>{username}
</code></pre>
<p>with the defaults of</p>
<pre><code>Controller = "Users"
</code></pre>
<p>For the finished product of:</p>
<pre><code> routes.MapRoute(
"Users",
"{username}",
new { c... | 29,096 |
<p>Is there a way to find the application name of the current active window at a given time on Mac OS X using Python?</p>
| <p>This should work:</p>
<pre><code>#!/usr/bin/python
from AppKit import NSWorkspace
activeAppName = NSWorkspace.sharedWorkspace().activeApplication()['NSApplicationName']
print activeAppName
</code></pre>
<p>Only works on Leopard, or on Tiger if you have PyObjC installed and happen to point at the right python bina... | <p>I needed the current frontmost application in a Python script that arranges the windows nicely on my screen (see <a href="https://github.com/SirVer/move_window" rel="nofollow noreferrer"><code>move_window</code></a>).</p>
<p>Of course, the complete credit goes to Peter! But here is the complete program:</p>
<pre><... | 48,774 |
<p>I need a serviceable shell for MSYS. This is my current dilemma: </p>
<p>The default rxvt.exe has a scroll bar and copy and paste, but doesn't send control characters or arrow keys to a running program in the shell (like interpreters/debuggers). This is a real thorn when using the Haskell interpreter ghci.</p>
<... | <p>If you're after a better terminal emulator, I've had success with <a href="http://sourceforge.net/projects/console/" rel="noreferrer">http://sourceforge.net/projects/console/</a></p>
<p>It's a replacement for the standard windows command window. You can set MSYS or Cygwin, or whatever you want as the shell backing ... | <p>Do yourself a favour and use proper Cygwin instead of the unmaintained fork of an old Cygwin version that is msys.</p>
| 27,180 |
<p>I am trying to read a single file from a <code>java.util.zip.ZipInputStream</code>, and copy it into a <code>java.io.ByteArrayOutputStream</code> (so that I can then create a <code>java.io.ByteArrayInputStream</code> and hand that to a 3rd party library that will end up closing the stream, and I don't want my <code>... | <p>Your loop looks valid - what does the following code (just on it's own) return?</p>
<pre><code>zipStream.read(tempBuffer)
</code></pre>
<p>if it's returning -1, then the zipStream is closed before you get it, and all bets are off. It's time to use your debugger and make sure what's being passed to you is actually... | <p>Check if the input stream is positioned in the begging.</p>
<p>Otherwise, as implementation: I do not think that you need to write to the result stream while you are reading, unless you process this exact stream in another thread.</p>
<p>Just create a byte array, read the input stream, then create the output strea... | 9,285 |
<p>In PHP, I want to read a file into a variable and process the PHP in the file at the same time without using output buffering. Is this possible?</p>
<p>Essentially I want to be able to accomplish this without using <code>ob_start()</code>:</p>
<pre><code><?php
ob_start();
include 'myfile.php';
$xhtml = ob_get_c... | <p>A little known feature of PHP is being able to treat an included/required file like a function call, with a return value.</p>
<p>For example:</p>
<pre><code>// myinclude.php
$value = 'foo';
$otherValue = 'bar';
return $value . $otherValue;
// index.php
$output = include './myinclude.php';
echo $output;
// Will e... | <p>Hack Alert! You could do the evaluation of the PHP yourself with a bit of hackery using <code>preg_replace_callback</code> to search and replace the PHP blocks.</p>
<pre><code>function evalCallback($matches)
{
// [0] = <?php return returnOrEcho("hi1");?>
// [1] = <?php
// [2] = return returnOrE... | 27,512 |
<p>I have a function that expects real numbers (either integers or floats) as its input, and I'm trying to validate this input before doing mathematical operations on it.</p>
<p>My first instinct is to cast inputs as floats from within a try-except block.</p>
<pre><code>try:
myinput = float(input)
except:
raise... | <p>To quote myself from <a href="https://stackoverflow.com/questions/367560/how-much-input-validation-should-i-be-doing-on-my-python-functionsmethods#368072">How much input validation should I be doing on my python functions/methods?</a>:</p>
<blockquote>
<p>For calculations like sum, factorial etc, pythons built-in ty... | <p>I don't get the question.</p>
<p>There are two things with wildly different semantics tossed around as "alternatives".</p>
<p>A type conversion is one thing. It works with any object that supports <code>__float__</code>, which can be quite a variety of objects, few of which are actually numeric.</p>
<pre><code>t... | 48,538 |
<p>Is there a way in C# to:</p>
<ol>
<li><p>Get all the properties of a class that have attributes on them (versus having to loop through all properties and then check if attribute exists.</p></li>
<li><p>If i want all Public, Internal, and Protected properties but NOT private properties, i can't find a way of doing t... | <p>I don't believe there's a way to do either of these.</p>
<p>Just how many types do you have to reflect over, though? Is it really a bottleneck? Are you able to cache the results to avoid having to do it more than once per type?</p>
| <p>In response to (2): If you're outside of the class/assembly in question, <code>internal</code> and <code>protected</code> are the same as <code>private</code>.</p>
<p>If you want to access these, you'll need to ask for all properties, as you've already done, and filter the list yourself.</p>
| 31,668 |
<p>Is there a way of getting the process id of my C++ application? I am using the Carbon framework, but not Cocoa…</p>
| <p>can you use the getpid() function found in unistd.h ?</p>
<p><a href="https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/getpid.2.html" rel="nofollow noreferrer">osx reference</a></p>
| <p>GetProcessPID is what you need. This takes a ProcessSerialNumber, which you can obtain from GetCurrentProcess.</p>
| 6,305 |
<p>In my C++ application (developed with Visual Studio 2003) and <a href="http://en.wikipedia.org/wiki/Qt_(toolkit)#Current" rel="noreferrer">Qt4</a>, I'd like to print the stack trace from a specific line of code, either to the console output or into a file.</p>
<p>What would it take ?
Is Qt of any help to do this ?<... | <p><a href="http://www.codeproject.com/KB/threads/StackWalker.aspx" rel="noreferrer">StackWalker</a> by Jochen Kalmbach [MVP VC++] and available on codeproject is probably the easiest way to do this. It wraps up all of the details of dealing with the underlying StackWalk64 API.</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/ms680650(VS.85).aspx" rel="nofollow noreferrer">StackWalk64</a> in the dbghelp.dll library should do what you're looking for.</p>
| 38,748 |
<p>I'm looking for an online tool that will let me create a gif or png like this one:</p>
<p><img src="https://upload.wikimedia.org/math/b/4/7/b477e400396c711c60c4302bbbd888ae.png" alt="alt text"></p>
<p>Some kind of LaTex online service, with friendly examples?</p>
| <p>I use <a href="http://rogercortesi.com/eqn/index.php" rel="noreferrer">Roger's Online Equation Editor</a>.</p>
<p>PNG, colors, transparent background and anti-aliasing are all included.</p>
| <p><a href="http://www.mr.ethz.ch/~majer/formula/formula.php" rel="nofollow noreferrer">http://www.mr.ethz.ch/~majer/formula/formula.php</a></p>
| 14,076 |
<p>Does anyone know of an accurate source for an (E)BNF for the Java language? Preferably, it would be from an authorative source, e.g. Sun.</p>
<p>Thanks.</p>
| <p><a href="http://java.sun.com/docs/books/jls/second_edition/html/syntax.doc.html" rel="nofollow noreferrer">First google result :)</a><br>
Though I can't speak for how up-to-date it might be.</p>
| <p>I'm not sure what you want the spec for, but you may be interested to know that: </p>
<ul>
<li>the parser in Javac is hand written. No parser generated tools. </li>
<li>there exists a number of repositories for popular parser generators grammars. Here is <a href="https://javacc.dev.java.net/servlets/ProjectDocument... | 45,947 |
<p>I need to clip out all the occurances of the pattern '--' that are <em>inside</em> single quotes in long string (leaving intact the ones that are outside single quotes). </p>
<p>Is there a RegEx way of doing this?
(using it with an iterator from the language is OK).</p>
<p>For example, starting with</p>
<pre><cod... | <p>I found another way to do this from an answer by <b>Greg Hewgill</b> at <a href="https://stackoverflow.com/questions/138552">Qn138522</a><br>
It is based on using this regex (adapted to contain the pattern I was looking for):</p>
<pre><code>--(?=[^\']*'([^']|'[^']*')*$)
</code></pre>
<p>Greg explains:</p>
<blockq... | <p>Hm. There <em>might</em> be a way in Python if there are no quoted apostrophes, given that there is the <code>(?(</code><em>id/name</em><code>)</code><em>yes-pattern</em><code>|</code><em>no-pattern</em><code>)</code> construct in regular expressions, but it goes way over my head currently.</p>
<p>Does this help?</... | 21,810 |
<p>Something like</p>
<pre><code>var life= {
users : {
guys : function(){ this.SOMETHING.mameAndDestroy(this.girls); },
girls : function(){ this.SOMETHING.kiss(this.boys); },
},
mameAndDestroy : function(group){ },
kiss : function(group){ }
};
</code></pre>
<p... | <p>JavaScript does not offer this functionality natively. And I doubt you could even create this type of functionality. For example:</p>
<pre><code>var Bobby = {name: "Bobby"};
var Dad = {name: "Dad", children: [ Bobby ]};
var Mom = {name: "Mom", children: [ Bobby ]};
</code></pre>
<p>Who does Bobby belong to?</p>
| <p>I have done something like this and it works like a charm.</p>
<p>Simple.</p>
<p>P.S. There is more the the object but I just posted the relevant part.</p>
<pre><code>var exScript = (function (undefined) {
function exScript() {
this.logInfo = [];
var that = this;
this.logInfo.push = fu... | 22,215 |
<p>I've got an Active Directory synchronization tool (.NET 2.0 / C#) written as a Windows Service that I've been working on for a while and have recently been tasked with adding the ability to drive events based on changes in group membership. The basic scenario is that users are synchronized with a security database a... | <p>I'd say it depends on how many active directory objects you need to keep track of. If it's a small number (less than 1000 users) you can probably serialize your state data to disk with little noticable performance hit. If you're dealing with a very large number of objects it might be more efficient to create a simpl... | <p>You know there are products which help you with directory synchronization and user provisioning (google those terms)? Not invented here and all that, and you may have to justify the investment in the current climate, but developing and maintaining code for which there already is a commercial solution is not, let us ... | 11,125 |
<p>What is the correct syntax to create objects in javascript that will work across the majority of web browsers (by that I mean : IE 6+, Firefox 2+, Opera 9+ )</p>
<p>Is this valid</p>
<pre><code>var a = {
"class": "Person",
"name": "William Shakespeare",
"birthday": -12802392000000,
"nickname": "Bill"
};
</... | <p><a href="https://stackoverflow.com/questions/380855/json-syntax-for-property-names#380860">@AndreasN is correct</a>: the <a href="http://www.json.org/" rel="noreferrer">JSON specification</a> dictates the use of quotes in order for it to actually be JSON. If you don't use quotes, it may be a valid object literal in ... | <p>The <a href="http://www.json.org/" rel="noreferrer">spec</a> say to use "".</p>
<p>Firefox accept without, but IE doesn't.</p>
<p>Pair is defined as</p>
<pre><code>string : value
</code></pre>
<p>Value can be a string
string is defined as</p>
<pre><code>" chars "
</code></pre>
| 49,910 |
<p>After I updated the firmware on my Prusa i3, the Bed won't switch off anymore. It worked perfectly before the update, but now, the moment I power up my printer, the LED on the bed turns on and it starts heating up. The manual control in Repetier Host doesn't turn if off or on and I even tried g-codes <code>M140 S0</... | <p>To answer the main question "Is ABS better for structural parts of a 3D printer as opposed to PLA".</p>
<p>The answer, unfortunately is it depends.</p>
<p>ABS has lower yield and ultimate strengths compared to PLA. This means that at room temperatures, ABS is weaker than PLA. However the difference between yield a... | <p>Actually, Both PLA and ABS could use for structural parts. PLA has high strength and is brittleness. ABS has better thermal resistance and durable. <a href="https://ecoreprap.com/pla-vs-abs/" rel="nofollow noreferrer">PLA and ABS</a> are the main types of 3D printing material, each has cons and pros.</p>
<p>If you w... | 585 |
<p>I have written a new custom component derived from TLabel. The component adds some custom drawing to component, but nothing else. When component is painted, everything works fine. But when the redraw is needed (like dragging another window over the component), "label part" works fine but my custom drawing is not pro... | <p>SOLVED:</p>
<p>The problem is (redundant) use of FloodFill. If the Canvas is not fully visible floodfill causes artifacts. I removed the floodfill and now it works as needed.</p>
| <p>I am not 100% sure it'll work for you, but I've seen rendering problem getting fixed by placing <code>TXPManifest</code> on a form.</p>
| 39,012 |
<p>Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how?</p>
<p>I would like to be able to do it in an app-server-agnostic way, if it is possible.</p>
<p>The application will be run on many different app servers-- basically whatever the client prefers.</p>
<p>If it isn... | <p>I would suggest that you're unlikely to find an appserver agnostic way. And while I don't pretend to know your requirements, I might question a design that requires the application to restart itself, other than an installer that is deploying a new version. Finally, I would suggest that for any nontrivial purpose "a... | <p>Most application servers provide a JMX interface, so you could invoke that.</p>
| 6,871 |
<p>C++ guarantees that variables in a compilation unit (.cpp file) are initialised in order of declaration. For number of compilation units this rule works for each one separately (I mean static variables outside of classes).</p>
<p>But, the order of initialization of variables, is undefined across different compilati... | <p>As you say the order is undefined across different compilation units.</p>
<p>Within the same compilation unit the order is well defined: The same order as definition.</p>
<p>This is because this is not resolved at the language level but at the linker level. So you really need to check out the linker documentation. T... | <p>If you really want to know the final order I would recommend you to create a class whose constructor logs the current timestamp and create several static instances of the class in each of your cpp files so that you could know the final order of initialization. Make sure to put some little time consuming operation in... | 25,947 |
<p>I have recently come across a situation where code is dynamically loading some libraries, wiring them up, then calling what is termed the "application entry point" (one of the libraries must implement IApplication.Run()).</p>
<p>Is this a valid "Appliation entry point"? </p>
<p>I would always have considered the a... | <p>The terms application and system are terms that are so widely and diversely used that you need to agree what they mean upfront with your conversation partner. E.g. sometimes an application is something with a UI, and a system is 'UI-less'. In general it's just a case of you say potato, I say potato.</p>
<p>As for t... | <p>The term "application" can mean whatever you want it to mean. "Application" merely means a collection of resources (libraries, code, images, etc) that work together to help you solve a problem.</p>
<p>So to answer your question, yes, it's a valid use of the term 'application'.</p>
| 18,410 |
<p>Is there a built-in mechanism in .NET to match patterns other than Regular Expressions? I'd like to match using UNIX style (glob) wildcards (* = any number of any character). </p>
<p>I'd like to use this for a end-user facing control. I fear that permitting all RegEx capabilities will be very confusing.</p>
| <p>I found the actual code for you:</p>
<pre><code>Regex.Escape( wildcardExpression ).Replace( @"\*", ".*" ).Replace( @"\?", "." );
</code></pre>
| <p>Just out of curiosity I've glanced into Microsoft.Extensions.FileSystemGlobbing - and it was dragging quite huge dependencies on quite many libraries - I've decided why I cannot try to write something similar?</p>
<p>Well - easy to say than done, I've quickly noticed that it was not so trivial function after all - ... | 22,911 |
<p>I'm working with an mpeg stream that uses a IBBP... GOP sequence. The <code>(DTS,PTS)</code> values returned for the first 4 AVPackets are as follows: <code>I=(0,3) B=(1,1) B=(2,2) P=(3,6)</code></p>
<p>The PTS on the I frame looks like it is legit, but then the PTS on the B frames cannot be right, since the B fram... | <p>I think I finally figured out what's going on based on a comment made in <a href="http://www.dranger.com/ffmpeg/tutorial05.html" rel="noreferrer">http://www.dranger.com/ffmpeg/tutorial05.html</a>:</p>
<blockquote>
<p>ffmpeg reorders the packets so that the DTS of the packet being processed by avcodec_decode_video... | <p>I'm fairly certain you are getting accurate values. It might help if you thing of an MPEG stream as, well, a stream. In that case, prior to the IBBPBB that you see there would normally be another GOP. Maybe something like this (using same notation as original question):</p>
<pre><code>P(-3,-2) B(-2,-1) B(-1,0)... | 12,166 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.