instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>The VSTO bit I understand. Visual Studio has the project templates to get you started with creating nice .NET based add-ins.</p>
<p>But where is VSTA? I installed the SDK but it seems to be gears towards adding extensibility to your own applications.</p>
<p>I had thought that VSTA was like the new VBA for Office ... | <p>As I understand it, VSTA is not a 'new VBA' nor built into Office 2007, but a separate 'Super-VBA with .NET' that must be licensed from Summit, and distributed as part of an external application. I think it's just targeted at ISVs wishing to extend Office, but the blurb about it also contains this gem:</p>
<blockq... | <p>If I understand correctly, VSTA is a new technology that provides a "standard" short-cut route to extensibility for application vendors. So it may appear in Office apps in the future or it may not, but it's not there now.</p>
<p>If it becomes supported by Excel, Word and the like, then the UI (Visual Studio Shell?)... | 32,080 |
<p>I'm currently running mongrel clusters with monit watching over them for 8 Rails applications on one server.</p>
<p>I'd like to move 7 of these applications to mod_rails, with one remaining on mongrel. The 7 smaller applications are low-volume, while the one I'd like to remain on mongrel is a high volume, app.</p>
... | <p>I would probably just move all the apps to mod_rails, as the performance seems comparable to Mongrel and there's less administration overhead.</p>
<p>With regards to configuration gotchas, just make sure that you allow your public directory, or you'll find static assets failing:</p>
<pre><code><Directory "/var/... | <p>Ended up moving everything to mod_rails.</p>
<p>Works like a champ!</p>
| 13,576 |
<p>I know that in the end it, can't be done.</p>
<p>But, what are the options to: </p>
<p> a) limit the options for persons to create multiple accounts,<br>
b) increase the chance of detecting multiple accounts / person </p>
<p>for a blog-like web service?<br>
(people can sign up for their own blog)</... | <p>I'm assuming you're talking about a free service? I can't think of any ways that don't either have serious drawbacks or would be trivial to defeat. Things like setting a cookie, requiring a unique e-mail address are easy to defeat.</p>
<p>Requiring a unique IP address is not foolproof but might work to some degree,... | <p>One common option is to verify the persons identity through their e-mail. Actually make them respond to an e-mail sent to their account. Some sites take this a step further and don't allow addresses from domains such as yahoo, g-mail, hotmail, etc ...</p>
| 20,535 |
<p>I have a form whose controls I want to enable/disable depending on the values in a ComboBox control. This ComboBox control is linked, like all the other controls in the form, to a table. Inside the ComboBox's Change event, I placed the code that enables/disables the other controls.</p>
<p>The problem I have is th... | <p>Most Access control events are not triggered by programmatic changes to the control. You may wish to call the code to enable the control(s) from the load event of the form.</p>
<p>You do not mention the version of Access that you are using, but I do not believe that any version has a Recordset property for combobox... | <p>Can you explain what type of combobox you have and what you want to do, please? For example, have you an unbound combobox that is used to find records for your form, or have you a bound combobox that is used to update fields in a table? This is controlled by the RowSource and ControlSource properties, Comboboxes do ... | 34,207 |
<p>I can't seem to find the _findfirst / findfirst, _findnext / findnext API on gcc for Linux, and would actually rather use the Standard Template Library (STL) for that if it is included there.</p>
<p>Does anyone know what API there is available for listing files in a directory under Linux for C++ (gcc)?</p>
| <p>Check out the <a href="http://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/index.htm" rel="noreferrer">Boost.Filesystem</a> library.</p>
<p>In particular, the <a href="http://www.boost.org/doc/libs/1_36_0/libs/filesystem/doc/reference.html#Class-template-basic_directory_iterator" rel="noreferrer">basic_directo... | <p>The STL does not, yet, have functions for listing files in a directory. But it does have functions for opening files you are already aware of.</p>
<p>Aside from Boost.Filesystem, there is also <a href="http://stlsoft.org" rel="nofollow noreferrer">STLSoft</a></p>
| 29,145 |
<p>I find that quite often Visual Studio memory usage will average ~150-300 MB of RAM.</p>
<p>As a developer who very often needs to run with multiple instances of Visual Studio open, are there any performance tricks to optimize the amount of memory that VS uses?</p>
<p>I am running VS 2005 with one add-in (TFS)</p>
| <p>From <a href="https://web.archive.org/web/20160817172313/http://geekswithblogs.net:80/sdorman/archive/2008/08/28/visual-studio-optimizations.aspx" rel="nofollow noreferrer">this blog post</a>:</p>
<blockquote>
<p>[...]<br />
These changes are all available from the Options dialog (Tools –> Options):</p>
<p><stron... | <p>By uninstalling (and re-installing) Visual Assist the problem got solved for me.</p>
| 20,328 |
<p>I'm trying to get all property names / values from an Outlook item. I have custom properties in addition to the default outlook item properties. I'm using redemption to get around the Outlook warnings but I'm having some problems with the GetNamesFromIDs method on a Redemption.RDOMail Item....</p>
<p>I'm using my r... | <p>Ruby on Rails will do simple CRUD operations <strong>very</strong> easily - although doing more than that can be a little more complex (would require some reading about RoR's way of doing things). The latest version of Rails automatically uses sqlite databases, and in fact the whole database, and CRUD GUI code can b... | <p>C# and WPF, it;s preatty easy and good to know (I've been playing with it for 1 week and fully wrote a twitter client in a few hours.</p>
<p>now Cocoa, and the interface Builder, that is a cool approach even for a simple app.</p>
| 31,185 |
<p>I am using MVC architecture for a GUI application. The model class has some C functions. One of the C functions calls some methods of Objective-C class. I call those methods using an object of that class. The strange thing happening is that methods previously to the an xyz method are called perfectly but when that x... | <p>As Marc points out, you're probably using a reference to the OBJC object that is un-initialised outside the objective-c scope.</p>
<p>Here's a working sample of C code calling an ObjC object's method:</p>
<pre><code>#import <Cocoa/Cocoa.h>
id refToSelf;
@interface SomeClass: NSObject
@end
@implementation ... | <p>There's a simple way to do this:</p>
<pre><code>@implementation
// Define a object
ClassName *thisClass;
</code></pre>
<p>and then init with self</p>
<pre><code>thisClass = self;
</code></pre>
<p>You can use any var and methods in C-Method</p>
| 39,201 |
<p>I have a fairly standards compliant XHTML+CSS site that looks great on all browsers on PC and Mac. The other day I saw it on FF3 on Linux and the letter spacing was slightly larger, throwing everything out of whack and causing unwanted wrapping and clipping of text. The CSS in question has</p>
<pre><code>font-size:... | <p>A List Apart has a pretty <a href="http://www.alistapart.com/articles/howtosizetextincss" rel="nofollow noreferrer">comprehensive article on sizing fonts in CSS</a>. Their conclusion is to use "<code>ems</code>" to size text, since it generally gives the most consistent sizing across browsers. They make no direct me... | <p>I find the easiest way to solve font sizing problems between browsers is to simply leave room for error. Make divs slightly larger or fonts slightly smaller so that platform variation doesn't change wrapping or clipping considerably.</p>
| 6,977 |
<p>I am writing a webpage in C# .NET. In javascript there is a function called GetElementsByTagName... this is nice for javascript invoked from the .aspx page. My question is, is there any way I can have this kind of functionality from my C# code-behind?</p>
<p>--</p>
<p>The scenario for those curious: I used an a... | <p>FindControl(), or iterate through the controls on the page...</p>
<pre><code>For each ctl as Control in Me.Controls
If ctl.Name = whatYouWant Then
do stuff
Next 'ctl
</code></pre>
<p>--If you are creating the controls, you should be setting their ID's </p>
<pre><code>Dim ctl as New Control()
ctl.ID = "blah1... | <p>Whenever you do any postback, <em>everything</em> is recreated, including your databound controls. </p>
<p>If your list is gone, so are the button controls. Unless, of course, you've recreated them, and in that case you should have recreated the list as well.</p>
| 15,732 |
<p>I'm writing a web application that will have "plugins". The plugins will be .DLL files which will export their functionality through predefined interfaces 'n stuff. All the .DLL files are in a folder called "Plugins", and the ASP.NET application loads them all upon startup (by using Assembly.LoadFrom).</p>
<p>The p... | <p>IF the plugins directory is under your Bin directory, the web app will automatically be restarted when anything changes.</p>
| <p>The <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx" rel="nofollow noreferrer">FileSystemWatcher</a> class is a general solution to these kind of problems, and <code>HttpRuntime.UnloadAppDomain();</code> is one way to restart your app. I think more research/explanation is required: ... | 42,800 |
<p>Out of the box SSRS reports cannot have data exposed in the page header. Is there a way to get this data to show?</p>
| <p>One of the things I want in my reports is to have nice headers for my reports. I like to have a logo and the user's report parameters along with other data to show to give more information for the business needs the report needs to clarify. One of the things that Microsoft SQL Server 2005 Reporting Services cannot... | <p>Here are two possible <strong>workarounds</strong>:</p>
<ol>
<li><p>You can place the databound field within the body of the report as a hidden textbox, and then in the header place another textbox with it's value pointed at the the one hidden within the body.</p></li>
<li><p>Try using report parameters to store th... | 8,940 |
<p>The title pretty much says it all. I'm using a TClientDataset to store an array of objects, and one of the objects has a member defined as a <strong>set of</strong> an enumerated type. As I understand it, Delphi sets are bitfields whose size can vary from 1 to 32 bytes depending on how much data they contain, and D... | <p>You could use a TBytesField or a TBlobField</p>
<p>ClientDataSet1MySet: TBytesField, Size=32</p>
<pre><code>var
MySet: set of Byte;
Bytes: array of Byte;
begin
MySet := [1, 2, 4, 8, 16];
// Write
Assert(ClientDataSet1MySet.DataSize >= SizeOf(MySet), 'Data field is too small');
SetLength(Bytes, Cli... | <blockquote>
<blockquote>
<p>Based on the example of Andreas, but made somewhat simpler and clearer IMHO.</p>
</blockquote>
</blockquote>
<p>Tested on XE2</p>
<p>You could use a TBytesField or a TBlobField</p>
<p>ClientDataSet1MySet: TBytesField, Size=32</p>
<p>1) Writing </p>
<pre><code>var
MySet: set o... | 45,235 |
<p>I produce a report as an CSV file.
When I try to open the file in Excel, it makes an assumption about the data type based on the contents of the cell, and reformats it accordingly.</p>
<p>For example, if the CSV file contains</p>
<pre><code>...,005,...
</code></pre>
<p>Then Excel shows it as 5.
Is there a way to ... | <p>There isn’t an easy way to control the formatting Excel applies when opening a .csv file. However listed below are three approaches that might help.</p>
<p>My preference is the first option.</p>
<p><strong>Option 1 – Change the data in the file</strong></p>
<p>You could change the data in the .csv file as follow... | <p>When opening a CSV, you get the text import wizard. At the last step of the wizard, you should be able to import the specific column as text, thereby retaining the '00' prefix. After that you can then format the cell any way that you want.</p>
<p>I tried with with Excel 2007 and it appeared to work.</p>
| 16,612 |
<p>I'd like to drop a user in a SQL Server script but I'll need to test for existence first or I'll get script errors. When dropping tables or stored procs, I check the sysobjects table like so:</p>
<pre><code>IF EXISTS (
SELECT *
FROM sysobjects
WHERE id = object_id(N'[dbo].[up_SetMedOptions]')
... | <p>SSMS scripts it in the following way:</p>
<p>For SQL 2005/2008 and later:</p>
<pre><code>IF EXISTS (SELECT * FROM sys.database_principals WHERE name = N'username')
DROP USER [username]
</code></pre>
<p>For SQL 2000:</p>
<pre><code>IF EXISTS (SELECT * FROM dbo.sysusers WHERE name = N'username')
EXEC dbo.sp_revokedb... | <p>The code below worked for me.</p>
<pre><code>IF EXISTS (SELECT * FROM sys.syslogins WHERE name = N'MyUserName')
DROP LOGIN [MyUserName]
</code></pre>
| 46,417 |
<p>Here's a problem I keep running into:</p>
<p>I have a lot of situations where I need to display some text with a styled container like so:</p>
<pre><code><mx:Canvas>
<mx:Text text="{text}" left="5" verticalCenter="0" right="5" />
</mx:Canvas>
</code></pre>
<p>As you can see - the text i... | <p>The Text component needs a width if you want it to automatically wrap for you. If you used a string with newlines in it it will work grow as you expected without a width. For you, use:</p>
<p><strong>Edit:</strong> Ok, you want it centered in a canvas of varying size. Then you can:</p>
<pre><code><mx:HBox
... | <p>Take a look at the TextArea component.</p>
| 23,758 |
<p>I have to do some JavaScript in the future, so it is time to update my toolbox. Right now I use Firefox with some addons:</p>
<ul>
<li>JavaScript Shell from <a href="https://www.squarefree.com/bookmarklets/webdevel.html" rel="nofollow noreferrer">https://www.squarefree.com/bookmarklets/webdevel.html</a></li>
<li>Fi... | <p>I use both Firefox and IE for Web Development and a few add-ons in each:</p>
<p><strong>Firefox:</strong></p>
<ul>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/1843" rel="nofollow noreferrer">Firebug</a></li>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/60" rel="nofollow noreferrer">W... | <p>A couple more::</p>
<ol>
<li>IE Explorer Toolbar </li>
<li>Firefox Developer Toolbar </li>
</ol>
| 5,470 |
<p>Anyone got any insight as to select x number of non-consecutive days worth of data? Dates are standard sql datetime. So for example I'd like to select 5 most recent days worth of data, but there could be many days gap between records, so just selecting records from 5 days ago and more recent will not do.</p>
| <p>Following the approach <a href="https://stackoverflow.com/questions/308650/select-x-most-recent-non-consecutive-days-worth-of-data#308670">Tony Andrews</a> suggested, here is a way of doing it in T-SQL:</p>
<pre><code>SELECT
Value,
ValueDate
FROM
Data
WHERE
ValueDate >=
(
SELECT
CONVERT(DAT... | <p>I don't know the SQL Server syntax, but you need to:</p>
<p>1) Select the dates (with time component truncated) in descending order</p>
<p>2) Pick off top 5</p>
<p>3) Obtain 5th value</p>
<p>4) Select data where the datetime >= 5th value</p>
<p>Something like this "pseudo-SQL":</p>
<pre><code>select *
from dat... | 39,762 |
<p>Has anyone managed to get PDFCreator running on an ASP.NET 2.0 website ?</p>
<p>On my development machine with Visual Studio webserver, it works just fine after following this procedure :</p>
<ul>
<li>create a com interop dll with tlbimp</li>
<li>reference this dll</li>
<li>write some code to use it</li>
</ul>
<p... | <p>The following Microsoft Knowledgebase article describes the problem and a solution:</p>
<p><a href="http://support.microsoft.com/kb/q184291/" rel="nofollow noreferrer">COM objects fail to print when called from ASP</a></p>
| <p>The following Microsoft Knowledgebase article describes the problem and a solution:</p>
<p><a href="http://support.microsoft.com/kb/q184291/" rel="nofollow noreferrer">COM objects fail to print when called from ASP</a></p>
| 27,243 |
<p>I have the following table schema;</p>
<pre><code>CREATE TABLE `db1`.`sms_queue` (
`Id` INTEGER UNSIGNED NOT NULL AUTO_INCREMENT,
`Message` VARCHAR(160) NOT NULL DEFAULT 'Unknown Message Error',
`CurrentState` VARCHAR(10) NOT NULL DEFAULT 'None',
`Phone` VARCHAR(14) DEFAULT NULL,
`Created` TIMESTAMP NOT N... | <p><a href="http://dev.mysql.com/doc/refman/5.5/en/timestamp-initialization.html" rel="noreferrer">From the <strong>MySQL 5.5</strong> documentation</a>:</p>
<blockquote>
<p>One TIMESTAMP column in a table can have the current timestamp as the default value for initializing the column, as the auto-update value, or b... | <p>My web host is stuck on version 5.1 of mysql so anyone like me that doesn't have the option of upgrading can follow these directions: </p>
<p><a href="http://joegornick.com/2009/12/30/mysql-created-and-modified-date-fields/" rel="nofollow noreferrer">http://joegornick.com/2009/12/30/mysql-created-and-modified-date... | 33,569 |
<p>So I want to start using RSpec stories, but I am not sure where writing controller, model and view specs fit in. </p>
<p>For example, you have the story "Logging in" with "User provides wrong password" scenario, don't you end up testing the same stuff than controller/model specs (response.should render..., user.sho... | <p>If you are starting with stories now (as opposed to having a lot of legacy stories) you may want to look at <a href="http://github.com/aslakhellesoy/cucumber/wikis/migration-from-rspec-stories" rel="noreferrer">Cucumber</a> which is the long term replacement for the RSpec story runner.</p>
<p>The easiest way of spl... | <p>What about skipping view spec if you've got Cucumber+Capybara on it. I tend to find view spec not needed.</p>
| 20,193 |
<p>I want to parse some HTML in order to find the values of some attributes/tags etc.</p>
<p>What HTML parsers do you recommend? Any pros and cons?</p>
| <p><a href="http://sourceforge.net/projects/nekohtml/" rel="nofollow noreferrer">NekoHTML</a>, <a href="http://home.ccil.org/~cowan/XML/tagsoup/" rel="nofollow noreferrer">TagSoup</a>, and <a href="http://sourceforge.net/projects/jtidy/" rel="nofollow noreferrer">JTidy</a> will allow you to parse HTML and then process ... | <p>Do you need to do a full parse of the HTML? If you're just looking for specific values within the contents (a specific tag/param), then a simple regular expression might be enough, and could very well be faster.</p>
| 4,618 |
<p>Hopefully this is a really quick one ;) I have written a lexer / parser specification in ANTLR3, and am targeting the CSharp2 target. The generated code works correctly, but I can't get ANTLR to put the C# output into a namespace.</p>
<p>The relevant section of the Grammar file is as follows:</p>
<pre><code>gram... | <p>I use this for a combined lexer and parser (and it generates the namespace correctly):</p>
<pre><code>grammar Test;
options
{
language=CSharp2;
}
@lexer::namespace {
My.Name.Space
}
@parser::namespace {
My.Name.Space
}
DIGIT : '0'..'9';
simple : DIGIT EOF;
</code></pre>
<p>So i wonder why... | <p>It seems that the @namespace directive needs to be placed AFTER the tokens{} block. All good now...</p>
| 40,845 |
<p>I've been looking for profiling tools for Rails for a while. I'm currently playing and testing ruby-prof and railsbench, but I kinda frustrated with the amount of tweaking and mangling required to make then work.</p>
<p>Althought I don't mind (much) the tweaking, I'd like to know if is there any other, more straigh... | <p><a href="http://www.newrelic.com/ruby" rel="nofollow noreferrer">New Relic</a> offers Rails profiling including a <a href="http://www.newrelic.com/ruby" rel="nofollow noreferrer">free 'Lite'</a> version.</p>
| <p>You should also take a look at FiveRuns' <a href="http://www.fiveruns.com/products/tuneup" rel="nofollow noreferrer">TuneUp</a>. It is completely free, installs as a plugin into your Rails application. Keep in mind that it does send data back to their server (mostly very harmless information), but that might bother ... | 45,619 |
<p>What open source projects would you recommend as a good place for a starting open source developer? Factors that I think would be important are some obvious ones like well written code and a community that is helpful to newbies. But it might be nice if the code base is such that I can start hacking some small proble... | <p>Trying to pick a project like that will never work because it's not something you're passionate about. What's an open source project that you use daily or enjoy using? Go work with that one.</p>
| <p><strong>sourceforge</strong> has a list of projects seeking a new developer. Therer are several for your requested programming languages:</p>
<p><a href="http://sourceforge.net/people/?category_id=1" rel="nofollow noreferrer">http://sourceforge.net/people/?category_id=1</a></p>
<p>Apart from developers they have ... | 29,790 |
<p>Wondering if there is a better why in the WHERE clause of choosing records when you need to look at effective start and end dates?</p>
<p>Currently this how I've done it in the past on MS SQL Server. Just worried about the date and not the time. I'm using SQL Server 2005.</p>
<pre><code>AND Convert(datetime, Conv... | <p>That is terrible, take a look at <a href="http://blogs.lessthandot.com/index.php/DataMgmt/DataDesign/only-in-a-database-can-you-get-1000-impr" rel="nofollow noreferrer">Only In A Database Can You Get 1000% + Improvement By Changing A Few Lines Of Code</a> to see how you can optimize this since that is not sargable</... | <p>try</p>
<pre><code>ep.EffectiveStartDate BETWEEN @date1 AND @date2
</code></pre>
<p>where you would do something like</p>
<pre><code>declare @date1 datetime, @date2 datetime;
set @date1 = cast('10/1/2000' as datetime)
set @date2 = cast('10/1/2020' as datetime)
</code></pre>
| 4,283 |
<p>I have a Python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it.</p>
<p>I want to call the <code>help</code> function on each one. In Ruby I can do something like <code>ClassName.methods</code> to get a list of all the methods available on that class. I... | <p>You can use <code>dir(module)</code> to see all available methods/attributes. Also check out PyDocs.</p>
| <p>This will append all the functions that are defined in your_module in a list.</p>
<pre><code>result=[]
for i in dir(your_module):
if type(getattr(your_module, i)).__name__ == "function":
result.append(getattr(your_module, i))
</code></pre>
| 16,842 |
<p>I am currently using CuteFTP Secure Sever 3.3 but it has problems. It seems to muck up connection management, drop connections occasionally and die on large files.</p>
<p>I am looking for a replacement that supports XCRC because I use the <em>Synchronize Folders</em> function in the CuteFTP client. I would prefer... | <p><a href="http://www.smartftp.com/support/kb/2549" rel="nofollow noreferrer">SmartFTP</a> supports XCRC, and works quite well. It isn't open source or free, but it is a decent product. The linked page also shows some FTP Servers that support it as well.</p>
| <p>FileZilla is always good if that's truly what you want. <a href="http://filezilla-project.org/" rel="nofollow noreferrer">http://filezilla-project.org/</a></p>
<p>SmartFTP also has a list of FTP servers supporting XCRC <a href="http://www.smartftp.com/support/kb/2549" rel="nofollow noreferrer">http://www.smartftp.... | 28,667 |
<p>Can anyone explain to me what this means?</p>
<p>"Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention."</p>
| <p>When calling a function, the compiler has to push some arguments on the stack, or put them in some registers. The function body will change some memory location (or a register) to contain the return value. Then it will return to a block of code at a location stored 'somewhere' on the stack.</p>
<p>The calling con... | <p>This is typically the case when casting a function pointer to shut up the compiler when calling a Windows API, such as DialogBox:</p>
<pre><code>DialogBox(hInstance, MAKEINTRESOURCE(MY_DIALOG), hWnd, &dlgProc);
</code></pre>
<p>Windows is a bit odd in that all functions are defined with the stdcall calling-con... | 38,714 |
<p>I'm trying out the following query:</p>
<pre><code>SELECT A,B,C FROM table WHERE field LIKE 'query%'
UNION
SELECT A,B,C FROM table WHERE field LIKE '%query'
UNION
SELECT A,B,C FROM table WHERE field LIKE '%query%'
GROUP BY B ORDER BY B ASC LIMIT 5
</code></pre>
<p>That's three queries stuck together, kinda sorta. ... | <p>Maybe you should try including a fourth column, stating the table it came from, and then order and group by it:</p>
<pre><code>SELECT A,B,C, "query 1" as origin FROM table WHERE field LIKE 'query%'
UNION
SELECT A,B,C, "query 2" as origin FROM table WHERE field LIKE '%query'
UNION
SELECT A,B,C, "query 3" as origin F... | <p>If there isn't a sort that makes sense to order them you desire, don't union the results together - just return 3 separate recordsets, and deal with them accordingly in your data tier.</p>
| 2,588 |
<p>Our design has one jvm that is a jboss/webapp (read/write) that is used to maintain the data via hibernate (using jpa) to the db. The model has 10-15 persistent classes with 3-5 levels of depth in the relationships.</p>
<p>We then have a separate jvm that is the server using this data. As it is running continuousl... | <p>A Hibernate session loads all data it reads from the DB into what they call the <i>first-level cache</i>. Once a row is loaded from the DB, any subsequent fetches for a row with the same PK will return the data from this cache. Furthermore, Hibernate gaurentees reference equality for objects with the same PK in a si... | <p>The most used practice is to have a <a href="http://docs.jboss.org/hibernate/entitymanager/3.6/reference/en/html_single/#d0e129" rel="nofollow">Container-Managed Entity Manager</a> so that two or more applications in the same container (ie Glassfish, Tomcat, Websphere) can share the same caches.
But if you don't use... | 7,117 |
<p>This is in reference to my other question <a href="https://stackoverflow.com/questions/16110/c-auto-clearing-winform-textbox">Auto Clearing Textbox</a>.<br>
If I choose to derive a new TextBox control from TextBox instead of implement a user control just containing my Textbox, how would I include that in the toolbox... | <blockquote>
<p>Right-click the toolbox, click "Choose
Items" from the context menu, browse
to your DLL, and select it.</p>
</blockquote>
<p>To extend on Greg's answer...
Just to clarify, you cannot add a user control to the tool box if the code for it is in the same project that you want to use it in. For some... | <p>Right-click the toolbox, click "Choose Items" from the context menu, browse to your DLL, and select it.</p>
| 3,685 |
<p>I'm using Eclipse 3.4 and have configured the Java code formatter with all of the options on the <em>Comments</em> tab enabled. The problem is that when I format a document comment that contains:</p>
<pre><code>* @see <a href="test.html">test</a>
</code></pre>
<p>the code formatter inserts a space in t... | <p>I can only assume it's a bug in Eclipse. It only happens with <em>@see</em> tags, it happens also for all 3 builtin code formatter settings.</p>
<p>There are some interesting bugs reported already in the neighbourhood, but I couldn't find this specific one. See for example a search for <em>@see</em> in the <a href=... | <p>Strict XML specifications require that the self closing tags should have a space before the closing slash like so:</p>
<pre><code><gcServer enabled="true" /> <!-- note the space just after "true" -->
</code></pre>
<p>I can only assume, like Bart said, that there is a bug in Eclipse's reformatter that t... | 6,729 |
<p>I'd like to build a CMS site based on Asp.Net Mvc and I want to choose my starting point.</p>
<p>I have seen that there is a lot of interest in the new Microsoft Oxite project also if it seems to be pretty early to adopt it in a production project.<br>
I've also looked at S#arp Architecture but it does not properly... | <p>Oxite might be feature rich, but the code quality is very low.</p>
<p>I was very surprised when I checkout the code and found controller actions with 100+ lines of very unclean code, tagsoup views, no unit tests, etc.</p>
<p>The criticism has been well summed up in these blog posts:</p>
<p><a href="http://blog.we... | <p>Oxite is well detailed already, entirely negatively.</p>
<p>I'll just add that I've been using <a href="http://sharparchitecture.net/" rel="nofollow noreferrer">S#arp architecture</a> for several months and found it very maintainable and flexible. There's also a very solid, growing and active community of users ar... | 46,903 |
<p>Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000.</p>
| <p>If you are making use of GUIDs this should be nice and easy, if you are looking for an integer ID, you will have to wait for another answer.</p>
<pre><code>SELECT newId() AS ColId, Col1, Col2, Col3 FROM table1
</code></pre>
<p>The newId() will generate a new GUID for you that you can use as your automatically gene... | <p>Is this perhaps what you are looking for?</p>
<blockquote>
<p>select NEWID() * from TABLE</p>
</blockquote>
| 16,668 |
<p>Anyone have any idea how much power it takes to run a Creality Ender 3 3D printer every day for several hours at a time? Like what does it eat up per hour? A rough estimate of power use per hour would be nice, then I can figure out how much it costs me. Can anyone help me?</p>
| <p>If it is really important to you to know how much you are spending per any given print, your best bet is not to guess, <em>but to know</em> how much power you're using. To that end, you could purchase a power meter which monitors your power usage. Given the right one, it can even calculate the cost of the power usag... | <p>Other answers include good estimates, and show that for one printer the electricity costs are not very significant. If you are using many printers and want a concrete answer, then it would be wise to purchase a power monitor (for continuous monitoring) or multimeter with clamp.</p>
<p>With a clamp-on multimeter, you... | 1,268 |
<p>Which libraries for Java are there that have a fast implementation for floating point or fixed point operations with a precision of several thousands of digits? How performant are they?</p>
<p>A requirement for me is that it implements a multiplication algorithm that is better than the naive multiplication algorith... | <p>There are three libraries mentioned on the <a href="http://en.wikipedia.org/wiki/Bignum" rel="noreferrer">Arbitrary Precision Arithmetic</a> page: java.math (containing the mentioned BigDecimal), <a href="http://www.apfloat.org/" rel="noreferrer">Apfloat</a> and <a href="http://jscience.org/" rel="noreferrer">JScien... | <p>Apfloat offers high precision on the mantissa, but appears to give less-than-usual precision on the exponent (based on the fact that it crashes with "Logarithm of zero" for values that double can handle). So it is not useful for big numbers.</p>
<p>Also, the documentation says:</p>
<p>"A pitfall exists with the c... | 34,991 |
<p>On my blog I use some CSS classes which are defined in my stylesheet, but in RSS readers those styles don't show up. I had been searching for <code>class="whatever"</code> and replacing with <code>style="something: something;"</code>. But this means whenever I modify my CSS I need to modify my RSS-generating code ... | <p>The popular RSS readers WILL NOT bother downloading a style sheet, even if you provide one and link to it using <code><?xml-stylesheet?></code>.</p>
<p>Many RSS readers simply strip all inline <code>style</code> attributes from your tags. From testing today, I discovered that Outlook 2007 seems to strip out a... | <p>Because RSS is (supposed to be) XML, you can use XML stylesheets.</p>
<p><a href="http://www.w3.org/TR/xml-stylesheet/" rel="nofollow noreferrer"><a href="http://www.w3.org/TR/xml-stylesheet/" rel="nofollow noreferrer">http://www.w3.org/TR/xml-stylesheet/</a></a></p>
| 14,450 |
<p>I'd like to write a simple C# application to monitor the line-in audio and give me the current (well, the rolling average) beats per minute.</p>
<p>I've seen <a href="http://www.gamedev.net/page/resources/_/technical/math-and-physics/beat-detection-algorithms-r1952" rel="noreferrer">this gamedev article</a>, and th... | <p>Calculate a powerspectrum with a sliding window FFT:
Take 1024 samples: </p>
<pre><code>double[] signal = stream.Take(1024);
</code></pre>
<p>Feed it to an FFT algorithm: </p>
<pre><code>double[] real = new double[signal.Length];
double[] imag = new double[signal.Length);
FFT(signal, out real, out imag);
</code><... | <p>The easy way to do it is to have the user tap a button in rhythm with the beat, and count the number of taps divided by the time.</p>
| 10,478 |
<p>Conceptually, I would like to accomplish the following but have had trouble understand how to code it properly in C#:</p>
<pre><code>
SomeMethod { // Member of AClass{}
DoSomething;
Start WorkerMethod() from BClass in another thread;
DoSomethingElse;
}
</code></pre>
<p>Then, when WorkerMethod() is comp... | <p>The <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="noreferrer">BackgroundWorker</a> class was added to .NET 2.0 for this exact purpose.</p>
<p>In a nutshell you do:</p>
<pre><code>BackgroundWorker worker = new BackgroundWorker();
worker.DoWork += delegate { myBCl... | <p>Ok, I'm unsure of how you want to go about this. From your example, it looks like WorkerMethod does not create its own thread to execute under, but you want to call that method on another thread. </p>
<p>In that case, create a short worker method that calls WorkerMethod then calls SomeOtherMethod, and queue that me... | 10,050 |
<p>I have a table with many millions of rows. I need to find all the rows with a specific column value. That column is not in an index, so a table scan results.</p>
<p>But would it be quicker to add an index with the column at the head (prime key following), do the query, then drop the index?</p>
<p>I can't add an in... | <p>I'm no DBA, but I would guess that building the index would require scanning the table anyway. </p>
<p>Unless there are going to be multiple queries on that column, I would recommend not creating the index.</p>
<p>Best to check the explain plans/execution times for both ways, though!</p>
| <p>Adding an index requires a table scan, so if you can't add a permanent index it sounds like a single scan will be (slightly) faster.</p>
| 4,996 |
<p>I'm developing my first ASP.NET MVC application. This application tracks events, users, donors, etc. for a charitable organization. In my events controller I support standard CRUD operations with New/Edit/Show views (delete is done via a button on Show view). But I also want to list all of the events.</p>
<p>Is... | <p>I've decided to have the Index action redirect to the List action. This saves me from having to create and maintain an Index view, but leaves open the possibility that I can implement an Index action that is something other than the list of models.</p>
<pre><code>public ActionResult Index()
{
return RedirectTo... | <p>Your Index view page could include</p>
<pre><code><body>
<% RenderPartial("List", "Events") %>
</body>
</code></pre>
<p>which is equivalent to calling</p>
<pre><code>/Views/Events/List.ascx
</code></pre>
<p>with the List view being an asp.net mvc user control. That will give you an Index vi... | 46,507 |
<p>In a ColdFusion Component (CFC), is it necessary to use fully qualified names for variables-scoped variables?</p>
<p>Am I going to get myself into trouble if I change this:</p>
<pre><code><cfcomponent>
<cfset variables.foo = "a private instance variable">
<cffunction name = "doSomething">... | <p>It won't matter to specify "variables" when you create the variable, because foo will be placed in the variables scope by default; but it will matter when you access the variable.</p>
<pre><code><cfcomponent>
<cfset foo = "a private instance variable">
<cffunction name="doSomething">
... | <p>After reading your answers here's what I'm thinking:</p>
<p><strong>Yes, it's safe. In general, it's not necessary or useful to explicitly specify the variables scope. It just adds clutter to an already verbose language.</strong></p>
<p>Granted, there is one minor exception, as <a href="https://stackoverflow.com/u... | 8,394 |
<p>I'm trying to make a select that calculates affiliate payouts.</p>
<p>my approach is pretty simple.</p>
<pre><code>SELECT
month(payments.timestmap)
,sum(if(payments.amount>=29.95,4,0)) As Tier4
,sum(if(payments.amount>=24.95<=29.94,3,0)) As Tier3
,sum(if(payments.amount>=19.95<=24.94,2,0)) As Tier2... | <p>The second part of the expression evaluates when you use <code>AND</code> - </p>
<pre><code>SELECT
month(payments.timestmap)
,sum(if(payments.amount>=29.95,4,0)) As Tier4
,sum(if(payments.amount>=24.95 AND payments.amount<=29.94,3,0)) As Tier3
,sum(if(payments.amount>=19.95 AND payments.amount<=24.9... | <p>What error did your first attempt give you? It should definitely work. However, note that the second form you have is incorrect syntax. It should be <code>amount >= 24.94 and amount <= 29.94</code>.</p>
| 22,678 |
<p><code>CGI.escapeHTML</code> is pretty bad, but <code>CGI.unescapeHTML</code> is completely borked. For example:</p>
<pre><code>require 'cgi'
CGI.unescapeHTML('&#8230;')
# => "…" # correct - an ellipsis
CGI.unescapeHTML('&hellip;')
# => "&hellip;" # should be "…"
... | <p>The htmlentities gem should do the trick:</p>
<pre><code>require 'rubygems'
require 'htmlentities'
coder = HTMLEntities.new
coder.decode('&#8230;') # => "…"
coder.decode('&hellip;') # => "…"
coder.decode('&#162;') # => "¢"
coder.decode('&cent;') # => "¢"
coder.encode("…", :named) # =&g... | <pre><code>require 'rubygems'
require 'hpricot'
Hpricot('&#8230;', :xhtml_strict => true).to_plain_text
</code></pre>
<p>Though you might have to fiddle around with the character encoding.</p>
| 49,626 |
<p>I've seen some horrific code written in Perl, but I can't make head nor tail of this one:</p>
<pre><code>select((select(s),$|=1)[0])
</code></pre>
<p>It's in some networking code that we use to communicate with a server and I assume it's something to do with buffering (since it sets <code>$|</code>).</p>
<p>But I... | <p>It's a nasty little idiom for setting autoflush on a filehandle other than STDOUT. </p>
<p><code>select()</code> takes the supplied filehandle and (basically) replaces STDOUT with it, and it returns the old filehandle when it's done. </p>
<p>So <code>(select($s),$|=1)</code> redirects the filehandle (remember <cod... | <p>please check <a href="http://perldoc.perl.org/functions/select.html" rel="nofollow noreferrer">perldoc -f select</a>. For the meaning of <code>$|</code>, please check <a href="http://perldoc.perl.org/perlvar.html" rel="nofollow noreferrer">perldoc perlvar</a></p>
| 23,908 |
<p>This <strike>is clearly not</strike> appears like it wouldn't be a best practice. Can someone explain why it would not be a best practice or how this works? Any books or articles providing an explanation would be appreciated.</p>
<pre><code>//The constructor
public Page_Index() {
//create a local value
st... | <p>currentValue is no longer a local variable: it is a <em>captured</em> variable. This compiles to something like:</p>
<pre><code>class Foo {
public string currentValue; // yes, it is a field
public void SomeMethod(object sender, EventArgs e) {
Response.Write(currentValue);
}
}
...
public Page_Index() {
... | <p>You need to capture the value of the variable within the closure/delegate, else it can be modified, like you saw.</p>
<p>Assign currentValue to a variable local (inside) to the delegate.</p>
| 17,907 |
<p>Is it possible to add attributes at runtime or to change the value of an attribute at runtime?</p>
| <p>Attributes are static metadata. Assemblies, modules, types, members, parameters, and return values aren't first-class objects in C# (e.g., the <code>System.Type</code> class is merely a reflected representation of a type). You can get an instance of an attribute for a type and change the properties if they're writab... | <p>Like mentionned in a comment below by Deczaloth, I think that metadata is fixed at compile time. I achieve it by creating a dynamic object where I override GetType() or use GetCustomType() and writing my own type. Using this then you could...</p>
<p>I tried very hard with System.ComponentModel.TypeDescriptor without... | 15,719 |
<p>How would you, as a developer with little (or no) artistic inclination, design a GUI for an application? In particular, I'm thinking about desktop apps but anything that relates to Web apps is welcome as well.
I find it extremely hard to design something that both I and potential users find pleasing. I can look up... | <p>The first thing you need to do is get out of your developer-point-of-view. We tend to think in terms of forms, controls, buttons, lists, grids etc. And this tends to push us to solutions that are not always optimal for the user.</p>
<p>Users don't want to use our software. (except when you're programming games) The... | <p>Just think about who your users are from the perspective of your application. Is there one kind? More? Then for each kind of user, think about the big overarching things they want to accomplish. Present them those general choices, and then go from there into more appropriate interfaces for each task.</p>
<p>Fin... | 20,405 |
<p>I'm trying to find a way to make a list of everything between <code><a></code> and <code></a></code> tags. So I have a list of links and I want to get the names of the links (not where the links go, but what they're called on the page). Would be really helpful to me.</p>
<p>Currently I have this:</p>
<... | <p>The standard disclaimer applies: Parsing HTML with regular expressions is not ideal. Success depends on the well-formedness of the input on a character-by-character level. If you cannot guarantee this, the regex will fail to do the Right Thing at some point.</p>
<p>Having said that:</p>
<pre><code><a\b[^>]*&... | <p>Regex, the black magic, again :)</p>
<p>I found one <a href="https://stackoverflow.com/questions/331426/common-regular-expressions">nice question</a> about common regex. There some interesting links where you will find very common regexpressions like yours.</p>
<blockquote>
<p>Grabbing HTML Tags</p>
<p><... | 44,615 |
<p>What's the most efficient way to concatenate strings?</p>
| <p>The <code>StringBuilder.Append()</code> method is much better than using the <code>+</code> operator. But I've found that, when executing 1000 concatenations or less, <code>String.Join()</code> is even more efficient than <code>StringBuilder</code>.</p>
<pre><code>StringBuilder sb = new StringBuilder();
sb.Append(... | <p>It would depend on the code.
StringBuilder is more efficient generally, but if you're only concatenating a few strings and doing it all in one line, code optimizations will likely take care of it for you. It's important to think about how the code looks too: for larger sets StringBuilder will make it easier to read... | 4,140 |
<p>I have around 8-9 parameters to pass in a function which returns an array. I would like to know that its better to pass those parameters directly in the function or pass an array instead? Which will be a better way and why?</p>
| <p>If I would do anything, then it would be to create an structure that holds all parameters to get nice intellisence and strong names.</p>
<pre><code>public struct user
{
public string FirstName;
public string LastName;
public string zilionotherproperties;
public bool SearchByLastNameOnly;
}
pu... | <p>Do not pass them as an array unless the function acts on an array, I wouldn't create a new data structure either to group the parameters for the following reasones</p>
<ol>
<li><p>Passing a new data structure hides what the function really needs as input (does it need all the data structure/part of it?)</p></li>
<l... | 43,167 |
<p>I'm trying to insert a comment character into a string something similar to this:</p>
<pre><code>-CreateVideoTracker VT1 "vt name"
</code></pre>
<p>becomes</p>
<pre><code>-CreateVideoTracker VT1 # "vt name"
</code></pre>
<p>The VT1 word can actually be anything, so I'm using the regex</p>
<pre><code>$line =~ s/... | <pre><code>$line =~ s/^(\-CreateVideoTracker)\s+(\w+)/$1 $2 #/;
</code></pre>
<p>The bracketed expressions (known as "capture buffers") in the first half of the regexp are referenced as <code>$1</code>, <code>$2</code>. etc in the second half.</p>
| <p>You have two problems in:</p>
<pre><code>$line =~ s/\-CreateVideoTracker \w/\-CreateVideoTracker \w # /g;
</code></pre>
<p>First, you want to match multiple character words, so in the left side, \w should be \w+.
Second, you can't use patterns like \w on the right side; instead capture what you want on the left wi... | 36,125 |
<p>So I'm having a path issue on OS X Leopard. It seems OS X is adding other paths that I'm not stating and it's messing with my path priority. I only have a <code>.bash_login</code> file, I don't have a <code>.bashrc</code> or a .profile file. My <code>.bash_login</code> file is as such:</p>
<pre><code>export PATH="/... | <p>Have you looked inside these two directories:</p>
<pre><code>/etc/paths.d/
/etc/manpaths.d
</code></pre>
<p>Any paths defined in files in those directories get appended automatically to PATH variable -- I mostly use those two directories to put third-party installed applications in the PATH. Also, do have a look a... | <p>I've also come across an interesting article on Apple's support forums:</p>
<p><a href="http://discussions.apple.com/thread.jspa?messageID=7976259&tstart=0" rel="nofollow noreferrer">.bash_login no longer executed</a></p>
<p>With that information I found an overlooked blank .bash_profile file that I had that w... | 45,187 |
<p>Sometimes we deploy applications behind customer firewall and we need read only access to their DB for debugging issues as sometimes their IT people are not SQL savvy. We want to bundle our application with some web based application that will expose the database and allow us to fire adhoc SQL queries and show their... | <p>If you want the database behind a firewall, and believe me, you do want your database behind a firewall, see if you can have a VPN for going directly into the box. Once you are on the VPN, you can use whichever management tool you currently use for managing the database. So if you use SQL Server, you can connect v... | <p>On my current project, we use <a href="http://www.quest.com/sql-navigator/" rel="nofollow noreferrer">SQL Navigator</a> in order to run queries on our Oracle database. I've also heard decent things about <a href="http://www.toadsoft.com/toad_oracle.htm" rel="nofollow noreferrer">TOAD</a>. I would advise against writ... | 17,365 |
<p>I have an image of a basic game map. Think of it as just horizontal and vertical walls which can't be crossed. How can I go from a png image of the walls to something in code easily?</p>
<p>The hard way is pretty straight forward... it's just if I change the image map I would like an easy way to translate that to... | <p>I dabble in video games, and I personally would not want the hassle of checking the boundaries of pictures on the map. Wouldn't it be cleaner if these walls were objects that just happened to have an image property (or something like it)? The image would display, but the object would have well defined coordinates ... | <p>If you don't need to precompute anything using the map info. You can just check in runtime logic using getPixel(x,y) like function.</p>
| 16,625 |
<p>I am writing a lib and a demo project. The project doesn't care which version of the lib I use (I can use sdl, directx or whatever I like as the gfx backend). To get the object I do </p>
<pre><code>Obj *obj = libname_newDevice();
</code></pre>
<p>Now, should I use delete or should I do <code>obj->deleteMe();</c... | <p>Since you are abstracting the creation inside <code>libname_newDevice()</code> (which I have to say isn't a good approach), you should destroy using something like <code>libname_destroyDevice (obj)</code>.</p>
<p>And as the comment from Martin suggests, it's best to put them in the constructor and destructor of a c... | <p>You definitely don't want to implement Obj::deleteMe(). It would have to do something like: </p>
<pre><code>delete this;
</code></pre>
<p>while you were still inside this->deleteMe(). Follow Jaywalker's suggestion and make the destroy function take an Obj* as a parameter.</p>
| 36,106 |
<p>I am having some trouble with the <a href="http://code.google.com/apis/maps/documentation/reference.html" rel="nofollow noreferrer">Google Maps API</a>. I have an array which holds a ojbect I created to store points.</p>
<p>My array and class:</p>
<pre><code>var tPoints = [];
function tPoint(name) {
va... | <p>Maybe a CLR stored procedure is what you are looking for. These are generally used when you need to interact with the system in some way.</p>
| <p>I still believe that a CLR procedure might be the best bet. So, I'm accepting that answer. However, either I'm not that bright or it's extremely difficult to implement. Our SQL Server service is running under a local account because, according to Mircosoft, that's the only way to get an iSeries linked server working... | 3,736 |
<p>Suppose I have a page that I am writing a javascript plugin for on the domain <code>first.com</code>. The javascript plugin injects an iframe pointing to a login page (of domain <code>second.com</code>) into the <code>first.com</code> page and displays it as a popup so that the user can login.</p>
<p>Is there anyw... | <p>If the developer of second.com can be convinced to load an iframe in their login page, which loads a page at first.com, the the inner iframe can call javascript on the outer, since they are both from first.com. You can pass parameters in this way too, through the url of the inner iframe. An <a href="http://mcknut.go... | <p>I think the issue you're running into is the browser stopping the cross-domain communication from happening. There is a way to <a href="http://www.mozilla.org/projects/security/components/signed-scripts.html" rel="nofollow noreferrer">sign your javascript</a> but it is pretty much breaking the browser security mode... | 37,203 |
<p>Publishing and/or collaborative applications often involve the sharing of access to resources. In a portal a user may be granted access to certain content as a member of a group or because of explicit access. The complete set of content could include public content, group membership content, and private user content... | <p>You may be interested in reading <a href="http://steffenbartsch.com/blog/2008/08/rails-authorization-plugins/" rel="noreferrer" title="Rails authorization plugins">this article by Steffen Bartsch</a>. It summarizes all authorization plugins for Ruby on Rails, and I am sure it will help you find your solution (altho... | <p>I generally have a schema like this</p>
<p>Users −−∈ UserDocuments ∋−− Documents</p>
<p>Then I create a view "ProfiledDocuments"</p>
<pre><code>SELECT <fields>
FROM Documents d
INNER JOIN UserDocuments ud on ud.DocumentId = d.Id
INNER JOIN Users u ON u.Id = ud.UserId
</cod... | 20,582 |
<p>Are there any easy, smart ways to keep your client and server-side validation-rules synchronized?</p>
<p>On the client side we have JavaScript, maybe some kind of framework like jQuery or YUI.</p>
<p>On the server-side we have ASP.NET WebForms or ASP.NET MVC.</p>
<p>What is validated are things like:</p>
<ul>
<l... | <p><asp:RegularExpressionValidator ...> (and the other asp.net validators) implement client side javascript and server side checking to the same rules.</p>
| <p>write a large, common corpus of test data that embodies the validation rules, and unit test your validators against this common data.</p>
<p>When your rules change, you reflect this by updating the test data and testing until everything goes green again.</p>
| 12,622 |
<p>How do I get the full width result for the *nix command "<strong>ps</strong>"?<br />
I know we can specify something like <code>--cols 1000</code> but is there anyway I can
the columns and just print out everything?</p>
| <p>Try <code>ps -w -w aux</code>. The -w option sets the output to wide, and doing it twice makes the width unlimited. The "aux" part makes it show more information, and is (afaik) pretty standard mode to use. This is of course platform-dependant, the above works with procps version 3.2.7 on Linux.</p>
| <p>Specify the <code>w</code> option twice, if you're using BSD-style <code>ps</code>. e.g., <code>ps auwwx</code>. A different set of options apply when using System V <code>ps</code>.</p>
| 25,479 |
<p>I'm relatively new in the field of 3D printing and design. By now I've created and printed some technical objects with TinkerCAD, but now I've a task, which I don't know how to solve.</p>
<p>I have the following model as STL-file:
<a href="https://i.stack.imgur.com/o8Bn1.jpg" rel="noreferrer"><img src="https://i.st... | <p>Basically there's no good easy way to do this.</p>
<p>At this point you only have the mesh - a list of triangles - the 3D model you have does not contain the concept of joints or moving parts so it can't regenerate the shoulder after the rotation.</p>
<p>The original author may or may not have the ability to do th... | <p>Basically there's no good easy way to do this.</p>
<p>At this point you only have the mesh - a list of triangles - the 3D model you have does not contain the concept of joints or moving parts so it can't regenerate the shoulder after the rotation.</p>
<p>The original author may or may not have the ability to do th... | 788 |
<p>A common mistake when configuring the compilation/linking/etc. settings in VC++ 2008 is to set them in Release but not Debug (or vice versa) rather than setting them for "All Configurations". Any suggestions on how to avoid this kind of mistake?</p>
<p>Some beginnings of ideas that I have:</p>
<ul>
<li><p>Find a w... | <p>I just ran a quick test and noticed the following, which may help you:</p>
<ul>
<li>When run from an open command prompt, the %0 variable does not have double quotes around the path. If the script resides in the current directory, the path isn't even given, just the batch file name.</li>
<li>When run from explorer,... | <p>Just add pause regardless of how it was opened? If it was opened from command prompt no harm done apart from a harmless pause. (Not a solution but just thinking whether a pause would be so harmful / annoying )</p>
| 49,422 |
<p>Well I testing my jython program, that does some neat [".xls", ".doc", ".rtf", ".tif", ".tiff", ".pdf" files] -> pdf (intermediary file) -> tif (final output) conversion using Open Office. We moved away from MS Office due to the problems we had with automation. Now it seems we have knocked down many bottles relate... | <p>First of all, a model class shall not talk to a view class. A TextView is part of the view.</p>
<p><a href="http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Art/cocoa_mvc.gif">alt text http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/Art/cocoa_mvc.gif</a></p>
<... | <p>Re: the recursive <code>#import</code> problem, what you're looking for is the <code>@class</code> directive. In most cases, all your class interface needs to know about other classes is their names, since all of the actual implementation-specific stuff is in your <code>*.m</code> files. The <code>@class</code> di... | 38,634 |
<p>I have a client/server application that communicates with .Net remoting. I need my clients to be able to find the server(s) on the network without requiring client-side configuration. </p>
<p>As far as I know, there is no support for discovery in remoting. I am prepared to implement a UDP solution where the clients... | <p>I've looked at both SSDP and UPnP for this type of functionality, but I'd recommend going with a custom UDP <a href="http://en.wikipedia.org/wiki/Multicast" rel="nofollow noreferrer">multicast</a> solution. Basically, multicast is very similar to a broadcast, but only machines that have joined the multicast group (i... | <p>The best solution I have found in my remoting work was to keep the server list in a config file on the client systems and make it updateable. Not the easiest to maintain but was fast and no broadcasting.</p>
| 4,231 |
<p>I want to get the name of internet connection type in iPhone?</p>
<p>Any help would be appreciated.</p>
<p>Regards</p>
<p>Uddhalaka</p>
| <p>Take a look at the <a href="http://developer.apple.com/iphone/library/samplecode/Reachability/index.html" rel="nofollow noreferrer">Reachability</a> sample. Figure that it'll use the best available connection (WiFi, 3G, or Edge).</p>
| <p>Take a look at the <a href="http://developer.apple.com/iphone/library/samplecode/Reachability/index.html" rel="nofollow noreferrer">Reachability</a> sample. Figure that it'll use the best available connection (WiFi, 3G, or Edge).</p>
| 40,412 |
<p>I seem to often find myself wanting to store data of more than one type (usually specifically integers and text) in the same column in a MySQL database. I know this is horrible, but the reason it happens is when I'm storing responses that people have made to questions in a questionnaire. Some questions need an integ... | <p>[Option 2 is] NOT the most normalized option [as @Ray claims]. The most normalized would have no nullable fields and obviously option 2 would require a null on every row.</p>
<p>At this point in your design you have to think about the usage, the queries you'll do, the reports you'll write. Will you want to do math ... | <p>Option 2 is the correct, most normalized option.</p>
| 41,593 |
<p>My clients application exports and imports quite a few variables of type real through a text file using writeln and readln. I've tried to increase the width of the fields written so the code looks like: </p>
<pre><code>writeln(file, exportRealvalue:30); //using excess width of field
....
readln(file, importRealval... | <p>You might try switching to <strong>extended</strong> for greater precision. As was pointed out though, floating point numbers only have so many significant digits of precision, so it is still possible to display more digits then are accurately stored, which could result in the behavior you specified.</p>
<p>From th... | <p>When using floating point types, you should be aware of the precision limitations on the specified types. A 4 byte IEEE-754 type, for instance, has only about 7.5 significant digits of precision. An eight byte IEEE-754 type has roughly double the number of significant digits. Apparently, the delphi real type has ... | 18,072 |
<p>I have an old C++ COM component which has to stay in Visual Studio 6.0 format. I can't for the life of me figure out how to debug the code in the actual COM component.</p>
<p>I'm able to build it in debug mode, add breakpoints and attach it to the dllhost.exe process, but the Visual Studio environment will only sh... | <p>If it is a VB6 based COM component, you can open the project in VB6 and run it (a DLL project cannot be run). The project properties has some option whereby it can be asked to run so that it runs & registers itself.</p>
<p>Now, try hitting the ASP page, which makes a call to COM component. The breakpoints set i... | <p>First of all, PDB file (produced during the compilation) should be in the same directory with DLL (can be set in project properties).</p>
<p>If your object does not use some ASP-specific functionality (Request, Response, Session objects) you can copy its invocation code to .vbs file and debug via setting <em>cscrip... | 48,363 |
<p>I want to store some information in the EPROCESS structure of the process in windows NT kernel. My aim is that when winlogon is called I want to assign a unique value to the next process based on which user logs in. But I do not know where to store this unique ID. I have tried and succeeded in modifying some informa... | <p>The EPROCESS structure is opaque and undocumented, meaning you shouldn't be messing with its internals. Doing so requires you, among other things, to test on every OS version and service pack you plan on supporting.</p>
| <p>Do not modify EPROCESS. It will bring you great sorrow.</p>
<p>Furthermore, if you do, do not install it on anyone elses machine. It is absolutely wrong to impose such a profoundly damaging, system destabilizing change on another persons computer. How would like it if I gave you tuberculosis?</p>
| 46,322 |
<p>PHP has a great function called <a href="http://us2.php.net/manual/en/function.htmlspecialchars.php" rel="noreferrer">htmlspecialcharacters()</a> where you pass it a string and it replaces all of HTML's special characters with their safe equivalents, it's <em>almost</em> a one stop shop for sanitizing input. Very ni... | <p>Try this.</p>
<pre><code>var encodedHtml = HttpContext.Current.Server.HtmlEncode(...);
</code></pre>
| <p>In an addition to the given answers:
When using <a href="http://en.wikipedia.org/wiki/ASP.NET_Razor_view_engine" rel="nofollow">Razor view engine</a> (which is the default view engine in ASP.NET), using the '@' character to display values will automatically encode the displayed value. This means that you don't have ... | 3,747 |
<p>So, i'm running emacs over a crappy ssh connection and I have it set up to use cscope. I can not use X because of this...hence I'm running emacs inside putty. However, when I search for something with cscope and it opens up the other buffer, I can not
follow the links where cscope tells me which file and line number... | <p>I don't know about cscope for sure - but you should be able to find out the appropriate key binding by doing a "Ctrl-h m" in the buffer with all the links. This should open another buffer showing you help/key bindings on all the active modes. </p>
<p>E.g. if you do the same thing in a grep result buffer it indicate... | <p>Could you use cscope with Tramp mode? I'm not familiar with cscope, but I've had great results using tramp mode to read/write files remotely over an SSH connection. </p>
| 47,585 |
<p>I bought an Anet A8 over christmas. When I bought my printer from Gearbest, I also bought the inductive sensor that they <a href="http://www.gearbest.com/3d-printer-parts/pp_591321.html" rel="nofollow noreferrer">sell</a>.</p>
<p>It doesn't seem to work, and I think it might be broken. However, I have no idea how I... | <p>I am not entirely familiar with the ANET A8 electronics, but it's very unlikely it's any different from how any other mainboard works, so any instructions that work for RAMPS should work for your board as well.</p>
<p>The sensor you linked to has an operating voltage range of "6V to 36V". However, the ends... | <p>You will have to:</p>
<ol>
<li><p>Find and print something on Thingiverse to mount sensor;</p></li>
<li><p>Change firmware to Skynet and change the offset values accordingly, in order for the new sensor to recognize the bed.</p></li>
</ol>
<p>There is official Facebook page of Anet A8 printers as well as Skynet fi... | 480 |
<p>We have a need to take dozens of different protocols from systems such as security systems, fire alarms, camera systems etc.. and integrate them into a single common protocol.</p>
<p>I would like this to be a messaging server that many systems could subscribe to and or communicate through.</p>
<ul>
<li>polling and... | <p>If you don't mind working on the Java platform there's a lightweight protocol switcher and implementation of the <a href="http://activemq.apache.org/camel/enterprise-integration-patterns.html" rel="nofollow noreferrer">Enterprise Integration Patterns</a> in an open source project called <a href="http://activemq.apac... | <p>I suggest <a href="http://www.openscada.org" rel="nofollow noreferrer">OpenSCADA</a>. The website is at the moment a bit of a mess, but the software is actively in use and in active development. A explicit goal is to create a common, technology independent, interface for SCADA use cases (although at the moment the d... | 28,398 |
<pre><code>from distutils.core import setup
import py2exe, sys, os
sys.argv.append('py2exe')
setup(
options = {'py2exe': {'bundle_files': 1}},
windows = [{'script': "single.py"}],
zipfile = None,
)
</code></pre>
<p>in this setup file for py2exe where it says single.py is that where I place the name of my... | <p>I don't know your py2exe tool, but we usually use this way to convert py to exe:</p>
<ol>
<li><p>Download and install Standard Python Software:
<a href="http://www.python.org/download/" rel="nofollow noreferrer">http://www.python.org/download/</a></p></li>
<li><p>Download PyInstaller via link below:
<a href="http:/... | <p>Yes. Are you making a windowing application or a console application? See the example setup.py files that came with py2exe.</p>
| 36,401 |
<p>I have a string <code>User name (sales)</code> and I want to extract the text between the brackets, how would I do this? </p>
<p>I suspect sub-string but I can't work out how to read until the closing bracket, the length of text will vary.</p>
| <p>A very simple way to do it is by using regular expressions:</p>
<pre><code>Regex.Match("User name (sales)", @"\(([^)]*)\)").Groups[1].Value
</code></pre>
<hr>
<p>As a response to the (very funny) comment, here's the same Regex with some explanation:</p>
<pre><code>\( # Escaped parenthesis, means "sta... | <p>I came across this while I was looking for a solution to a very similar implementation.</p>
<p>Here is a snippet from my actual code. Starts substring from the first char (index 0).</p>
<pre><code> string separator = "\n"; //line terminator
string output;
string input= "HowAreYou?\nLets go there!";
output... | 49,563 |
<p>Because I run a blog aggregator website which checks a large list of RSS feeds for new posts every hour so I will be happy if its possible to use google feed api or <a href="http://code.google.com/apis/ajaxfeeds/" rel="nofollow noreferrer">Google AJAX Feed API</a> instead of making the cron jobs to read the whole fe... | <p>You can use the Google Feed API, however instead of polling the feed source every hour you will still need to poll the google feed API every hour. It doesn't notify you of feed updates. If you want to be notified when to update feeds, then you should look into using a ping server, <a href="http://en.wikipedia.org/... | <p>As Nanek said, the Google Feed API won't notify you when a feed is changed... for this you'll have to use the <strong>PubSubHubbub</strong> protocol or services like <a href="https://superfeedr.com/subscriber" rel="nofollow">Superfeedr</a> which is a Google Feed API alternative.</p>
| 25,179 |
<p>I'm not talking about tools that let one view a page in combinations of operating systems and browsers like crossbrowsertesting.com but in creating or figuring out the actual CSS.</p>
| <p>If you guys are still coding for IE6, you're making a mistake. </p>
<p>I use <strong>IE7.js</strong> to get IE6 to render pages like IE7. IE7 is not perfect, but at least it has some semblance of standards. Since I only have to code for IE7 and FF it makes me 33% more efficient in terms of testing against browse... | <p>I write to the standards and both Firefox and IE7 follow a pretty good set in common. </p>
<p>IE6 is dead as far as I am concerned but if I get back into professional web dev I'll probably have to revise that ;)</p>
| 4,570 |
<p>I upgraded my Ender 3 with a new Mobo, the 4.2.7 version.</p>
<p>My current setup is:</p>
<p>Printer Specifications:</p>
<ul>
<li>Ender 3</li>
<li>Upgraded Motherboard 4.2.7 (Silent Stepper Drivers)</li>
<li>Marlin FW Upgrade to Version 2.1.x</li>
<li>New metal extruder handle</li>
<li>Replacement bed springs</li>
<... | <p>There are different versions of the 4.2.7 main board. This is an excellent video made by <a href="https://www.youmaketech.com/how-to-adjust-stepper-motor-currents-on-ender-3-pro-v2/" rel="nofollow noreferrer">YouMakeTech</a>: <div class="youtube-embed"><div>
<iframe width="640px" height="395px" src=... | <p>I would try to reinstall the old board and see if the extruder still skips.</p>
<p>If the extruder is not having an issue with the old board installed, you'll need to visit <a href="https://www.creality.com/pages/download-ender-3?spm=..page_1934481.products_display_1.1" rel="nofollow noreferrer">Creality's Updates p... | 2,226 |
<p>I have a couple of questions about generic wildcards in Java:</p>
<ol>
<li><p>What is the difference between <code>List<? extends T></code> and <code>List<? super T></code>?</p></li>
<li><p>What is a bounded wildcard and what is an unbounded wildcard?</p></li>
</ol>
| <p>In your first question, <code><? extends T></code> and <code><? super T></code> are examples of bounded wildcards. An unbounded wildcard looks like <code><?></code>, and basically means <code><? extends Object></code>. It loosely means the generic can be any type. A bounded wildcard (<code... | <p>learn by example:</p>
<p>consider the <code>sort()</code> method in <code>Collections</code> class which use both <code>extends</code> and <code>super</code>:</p>
<pre><code> public static <T extends Comparable<? super T>> void sort(List<T> list){...}
</code></pre>
<p>so</p>
<p><strong>why <code... | 31,402 |
<p>In previous versions of VS, if you right-clicked a breakpoint's red dot and selected Disable Breakpoint, the dot would become 'hollow', and clicking it again would re-enable it. But in VS2008, disabling the breakpoint removes the red dot entirely and you need to go to the Breakpoints window to re-enable.</p>
<p>Any... | <p>Looks like a bug in VS 2008 SP1.</p>
<p><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=366060" rel="nofollow noreferrer"><a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=366060" rel="nofollow noreferrer">https://connect.microsoft.co... | <p>I have VS2008 SP1 and it has the 'diasble breakpoint' functionality you describe... do you have SP1 installed? Maybe it's a bug?</p>
| 28,907 |
<p>I'm looking for a regular expression that will match all strings EXCEPT those that contain a certain string within. Can someone help me construct it?</p>
<p>For example, looking for all strings that <em>do not</em> have a, b, and c in them in that order.</p>
<p>So <br />
abasfaf3 would match, whereas <br />
asasd... | <p>in perl:</p>
<pre><code>if($str !~ /a.*?b.*?.*c/g)
{
print "match";
}
</code></pre>
<p>should work.</p>
| <p>in Java:</p>
<pre><code>(?m)^a?(.(?!a[^b\r\n]*b[^\r\nc]*c))+$
</code></pre>
<p>does match</p>
<pre><code>abasfaf3
xxxabasfaf3
</code></pre>
<p>does not match</p>
<pre><code>asasdfbascf
xxxxasasdfbascf
</code></pre>
| 41,732 |
<p>I am working on an application where I have an images folder relative to my application root. I want to be able to specify this relative path in the Properties -> Settings designer eg. "\Images\". The issue I am running into is in cases where the Environment.CurrentDirectory gets changed via an OpenFileDialog the re... | <p>As far as I know, there is no built-in functionality that will allow this type of path resolution. Your best option is to dynamically determine the applications executing directory and concatenate to it your images path. You don't want to use <code>Environment.CurrentDirectory</code> specifically for the reasons you... | <p>2 options:</p>
<ul>
<li>The code that uses the setting can resolve the setting against the directory of the current executing assembly.</li>
<li>You can create your own type that serializes as a string relative to the executing assembly, and has an accessor for the full path that will resolve against the directory ... | 36,035 |
<p>Is there a way to have a file that is modified / touched whenever the WC is updated to a new revision? Or, as the second-best option, whenever <code>svn update</code> is executed?</p>
<p>Here's the motivation: I want to have the SVN revision number inside my executable. So I have to run SubWCRev as part of the buil... | <ol>
<li>Get the SubWCRev output into a temporary file</li>
<li>Compare this file to the current revision-number file</li>
<li>Overwrite it with the temp file only if the two are different</li>
<li>Delete the temporary file</li>
</ol>
<p>You might even be able to do this with a .bat file (using <code>fc</code>). Somet... | <p>My answer will probably be too short, but might give you some direction.</p>
<p>SVN has hooks. They are scripts that get executed everytime code is commited.</p>
<p>Maybe?</p>
| 19,219 |
<p>Why was the <code>arguments.callee.caller</code> property deprecated in JavaScript?</p>
<p>It was added and then deprecated in JavaScript, but it was omitted altogether by ECMAScript. Some browser (Mozilla, IE) have always supported it and don't have any plans on the map to remove support. Others (Safari, Opera) ... | <p>Early versions of JavaScript did not allow named function expressions, and because of that we could not make a recursive function expression:</p>
<pre><code> // This snippet will work:
function factorial(n) {
return (!(n>1))? 1 : factorial(n-1)*n;
}
[1,2,3,4,5].map(factorial);
// But this snippet will... | <p>Just an extension. The value of "this" changes during recursion. In the following (modified) example, factorial gets the {foo:true} object.</p>
<pre><code>[1,2,3,4,5].map(function factorial(n) {
console.log(this);
return (!(n>1))? 1 : factorial(n-1)*n;
}, {foo:true} );
</code></pre>
<p>factorial cal... | 12,925 |
<p>I was wondering which was better:</p>
<pre><code>$lookup = array( "a" => 1, "b" => 2, "c" => 3 );
return $lookup[$key];
</code></pre>
<p>or</p>
<pre><code>if ( $key == "a" ) return 1
else if ( $key == "b" ) return 2
else if ( $key == "c" ) return 3
</code></pre>
<p>or maybe just a nice switch...</p>
<p... | <p>For anything with measurable performance (not only 3 entries) lookup is fastest way. That's what hash tables are for.</p>
| <p>If you've got thousands of entries, an array lookup will win hands down. The associative array might be a bit slow, but finding an array key is much faster than doing thousands of <code>if()</code> blocks (not to mention the time it takes to type it all out!)</p>
| 44,760 |
<p>I am designing the (G)UI of a program, and have stumbled across a problem; The program will convert a number into different units, and the layout of a unit been converted to is:</p>
<p>[Unit name (when clicked gives information)]
[Special status, if any]
[Output in textfield that can also be used for input (to conv... | <p>There's nothing wrong with a Copy button after every field if you feel that it's going to be a very common operation. </p>
<p>Two suggestions, however:</p>
<ol>
<li><p>In terms of look and feel, make sure that the button is clearly associated with the field. For a text field, the best way to do this is to put the ... | <p>If you accidentally click on the wrong area, you could just click on the right area after that. If your issue lies in the user not knowing when they click on the wrong area, just highlight the last-clicked area.</p>
<p>Is there a problem with copying whatever is in the textfield when they click on it? So what if ... | 38,777 |
<p>For a complex web application that includes dynamic content and personalization, what is a good response time from the server (so excluding network latency and browser rendering time)? I'm thinking about sites like Facebook, Amazon, MyYahoo, etc. A related question is what is a good response time for a backend ser... | <p>There's a great deal of research on this. Here's a <a href="http://www.useit.com/papers/responsetime.html" rel="noreferrer">quick summary</a>.</p>
<blockquote>
<h2>Response Times: The 3 Important Limits</h2>
<p>by <a href="http://www.nngroup.com/articles/author/jakob-nielsen/" rel="noreferrer">Jakob Nielsen<... | <p>2 to 3 seconds</p>
| 19,848 |
<p>because i read that one of the advantages of <a href="http://en.wikipedia.org/wiki/WS-Discovery" rel="nofollow noreferrer">WS-Discovery</a> that it
"Support both SOAP 1.1 and SOAP 1.2 Envelopes"
so what?</p>
| <p>thanks for your replies. I toyed around with doing both of these suggestions but neither is "exactly" what I was looking for - even if it gets the job done. I can't see us ever going back to 1.1 either so we did end up making it the default but i'm still holding out hope that there's a magic setting on some task ... | <p>None of this works simple as the following lines:</p>
<p>First, create the website directory:</p>
<pre><code><WebDirectoryCreate
ServerName="$(DeployServerName)"
VirtualDirectoryName="MyVirualSiteName" />
</code></pre>
<p>Second, Apply the ASP.NET version you want:</p>
<pre><code><Instal... | 46,104 |
<p>I have a problem with stopping a service and starting it again and want to be notified when the process runs and let me know what the result is. </p>
<p>Here's the scenario,
I have a text file output of an "sc" command. I want to send that file but not as an attachment. Also, I want to see the initial status quic... | <p>Thanks to Jeremy Lew's answer and a bit more playing around, I figured out how to remove blank <code>xmlns</code> attributes: pass in the root node's namespace when creating any child node you want <em>not</em> to have a prefix on. Using a namespace without a prefix at the root means that you need to use that same ... | <p>If possible, create a serialization class then do:</p>
<pre><code>XmlSerializerNamespaces ns = new XmlSerializerNamespaces();
ns.Add("", "");
XmlSerializer serializer = new XmlSerializer(yourType);
serializer.Serialize(xmlTextWriter, someObject, ns);
</code></pre>
<p>It's safer, and you can control the namespaces ... | 16,354 |
<p>What's the best way to pipe the output from an java.io.OutputStream to a String in Java?</p>
<p>Say I have the method:</p>
<pre><code> writeToStream(Object o, OutputStream out)
</code></pre>
<p>Which writes certain data from the object to the given stream. However, I want to get this output into a String as easi... | <p>I would use a <code>ByteArrayOutputStream</code>. And on finish you can call:</p>
<pre><code>new String( baos.toByteArray(), codepage );
</code></pre>
<p>or better:</p>
<pre><code>baos.toString( codepage );
</code></pre>
<p>For the <code>String</code> constructor, the <code>codepage</code> can be a <code>String<... | <p>Here's what I did (don't use this in production, this is not great! But it makes fixing multiple errors easier.)</p>
<ul>
<li><p>Create a list that holds Exceptions.</p>
</li>
<li><p>Create a logger to log exceptions.</p>
</li>
<li><p>Use the code below:</p>
<p>private static void exceptionChecker() throws Exception... | 26,667 |
<p>Does anyone have any good suggestions for creating a Pipe object in Java which <em>is</em> both an InputStream and and OutputStream since Java does not have multiple inheritance and both of the streams are abstract classes instead of interfaces?</p>
<p>The underlying need is to have a single object that can be pass... | <p>It seems the point of this question is being missed. If I understand you correctly, you want an object that functions like an InputStream in one thread, and an OutputStream in another to create a means of communicating between the two threads.</p>
<p>Perhaps one answer is to use composition instead of inheritance ... | <p>I had to implement a filter for slow connections to Servlets so basically I wrapped the servlet output stream into a QueueOutputStream which will add every byte (in small buffers), into a queue, and then output those small buffers to a 2nd output stream, so in a way this acts as input/output stream, IMHO this is bet... | 47,633 |
<p>Instead of arranging controls on a winform form by specifying pixel locations, I'd like to lay it out similar to the way you'd layout a form in html. This would make it scale better (for larger fonts etc).</p>
<p>Does anyone know of a layout library that allows you to define the form in xml and lay it out similar ... | <p>Have you checked out the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.tablelayoutpanel.aspx" rel="nofollow noreferrer">TableLayoutPanel</a> and <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.flowlayoutpanel.aspx" rel="nofollow noreferrer">FlowLayoutPanel</a> in the .NE... | <p>You may also want to consider using Windows Presentation Foundation (WPF) instead of WinForms - WPF has an XML declarative markup language (XAML) that works well for defining scalable UI.</p>
| 7,217 |
<p>Is it possible to enable a second monitor programatically and extend the Windows Desktop onto it in C#? It needs to do the equivalent of turning on the checkbox in the image below.</p>
<p><img src="https://i.stack.imgur.com/ss2sE.png" alt="alt text"></p>
| <p><a href="http://msdn.microsoft.com/en-us/library/ms533259.aspx" rel="noreferrer">MSDN Device Context Functions</a></p>
<p>What you basically need to do:</p>
<blockquote>
<p>Use the EnumDisplayDevices() API call
to enumerate the display devices on
the system and look for those that
don't have the
<code>DI... | <p>To enable a monitor, set its position to something other than 0,0, like as shown:</p>
<pre><code>POINTL enabledPosition = new POINTL();
enabledPosition.x = -1280;
enabledPosition.y = 0;
dm.dmPosition = enabledPosition;
dm.dmFields = DM.Position;
res = ChangeDisplaySettingsEx(d.DeviceName, ref dm, IntPtr.Zero, (uin... | 28,891 |
<p>I have CLI/MFC application and I would like to begin to learn how to unit test with it. I have VS2008 Pro. If possible, I would like to use the built in unit testing. Thanks for your input!</p>
| <p>I've had success with both <a href="http://sourceforge.net/projects/cppunit" rel="nofollow noreferrer">CPPUnit</a> and <a href="http://code.google.com/p/googletest/" rel="nofollow noreferrer">Google Test</a>. For either you have to do a bit of work to get the test results to integrate back into Studio. The granula... | <p>We use Gallio & MbUnit to test our MFC & C++/CLI application. Simply write the tests in C++/CLI then you can test both managed and unmanged code in a single framework. We also use NMock2 for mocking the managed code.</p>
| 44,796 |
<p>Currently I have a ListView (using the Details View). I would like to implement the behaviour whereby when a user selects a single item (log entry) the log entry expands (from one line to multiple lines) to provide more detailed information about the error that occured.</p>
<p>My question is this: Is this possible?... | <p>Edit: sorry this is wpf</p>
<p>The trick I used to achieve the same thing was creating a trigger to show a secondary grid which is defaulted to collapsed.</p>
<p>Try this out:</p>
<pre><code> <ListBox ItemsSource="{Binding}">
<ListBox.ItemTemplate>
<DataTemplate>
... | <p>Not a direct answer to your question, but I think
you're better off with a grid in this case.</p>
| 38,190 |
<p>I bought a set of 5 <a href="https://a.aliexpress.com/_mL7Tt7b" rel="nofollow noreferrer">stepper motors</a> from Trianglelab's official Aliexpress shop.</p>
<p><a href="https://i.stack.imgur.com/XZDW8.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XZDW8.jpg" alt="enter image description here" />... | <p>For the AliExpress part, open a dispute and attach pictures to the dispute and ask for a partial, reasonable discount. It always worked for me.</p>
<p>As for how to test the motors themselves, it depends on what other hardware you have.</p>
<p>For example, you could wire the motors to your printer board, and try to ... | <p>I would be far more worried about damage to the wire insulation (i.e. are they nicked/cut at all or just scuffed up?) as that could potentially lead to a short circuit situation against your frame etc. Assuming no serious cable damage, motors can take a fair amount of mechanical abuse so I'd just put them through t... | 1,788 |
<p>Marlin offers a bunch of different choices for auto-levelling and assisted manual levelling for bent build plates (mesh levelling), but for the moment I want to level things completely manually.</p>
<p>That is, I want to move Z to 0, disable steppers, and then move around the print head and adjust the distance betw... | <p>Write a few pieces of gcode to do this. Place it on an SD-card (I assume you have a reader) and select the file you want to execute.</p>
<p>Home all:</p>
<pre><code>G28
G1 Z0
</code></pre>
<p>Do you really want to home it directly? I would say you want to take it down slowly and adjusting end-stops incrementally.... | <p>The way I manually level my bed is by connecting a computer to the printer via USB. As far as I am aware, if you have a touchscreen this should be available on the printer options as well for marlin.</p>
<p>But if you connect a computer, simply run something like pronterface or any other manual control gui and:</p>... | 532 |
<p>I'm doing this system <a href="http://stacked.ra-ajax.org/" rel="nofollow noreferrer">Stacked</a> and I am creating the search function. And in that process it occurs to me that <em>maybe</em> AR/nHibernate Expression.Like (and siblings) might maybe not be 100% "safe" in that you can create stuff like;
"\r\ndrop dat... | <p>NHibernate (and by extension ActiveRecord) generate parameterized SQL statements of the form <code>sp_executesql 'select blah from table where column = @p1', '@p1 varchar(10)', @p1 = 'drop database xxx;---'</code> for queries. These types of SQL statements are safe from SQL injection because the contents of the par... | <p>If you find a security bug, you should definitely file it. Many rely on such things.</p>
| 43,137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.