instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>We are trying to integrate tests in our daily builds using TestComplete, so far we have a machine dedicated for testing and our build script copies to this machine everything TestComplete needs for its tests (Application, Database, Test script project and source files, etc).</p>
<p>Basically we can open the TestCom... | <p>Answering my own question:</p>
<p>The solution was writing a little C# application which sits on the system tray and monitors a folder.</p>
<p>When a new folder (containing the tests source code) are added to the monitored folder TestComplete is called using the command line, then the application catch its ExitCod... | <p>There are different methods to do this activity. The Best and Most powerful method is using Cruise control.NET for Continuous integration of testing/Development Cycle.</p>
<p>Second Method is create a batch file to run Test complete script using command line parameter. Schedule the running of this batch file . Also... | 12,027 |
<p>How do I stop a Java process gracefully in Linux and Windows?</p>
<p>When does <code>Runtime.getRuntime().addShutdownHook</code> get called, and when does it not?</p>
<p>What about finalizers, do they help here?</p>
<p>Can I send some sort of signal to a Java process from a shell?</p>
<p>I am looking for prefera... | <p>Shutdown hooks execute in all cases where the VM is not forcibly killed. So, if you were to issue a "standard" kill (<code>SIGTERM</code> from a kill command) then they will execute. Similarly, they will execute after calling <code>System.exit(int)</code>.</p>
<p>However a hard kill (<code>kill -9</code> or <code... | <p>Signalling in Linux can be done with "kill" (man kill for the available signals), you'd need the process ID to do that. (ps ax | grep java) or something like that, or store the process id when the process gets created (this is used in most linux startup files, see /etc/init.d)</p>
<p>Portable signalling can be done... | 23,218 |
<p>Is there a better unit testing tool than <a href="http://wtr.rubyforge.org/" rel="nofollow noreferrer">WaTiR</a> for Ruby web testing? Or is the defacto standard? What unit testing tools do you use?</p>
| <p>We use it for all our web application testing, not just ruby based web applications. We did look into a number of products but felt that WaTiR was the best. Plus it is in Ruby so we can pat ourselves our backs and tell each other how cool we are for using Ruby. </p>
| <p>We had a look at WaTiR a few years ago and decided against it for various reasons, mostly around ease of use compared to the likes of selenium (as in writing code vs visual tools).</p>
<p>It's worth mentioning that the people who were doing the test-building where not developers let alone Ruby developers.</p>
<p>T... | 16,654 |
<p>I have been developing an event handler to clean up the RolesAssignments of the new item of a document library in MOSS. I’ve searched for a method that could clean all the RolesAssignments efficiently, although the best way I found seams to be loop through the RolesAssignments and delete one by one? Is there anoth... | <p>I have the answer, put the propertie SPListItem.BreakRoleInheritance(false) to break the role inheritance and remove the role assignments.</p>
| <p>How about ResetRoleInheritance? This should clear out all of the RoleAssignments.</p>
| 45,972 |
<p>for working with MS word files in python, there is python win32 extensions, which can be used in windows. How do I do the same in linux?
Is there any library?</p>
| <p>You could make a subprocess call to <a href="http://en.wikipedia.org/wiki/Antiword" rel="noreferrer">antiword</a>. Antiword is a linux commandline utility for dumping text out of a word doc. Works pretty well for simple documents (obviously it loses formatting). It's available through apt, and probably as RPM, or... | <p><a href="https://products.aspose.cloud/words/python" rel="nofollow noreferrer">Aspose.Words Cloud SDK for Python</a> is a platform independent solution to convert MS Word/Open Office files to text. It is a commercial product but free trial plan provides 150 monthly API calls.</p>
<p>P.S: I am a developer evangelist ... | 15,221 |
<p>I'm trying to convert my sites from CF8 to openBD. I have a cfloop in a site that loops over a date range.</p>
<p>In essence, I want to insert a new record into the db for every 2 weeks (step) of a date range (from and to)</p>
<p>my loop looks like this... </p>
<pre><code><cfloop
from = "#form.startDate#"... | <p>Your problem lies in not checking for ambiguous locale dependent date strings from your FORM.</p>
<p>A more robust version would be this:</p>
<pre><code><cfset SetLocale("English (US)")> <!--- set expected input locale here --->
<cfif LSIsDate(form.startDate) and LSIsDate(form.endDate)>
<cf... | <p>I can't see your code, but here's my first suggestion:</p>
<pre><code><cfset current = [your begin date]>
<cfloop condition = "datecompare(enddate, current)">
[do stuff]
<cfset current = dateadd('d', 14, current)>
</cfloop>
</code></pre>
<p>HTH.</p>
| 32,916 |
<p>A fairly basic question, but I don't see it asked anywhere.</p>
<p>Let's say we have a global struct (in C) like so:</p>
<pre><code>struct foo {
int written_frequently1;
int read_only;
int written_frequently2;
};
</code></pre>
<p>It seems clear to me that if we have lots of threads reading and writing, we n... | <p>If the read_only member is actually read only, then there is no danger of the data being changed and therefore no need for synchronization. This could be data that is set up before the threads are started.</p>
<p>You will want synchronization for any data that can be written, regardless of the frequency.</p>
| <p>I would hide each field behind behind a function call. The write-only fields would have a semaphore. The read-only just returns the value.</p>
| 33,314 |
<p>I am using Struts + Velocity in a Java application, but after I submit a form, the confirmation page (Velocity template) shows the variable names instead an empty label, like the Age in following example:</p>
<blockquote>
<p><strong>Name</strong>: Fernando</p>
<p><strong>Age</strong>: {person.age}</p>
<p><strong>Sex... | <p>You can mark variables as "<a href="https://velocity.apache.org/engine/1.5/user-guide.html#quietreferencenotation" rel="noreferrer">silent</a>" like this:</p>
<pre><code>$!variable
</code></pre>
<p>If $variable is null, nothing will be rendered. If it is not null, its value will render as it normally would.</p>
| <p>You will also need to be sure and use the proper syntax. Your example is missing the dollar before the variable. It should be $!{person.age}, not just {person.age}.</p>
| 4,367 |
<p>I originally asked <a href="https://stackoverflow.com/questions/46933/why-doesnt-inheritance-work-the-way-i-think-it-should-work">this question</a>, but in finding an answer, discovered that my original problem was a lack of support in C# for covariance on inherited methods' return types. After discovering that, I b... | <ul>
<li>C++</li>
<li>Java</li>
<li>REALbasic</li>
<li>Eiffel</li>
<li>Sather</li>
<li>Modula-3</li>
</ul>
| <blockquote>
<p>but I think thats what I'm asking for..or is it?</p>
</blockquote>
<p>I frankly don't know what you're asking. Java apparently has the same support for return-type covariance as C#, so if whatever you're looking for is lacking in C#, it's lacking in Java also.</p>
| 6,921 |
<p>The font used in xterms is extremely compact yet readable. What font is that? The closest I've found that I can use in other other applications is DejaVu Sans Mono or Bitstream Vera Sans Mono. Those are as compact as xterms vertically but take up more space horizontally.</p>
<p>I'd really like to switch from xte... | <p>It's not <i>exactly</i> the same, but 10 point Monaco (with anti-aliasing turned off) is pretty darn close. I'd say it's actually a little better, because Monaco's 1/l and O/0 glyphs are more distinct than the X font's.</p>
| <p>Try andale mono without anti-aliasing... it looks good on my mac pro 15in</p>
| 49,751 |
<p>Code and preview: <img src="https://i.stack.imgur.com/3J6CX.gif" alt="what i have"></p>
<pre><code><html>
<head>
<title>Testing some CSS</title>
<style type="text/css">
.dDay {
font-size:205%
}
.dMon {
font-weight:bold;
font-variant:small-caps;
font-size:130%;
margi... | <pre><code><html>
<head>
<title>Testing some CSS</title>
<style type="text/css">
.dDay {
font-size:205%
}
.dMon {
font-weight:bold;
font-variant:small-caps;
font-size:130%;
margin-top:-.7em;
}
.detailContainer {
vertical-align:middle;
display:table-cell;
pad... | <ol>
<li>Copy dContainer and place the copy immediately after it.</li>
<li>Change the ID and the new ID to the #dContainer style.</li>
<li>Add a new CSS block that has just #dContainer (not the new div) and put "float:left;" in the block.</li>
</ol>
| 22,170 |
<p>I have data that looks like</p>
<blockquote>
<pre><code>CUSTOMER, CUSTOMER_ID, PRODUCT
ABC INC 1 XYX
ABC INC 1 ZZZ
DEF CO 2 XYX
DEF CO 2 ZZZ
DEF CO 2 WWW
GHI LLC 3 ZYX
</code></pre>
</blockquote>
<p>I'd like to write a query th... | <p>I think LISTAGG is the best aggregate group by function to use in this situation:</p>
<pre><code> SELECT CUSTOMER, CUSTOMER_ID,
LISTAGG(PRODUCT, ', ') WITHIN GROUP (ORDER BY PRODUCT)
FROM SOME_TABLE
GROUP BY CUSTOMER, CUSTOMER_ID
ORDER BY 1, 2
</code></pre>
| <p>Thanks Nigel,</p>
<p>My SQL is not as elegant as could be, but I needed a solution that required SQL only, not PLSQL or TSQL, so it ended up looking like this:</p>
<pre><code>SELECT CUSTOMER, CUSTOMER_ID, COUNT(PRODUCT) PROD_COUNT,
RTRIM(
XMLAGG( XMLELEMENT (C, PRODUCT || ',') ORDER BY PRO... | 29,031 |
<p>In C#, it is possible to retrieve assembly related information like product name, version etc using reflection:</p>
<pre><code>string productName = Assembly.GetCallingAssembly().GetName().Name;
string versionString = Assembly.GetCallingAssembly().GetName().Version.ToString();
</code></pre>
<p>How do I do the equiv... | <p>Walking the stack is not necessary to find out what process you are in. You simply make a single Win32 API call:</p>
<pre><code>HMODULE hEXE = GetModuleHandle(NULL);
</code></pre>
<p>According to the <a href="http://msdn.microsoft.com/en-us/library/ms683199(VS.85).aspx" rel="nofollow noreferrer">documentation for ... | <p>you could use the following code in VB.Net to retrieve extended document properties:</p>
<pre><code>Sub Main()
Dim arrHeaders(41)
Dim shell As New Shell32.Shell
Dim objFolder As Shell32.Folder
objFolder = shell.NameSpace("C:\tmp\")
For i = 0 To 40
arrHeaders(i) = objFolder.GetDetailsO... | 42,766 |
<p>I have a textarea with overflow-x: auto; attributed to it. It works great when a user is typing text into the box by hand. When a user copy pastes a line from a file, however, that is bigger than my textarea, the overflow-x property does not work, instead the textarea wordwraps the long line.</p>
<p>Is there a way ... | <p>I'm not sure what you are trying to achieve - is that for the text area to automatically expand when user types text in? I couldn't create such a behavior using just HTML and CSS.</p>
<p>You can theoretically set your textarea wrap attribute to "no" which will force the creating of a horizontal scrollbar when users... | <p>From the looks of it, it would seem that the text comes pre-wordwrapped from the editor. What editor are you using, and on which platform are you experiencing this behaviour?</p>
| 19,736 |
<p>I have used cyanoacrylate glue aka superglue to bond PLA. I have created several electronics enclosures. (Definitely the most time-consuming part of the project.)</p>
<p>Now my question is which debonder/solvent can I use to separate the pieces again without destroying the PLA parts?</p>
<p>Wikipedia proposes the ... | <p><strong>Acetone</strong></p>
<p>Acetone will dissolve cynoacrylate (superglue) and should weaken it enough to be able to separate the parts.<br>
A readily available cheap source of acetone is nail varnish remover (just make sure you don't buy the acetone free version!).<br>
Give the pieces a soak in nail varnish re... | <p>Gamma butyrolactone is by far the best product to remove cyanoacrylate and also great to dissolve PLA.</p>
| 380 |
<p>Let me use the following example to explain my question:</p>
<pre class="lang-csharp prettyprint-override"><code>public string ExampleFunction(string Variable) {
return something;
}
string WhatIsMyName = "Hello World";
string Hello = ExampleFunction(WhatIsMyName);
</code></pre>
<p>When I pass the vari... | <p>What you want isn't possible directly but you can use Expressions in C# 3.0:</p>
<pre><code>public void ExampleFunction(Expression<Func<string, string>> f) {
Console.WriteLine((f.Body as MemberExpression).Member.Name);
}
ExampleFunction(x => WhatIsMyName);
</code></pre>
<p>Note that this relies... | <p><strong>No.</strong> I don't think so.</p>
<p>The variable name that you use is for your convenience and readability. The compiler doesn't need it & just chucks it out if I'm not mistaken.</p>
<p>If it helps, you could define a new class called <code>NamedParameter</code> with attributes <code>Name</code> and <c... | 9,770 |
<p>Im using a fileupload control for my asp application and it throws a HttpException when the file upload size is bigger than the max request length. </p>
<p>As far i understand the fileupload will open a memory stream to a file once the file browse dialog is closed but there is no way of knowing when the dialog is c... | <p>If you leave file upload to built-in Asp.Net mechanisms, then an upload will fail if the request size is larger than the max size set in web.config (or machine.config).</p>
<p>You can solve that by writing your own HttpHandler and first check the size of the request, and then handle the request data in your code.</... | <p>I doubt there is a universal way to check file size on client-side ( I mean for all browsers ), as usually client-side script does not have access to file system.</p>
<p>I used to catch the exception on server side and then notice the user when programming in classic ASP.</p>
| 42,267 |
<p>we're dealing with a very slow update statement in an Oracle project.</p>
<p>Here's a little script to replciate the issue:</p>
<pre><code>drop table j_test;
CREATE TABLE J_TEST
(
ID NUMBER(10) PRIMARY KEY,
C1 VARCHAR2(50 BYTE),
C2 VARCHAR2(250 BYTE),
C3 NUMBER(5),
C4 NUMBER(10)
);
-- just ins... | <p>One possible cause of poor performance is row chaining. All your rows initially have columns C3 and C4 null, and then you update them all to have a value. The new data won't fit into the existing blocks, so Oracle has to chain the rows to new blocks.</p>
<p>If you know in advance that you will be doing this you c... | <p>This is very similar to the question and my answer <a href="https://stackoverflow.com/questions/199537/oracle-sql-technique-to-avoid-filling-trans-log#202530">here</a>.</p>
<p>Never update 100% of the rows in a table. Just follow the procedure in that link. build the "right answer" as a new table and then swap that... | 37,866 |
<p>I'm collecting metadata using the sys.* views, and according to the documentation, the sys.identity_columns view will return the seed and increment values like so.</p>
<pre><code>CREATE TABLE ident_test (
test_id int IDENTITY(1000,10),
other int
)
SELECT name, seed_value, increment_value
FROM sys.identity_co... | <p>Shouldn't you reverse the from and join, like this:</p>
<pre><code>SELECT c.name, i.seed_value, i.increment_value
from sys.identity_columns i
join sys.columns c
ON i.object_id = c.object_id
AND i.column_id = c.column_id
</code></pre>
| <p>Are you sure you are running this in a database with tables with <code>IDENTITY</code> columns?</p>
<pre><code>SELECT c.name, i.seed_value, i.increment_value
FROM sys.columns c
INNER JOIN sys.identity_columns i
ON i.object_id = c.object_id
AND i.column_id = c.column_id
</code></pre>
<p>Returns rows for me ... | 27,062 |
<p>I'm tasked with automating the retrieval of a couple of <a href="http://www.businessobjects.com/product/catalog/web_intelligence/" rel="nofollow noreferrer">BusinessObjects Web Intelligence</a> reports and further processing thereof.</p>
<p>I have no other means of access to this data (this was the first avenue I f... | <p>The BO job scheduler can be set up to automatically run reports at a given time and export them as Excel, CSV, etc. The reports can be dumped onto a web server, which will make for easier screen scraping or downloads than trying to go against the BO web reports directly, because the web reports are paginated.</p>
... | <p>Have you looked at QaaWS? (Query As A Web Service) -- it should let you get access to the same universe query that the WebI report is using -- but that may not do you much good if you are relying upon the WebI report as a pre-processor. Just a thought.</p>
| 38,150 |
<p>I am trying to return the minimum and maximum prices for a villa booking system. I have a look up table that stores the price for each week for each villa. </p>
<p>I am using the min and max functions to do this within the select but I'm having lots of problems. Can anyone explain where i'm going wrong? Heres the s... | <p>You don't elaborate on <em>what</em> problems you are getting, but this is probably one: you need to specify <strong>all</strong> the non-aggregate columns in the GROUP BY clause i.e.:</p>
<pre><code>GROUP BY tblVillas.name,
tblVillas.introduction,
tblVillas.italian_introduction,
tblVillas.uk_... | <p>Thanks for your help</p>
<p>When I Group By and include all the columns from the select except the two functions I get the following error</p>
<pre><code>Msg 306, Level 16, State 2, Procedure spVillaGet, Line 22
</code></pre>
<p>The text, ntext, and image data types cannot be compared or sorted, except when using... | 41,423 |
<p>When I use A.column name, B.Column name where A = Table A and B = Table B , what is the technical name for the A.Column name? Is it a prefix, identifier or what else? </p>
| <p>I have always seen it called an alias.</p>
<p>Edit:
<a href="http://www.w3schools.com/SQL/sql_alias.asp" rel="nofollow noreferrer">Yeap!</a></p>
| <p>I think the correct name is table-alias</p>
| 49,011 |
<p>I am refering to the <a href="https://stackoverflow.com/questions/252893/how-do-you-change-the-classpath-within-java#252905">question</a> on changing the classpath programmatically.</p>
<p>I read and found out that there is some function under <strong>System</strong> class as getproperties where we can retrieve the... | <p>You can certainly set any system properties you want at any point of time. The question is, will it have any effect? In the case of classpath, the answer is NO. The system class loader is initialized at a very early point in the startup sequence. It copies the classpath into its own data structures, and the classpat... | <p>The basic idea of <code>getProperty()</code> is that programs/code can be configured from outside of the JVM, passing properties on the command line using the <code>java -Dfoo=bar</code> syntax.</p>
<p>As you may want to configure certain behaviour in other software components (such as a logging component) in situa... | 34,143 |
<p>I need to upgrade my current version of DNN this week. I am currently using 2.1.1. I don't want to do everything twice, so, I have several questions.</p>
<ol>
<li>Is there an upgrade tool or some scripts somewhere that will help me to do an upgrade.</li>
<li>Am I better off installing 4.9 or 5.0. It is production.<... | <p>It's been my experience that DotNetNuke has a tendancy to release breaking changes without documenting them (or documenting much of anything, for that matter). Without knowing exactly what you have installed in it, it's impossible to say exactly <em>how</em> screwed you are. But I can guarantee you the transition wi... | <p>To be honest, I don't know. But I see that the DNN download page very strongly states that the 5.0 release-candidates are "NOT RECOMMENDED FOR PRODUCTION USE".</p>
| 40,555 |
<p>Using jQuery, how would you <code>show()</code> every <code>div.foo</code> on a page in a random order, with a new one appearing every X milliseconds?</p>
<p><strong>Clarification</strong>: I want to start with all these elements hidden and end with all of them showing, so it wouldn't make sense to <code>show()</co... | <p>An interesting way to do this would be the extend Javascript's Array base object with a shuffle function. In Prototype (should be the same in JQuery, except jQuery.extend). This is quick and dirty shuffle, there are plenty of other ways to do it.</p>
<pre><code>Object.extend(Array.prototype, {
shuffle : function... | <p>Here's how I would do it <s>(untested)</s>:</p>
<pre><code>(function () {
var int, els;
int = 100; // interval, in milliseconds
els = $('div.foo');
setInterval(function () {
var idx;
idx = Math.floor(els.length * Math.random());
$(els[idx]).show();
setTimeout(function... | 29,157 |
<p>For a .NET component that will be used in both web applications and rich client applications, there seem to be two obvious options for caching: System.Web.Caching or the Ent. Lib. Caching Block.</p>
<ul>
<li>What do you use?</li>
<li>Why?</li>
</ul>
<h2><a href="http://msdn.microsoft.com/en-us/library/system.web.c... | <p>These are the items that I consider for the topic of Caching:</p>
<p>MemCached Win32
Velocity
.net Cache
Enterprise Library Caching Application Block</p>
<p><strong>MemCached Win32:</strong> Up until recently I have used MemCached Win32. This is a akin to a web farm (many servers serving the same content for high... | <p>@Davide Vosti</p>
<p>"If they put it in the web namespace, I think's it's for a good reason."
Does that same logic apply to the Concurrency and Coordination Runtime (CCR) in the robotic studio? no? didn't think so.</p>
| 4,190 |
<p>My project invovles me to make a lot of changes on the production code. The requirement keeps coming up and I need to make changes and deploy it as soon as possible. I sometimes end up creating patch work sort of code because some of the requirement would not fit into the overall design of the software. How can this... | <p>I've seen this happen many times and it always ends in tears. The last time the customer lost millions of dollars before they improved their process.</p>
<p>Users always want new requirements to be made available "as soon as possible," but they do not understand the risks of making the changes in the same way that ... | <p>There are several project lifecycles that you can pattern your approach against. <a href="http://www.business-esolutions.com/islm.htm" rel="nofollow noreferrer">This site</a> lists a few (it sounds like you're using the "Code-And-Fix" one!), but this is by no means a definitive list, a larger list can be found <a hr... | 38,196 |
<p>Anybody know of a way to copy a file from path A to path B and suppressing the Windows file system cache?<br>
Typical use is copying a large file from a USB drive, or server to your local machine. Windows seems to swap everything out if the file is really big, e.g. 2GiB.
Prefer example in C#, but I'm guessing this w... | <p>Even more important, there are FILE_FLAG_WRITE_THROUGH and FILE_FLAG_NO_BUFFERING.</p>
<p>MSDN has a nice article on them both: <a href="http://support.microsoft.com/kb/99794" rel="noreferrer">http://support.microsoft.com/kb/99794</a></p>
| <p>Eseutil is a correct answer, also since Win7 / 2008 R2, you can use the /j switch in Xcopy, which has the same effect.</p>
| 7,115 |
<p>I have 4 databases with similar schema's, and I'm trying to create a query to return just the table, column pairs that exist ONLY in database 1 and do not exist in database 2, 3, or 4.</p>
<p>Currently I can return the symmetric difference between database 1 and 2 via the following query...</p>
<pre><code>select t... | <p>Attributes will take an array. Though if you control the attribute, you can also use <code>params</code> instead (which is nicer to consumers, IMO):</p>
<pre><code>class MyCustomAttribute : Attribute {
public int[] Values { get; set; }
public MyCustomAttribute(params int[] values) {
this.Values = va... | <p>I use maybe a bit stupid workaround using this trick:</p>
<pre><code>public class CLParam : Attribute
{
/// <summary>
/// Command line parameter
/// </summary>
public string Names { get; set; }
}
</code></pre>
<p>and then splitting the Names into string[]:</p>
<pre><code>var names = loadA... | 33,953 |
<p>I want to write Html format, but I can not even get a simple MSDN example of it to work.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/tbfb3z56.aspx</a></p>
<p>Does this console app, a clipboard round tripper, work for anyon... | <p>When you copy data from a browser onto the clipboard, it puts the same data onto the clipboard in multiple formats, including both text and HTML. So you can read the data back out in either text or HTML format. However, when you call SetText here, you are ONLY passing in HTML format, so when you use the regular GetT... | <p>I can reproduce that it doesn't work... the <code>var text2 = Clipboard.GetText();</code> returns <code>""</code> each time...</p>
<p>(edit)
A quick search yields <a href="http://blogs.msdn.com/jmstall/archive/2007/01/21/html-clipboard.aspx" rel="nofollow noreferrer">this</a>, which seems on topic.</p>
| 45,144 |
<p>I've got a simple application that shows pictures dragged onto it. I'd like the application to resize itself according to the picture it displays. The code below does just that:</p>
<pre><code>// Load the picture
Bitmap picture = new Bitmap(s);
// Calculate the size of the main form
this.Size = new Size(picture.... | <p>You could compute the difference in size between the old picture and the new picture, and then just adjust the size of the form by that amount... as long as all the other stuff on the form stays the same size.</p>
| <p>You can take a look at the Forms properties:</p>
<ul>
<li>Form.AutoSize</li>
<li>Form.AutoSizeMode</li>
</ul>
<p>Those, coupled with setting the PictureBox's AutoSizeMode should give you the effect you're looking for (without having to write any code).</p>
| 45,618 |
<p>I have an image that I want to show some 'spotlights' on, like they do on TV. The rest of the image should be darker than the original, and the person that I'm spotlighting should be normal. I have the x,y and radius of the spotlight, but I'm not sure how to change the brightness at that location. </p>
<p>Also, ... | <p>Use RescaleOp on the original image and subimages. Given that you have a buffered image (called biDest) that contains the image, call RescaleOp(0.6, 0, null) on it to make it darker. Then, to add a (rectangular) spotlight, call the following:</p>
<pre><code> public void spotLight(int x, int y, int w, int h)
... | <p>A simple way is to convert the color to HSL, lower L to darken, increase to lighten, then convert back to RGB and set the pixel.</p>
<p><a href="http://www.mpa-garching.mpg.de/MPA-GRAPHICS/hsl-rgb.html" rel="nofollow noreferrer">http://www.mpa-garching.mpg.de/MPA-GRAPHICS/hsl-rgb.html</a></p>
| 35,104 |
<p>I have a weird date rounding problem that hopefully someone can solve. My client uses a work week that runs from Monday through Sunday. Sunday's date is considered the end of the week, and is used to identify all records entered in a particular week (so anything entered last week would have a WEEKDATE value of '10... | <pre><code>public DateTime WeekNum(DateTime now)
{
DateTime NewNow = now.AddHours(-11).AddDays(6);
return (NewNow.AddDays(- (int) NewNow.DayOfWeek).Date);
}
public void Code(params string[] args)
{
Console.WriteLine(WeekNum(DateTime.Now));
Console.WriteLine(WeekNum(new DateTime(2008,10,27, 10, 00,... | <p>I've used these extensions with great success:</p>
<p><a href="http://www.codeplex.com/DateTimeExtensions" rel="nofollow noreferrer">http://www.codeplex.com/DateTimeExtensions</a></p>
| 29,775 |
<p>I have a KTextEdit, filled with some text. </p>
<p>When I put lots of text, the KTextEdit will be scrolled automatically to the end (obviously). </p>
<p>My question is: how can I scroll to the start (viz to the first line of the KTextEdit) ?!?</p>
| <p>Looks like you use </p>
<pre><code>QTextCursor cursor = edit->textCursor();
cursor.setPosition(0);
edit->setTextCursor(cursor);
</code></pre>
<p>Not tested, but looks fine. Found another, shorter way:</p>
<pre><code>edit->moveCursor(QTextCursor::Start);
</code></pre>
| <p>The simplest way i can think of is:</p>
<pre><code>KTextEdit *kte;
...
kte->append("some huge text");
kte->verticalScrollBar()->setValue(0);
</code></pre>
| 48,476 |
<p>I'm using LINQ to SQL classes in a project where the database design is still in a bit of flux.</p>
<p>Is there an easy way of synchronising the classes with the schema, or do I need to manually update the classes if a table design changes?</p>
| <p>You can use SQLMetal.exe to generate your dbml and or cs/vb file. Use a pre-build script to start it and target the directory where your datacontext project belongs. </p>
<pre><code>C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bin\x64\sqlmetal.exe
/server:<SERVER>
/database:<database>
/code:"... | <p>How about modifying the Properties of the entity/table within the DataContext design surface within Visual Studio?</p>
<p>For instance if I added a column to an SQL Server table:</p>
<ol>
<li>Open the *.dbml file.</li>
<li>Right click the entity and select Add > Property.</li>
<li>Fill out the values in the Proper... | 6,120 |
<p>Google hosts some popular JavaScript libraries at:
<a href="http://code.google.com/apis/ajaxlibs/" rel="noreferrer">http://code.google.com/apis/ajaxlibs/</a></p>
<p>According to google:</p>
<blockquote>
<p>The most powerful way to load the libraries is by using google.load() ...</p>
</blockquote>
<p>What are th... | <p>Aside from the benefit of Google being able to bundle multiple files together on the request, there is no perk to using google.load. In fact, if you know all libraries that you want to use (say just jQuery 1.2.6), you're possibly making the user's browser perform one unneeded HTTP connection. Since the whole point o... | <p>Personally, I'm interested in whether there's a caching benefit for browsers that will already have loaded that library as well. Seems like if someone browses to google and loads the right jQuery lib and then browses to my site and loads the right jQuery lib... ...both might well use the same cached jQuery. That's... | 25,623 |
<p>I have an entry in my .vimrc which makes it page down the viewport when I hit the spacebar. It looks like this:</p>
<pre><code>map <Space> <PageDown>
</code></pre>
<p>I want to create another key mapping which pages the viewport up when holding shift and hitting the spacebar. I have tried the following... | <p>You cannot. CMS's solution will work for gVim, but not in vim because terminals cannot distinguish between <Space> and <S-Space> because curses sees them the same. It might be possible in the future if vim gains libtermkey support and your terminal supports the proper <CSI> sequences (xterm does if... | <p>Inspired by <a href="https://unix.stackexchange.com/a/320750/124200">this answer</a>, I got the mapping done by:</p>
<ul>
<li>Using a terminal that supports key mapping</li>
<li>Mapping <kbd>Shift</kbd>+<kbd>Space</kbd> to a sequence of characters that can be distinguished from <kbd>Space</kbd> by Vim, but still has... | 35,388 |
<p>Sometimes when I try to start Firefox it says "a Firefox process is already running". So I have to do this:</p>
<pre><code>jeremy@jeremy-desktop:~$ ps aux | grep firefox
jeremy 7451 25.0 27.4 170536 65680 ? Sl 22:39 1:18 /usr/lib/firefox-3.0.1/firefox
jeremy 7578 0.0 0.3 3004 768 pts/0 S+ ... | <pre><code>pkill firefox
</code></pre>
<p>More information: <a href="http://linux.about.com/library/cmd/blcmdl1_pkill.htm" rel="noreferrer">http://linux.about.com/library/cmd/blcmdl1_pkill.htm</a></p>
| <pre class="lang-none prettyprint-override"><code>ps aux | grep processname | cut -d' ' -f7 | xargs kill -9 $
</code></pre>
| 19,448 |
<p>What tools are useful for automating clicking through a windows form application? Is this even useful? I see the testers at my company doing this a great deal and it seems like a waste of time.</p>
| <p>Check out <a href="https://github.com/TestStack/White" rel="nofollow noreferrer">https://github.com/TestStack/White</a> and <a href="http://nunitforms.sourceforge.net/" rel="nofollow noreferrer">http://nunitforms.sourceforge.net/</a>. We've used the White project with success.</p>
| <p>There's a couple out there. They all hook into the windows API to log item clicks, and then reproduce them to test.</p>
<p>We're now mostly web based (using WatiN), but we used to use Mercury Quicktest. </p>
<p>Don't use Quicktest, it's awful for a tremendously long list of reasons.</p>
| 3,355 |
<p>I've got a database server that I am unable to connect to using the credentials I've been provided. However, on the staging version of the same server, there's a linked server that points to the production database. Both the staging server and the linked server have the same schema.</p>
<p>I've been reassured that ... | <p>I don't believe that you can access a linked server directly from an application without the OpenQuery syntax. Depending on the complexity of your schema, it might make sense to write a routine or sproc to populate your staging database with data from your live database.</p>
<p>You might also consider looking at R... | <p>creating a linked server from .NET doesn't make any sense since a linked server is nothing but a connection from one sqlserver to another server (sql, file, excel, sybase etc etc), in essence it is just a connection string (you can impersonate and do some other stuff when creating a linked server). </p>
| 3,877 |
<p>I have a MySQL table containing domain names:</p>
<pre><code>+----+---------------+
| id | domain |
+----+---------------+
| 1 | amazon.com |
| 2 | google.com |
| 3 | microsoft.com |
| | ... |
+----+---------------+
</code></pre>
<p>I'd like to be able to search through this table for ... | <p>You can use the column on the right of the like too:</p>
<pre><code>SELECT domain FROM table WHERE 'www.google.com' LIKE CONCAT('%', domain);
</code></pre>
<p>or </p>
<pre><code>SELECT domain FROM table WHERE 'www.google.com' LIKE CONCAT('%', domain, '%');
</code></pre>
<p>It's not particularly efficient but it ... | <p>You could use a bit of SQL string manipulation to generate the equivalent of string.EndsWith():</p>
<pre><code>SELECT * FROM table WHERE
substring('www.google.com',
len('www.google.com') - len([domain]) ,
len([domain])+1) = [domain]
</code></pre>
| 43,980 |
<p>I am currently running into a problem where an element is coming back from my xml file with a single quote in it. This is causing xml_parse to break it up into multiple chunks, example: Get Wired, You're Hired!
Is then enterpreted as 'Get Wired, You' being one object, the single quote being a second, and 're Hired!'... | <p><strong>Finally, we got through the support services processes at Microsoft and got a solution!</strong></p>
<p>First, Microsoft stated this to be a bug. It is a minor bug, because there is a good workaround, so it may take some longer time, until this bug will be fixed (the support technician said something with n... | <p>I've encountered this issue as well and found out that once a workflow has started, it cannot be re-started automatically, no matter how you update the item. You can, however, manually start the workflow again, as many times as you like.</p>
| 16,210 |
<p>I have a 'reference' SQL Server 2005 database that is used as our global standard. We're all set up for keeping general table schema and data properly synchronized, but don't yet have a good solution for other objects like views, stored procedures, and user-defined functions.</p>
<p>I'm aware of products like <a hr... | <p>1) Keep all your views, triggers, functions, stored procedures, table schemas etc in Source Control and use that as the master.</p>
<p>2) Failing that, use your reference DB as the master and script out views and stored procedures etc: Right click DB, Tasks->Generate Scripts and choose your objects.</p>
<p>3) You ... | <p>I use (and love) the RedGate tools, but when Microsoft announced Visual Studio 2010, they decided to allow MSDN subscribers who get Visual Studio 2008 Team System to also get Visual Studio 2008 Database Edition (which has a schema compare tool).</p>
<p>So if you or your organization has an MSDN subscription, you mi... | 43,561 |
<p>I am seeking a backup tool to back-up virtual OS instances run through Microsoft Virtual Server 2005 R2. According to the <a href="http://technet.microsoft.com/en-us/library/cc720377.aspx" rel="nofollow noreferrer">MS docs</a>, it should be possible to do it <em>live</em> through volume shadow copy service, but I am... | <p>I'm personally fond of using <a href="http://technet.microsoft.com/en-us/library/cc722145.aspx" rel="nofollow noreferrer">ImageX</a> to capture the VHD to a WIM file. (This is called file-based imaging, as opposed to sector-based imaging.) WIMs are sort of like an NTFS-specific compression format. It also has a s... | <p><a href="http://technet.microsoft.com/en-us/library/cc720377.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/library/cc720377.aspx</a>
<a href="http://support.microsoft.com/kb/867590" rel="nofollow noreferrer">http://support.microsoft.com/kb/867590</a></p>
<p>There appear to be a number of ways ... | 21,934 |
<p>I get this error during checkout:</p>
<pre><code>cvs checkout: warning: new-born file.java has disappeared
cvs [checkout aborted]: cannot make directory : No such file or directory
cvs status: cannot rewrite CVS/Entries.Backup: Permission denied
</code></pre>
<p>I'm sure I have the proper permissions to this folde... | <p><code>new-born</code> refers to a file that has been <code>add</code>-ed but not <code>commit</code>-ted yet, or that <code>CVS</code> is having trouble getting the file written locally.</p>
<p>My guess would be that there is a <code>.cvs</code> directory present that records an <code>add</code> but the file has si... | <p>I had a similar error message for a file that used to have ACLs that matched my account but no longer did.</p>
| 41,052 |
<p>I'm working on a project with a rather large Oracle database (although my question applies equally well to other databases). We have a web interface which allows users to search on almost any possible combination of fields.</p>
<p>To make these searches go fast, we're adding indexes to the fields and combinations ... | <p>It depends on the operations that occur on the table.</p>
<p>If there's lots of SELECTs and very few changes, index all you like.... these will (potentially) speed the SELECT statements up.</p>
<p>If the table is heavily hit by UPDATEs, INSERTs + DELETEs ... these will be very slow with lots of indexes since they ... | <p>It is totally based on the columns which are being used in Where Clause.
And as the Thumb of Rule, we must have indexes on Foreign Key Columns to avoid DEADLOCKS.
AWR report should analyze periodically to understand the need of indexes.</p>
| 17,057 |
<p>I'm creating a multi-part web form in ASP.NET that uses Panels for the different steps, making only the Panel for the current step visible. On Step 1, I have a drop-down list that uses a Javascript function to reconfigure some of the fields in the same Panel via "onchange". Obviously, since the client-side script i... | <p>First off, there is <em>no</em> must know about learning PHP and MySQL... You go into it not knowing anything, and you'll come out of it knowing a bunch. If there was a must know, then nobody would be able to get into PHP and MySQL development. I personally think you are at a slight advantage going into this without... | <p>You should know how to use effectively at least one Debugger/IDE. It is amazing what you can learn from your code by stepping through it and watching it run. It both makes it much simpler to track down bugs, and improves the quality of your code. I believe you should never commit code to a project that you haven't s... | 39,427 |
<p>I need a JavaScript library that supports Ajax as well as help me in making simple and neat animation effects <a href="http://www.voidy.com/" rel="nofollow noreferrer">in a website</a> I am working on.</p>
<p>Which library do you recommend?</p>
| <p>I would definitely recommend JQuery as the easiest to use and the one which requires you to write the least code. <a href="http://jquery.com/" rel="nofollow noreferrer">http://jquery.com/</a></p>
| <ol>
<li>If you want to implement some basic animation jQuery is ok.</li>
<li>Also personally I like the prototype.js</li>
<li>For more difficult thing we using some features of Microsoft AJAX client library</li>
</ol>
| 10,401 |
<p>I need a solution to export a dataset to an excel file without any asp code (HttpResonpsne...) but i did not find a good example to do this...</p>
<p>Best thanks in advance</p>
| <p>I've created a class that exports a <code>DataGridView</code> or <code>DataTable</code> to an Excel file. You can probably change it a bit to make it use your <code>DataSet</code> instead (iterating through the <code>DataTables</code> in it). It also does some basic formatting which you could also extend.</p>
<p>To... | <p>Microsoft has a built in solution for Importing/Exporting Excel files. It's not the most straightforward library but it generally works better than the others listed above.</p>
<p>The library required to do this is included in Office and can be found under the list of Framework assemblies at Microsoft.Office.Inter... | 48,900 |
<p>Looking for a column formatting script, I have a feeling this could be a one line awk. Ideally, a small shell script is all I am after.</p>
<p>The data is tab separated, each cell in each row is of variable length, and of course, may have spaces in it.</p>
<p>So we have something like this</p>
<pre>
dasj dhsa... | <p>If you're on a BSD-derived OS (including Mac OS X), column(1) and its -t option might do what you want:</p>
<pre><code>% column -t coltest
dasj dhsahdwe dhasdhajks ewqhehwq dsajkdhas
e dward das dsaw das daswf
fjdk ewf ... | <p>In un-obsfucated Perl:</p>
<pre><code>#!/usr/bin/perl -w
use strict;
my (@data, @length);
while (<>) {
chomp;
my @line = split(/\t/);
foreach my $i (0 .. $#line) {
my $n = length($line[$i]);
$length[$i] = $n if (!defined($length[$i]) || $n > $length[$i]);
}
push(@data,... | 43,202 |
<p>Is there a way to make all your prints seamless?? I know there was this program that printed a vase constantly changing the z axis making it seamless. Why cant this be done with regular prints?</p>
| <p>If you ever seen 3d printouts on your own and you did keep it in hand then you probably felt layers. Most printouts contains 3 main "components"</p>
<ol>
<li>bottom and top component (floor and ceiling)</li>
<li>outline (perimeters)</li>
<li>infill (inside supporting structure)</li>
</ol>
<p>It is almost imposible... | <p>Look into post processing your model with an <a href="http://makezine.com/2014/09/24/smoothing-out-your-3d-prints-with-acetone-vapor/" rel="nofollow">Acetone vapor Bath.</a>. ABS plastic disolves in acetone. if you put your print in a chamber full of acetone vapor, the outer skin will sort of melt, and give you t... | 250 |
<p>I'm using the MessageBox class to show errors to users, and while that might not be the right behavior, it's very convenient. This is a touchscreen application, however, so I need the 'ok' button to be much larger than it is (curse my inordinately large fingers!).</p>
<p>I think that if I increase the font size in... | <p>As far as I'm aware you can't, as the 'normal' dialog boxes are using your default system font settings.</p>
<p>Roll your own is probably the best way forward. It's fairly trivial to do, and much fun! And you can build in things that the standard dialog doesn't support (without PInvoke magic) such as centering in t... | <p>I would create my own MessageBox class for this purpose - BigMessageBox perhaps?.
It would then be a matter of replacing MessageBox.Show with BigMessageBox.Show.</p>
<p>Another alternative is using windows hooks to modify the form - have a look at <a href="https://web.archive.org/web/20091208060754/http://msdn.micr... | 28,725 |
<p>Has anybody got any suggestions for a custom tabcontrol implemented in C# and which adheres to these criteria:</p>
<ul>
<li>Allows the tabs to be placed along the side of the control.</li>
<li>Tab text must read horizontally.</li>
<li>Allow custom colouring.</li>
<li>Open source or no cost.</li>
</ul>
<p>I prefer ... | <p>You probably don't have a need for this anymore but anyone else who stumbles upon it might find it useful. </p>
<p>I found this tabcontrol on CodeProject it is also very easy to Draw your own tabs with it, they even give you a example on the site.</p>
<p><a href="http://www.codeproject.com/KB/miscctrl/yatabcontrol... | <p>The tab control in WPF fulfills all of your requirements. You can override the template and go to town on it.</p>
| 25,850 |
<p>I think most people here understand the importance of fully automated builds.</p>
<p>The problem is one of our project is now using an integrated Visual Studio Setup project (vdproj) and has recently been ported to Visual Studio 2008. Unfortunatly, those won't build in MSBuild and calling devenv.exe /build on 2008 ... | <p>The low cost solution is to switch to using ClickOnce, which you can automate using MSBuild. But if you still need to create a Windows Installer package, you will need to convert your project to WiX (pretty straight foward) and build that with your solution. </p>
<p>This will get you started:
<a href="http://msdn.m... | <p>I had the same requirement and ended up using what is suggested in these two links</p>
<p><a href="http://geekswithblogs.net/davewill/archive/2009/03/02/129787.aspx" rel="nofollow noreferrer">David Williams Blog</a></p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms404859.aspx" rel="nofollow noreferrer">MS... | 2,591 |
<p>A client of mine is looking to convert a critical 'application' based on multiple (very complex) spreadsheets into a web app. As part of this they'd like some of the web pages they use to enter/model data to resemble a spreadsheet as much as possible.</p>
<p>I'd be interested to know if anyone has any experience/r... | <p>I'd say this comes down to data grids.</p>
<p>For Javascript frameworks: Jquery has 'plugins' like <a href="http://trirand.com/jqgrid/jqgrid.html" rel="nofollow noreferrer">this</a>.
Serverside: Telerik has asp.net controls like <a href="http://demos.telerik.com/ASPNET/Prometheus/Grid/Examples/Overview/DefaultCS.as... | <p>I would consider a solution based on google docs/apps or similar and background web services.</p>
| 24,999 |
<p>What is the use of a Dispatcher Object in WPF?</p>
| <p>A dispatcher is often used to invoke calls on another thread. An example would be if you have a background thread working, and you need to update the UI thread, you would need a dispatcher to do it.</p>
| <p>In my experience we use Prism Event Aggregator. When the event happens it calls the <code>Dispatcher.Invoke()</code> to update the UI. This is because <code>only the Dispatcher can update the objects in your UI from a non-UI thread</code>.</p>
<pre><code>public PaginatedObservableCollection<OrderItems> Orders ... | 19,238 |
<p>We are developing a middleware SDK, both in C++ and Java to be used as a library/DLL by, for example, game developers, animation software developers, Avatar developers to enhance their products.</p>
<p>Having created a typical API using specific calls for specific functions I am considering simplifying the API by u... | <p>Yes, this is a feasible idea. But I'm not sure the benefits would justify the costs. REST is best applied to a networked application scenario, oriented around requests and responses. While there are definite learning curve advantages to a uniform interface, those advantages can be present in almost any well-designed... | <p>Remember that REST is not specific to HTTP, and does not rely on just the 4 HTTP verbs. The verbs you have and can use depend on what protocol you're using.</p>
| 8,799 |
<p>If you take over a project from someone to do simple updates do you follow their naming convention? I just received a project where the previous programmer used Hungarian Notation everywhere. Our core product has a naming standard, but we've had a lot of people do custom reporting over the years and do whatever th... | <p>Yes, I do. It makes it easier to follow by the people who inherit it after you. I do try and clean up the code a little to make it more readable if it's really difficult to understand.</p>
| <p>If there's a standard in the existing app, I think it's best to follow it. If there is no standard (tabs and spaces mixed, braces everywhere... oh the horror), then I do what I feel is best and generally run the existing code through a formatting tool (like Vim). I'll always keep the capitalization style, etc of t... | 36,045 |
<p>Is there any way (in Javascript) to download a remote website (i.e. like with Curl), read it into a string variable and further process it?</p>
| <p>You can only download a file from the same domain, as per the <a href="http://en.wikipedia.org/wiki/Same_origin_policy" rel="noreferrer">Same Origin Policy</a>. You can download content from the same domain though, using the XMLHTTPRequest object:</p>
<pre><code> var xhReq = createXMLHttpRequest();
xhReq.open("GET... | <p>You can use the <a href="http://developer.yahoo.com/yql/console/" rel="nofollow noreferrer">Yahoo Query Language</a> to query any page on the web.</p>
<p>For example, if you want the full source of the <a href="http://google.com" rel="nofollow noreferrer">Google</a> homepage, you could use:</p>
<pre><code>select *... | 48,551 |
<p>What are some real world places that call for delegates? I'm curious what situations or patterns are present where this method is the best solution. No code required.</p>
| <p>As stated in <a href="http://msdn.microsoft.com/en-us/library/orm-9780596521066-01-17.aspx" rel="noreferrer">"Learning C# 3.0: Master the fundamentals of C# 3.0"</a></p>
<blockquote>
<p><strong>General Scenario:</strong> When a head of state dies, the President of the United States typically does not hav... | <p>A quick google search came up with this <a href="http://en.wikipedia.org/wiki/Delegation_pattern" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Delegation_pattern</a> . Basically, anytime that you use an object that forwards it's calls to another object then you are delegating.</p>
| 5,145 |
<p>I have a problem (and have been having it for some time now) -- the new sound mixer stack in Vista features new cool things, but also re-invents the wheel. Many applications that used to use Volume Mixer on a Windows system to mix different voiced outputs into one input (for example Wave-out + Line-in --> Stereo Mix... | <p>Controlling the volume levels of a soundcards indivudual input/output levels in Windows Vista mixer is possible using the audio <a href="http://msdn.microsoft.com/en-us/library/ms679162(VS.85).aspx" rel="nofollow noreferrer">EndPoint API</a></p>
<p>This should allow you to adjust the main volume, and the volume of ... | <blockquote>
<p>If you mark your app as running in Windows XP compatibility, then all the old controls and behaviors will come back.</p>
</blockquote>
<p>This is true, but as of Vista SP1 patch KB957388, included in SP2, and with some soundcard drivers, the old mixer API (winmm.dll) functions can hang when the app i... | 9,665 |
<p>Some time back I was working on an algorithm that processed code, and required a reflections API. We were interested in its implementation for multiple languages, but the reflections API for a language would not work for any other language. So is there any thing like a "universal reflections API" that would work for... | <p>I don't believe there is universal Reflection API. Any Reflection API depends on the metadata that the compiler generates for the language constructs and these can vary quite a lot from language to language, even though there is a common subset across multiple languages.</p>
| <p>If you want a universal API, you need to step outside the language. See our <a href="http://www.semanticdesigns.com/Products/DMS/DMSToolkit.html" rel="nofollow">DMS meta-tool</a> for processing arbitrary languages, and answering arbitrary questions, including those you think of as reflection.
(Op asked for support ... | 17,547 |
<p>Let's say I had a program in C# that did something computationally expensive, like encoding a list of WAV files into MP3s. Ordinarily I would encode the files one at a time, but let's say I wanted the program to figure out how many CPU cores I had and spin up an encoding thread on each core. So, when I run the progr... | <p>Don't bother doing that.</p>
<p>Instead use the <a href="http://msdn.microsoft.com/en-us/library/system.threading.threadpool.aspx" rel="noreferrer">Thread Pool</a>. The thread pool is a mechanism (actually a class) of the framework that you can query for a new thread.</p>
<p>When you ask for a new thread it will e... | <p>One of the reasons you should not (as has been said) try to allocated this sort of stuff yourself, is that you just don't have enough information to do it properly, particularly into the future with NUMA, etc. </p>
<p>If you have a thread read-to-run, and there's a core idle, the kernel <em>will</em> run your thr... | 5,226 |
<p>I want to get a list of files in a directory, but I want to sort it such that the oldest files are first. My solution was to call File.listFiles and just resort the list based on File.lastModified, but I was wondering if there was a better way.</p>
<p>Edit: My current solution, as suggested, is to use an anonymous... | <p>I think your solution is the only sensible way. The only way to get the list of files is to use <a href="http://java.sun.com/javase/6/docs/api/java/io/File.html#listFiles()" rel="noreferrer">File.listFiles()</a> and the documentation states that this makes no guarantees about the order of the files returned. There... | <p>There is also a completely different way which may be even easier, as we do not deal with large numbers. </p>
<p>Instead of sorting the whole array after you retrieved all filenames and lastModified dates, you can just insert every single filename just after you retrieved it at the right position of the list.</p>
... | 24,832 |
<p>For the computer game I'm making, I obviously want to play sound. So far, I've been using AudioClip to play WAV files. While this approach works fine, the WAV files tend to be gigantic. A few seconds of sound end up being hundreds of kB. I'm faced with having a game download that's 95% audio!</p>
<p>The obvious opt... | <p>You could use <a href="http://www.jcraft.com/jorbis/" rel="nofollow noreferrer">JOrbis</a> library to play back OGG music. For working sample usage you can look at these files <a href="http://code.google.com/p/open-ig/source/browse/#svn/trunk/open-ig/src/hu/openig/music" rel="nofollow noreferrer">here</a>.</p>
<p>I... | <p>These may be outdated, but they are officially recognized by the Xiph.org team (who maintain Ogg and Vorbis, among others).
<a href="http://www.vorbis.com/software/#java" rel="nofollow noreferrer">http://www.vorbis.com/software/#java</a></p>
| 30,300 |
<p><a href="http://en.wikipedia.org/wiki/Procedural_generation" rel="noreferrer">Procedural generation</a> has been brought into the spotlight recently (by Spore, MMOs, etc), and it seems like an interesting/powerful programming technique.<br /><br />
My questions are these:</p>
<ul>
<li>Do you know of any mid-sized p... | <p>You should probably start with a little theory and simple examples such as the <a href="https://web.archive.org/web/20170812230846/http://www.gameprogrammer.com/fractal.html" rel="noreferrer">midpoint displacement algorithm</a>. You should also learn a little about <a href="http://en.wikipedia.org/wiki/Perlin_noise"... | <p>Answering "Do you know of any mid-sized projects that utilize procedural generation techniques?" - the Wilder World project is a Web3, virtual world being created that utilizes procedural generation techniques to create the NFT assets and I believe the virtual world which will be created using UnReal Engin... | 18,746 |
<p>My company is considering offering a lightweight mobile web site for data entry in the field (we already have a thick-client mobile application). One hard requirement is that we must be able to capture a signature.</p>
<p><strong>Is there any prior art for capturing a signature, specifically inside a web page runn... | <p>There is a jQuery plugin to do this now -> <s><a href="http://thomasjbradley.ca/lab/signature-pad" rel="nofollow noreferrer">http://thomasjbradley.ca/lab/signature-pad</a></s></p>
<p>The previous link is inactive as of March 17, 2016, but the relevant repository is on GitHub: <a href="https://github.com/thomasjbrad... | <p>I don't think this is even technically possible if you're talking about having it work on a wide array of mobile browers. Most phones can at least email a picture pretty easily so you could always send it to some account where the attachments are dumped somewhere. Still, you would have to manually type in some ident... | 16,294 |
<p>I'm currently writing an object dumper (allowing different dumping strategies).</p>
<p>Of course, I would like to write unit tests to verify that what I will develop will match all the features that I expect.</p>
<p>However, I cannot imagine how I will perform the testing on this solution.
I have thought about cre... | <p>Why would you explicitly care how many times the properties have been accessed etc? I'd just test that the output matched expectations. If there's some reason to have one particular strategy (e.g. fields instead of properties) then there's likely to be an easy way of testing that (e.g. make the property return a cap... | <p>You just have to test the value dumped is the value that was assigned to the properties/public field. Just ensure to assign a different value to each property/field. </p>
| 39,844 |
<p>Is there a unicode debug visualizer in Visual Studio 2008? I have a xml file that I'm pretty sure is in unicode. When I open it in wordpad, it shows the japanese characters correctly. When I read the file into a string using File.ReadAllText (UTF8), all the japanese characters show up as blocks in the string visuali... | <p>If you're getting square blocks, rather than complete garbage, you probably just need to specify a more suitable font in Visual Studio (in Tools | Options | Fonts and Colors). Try MS Gothic or MS Mincho (both Japanese fonts); I am guessing your issue can be resolved by tweaking the settings for [Watch, Locals and Au... | <p>You say it's <strong>Unicode</strong>, so why not use File.ReadAllText(<strong>Encoding.Unicode</strong>) then?</p>
| 10,766 |
<p>A while ago I came across some code that marked a member variable of a class with the <code>mutable</code> keyword. As far as I can see it simply allows you to modify a variable in a <code>const</code> method:</p>
<pre><code>class Foo
{
private:
mutable bool done_;
public:
void doSomething() cons... | <p>It allows the differentiation of bitwise const and logical const. Logical const is when an object doesn't change in a way that is visible through the public interface, like your locking example. Another example would be a class that computes a value the first time it is requested, and caches the result. </p>
<p>S... | <p>The very keyword 'mutable' is actually a reserved keyword.often it is used to vary the value of constant variable.If you want to have multiple values of a constsnt,use the keyword mutable.</p>
<pre><code>//Prototype
class tag_name{
:
:
mutable var_name;
... | 13,063 |
<p>Is there some built-in way to share files between Xen guests? I don't currently need to share the actual images, just some data files.</p>
| <p>Do you mean between Xen and the host or between different guests?</p>
<p>If guests, I don't think there is something provided but you should probably use NFS as it is the best supported file system that supports a decent number of permissions and attributes but assumes a trusted network.</p>
| <p>You can also try <a href="http://www.gluster.org/docs/index.php/Main_Page" rel="nofollow noreferrer">glusterfs</a> or <a href="http://wiki.lustre.org/index.php?title=Main_Page" rel="nofollow noreferrer">lustre</a> to share files between Xen guests.</p>
| 11,008 |
<p>I want to implement in Java a class for handling graph data structures. I have a Node class and an Edge class. The Graph class maintains two list: a list of nodes and a list of edges. Each node must have an unique name. How do I guard against a situation like this:
</p>
<pre><code>Graph g = new Graph();
Node n1 = ... | <p>I work with graph structures in Java a lot, and my advice would be to make any data member of the Node and Edge class that the Graph depends on for maintaining its structure final, with no setters. In fact, if you can, I would make Node and Edge completely immutable, which has <a href="http://www.javapractices.com/t... | <p>In addition to the comments by @jhkiley.blogspot.com, you can create a factory for Edges and Nodes that refuses to create objects with a name that was already used.</p>
| 8,914 |
<p>I'd like to set up a cheap Linux box as a web server to host a variety of web technologies (PHP & Java EE come to mind, but I'd like to experiment with Ruby or Python in the future as well). </p>
<p>I'm fairly versed in setting up Tomcat to run on Linux for serving up Java EE applications, but I'd like to be ab... | <p>This article has some of the best ways to lock things down:</p>
<p><a href="http://www.petefreitag.com/item/505.cfm" rel="noreferrer">http://www.petefreitag.com/item/505.cfm</a></p>
<p>Some highlights:</p>
<ul>
<li>Make sure no one can browse the directories</li>
<li>Make sure only root has write privileges to ev... | <p>There are plenty of ways to do this that will work just fine. I would usually jsut use a .htaccess file. Quick to set up and secure <em>enough</em> . Probably not the best option but it works for me. I wouldn't put my credit card numbers behind it but other than that I dont really care.</p>
| 2,706 |
<p>Is there a method for controlling the Balance of the Wave output that will work on both XP and Vista?</p>
| <p>Vista has a new api for everything related to mixers and audio, per process legacy api's should still work, but to change global volume, you would have to look at the new COM interfaces added to Vista</p>
<p><a href="http://www.codeproject.com/KB/vista/CoreAudio.aspx" rel="nofollow noreferrer">This</a> should get y... | <p>have you looked at this?</p>
<blockquote>
<p>waveOutSetVolume</p>
<p>The waveOutSetVolume function sets the
volume level of the specified
waveform-audio output device.</p>
</blockquote>
<p>It uses Winmm.lib.
<a href="http://msdn.microsoft.com/en-us/library/ms713762.aspx" rel="nofollow noreferrer">http:... | 12,001 |
<p>I would like to get the path to the execution directory of a Windows Forms application. (That is, the directory in which the executable is located.)</p>
<p>Does anyone know of a built-in method in .NET to do this?</p>
| <p>Application.Current results in an appdomain
<a href="http://msdn.microsoft.com/en-us/library/system.appdomain_members.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.appdomain_members.aspx</a></p>
<p>Also this should give you the location of the assembly</p>
<pre><code>AppDomain.CurrentDomain... | <pre><code>Private Sub Main_Shown(sender As Object, e As EventArgs) Handles Me.Shown
Dim args() As String = Environment.GetCommandLineArgs()
If args.Length > 0 Then
TextBox1.Text = Path.GetFullPath(Application.ExecutablePath)
Process.Start(TextBox1.Text)
End If
End Sub
</code></pre>
| 37,798 |
<p>There are several ways to do burn down charts in Scrum.</p>
<p>Some people suggest using the story points of unfinished stories left as your burn down charts in Scrum.</p>
<p><strong>Pro</strong>: Only finished stories lower the chart</p>
<p><strong>Contra</strong>: Chart doesn't move down in the beginning and th... | <p>We are using <strong>remainig time for sprint burndown</strong> - teams can see progress every day. If there are flat parts, than they really occured.</p>
<p>In the <strong>release burndown</strong> we are using <strong>story points</strong>. Release planning is more about he feature completness, the time is tracke... | <p>We use tasks because it provides so much more granularity. Graphing only the completion of stories (which we do 5-10 per two-week sprint) will only show a change every day or two and, as you mention, won't move much at all during the beginning of the sprint.</p>
<p>Another useful thing my team has found is using a... | 48,257 |
<p>Does anyone ever found/used an ASP.NET application similar to Joomla?<br />
I need to set up a quick and dirty CMS on a Windows Server and our client doesn't want us to use something else than ASP.NET.<br /></p>
| <p>I've been told by a friend that <a href="http://www.umbraco.org/" rel="nofollow noreferrer">Umbraco</a> is everything you would ever want in a CMS (and it was in the list that Nathan included in his answer). This recommendation is coming from a guy who's built several CMS solutions over the years and after taking a ... | <p>Did you Look at DotNetNuke (<a href="http://www.dotnetnuke.com/" rel="nofollow noreferrer">http://www.dotnetnuke.com/</a>) Its seems to be a good Systems to Start off as a base , But I doubt I could call it a Full CMS ? (Upto the users to decide)</p>
| 2,703 |
<p>I will be teaching a class sson, and I need to explain what factors should affect your decision of data access technology.
I am familiar with many data access methods like Typed Data Sets, Linq to SQL, Linq to Entities, .netTiers, LLBLGen, and custom calls with SQL connection objects and command objects.
Some of my... | <p>Like with all choice's in a software project : It depends...
But in my opinion the most important factor is the environment of the project.</p>
<p>This consists of (I don't claim that this list is complete in anyway):</p>
<ul>
<li>Available skills within development team AND maintenance team (if different)</li>
<l... | <p>I'm really only thinking of two things. The first is whether I going to have so much data that anything else matters. If you're not putting millions of rows into the tables, it probably doesn't matter which technology you're going to use because they'll all work fast enough. </p>
<p>The second thing is whether I ca... | 24,553 |
<p>If I set the platform flags of MyApp.exe to be x64
I still can run the corflags utilty like this:<br>
corflags /32bit+ MyApp.exe<br>
corflags will happily set the 32bit flag to 1.
Of course when I'll try to run the application I'll get an error:
0xC000007B = <code>STATUS_INVALID_IMAGE_FORMAT</code> </p>
<p>My ... | <p>Compiling your binary by setting the "Platform Type" to x64 also changes the image PE header to make it 64 bits only. You can see this by using the <a href="http://www.dependencywalker.com/" rel="nofollow noreferrer">Dependency Walker</a>, for instance.</p>
<p>Having a 64Bits PE header does seem to take precedence ... | <p>Because if you don't load a native DLL, there's no reason that you <em>couldn't</em> remark it as 32-bit. If it's pure MSIL, the decision doesn't mean as much.</p>
| 40,098 |
<p>Whenever I list the contents of a directory with a function like readdir, the returned file names also include "." and "..". I have the suspicion that these are just normal links in the file system and therefore indistinguishable from actual files, but I always have to filter them out because they are not actual obj... | <p><code>.</code> and <code>..</code> are actually hard links in filesystems. They are needed so that you can specify relative paths, based on some reference path (consider <code>"../sibling/file.txt"</code>). Since these hard links are actually existing in the filesystem, it makes sense for <code>readdir</code> to tel... | <p>there is no good reason a directory scan should return these filenames.</p>
| 41,768 |
<p>I am inputting a 200mb file in my application and due to a very strange reason the memory usage of my application is more than 600mb. I have tried vector and deque, as well as std::string and char * with no avail. I need the memory usage of my application to be almost the same as the file I am reading, any suggestio... | <p>Your memory is being fragmented.</p>
<p>Try something like this :</p>
<pre><code> HANDLE heaps[1025];
DWORD nheaps = GetProcessHeaps((sizeof(heaps) / sizeof(HANDLE)) - 1, heaps);
for (DWORD i = 0; i < nheaps; ++i)
{
ULONG HeapFragValue = 2;
HeapSetInformation(heaps[i],
H... | <p>Growing vectors by pushBack() will cause memory fragmentation and inefficient memory usage. I'd try using lists instead, and only creating a vector (if you need one) when you know exactly how many elements it will require.</p>
| 46,579 |
<p>We have recently been faced with the problem of porting our C++ framework to an ARM platform running uClinux where the only vendor supported compiler is GCC 2.95.3. The problem we have run into is that exceptions are extremely unreliable causing everything from not being caught at all to being caught by an unrelated... | <p>Generally you end up with code like this for objects on the stack:</p>
<pre><code>MyClassWithNoThrowConstructor foo;
if (foo.init(bar, baz, etc) != 0) {
// error-handling code
} else {
// phew, we got away with it. Now for the next object...
}
</code></pre>
<p>And this for objects on the heap. I assume you... | <p>If a constructor is only doing trivial things like initializing POD variables (and calling other trivial constructors implicitly), then it can't possibly fail. See the <a href="http://yosefk.com/c++fqa/ctors.html#fqa-10.17" rel="nofollow noreferrer">C++ FQA</a>; see also <a href="http://yosefk.com/c++fqa/exceptions... | 43,368 |
<p>I have a long "binary string" like the output of PHPs pack function.</p>
<p>How can I convert this value to base62 (0-9a-zA-Z)?
The built in maths functions overflow with such long inputs, and BCmath doesn't have a base_convert function, or anything that specific. I would also need a matching "pack base62" function... | <p>I think there is a misunderstanding behind this question. Base conversion and encoding/decoding are <strong>different</strong>. The output of <code>base64_encode(...)</code> is <strong><em>not</em></strong> a large base64-number. It's a series of discrete base64 values, corresponding to the compression function. Tha... | <p>Unless you really, really have to have base62, why not go for:</p>
<pre><code>base64_encode()
base64_decode()
</code></pre>
<p>The only other added characters are "+" and "=", and it's a very well-known method to pack and unpack binary strings with available functions in many other languages.</p>
| 45,889 |
<p>Has anyone tried the steel-reinforced polyurethane timing belts? If so, how do they compare to the rubber ones?</p>
| <p>Belts come in several formulations. This <a href="https://www.mcmaster.com/#belts/=1e9qsqj" rel="noreferrer">page</a> from McMaster-Carr lists several types of belts. The main materials (rubbers) are Neoprene and urethane, with fiberglass, Kevlar, and steel reinforcement. I would suggest spending some time lookin... | <p>I had really bad problems with GT2 PU belts (including steel reinforced), under big tension they degrade suddenly with big change in the geometry at some position. When removed they look twisted. Looks like some reinforcing wires slipped inside the PU body of the belt.</p>
<p>Once switched to rubber GT2 belts (fibre... | 1,007 |
<p>We have a situation in our product where for a long time some data has been stored in the application's database as SQL string (choice of MS SQL server or sybase SQL anywhere) which was encrypted via the Windows API function <a href="http://msdn.microsoft.com/en-us/library/aa379924.aspx" rel="nofollow noreferrer">Cr... | <p>Any semi-decent algorithm will end up with a strong chance of generating a NULL value somewhere in the resulting ciphertext.</p>
<p>Why not do something like <a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">base-64 encode</a> your resulting binary blob before persisting to the DB? (<a href="h... | <p>That's an interesting route OJ.
We're looking at the feasability of a non-reversable method (still making sure we don't explicitly retrieve the data to decrypt) e.g. just store a Hash to compare on a submission</p>
| 3,825 |
<p>first off, I know that this question could be borderline-duplicate <a href="https://stackoverflow.com/questions/1683/">to this one</a>, and yes, it is a bit ironic that I am asking a question for something that I even answered myself.</p>
<p>Now, I am talking about ASP.net Profiles. I am building an application usi... | <p>I'm not experienced writing my own profile provider, but I have written my own membership provider. It's relatively easy (there are plenty of methods that you <em>don't</em> need to implement). In fact the only methods that seem really required are the GetUser() and ValidateUser() methods.</p>
<p>The only part that... | <p>To be able to answer the question of what to do, you need to sit down and firgure out exactly what all the features and requirements your authentication and profile model requires and then look at what the built in .net stuff offers. Only once you have a list of requirements will you be able to accurately evaluate w... | 35,793 |
<p>In a normal web app w/ login and secure data, what is an easy way to secure that data and prevent it from being seen by using the browser's back button, once a user logs out? </p>
| <p><a href="http://www.mnot.net/cache_docs/" rel="nofollow noreferrer">Here's a useful browser caching guide</a>.</p>
<p>You want to set the cache-control and expiration date headers (setting a date in the past), e.g.</p>
<pre><code> Cache-Control: no-cache
Expires: Fri, 31 Dec 1998 12:00:00 GMT
</code></pre>
| <p>Depends on your login solution (SSO - Windows Live / OpenID vs homegrown, where login info is stored, etc)... Since 'back' doesn't generally request the page again, I'd suggest clearing the forms in JavaScript (OnLoad). On the server side, you can then populate them (Page_Load). Clear your session and viewstate upo... | 25,911 |
<p>I have a desktop app that needs to send data to a MySQL Server. The app will be for internal company use, but the MySQL is on a server at a hosting company.</p>
<p>The data will need to be massaged a bit before being inserted and standard simple insert, delete and update.</p>
<p>Which should I use PHP or Perl?</p>... | <p>Perl's <a href="http://search.cpan.org/~timb/DBI-1.607/DBI.pm" rel="nofollow noreferrer">DBI</a> module is very powerful and makes it easy to avoid SQL injection attacks through the use of bound parameters. See 'perldoc DBI' for details on the use of placeholders in SQL statements. Protecting the username/password... | <p><strong>Can Perl work with MySQL easily?</strong></p>
<p>Yes, LAMP used to be Linux, Apache, MySQL and Perl. Amateurs use PHP instead :-P. More seriously PHP has got much better over the last few years, but Perl is more mature so use it if you can do so without compromising delivery deadlines.</p>
<p><strong>The P... | 45,159 |
<p>We have a Windows Server Web Edition 2003 Web Farm. </p>
<p>What can we use that handles replication across the servers for:</p>
<p>Content & IIS Configuration (App Pools, Virtual Directories, etc...)</p>
<p>We will be moving to Windows 2008 in the near future, so I guess what options are there on Windows 200... | <p>A short list might be:</p>
<ul>
<li>Avoid memory leaks through use shared pointers to manage memory allocation and cleanup</li>
<li>Use the <a href="https://en.wikipedia.org/wiki/Resource_Acquisition_Is_Initialization" rel="noreferrer">Resource Acquisition Is Initialization</a> (RAII) idiom to manage resource clean... | <pre><code>#include <boost/shared_ptr.hpp>
class A {
public:
void nuke() {
boost::shared_ptr<A> (this);
}
};
int main(int argc, char** argv) {
A a;
a.nuke();
return(0);
}
</code></pre>
| 5,030 |
<p>This is the css for setting the color for h1 text that is linked:</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-css lang-css prettyprint-override"><code>.nav-left h1 a,
a:visited {
color: #055830;
}</co... | <p>What about:</p>
<pre><code>.nav-left h1 a:visited{
color:#055830;
}
</code></pre>
| <pre><code>.nav-left h1 a {
color: #055830;
}
</code></pre>
<p>You don't need to add a:visited if it is the same color.</p>
| 30,341 |
<p>Is the a VS2005 C++ compiler flag like the Xmx???M java flag so I can limit the heap size of my application running on Windows. </p>
<p>I need to limit the heap size so I can fill the memory to find out the current free memory. (The code also runs on an embedded system where this is the best method to get the memor... | <p>You might want to look into whether the gflags utility (in the Windows Debugging Tools) can do this. It can do a lot of other interesting things with the heap of native applications.</p>
| <p>The heap size depends on the allocator used. There might also be some Windows API call that limits the amount of memory a process can allocate, but I'm not aware of one and I don't feel like looking for it right now, sorry. But in general, if you write your own allocator (maybe just wrap around the compiler-provided... | 12,359 |
<p>I've always wondered this - why can't you declare variables after a case label in a switch statement? In C++ you can declare variables pretty much anywhere (and declaring them close to first use is obviously a good thing) but the following still won't work:</p>
<pre><code>switch (val)
{
case VAL:
// This w... | <p><code>Case</code> statements are only <strong>labels</strong>. This means the compiler will interpret this as a jump directly to the label. In C++, the problem here is one of scope. Your curly brackets define the scope as everything inside the <code>switch</code> statement. This means that you are left with a scope ... | <p>I believe the issue at hand is that is the statement was skipped, and you tried to use the var elsewhere, it wouldn't be declared.</p>
| 11,780 |
<p>I need a create a specific type of file in OS X. It needs resources in a specific way. Currently, the only way I can find to do this is in AppleScript with an OSAX. This is slow, about 1 second round trip to run, since the OSAX must open, load, do it's job, and quit. I have explored doing it in C, but that would... | <p>Have you had a look at REALbasic? That makes it much easier than C to program something like this. You won't get that for free, though.</p>
<p>Otherwise, explain more what languages you can use. You're talking of an app you're distributing - is that app's job only to create this file out of the blue?</p>
<p>Also, ... | <p>yes, Real Basic can do this. In a nutshell, I use an oddball email server, and in order for it to take an email from the command line, I have to build a text file in a certain way, then move it to a certain folder, and the email will be delivered. The developer seems to like the resource forks, and that probably w... | 45,156 |
<p>I cannot add workflow item to my WPF project.</p>
<p>I create a new WPF project and want to add a sequential workflow. When I do "Add new item" there is no item template to select.</p>
<p>Any hints?</p>
| <p>I don't think you can simply add a workflow to a WPF project. You need to create a WF project and build your workflow in that, then reference the WF project. </p>
| <p>Rather create a Workflow Library and access it from your WPF application?</p>
<p>Check out <a href="http://www.codeplex.com/DinnerNow" rel="nofollow noreferrer">DinnerNow</a> sample app... thy use it!</p>
| 22,656 |
<p>I was looking into sorting tables by a column designated given some input, and from what I've found, there is no easy way to do this. The best I've found is a switch statement: </p>
<pre><code>SELECT Column1, Column2, Column3, Column4
FROM Table
ORDER BY CASE WHEN @OrderBY = 'Column1' THEN Column1
WH... | <p>You have two choices:</p>
<ol>
<li><p>As you have implemented above</p></li>
<li><p>Or generate dynamic sql and execute
using <code>sp_executesql</code></p></li>
</ol>
| <p>In this case, unless you have an extremely large dataset and you need to leverage the power of the database server (thin client, weak client machine, etc), it is best to sort within the client.</p>
| 20,477 |
<p>I have a third party .NET Assembly and a large Java application. I need to call mothods provided by the .NET class library from the Java application. The assembly is not COM-enabled.
I have searched the net and so far i have the following:</p>
<p>C# code (cslib.cs):</p>
<pre><code>using System;
namespace CSLib
{
... | <p>OK, the mystery is solved. </p>
<p>The JVM crash is caused by unhandled System.IO.FileNotFoundException. The exception is thrown because the .NET assembly is searched in the folder where the calling exe file resides. </p>
<ol>
<li>The mscorlib.dll is in the Global Assembly Cache, so it works. </li>
<li>The CPP app... | <p>I was so glad to find this article since I got stuck and had exactly that problem.
I want to contribute some code, which helps to overcome this problem.
In your Java constructor call the init method, which adds the resolve event.
My experience it is necessary to call init NOT just before the call into your library i... | 16,749 |
<p>How do you page through a collection in LINQ given that you have a <code>startIndex</code> and a <code>count</code>?</p>
| <p>A few months back I wrote a blog post about Fluent Interfaces and LINQ which used an Extension Method on <code>IQueryable<T></code> and another class to provide the following natural way of paginating a LINQ collection.</p>
<pre><code>var query = from i in ideas
select i;
var pagedCollection = qu... | <p>This question is somewhat old, but I wanted to post my paging algorithm that shows the whole procedure (including user interaction).</p>
<pre><code>const int pageSize = 10;
const int count = 100;
const int startIndex = 20;
int took = 0;
bool getNextPage;
var page = ideas.Skip(startIndex);
do
{
Console.WriteLi... | 2,247 |
<p>In a UNIX shell script, what can I use to convert decimal numbers into hexadecimal? I thought od would do the trick, but it's not realizing I'm feeding it ASCII representations of numbers.</p>
<p>printf? Gross! Using it for now, but what else is available?</p>
| <p>Tried <code>printf(1)</code>?</p>
<pre><code>printf "%x\n" 34
22
</code></pre>
<p>There are probably ways of doing that with builtin functions in all shells but it would be less portable. I've not checked the POSIX sh specs to see whether it has such capabilities.</p>
| <p>Wow, I didn't realize that printf was available at the shell!</p>
<p>With that said, I'm surprised no-one commented about putting the printf into a shell script (which then you could put in your personal bin directory if you wanted).</p>
<p>echo "printf "0x%x\n" $1" > hex
chmod +x hex</p>
<p>N... | 49,624 |
<p>Suppose you're maintaining an API that was originally released years ago (before java gained <code>enum</code> support) and it defines a class with enumeration values as ints:</p>
<pre><code>public class VitaminType {
public static final int RETINOL = 0;
public static final int THIAMIN = 1;
public static final i... | <p>Personal opinion is that it's probably not worth the effort of trying to convert. For one thing, the "public static final int" idiom isn't going away any time soon, given that it's sprinkled liberally all over the JDK. For another, tracking down usages of the original ints is likely to be really unpleasant, given t... | <p>The best would be if you could just fix the published versions, if possible. In my opinion consistency would be the best solution, so you would need to do some refactoring. I personally don't like deprecated things, because they get into way. You might be able to wait until a bigger version release and use those int... | 44,306 |
<p>I have inherited a VB6/Access application that we have developed and sold for many years. We're going to SQL Server 2005 Express Edition and .Net.</p>
<p>The application can be multi-user. Currently the setup is simple for the customer -- Navigate to the folder to create the database on first launch; second use... | <p>A deployment project from Visual Studio allows you to install a SQL Server Express instance with ease.</p>
<p>We have the same kind of scenario for our applications and it means you do need separate installations for the client and server.</p>
<p>Our server installation deals with either installing a new SQL Serve... | <p>Since you're still considering going to SQLExpress, has your group considered <a href="http://www.sqlite.org/" rel="nofollow noreferrer">SQLite</a>? You can still have the database functionality you require without having to install an engine on the client's system.</p>
| 12,248 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.