instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have quickly read over the <a href="http://msdn.microsoft.com/en-us/library/bb397687.aspx" rel="noreferrer">Microsoft Lambda Expression</a> documentation.</p>
<p>This kind of example has helped me to understand better, though: </p>
<pre><code>delegate int del(int i);
del myDelegate = x => x * x;
int j = myDel... | <p><a href="http://weblogs.asp.net/scottgu/archive/2007/04/08/new-orcas-language-feature-lambda-expressions.aspx" rel="noreferrer">Lambda expressions</a> are a simpler syntax for anonymous delegates and can be used everywhere an anonymous delegate can be used. However, the opposite is not true; lambda expressions can ... | <p>This is perhaps the best explanations on why to use lambda expressions -> <a href="https://youtu.be/j9nj5dTo54Q" rel="nofollow noreferrer">https://youtu.be/j9nj5dTo54Q</a> </p>
<p>In summary, it's to improve code readability, reduce chances of errors by reusing rather than replicating code, and leverage optimizatio... | 20,211 |
<p>I'd like to mirror a triangular prism I made. However, whenever I select it I am only able to select the faces or sides.</p>
<p>Is there a way to select the whole 3D object to move or mirror it?</p>
| <p>Yes, there is a "select" tool in the toolbar next to "make". You can use select filters to select components, bodies and faces.</p>
| <p>Selecting the body in the browser will select the entire body. Clicking on the body in the viewer will only get you faces or edges. </p>
<p>A long click (click and hold) on the model will give you options on what to select. You can choose a face or body under "Depth" or choose a body or feature under "Parents." </... | 815 |
<p>I have a table in an MS SQL Server db. I want to create a script that will put the table and all records into another db. So I right-click the table in Management Studio and select Create-To new query editor... but all I get is the table structure. </p>
<p>How exactly do I get the values too?</p>
| <p>One of the things I really like about the tools for MySQL that SQL Server is missing out of the box to be certain.</p>
<p>You can use a <a href="http://vyaskn.tripod.com/code/generate_inserts.txt" rel="nofollow noreferrer">script to do it</a> however.</p>
| <p>it doesn't really create a "SQL script" but it does the job :</p>
<ul>
<li><p>select the database in the object explorer </p></li>
<li><p>right click</p></li>
<li><p>select import/export data</p></li>
<li><p>follow the wizard</p></li>
<li><p>at the end of the process you can save the "integration service package" t... | 28,684 |
<p>Is there a way to find all nodes in a xml tree using cElementTree? The findall method works only for specified tags.</p>
| <p>You can use <a href="http://effbot.org/zone/element-xpath.htm" rel="nofollow noreferrer">XPath paths</a> on the findall method:</p>
<blockquote>
<p>The 1.2 release supports simple
element location paths. In its
simplest form, a location path is one
or more tag names, separated by
slashes (/).</p>
<p>... | <p>Have you looked at node.getiterator()?</p>
| 39,083 |
<p>I have a shell script that executes a number of commands. How do I make the shell script exit if any of the commands exit with a non-zero exit code?</p>
| <p>After each command, the exit code can be found in the <code>$?</code> variable so you would have something like:</p>
<pre><code>ls -al file.ext
rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi
</code></pre>
<p>You need to be careful of piped commands since the <code>$?</code> only gives you the return code of the last ... | <pre><code>#
#------------------------------------------------------------------------------
# purpose: to run a command, log cmd output, exit on error
# usage:
# set -e; do_run_cmd_or_exit "$cmd" ; set +e
#------------------------------------------------------------------------------
do_run_cmd_or_exit(){
... | 11,579 |
<p>While connecting .NET to sybase server I got this error message:</p>
<blockquote>
<p>[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified</p>
</blockquote>
<p>This has worked properly before. System DSN with same details worked and data connection through vs.net also worked.</p... | <p>If you're working with an x64 server, keep in mind that there are different ODBC settings for x86 and x64 applications. The "Data Sources (ODBC)" tool in the Administrative Tools list takes you to the x64 version. To view/edit the x86 ODBC settings, you'll need to run that version of the tool manually:</p>
<pre><co... | <p>Perform the following steps:</p>
<ol>
<li>Start the Registry Editor by typing <code>regedit</code> in the Run window.</li>
<li>Select the following key in the registry: <code>HKEY_LOCAL_MACHINE\SOFTWARE\ODBC</code>.</li>
<li>In the Security menu, click Permissions.</li>
<li>Grant Full Permission to the account whic... | 35,933 |
<p>I have a bunch a values I would like to add together which are entered into a form. Right now, the form has 11 lines but it could get larger in the future. I can easily add all the values together with something like:</p>
<pre><code>$total = $value1 + $value2 + ... + $value11;
</code></pre>
<p>All the values I wan... | <pre><code>for ($i = 1 ; $i <= 3 ; $i++){
$varName = "pBalance".$i;
$tempTotal += $$varName;
}
</code></pre>
<p>This will do what you want. However you might indeed consider using an array for this kind of thing.</p>
| <p>The concept you're looking for is called a variable variable (at least it's called that in PHP). Here is the official <a href="http://ca.php.net/language.variables.variable" rel="nofollow noreferrer">documentation</a> and a useful <a href="http://www.devshed.com/c/a/PHP/Using-Variable-Variables-in-PHP/" rel="nofollo... | 15,816 |
<p>Given a template where the HTML cannot be modified because of other requirements, how is it possible to display (rearrange) a <code>div</code> above another <code>div</code> when they are not in that order in the HTML? Both <code>div</code>s contain data that varies in height and width.</p>
<pre><code><div id="w... | <p><a href="http://tanalin.com/en/articles/css-block-order/" rel="noreferrer">This solution</a> uses only CSS and works with variable content</p>
<pre class="lang-css prettyprint-override"><code>#wrapper { display: table; }
#firstDiv { display: table-footer-group; }
#secondDiv { display: table-header-group; }
</cod... | <p>CSS really shouldn't be used to restructure the HTML backend. However, it is possible if you know the height of both elements involved and are feeling hackish. Also, text selection will be messed up when going between the divs, but that's because the HTML and CSS order are opposite.</p>
<pre><code>#firstDiv { posit... | 27,124 |
<p>I won the bid on a project and now the client (who is itself from IT Department) wants me to architect/implement the solution in a very particular way. I am sure the application will fail that way for performance problems. And it will not be easily scalable.</p>
<p>This particular client/user does not know ANYTHING... | <p>You're looking at this from the entirely wrong perspective. This isn't a stupid request from a client who doesn't know anything about technology. It's a design constraint that you think introduces risk into the project.</p>
<p>So you do whatever you do when you encounter risk in a project: Define it, assess it, ... | <p>Basically it is only you that can answer this question. You know your client and your situation the best and if you can find a way to make this work, it's your call.</p>
<p>Personally, I would decline the project. If they want to keep you, explain why you can't take the project under the requirements set forth.</p>... | 29,305 |
<p>I have a query (which was created by LINQ to SQL) to get me a list of 'site visits' that were made between a certain date range which resulted in an order (orderid is not null).</p>
<p>Theres nothing wrong with the query. I just need advice on creating the correct index for it. I was playing around trying different... | <p>How many rows do you expect to have between a typical date range? Are you typically looking at a month at a time?</p>
<p>I would start out with an index over the <code>[Date]</code> column. If, for a typical query, your resulting row count is small you shouldn't need to add the <code>[OrderId]</code> column to yo... | <p>It's also worth considering if you need to store rows in the SiteVisit who don't have a KnownRefererId in your KnownReferer table, and who have a Null OrderId. If you don't need these, change delete them from the table, and change your clustered index to be on both SiteVisitId and Date and the query should be pretty... | 40,244 |
<p>I know something about Java but completely new to Enterprise Java. I'm trying my hand with NetBeans 6.1 and GlassFish Application Server.
Please guide me to some resources which tell me actually what java enterprise applications are, how they are different from normal java classes etc. </p>
<p>Also which is the be... | <p>"what java enterprise applications are, how they are different from normal java classes etc"</p>
<p>Well they are normal classes. They are ran by an application server. The "application server" is often <em>just a JVM</em>, but sometimes enhanced or modified or extended by the vendor. But that shouldn't be any conc... | <p>Glassfish on Linux is an excellent choice.</p>
| 10,067 |
<p>I am trying to create a new contact using Dynamic Entity. The sample i found in CRM SDK had this code.</p>
<pre><code>// Set the properties of the contact using property objects.
StringProperty firstname = new StringProperty();
firstname.Name = "firstname";
firstname.Value = "Jesper";
... | <p>Here is an article from Microsoft that makes an attempt to discuss this topic:</p>
<p><a href="http://community.dynamics.com/blogs/cscrmblog/archive/2008/06/23/web-services-amp-dlls-or-what-s-up-with-all-the-duplicate-classes.aspx" rel="nofollow noreferrer">http://community.dynamics.com/blogs/cscrmblog/archive/2008... | <p>I believe the issue is that you are referencing the dynamic entity class in the Microsoft.Crm.Sdk assembly. The sample in the SDK is using a reference to the CRM web service. This can get confusing as both assemblies contain many of the same types, however they are different.</p>
| 25,032 |
<p>I have db table with parent child relationship as:</p>
<pre><code>NodeId NodeName ParentId
------------------------------
1 Node1 0
2 Node2 0
3 Node3 1
4 Node4 1
5 Node5 3
6 Node6 5
7 Node7 2
</code></pre>
<p>He... | <pre><code>with [CTE] as (
select * from [TheTable] c where c.[ParentId] = 1
union all
select * from [CTE] p, [TheTable] c where c.[ParentId] = p.[NodeId]
)
select * from [CTE]
</code></pre>
| <pre><code> WITH Temp_Menu AS
(
SELECT AM.* from FCB_AccessMenu AM where AM.[ParentId] = 6
UNION ALL
SELECT AM.* FROM FCB_AccessMenu AM ,Temp_Menu TM WHERE AM.[ParentID]=TM.[MenuID]
)
SELECT * FROM Temp_Menu ORDER BY ParentID
</code></pre>
| 25,406 |
<p>I'd like to find the different ways to solve a real life problem I had: imagine to have a contest, or a game, during which the users collect points. You have to build a query to show the list of users with the best "n" scores. </p>
<p>I'm making an example to clarify. Let's say that this is the Users table, with th... | <p>Untested, but should work:</p>
<pre><code>select * from users where points in
(select distinct top 3 points from users order by points desc)
</code></pre>
| <p>@bosnic, I don't think that will work as requested, I'm not that familiar with MS SQL but I would expect it to return only 3 rows, and ignore the fact that 3 users are tied for 3rd place.</p>
<p>Something like this should work:</p>
<pre><code>select userid, points
from scores
where points in (select top 3 ... | 5,853 |
<p>I need to create a web application installer.</p>
<p>Install Shield seems like overkill, is there something that can reliably install a web application (IIS setup + sql server db setup).</p>
<p>Suggestions?</p>
| <p>CruiseControl.NET (<a href="http://sourceforge.net/projects/ccnet/" rel="nofollow noreferrer">http://sourceforge.net/projects/ccnet/</a>) uses NullSoft's NSIS for this. It does a good job and it's free. The installer setup scripts, including the VBScript program that sets some of the website characteristics in II... | <p>installshield is a good way to do this. handles sql server setup and iis config fairly well. </p>
<p>not cheap though I'm afraid but worth it for any type of install. wix might be an good option but how much time can you afford to spend on learning it rather than clicking some wizards in installshield.</p>
| 32,793 |
<p>I know you cannot use a alias column in the where clause for T-SQL; however, has Microsoft provided some kind of workaround for this?</p>
<blockquote>
<p><strong>Related Questions:</strong> </p>
<ul>
<li><a href="https://stackoverflow.com/questions/200200/can-you-use-an-alias-in-the-where-clause-in-mysql"... | <p>One workaround would be to use a derived table.</p>
<p>For example:</p>
<pre><code>select *
from
(
select a + b as aliased_column
from table
) dt
where dt.aliased_column = something.
</code></pre>
<p>I hope this helps.</p>
| <p>Depending on what you are aliasing, you could turn it into a user defined function and reference that in both places. Otherwise your copying the aliased code in several places, which tends to become very ugly and means updating 3+ spots if you are also ordering on that column.</p>
| 32,547 |
<p>I'm automating some source control software functionality using a dot bat script but given that our svn repos are hosted in a *NIX box, I'm facing the eternal case problem between these two worlds.</p>
<p>Is there any cmd.exe function to convert the value of the Windows system variable %USERNAME% to lower case?</p>... | <p>a quick google found <a href="http://cwashington.netreach.net/depo/view.asp?Index=780" rel="noreferrer">this</a>... </p>
<pre><code>@echo off
goto :end_remarks
*************************************************************************************
*
*
* authored:Sam Wofford
* Returns lowercase of a string
* ... |
<p>This is the same answer /by <a href="https://stackoverflow.com/users/8177207/it-wasnt-me?tab=profile">@It Wasn't Me</a> <a href="https://superuser.com/a/1522183/969781">here</a></p>
<hr>
<p>For a predictive character set, this substring <strong><code>Set !var:A=a!</code></strong> works, and only working with <s... | 36,138 |
<p>I'm new to Air. I've got an existing Flex 2 application which I'm considering bringing into Flexbuilder 3. My question is can I use the same base application (and source code) to make the Air version, or would I have to maintain to separate code trees: one for the Air version and one for the Flex/SWF version?</p>
| <p>The best approach I've found to creating both Flex and AIR applications from the same source, is to use a core library project for almost all code, with separate small projects for the Flex and AIR applications.</p>
<p>There are two key concepts that make this very powerful and maintainable, allowing for not just t... | <p>Create 3 project: Air, Web, and common. from air and web, include common. </p>
<p><a href="http://simplifiedchaos.com/how-to-compile-both-flex-and-air-application" rel="nofollow">http://simplifiedchaos.com/how-to-compile-both-flex-and-air-application</a></p>
| 11,888 |
<p>Is there a good Eclipse plugin for recording and playing back macros?</p>
<p>I've tried <a href="http://web.archive.org/web/20161025001953/http://www.bdaum.de:80/eclipse/" rel="nofollow noreferrer">this one</a>, but it didn't do me any good- it seemed like it wasn't ready for prime time.</p>
<p>I know about editor... | <p>I put something together over the last month or so that you may find useful. It has limitations since the Eclipse editor/commands weren't designed with macro support in mind, but I think it works reasonably well. I just posted <a href="http://sourceforge.net/projects/practicalmacro/files/" rel="noreferrer">Practica... | <p>Just for the record, there is another project called <a href="http://web.archive.org/web/20070724060839/https://macroshmacro.dev.java.net/" rel="nofollow noreferrer">MacroSchmacro</a> that does Eclipse macros, but it doesn't record many important things (like searching to navigate). It is also extremely slow.</p>
| 12,878 |
<p>Here is one of my header file which consists of a union template with 4 different structures.</p>
<pre><code>#define MAX 3
union family
{
struct name /*for taking the name and gender of original member*/
{
unsigned char *namess;
unsigned int gender;
union family *ptr_ancestor; /*this... | <p>You need to read this <a href="https://stackoverflow.com/questions/252552/unions-in-c">question about unions</a>. You want something more like:</p>
<pre><code>struct family {
struct name {
int gender;
int married;
blah
} names;
union {
struct male { blah } male_ancestor... | <p>Do you know what union means in C? Your union doesn't have 3 members. Your union has 4 members. Among those 4 members, how many do you want to store values in?</p>
<p>Why didn't you ask your TA?</p>
| 31,475 |
<p>I am on a shared host and can not change the symbolic link to Python2.4, it defaults to 2.3. I tried creating a sym link in the director I would be working on to 2.4, but it seems the the 'global' python interpreter under /usr/bin/python take presedence unless I run it as ./python. What alternative ways are there to... | <p>Create a symlink and prepend the path to your PATH variable:</p>
<pre><code>ln -s /usr/bin/python2.4 $HOME/bin/python
export PATH="$HOME/bin:$PATH"
</code></pre>
| <p>If you're working from the shell, you can create a symbolic link as suggested and update your path in the .profile. This is described in a previous post.</p>
<p>In case these are CGI/whatever scripts that you only run on your shared host, you can alter the shebang line at the top of your scripts that tell the syste... | 45,992 |
<p>I just wanted some opinions from people that have run Selenium (<a href="http://selenium.openqa.org" rel="nofollow noreferrer">http://selenium.openqa.org</a>) I have had a lot of experience with WaTiN and even wrote a recording suite for it. I had it producing some well-structured code but being only maintained by m... | <p>If you are using <a href="http://selenium-ide.openqa.org/" rel="nofollow noreferrer">Selenium IDE</a> to generate code, then you just get a list of every action that selenium will execute. To me, Selenium IDE is a good way to start or do a fast "try and see" test. But, when you think about maintainability and more r... | <p>Selenium is pretty decent tool but there are couple things to watch out:</p>
<ul>
<li><p>Selenium IDE and Selenium core do not share 100% same functionality. For example right clicking is supported by IDE but current core release does not have it. However, using a newer version from their repository solves that.</p... | 12,508 |
<p>I have researched and haven't found a way to run INTERSECT and MINUS operations in MS Access. Does any way exist</p>
| <p>INTERSECT is an inner join. MINUS is an outer join, where you choose only the records that don't exist in the other table.
<hr>
<b>INTERSECT</b></p>
<pre><code>select distinct
a.*
from
a
inner join b on a.id = b.id
</code></pre>
<hr>
<p><b>MINUS</b></p>
<pre><code>select distinct
a.*
from
a
left ... | <p>I believe this one does the MINUS</p>
<pre><code>SELECT DISTINCT
a.CustomerID,
b.CustomerID
FROM
tblCustomers a
LEFT JOIN
[Copy Of tblCustomers] b
ON
a.CustomerID = b.CustomerID
WHERE
b.CustomerID IS NULL
</code></pre>
| 43,744 |
<p>What do you think the next evolution of languages will look like?</p>
| <p>You might assume C and C++ are being "phased out" and that Java/.Net/Python/whatever is an "advance" or the "next stop".</p>
<p>They are all used heavily (see the number C or C++ of tags on this site). The difference is that neither one is the lingua-franca of the programming world anymore. It used to be that the m... | <p>On the short term, I expect high level languages to become more powerful and more used. Perl 6 and Javascript 2.0 are good examples of what awaits us.</p>
<p>On the long term, functional languages might make it into the mainstream, but I expect that will not happen any time soon.</p>
| 19,678 |
<p>I keep seeing references to the visitor pattern in blogs but I've got to admit, I just don't get it. I read the <a href="http://en.wikipedia.org/wiki/Visitor_pattern" rel="noreferrer">wikipedia article for the pattern</a> and I understand its mechanics but I'm still confused as to when I'd use it.</p>
<p>As someon... | <p>I'm not very familiar with the Visitor pattern. Let's see if I got it right. Suppose you have a hierarchy of animals</p>
<pre class="lang-cpp prettyprint-override"><code>class Animal { };
class Dog: public Animal { };
class Cat: public Animal { };
</code></pre>
<p>(Suppose it is a complex hierarchy with a well-... | <p>Thanks for the awesome explanation of <a href="https://stackoverflow.com/questions/255214/when-should-i-use-the-visitor-design-pattern/50575946#50575946#answer-255300">@Federico A. Ramponi</a>, I just made this in <strong>java</strong> version. Hope it might be helpful. </p>
<p>Also just as <a href="https://stackov... | 31,844 |
<p>I'm very new to 3D printing and I've had numerous failed prints. Sometimes, the print is good but while trying to get it off the base I end up bending or breaking the print.</p>
<p>My question is: How to I print and make it easier to release from the plate?</p>
<p>I'm printing with PETG, PLA and ABS. At the moment... | <p>I would reccomend heating up the base a bit. If your printer doesnt come with such an option, try heat-gun.</p>
| <p>I use multiple layers of Elmer's white glue on the glass bed (five layers I think). The glue is PVA which provides a textured surface onto which the PETG adheres. It sticks better when the bed is hot than when the bed is cold. I use a bed temp of 58 degrees on my Anet A8. I have found out that the temp reported by t... | 765 |
<p>I have several sites (Asp.Net) that I would like to have a single sign on for...</p>
<p>I would like a user to visit Site1 and have Site1 contact a central single sign-on server (SSS). </p>
<p>The SSS would then determine that the user was not logged on (Not sure how) and would redirect the user to a Logon screen ... | <p>Don't discard OpenID so rapidly - as the site owner, it's up to you to choose which OpenID provider(s) you choose to support. You could choose to run your own OpenID server and only trust it.</p>
<p>Also, remember that OpenID is a system for authentication - how user X proves they are who they say they are.</p>
<p... | <p>You could try using a shared session state server.</p>
| 28,962 |
<p>How can I use the Prototype library and create unobtrusive javascript to inject the onmouseover and onmouseout events to each row, rather than putting the javascript in each table row tag?</p>
<p>An answer utilizing the Prototype library (instead of mootools, jQuery, etc) would be most helpful.</p>
| <pre><code><table id="mytable">
<tbody>
<tr><td>Foo</td><td>Bar</td></tr>
<tr><td>Bork</td><td>Bork</td></tr>
</tbody>
</table>
<script type="text/javascript">
$$('#mytable tr').each(function... | <p>I found ab interesting solution for Rows background, the rows highlighting on mouse over, without JS. Here is <a href="http://www.sopov.com/joomla-wordpress-tips-and-tricks/70-how-highlight-table-row-background.html" rel="nofollow noreferrer">link</a></p>
<p>Works in all browsers. For IE6/7/8 ...</p>
<pre><code>t... | 7,548 |
<p>I want to setup my local development machine so that any requests for <code>*.local</code> are redirected to <code>localhost</code>. The idea is that as I develop multiple sites, I can just add vhosts to Apache called <code>site1.local</code>, <code>site2.local</code> etc, and have them all resolve to <code>localhos... | <p>Acrylic DNS Proxy (free, open source) does the job. It creates a proxy DNS server (on your own computer) with its own hosts file. The hosts file accepts wildcards.</p>
<p><strong>Download from the offical website</strong></p>
<p><a href="http://mayakron.altervista.org/support/browse.php?path=Acrylic&name=Home"... | <p>You can use a dynamic DNS client such as <a href="http://www.no-ip.com" rel="nofollow noreferrer">http://www.no-ip.com</a>. Then, with an external DNS server CNAME *.mydomain.com to mydomain.no-ip.com.</p>
| 16,722 |
<p>We are using Team City and I noticed problem during running Watin test. Sometimes some instance of IE randomly just don't stop in task manager on build server, even if test closes all opened instances. This causes failure of all tests that follows.
We tried with script that kills all instances of ie before this test... | <p>I don't know if it will help but.... I had a similar error.
My issue was: "running the tests on Vista with internet explorer having protectedMode = On for localhost "</p>
<p>The solution is documented here:
<a href="http://codebetter.com/blogs/james.kovacs/archive/2008/06/18/running-watin-tests-on-vista.aspx" rel=... | <p>This is the error message:</p>
<blockquote>
<p>WatiN.Core.Exceptions.TimeoutException
: Timeout while Internet Explorer busy
TearDown :
System.Reflection.TargetInvocationException
: Exception has been thrown by the
target of an invocation.
----> System.NullReferenceException : Object reference not set... | 30,741 |
<p>This is kinda a general question, open for opinions. I've been trying to come up with a good way to design for localization of string resources for a Windows MFC application and related utilities. My wishlist is:</p>
<ul>
<li>Must preserve string literals in code (as opposed to replacing with macro #define resource... | <p>We use the English string as the ID.</p>
<p>If it fails the look up from the international resource object (loaded from the I18N dll installed) then we default to the ID string.</p>
<p>Code looks like:</p>
<pre><code>doAction(I18N.get("Press OK to continue"));
</code></pre>
<p>As part of the build processes we h... | <p>On one project I had localized into 10+ languages, I put everything that was to be localized into a single resource-only dll. At install time, the user selected which dll got installed with their application.</p>
<p>I only had to deliver the English dll to the localization team. They returned a localized dll to m... | 22,408 |
<p>I'm able to get cells to format as Dates, but I've been unable to get cells to format as currency... Anyone have an example of how to create a style to get this to work? My code below show the styles I'm creating... the styleDateFormat works like a champ while styleCurrencyFormat has no affect on the cell.</p>
<pr... | <p>After digging through the documentation a bit more, I found the answer:</p>
<p><a href="http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFDataFormat.html" rel="noreferrer">http://poi.apache.org/apidocs/org/apache/poi/hssf/usermodel/HSSFDataFormat.html</a></p>
<p>Just need to find an appropriate pre-s... | <p>You can try this code to format your cell with currency mode (with thowsand separator like used in Brazil or Germany. Eg. 12.345,67):</p>
<pre><code>HSSFCellStyle cell = yourWorkBook.createCellStyle();
CreationHelper ch = yourWorkBook.getCreationHelper();
cell.setDataFormat(ch.createDataFormat().getFormat("#,##0.00... | 41,303 |
<p>I have come to realize that Windbg is a very powerful debugger for the Windows platform & I learn something new about it once in a while. Can fellow Windbg users share some of their mad skills?</p>
<p>ps: I am not looking for a nifty command, those can be found in the documentation. How about sharing tips on do... | <p>My favorite is the command <code>.cmdtree <file></code> (undocumented, but referenced in previous release notes). This can assist in bringing up another window (that can be docked) to display helpful or commonly used commands. This can help make the user much more productive using the tool.</p>
<p>Initially t... | <p>Do <strong>not</strong> use WinDbg's <code>.heap -stat</code> command. It will sometimes give you incorrect output. Instead, use DebugDiags memory reporting.</p>
<p>Having the correct numbers, you can then use WinDbg's <code>.heap -flt ...</code> command.</p>
| 15,521 |
<p>A 3D printer needs to be homed (homing) before the print starts.</p>
<ul>
<li>What is homing?</li>
<li>What is the purpose of homing?</li>
<li>Is it necessary?</li>
</ul>
| <blockquote>
<ul>
<li>What is homing?</li>
</ul>
</blockquote>
<p>From the <a href="https://3dprinting.stackexchange.com/tags/homing/info">tag wiki</a> <a href="/questions/tagged/homing" class="post-tag" title="show questions tagged 'homing'" rel="tag">homing</a> we can read:</p>
<blockquote>
<p>The process of ... | <p>Most 3d printers control head position using stepper motors and end stops with no position feedback. The stepper motor does not actually know its location.</p>
<p>The printer's control system can only know the location of the head by keeping track of the relative number of steps the head has been moved by the stepp... | 2,059 |
<p>We are a small team of 3 developers (2 experienced but new to this particular business sector) developing a functionally complex product. We're using Scrum and have a demo at the end of each sprint. Its clear that the functional team have plenty of ideas but these are not well communicated to the development team... | <p>Have you tried working with your customer to define / formulate <strong>acceptance tests</strong>?<br>
Using something like Fit to come up with these tests - would result in better specs as well as force the customer to think about what is really required. The icing on the cake is instant-doc-executable specs at the... | <p>Are they participating in the stand-up meetings?</p>
<p>You could propose to have a representative at each (or some) of them, to ask them for input before the end of the sprint</p>
| 4,849 |
<p>I have some HTML and jQuery that slides a <code>div</code> up and down to show or hide` it when a link is clicked:</p>
<pre class="lang-html prettyprint-override"><code><ul class="product-info">
<li>
<a href="#">YOU CLICK THIS TO SHOW/HIDE</a>
<div class="toggle">
<p... | <p>Try something like:</p>
<pre><code>$('div.toggle').hide();
$('ul.product-info li a').click(function(event) {
event.preventDefault();
$(this).next('div').slideToggle(200);
});
</code></pre>
<p>Here is the page about that in the <a href="http://learn.jquery.com/events/event-basics/#preventdefault" rel="noref... | <p>You can make use of <code>return false;</code> from the event call to stop the event propagation, it acts like an <code>event.preventDefault();</code> negating it. Or you can use <code>javascript:void(0)</code> in href attribute to evaluate the given expression and then return <code>undefined</code> to the element.<... | 33,274 |
<p>I can use <code>set_error_handler()</code> to catch most PHP errors, but it doesn't work for fatal (<code>E_ERROR</code>) errors, such as calling a function that doesn't exist. Is there another way to catch these errors?</p>
<p>I am trying to call <code>mail()</code> for all errors and am running PHP 5.2.3.</p>
| <p>Log fatal errors using the <code>register_shutdown_function</code>, which requires PHP 5.2+:</p>
<pre><code>register_shutdown_function( "fatal_handler" );
function fatal_handler() {
$errfile = "unknown file";
$errstr = "shutdown";
$errno = E_CORE_ERROR;
$errline = 0;
$error = error_get_last... | <p>As of PHP 7.4.13 my experience is that all possible errors and exceptions in a program can be caught with only two callback functions:</p>
<pre><code>set_error_handler("ErrorCB");
set_exception_handler("ExceptCB");
</code></pre>
<p>ErrorCB simply reports its arguments in any way desired and calls... | 34,981 |
<p>Let's say I have committed some bad changes to Subversion repository. Then I commit good changes, that I want to keep.</p>
<p>What would be easiest way to roll back those bad changes in Eclipse, and keep the good changes? Assuming that files relating to bad changes are not same as those relating to the good changes... | <p>You have two choices to do this.</p>
<p>The Quick and Dirty is selecting your files (using <kbd>ctrl</kbd>) in Project Explorer view, right-click them, choose <code>Replace with...</code> and then you choose the best option for you, from <code>Latest from Repository</code>, or some <code>Branch</code> version. Afte... | <p>I have same problem but CleanUp eclipse option doesn't work for me.</p>
<p>1) install TortoiseSVN <br>
2) Go to windows explorer and right click on your project directory<br>
3 Choice CleanUp option (by checking break lock option)<br></p>
<p>It's works.</p>
<p>Hope this helps someone.</p>
| 5,659 |
<p>At work we are currently still using JUnit 3 to run our tests. We have been considering switching over to JUnit 4 for <strong>new</strong> tests being written but I have been keeping an eye on TestNG for a while now. What experiences have you all had with either JUnit 4 or TestNG, and which seems to work better for ... | <p>I've used both, but I have to agree with Justin Standard that you shouldn't really consider rewriting your existing tests to any new format. Regardless of the decision, it is pretty trivial to run both. TestNG strives to be much more configurable than JUnit, but in the end they both work equally well.</p>
<p>Test... | <p>Your question seems two folded to me. On one had you would like to compare two test frameworks, on the other hand you would like to implement tests easily, have natural assertions, etc...</p>
<p>Ok, firstly JUnit has been playing catchup with TestNG in terms of functionality, they have bridged the gap some what wit... | 2,839 |
<p>I have library code that overrides Ar's find method. I also include the module for all Association classes so both MyModel.find and @parent.my_models.find work and apply the correct scope.</p>
<p>I based my code off of will_paginate's:</p>
<pre><code>a = ActiveRecord::Associations
returning([ a::AssociationCollect... | <p>First of all, make sure you know Ruby's <a href="http://mpathirage.com/ruby-method-lookupmethod-name-resolution-algorithm/" rel="noreferrer">method call inheritance structure</a> well, as without this you can end up stabbing around in the dark.</p>
<p>The most straightforward way to do this inside an ActiveRecord c... | <p>'Pedro's answer is right, but there's a small mistake.</p>
<pre><code>def self.included(base)
class << base
base.extend ClassMethods
end
end
</code></pre>
<p>should be</p>
<pre><code>def self.included(base)
base.extend ClassMethods
end
</code></pre>
<p>Using class << base ... end has the ef... | 40,635 |
<p>I am trying to print something at the bottom of a report. I am using a section <code>Pagefooter</code>.<br>
I thought that if you used <code>Pagefooter</code> that it would print at the bottom on the report.</p>
| <ul>
<li>Select the HTML table in your tools's UI and copy it into the clipboard (if that's possible</li>
<li>Paste it into Excel.</li>
<li>Save as CSV file</li>
</ul>
<p>However, this is a manual solution not an automated one.</p>
| <p>Have you tried opening it with excel?
If you save a spreadsheet in excel as html you'll see the format excel uses.
From a web app I wrote I spit out this html format so the user can export to excel.</p>
| 32,361 |
<p>I have this PHP code</p>
<pre><code>echo '<a href="#" onclick="updateByQuery(\'Layer3\', ' . json_encode($query) . ');">Link 1</a>';
</code></pre>
<p>which generates a link like this:</p>
<pre><code><a href="#" onclick="updateByQuery('Layer3', "Ed Hardy");">Link 1</a><li>Link 2</l... | <p>You should <a href="http://www.php.net/htmlentities" rel="nofollow noreferrer">html encode</a> it:</p>
<pre><code>echo '<a href="#" onclick="updateByQuery(\'Layer3\', ' . htmlentities(json_encode($query)) . ');">Link 1</a>';
</code></pre>
<p>You could also use <code>htmlspecialchars</code></p>
| <pre><code>echo "<a href='#' onclick='updateByQuery(\"Layer3\", " . json_encode($query) . ");'>Link 1</a>";
</code></pre>
| 47,457 |
<p>I have a table (SQL 2000) with over 10,000,000 records. Records get added at a rate of approximately 80,000-100,000 per week. Once a week a few reports get generated from the data. The reports are typically fairly slow to run because there are few indexes (presumably to speed up the INSERTs). One new report coul... | <p>You need to look at the query plan and see if it is using that new index - if it isnt there are a couple things. One - it could have a cached query plan that it is using that has not been invalidated since the new index was created. If that is not the case you can also trying index hints [ With (Index (yourindexname... | <p>For a table of that size your best bet is probably going to be partitioning your table and indexes.</p>
| 47,104 |
<p>After lots of attempts and search I have never found a satisfactory way to do it with CSS2.</p>
<p>A simple way to accomplish it is to wrap it into a handy <code><table></code> as shown in the sample below. Do you know how to do it avoiding table layouts and also avoiding quirky tricks?</p>
<p><div class="snip... | <p>@Jason, yep, <code><center></code> works. Good times. I'll propose the following, though:</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>body {
text-align: ce... | <p>The following works well enough. note the <em>position</em>, and the use of <em>auto</em></p>
<pre><code><div style="border: 1px solid black;
width: 300px;
height: 300px;">
<div style="width: 150px;
height: 150px;
back... | 6,845 |
<p>How best to make the selected date of an ASP.NET Calendar control available to JavaScript?</p>
<p>Most controls are pretty simple, but the calendar requires more than just a simple <em>document.getElementById().value</em>.</p>
| <p>When you click on a date with the calendar, ASP does a postback, you could always put the SelectedDate value of the calendar control into a hidden field on the page during the OnLoad event of the page or the SelectionChanged event of the Calendar control.</p>
| <p>This might help you. It uses YUI, but you can probably port some of that functionality over to another library or custom code it. It should get you started though.</p>
<p><a href="http://www.codeproject.com/KB/aspnet/aspnet-yahoouicalendar.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/aspnet-... | 11,346 |
<p>Most of time we represent concepts which can never be less than 0. For example to declare length, we write:</p>
<pre><code>int length;
</code></pre>
<p>The name expresses its purpose well but you can assign negative values to it. It seems that for some situations, you can represent your intent more clearly by writ... | <p>“When in Rome, do as the Romans do.”</p>
<p>While there is theoretically an advantage in using unsigned values where applicable because it makes the code more expressive, this is simply not done in C#. I'm not sure why the developers initially didn't design the interfaces to handle <code>uints</code> and make the t... | <p>Your two points are good. The primary reason to avoid it is casting, though. Casting makes them incredibly annoying to use. I tried using unisigned variables once but I had to sprinkle casts absolutely everywhere because the framework methods all use signed integers. Therefore, whenever you call a framework method, ... | 5,397 |
<p>How can I configure an application, or even an entire machine, to use either the server or workstation flavor of the CLR's garbage collection? </p>
| <p>Have a look <a href="http://blogs.msdn.com/maoni/archive/2004/09/25/234273.aspx" rel="nofollow noreferrer">here</a>. </p>
<p>I recommend giving the entire series of blog posts a good read - very informative.</p>
| <p>I should mention that I found there are two ways of handling this, either for the entire application using a .config file (application or machine), using the gcConcurrent and gcServer elements, or it can be done on a code block level using <code>GCSettings.LatencyMode</code>.</p>
| 20,414 |
<p>I want to autowire a bean partially - that is, I want some args to be autowired but other to be explicitly set. For example:</p>
<p>public MyClient(Service svc, boolean b)</p>
<p>In the case of this constructor, I would like to specify in my xml the value for b, but have svc autowired. Is that possible?</p>
<p>Th... | <p>I don't think it is possible with constructors, but with explicit setters it certainly is. Just annotate the ones you want autowired with @Autowired, and set the others in your config-file </p>
<p>Something like:</p>
<pre><code>public MyClient() {}
@Autowired
public setService (Service svc) {...}
public setBoole... | <p>I don't think it is possible with constructors, but with explicit setters it certainly is. Just annotate the ones you want autowired with @Autowired, and set the others in your config-file </p>
<p>Something like:</p>
<pre><code>public MyClient() {}
@Autowired
public setService (Service svc) {...}
public setBoole... | 30,001 |
<p>I want to create a keyboard and mouse hook which will be started as a windows service. I want to monitor the activity of the various users who use the system throughout the day. i.e. which users are <em>active</em> at what times.</p>
<p>Is is possible to determine which user will be receiving the events? (The servi... | <p>No, Environment.UserName does not work - the hook procedure is not called under the context of the input receiver.</p>
<p>Indeed, I think this is not possible - the _LL hooks, which you are no doubt using if using .NET, are low-level hooks. It seems to me that they are executed well before Windows even determines w... | <p>I don't know about these hooks - do they receive events from Remote Desktop keyboards? If they only get the local keyboard, then I think you need to find the owner of WinSta0.</p>
| 14,534 |
<p>Using TortoiseSVN against VisualSVN I delete a source file that I should not have deleted. Now this isn't a train smash because I can get the file back from the daily backup. However I would like to undelete it from SVN (VisualSVN) so that I can get the history back. However I can't work out how to do that.</p>
<p>... | <p>What you have to do is the following:</p>
<ol>
<li>Right click on the folder where you think it is.</li>
<li>Choose Show Log under TortioseSVN</li>
<li>Find the checkin that the file was deleted in</li>
<li>Go down the list and find the file</li>
<li>Select Revert changes for this version to undelete.</li>
</ol>
| <p>Did you only delete it locally, or did you commit the deletion? In the latter case, try checking out the previous revision.</p>
| 3,477 |
<p>Presently, I am working on a project using classic ASP. My development machine is Vista Enterprise. Although Vista does allow you to have multiple Web Sites (not without a workaround in XP), it has removed the SMTP service from IIS. </p>
<p>Is there a standard workaround for this issue?</p>
<p>As more web develope... | <p>I found a better suggestion over on serverfault.
<a href="https://serverfault.com/questions/64753/smtp-server-on-windows-7">This thread details it</a></p>
<p><a href="http://smtp4dev.codeplex.com/" rel="nofollow noreferrer">http://smtp4dev.codeplex.com/</a> Nice tool.</p>
| <p>I use the built-in settings for SMTP mail to dump emails to a directory as shown in this post:
<a href="https://stackoverflow.com/questions/1120132/how-can-i-use-a-local-smtp-server-when-developing-on-windows-7/2734772#2734772">How can I use a local SMTP server when developing on Windows 7?</a></p>
| 44,411 |
<p>I am writing a .NET wrapper class for an existing native class which throws exceptions. What are the best practices for translating between native C++ exceptions and Managed exceptions? Catch and re-throw on a one-to-one basis (e.g. std::invalid_argument -> System.System.ArgumentException)? Is there a mapping alread... | <p>There is no standard mapping that I know of. What I've done in the past is translate the ones I know about, and a catch block for System.Runtime.InteropServices.SEHException. All non-translated exceptions will be turned into that exception. As long as you have a debug build of the code that is throwing the except... | <p>What are you really trying to do?</p>
<p>Interop already translates native exceptions to managed, including SEH exceptions. However, good design dictates that <em>ALL</em> exceptions should be caught at the native API level. You shouldnt deviate from this unless there is a good reason. We dont know enough about you... | 14,352 |
<p>What I am trying to achieve is a form that has a button on it that causes the Form to 'drop-down' and become larger, displaying more information. My current attempt is this:</p>
<pre><code>private void btnExpand_Click(object sender, EventArgs e)
{
if (btnExpand.Text == ">")
{
btnExpand.Text = "&l... | <p>As per the docs, use 0 to denote no maximum or minimum size. Tho, I just tried it and it didn't like 0 at all. So I used int.MaxValue like you did and it worked. What version of the the framework you using?</p>
| <p>Actually, having a look at the <code>MinimumSize</code> and <code>MaximumSize</code> (.NET 3.5) in reflector its pretty clear that the designed behaviour is not quite the same as the docs suggest. There is some minimum width constraints determined from a helper class and 0 has no special meaning (i.e. no limit.</p>
... | 12,255 |
<p>I'd like to write a game for the Nintendo Wii. How do I go about obtaining an SDK and/or any other tools necessary for writing a game?</p>
| <p>The Wii Remote and Wii Balance Board use bluetooth. You can <a href="http://www.wiiprojects.org/bluetooth.html" rel="noreferrer">pair them with your PC</a> and write your own PC apps that interact with them (like <a href="http://www.cs.cmu.edu/~johnny/projects/wii/" rel="noreferrer">this guy</a>). If you want to m... | <p>You would have to get in contact with Nintendo of America and obtain a developer kit from them. Be prepared to spend a wad of dough though.</p>
<p>Check this out:
<a href="http://www.nintendo.com/corp/developer.jsp" rel="noreferrer">http://www.nintendo.com/corp/developer.jsp</a></p>
| 4,912 |
<p>I'm making heavy use of PropertySheets in my application framework's configuration editor. I like them a lot because it's pretty easy to work with them (once you learn how) and make the editing bulletproof.</p>
<p>One of the things that I'm storing in my configuration are Python scripts. It's possible to edit a P... | <p>You would need to write your own type editor. You can think of this as a user control, in that when you write your own type editor you are providing the UI controls that appear when the property grid edits the property. As such, you can create a type editor that does anything, which means if you have a third-party e... | <p>You would need to write your own type editor. You can think of this as a user control, in that when you write your own type editor you are providing the UI controls that appear when the property grid edits the property. As such, you can create a type editor that does anything, which means if you have a third-party e... | 38,976 |
<p>Can a (||any) proxy server cache content that is requested by a client over https? As the proxy server can't see the querystring, or the http headers, I reckon they can't.</p>
<p>I'm considering a desktop application, run by a number of people behind their companies proxy. This application may access services acros... | <p>No, it's not possible to cache https directly. The whole communication between the client and the server is encrypted. A proxy sits between the server and the client, in order to cache it, you need to be able to read it, ie decrypt the encryption.</p>
<p>You can do something to cache it. You basically do the SSL on... | <p>How about setting up a server cache on the application server behind the component that encrypts https responses? This can be useful if you have a reverse-proxy setup.</p>
<p>I am thinking of something like this:</p>
<pre><code>application server <---> Squid or Varnish (cache) <---> Apache (performs S... | 3,546 |
<p>I have a string in a node and I'd like to split the string on '?' and return the last item in the array.</p>
<p>For example, in the block below:</p>
<pre><code><a>
<xsl:attribute name="href">
/newpage.aspx?<xsl:value-of select="someNode"/>
</xsl:attribute>
Link text
<... | <p>Use a recursive method:</p>
<pre><code><xsl:template name="output-tokens">
<xsl:param name="list" />
<xsl:variable name="newlist" select="concat(normalize-space($list), ' ')" />
<xsl:variable name="first" select="substring-before($newlist, ' ')" />
<xsl:variable name="r... | <p>XSLT 1.0 doesn't have a split function per se, but you could potentially achieve what you're trying to do with the substring-before and substring-after functions.</p>
<p>Alternatively, if you're using a Microsoft XSLT engine, you could use inline C#.</p>
| 16,519 |
<p>What is the best approach to play a sequence of flv video files in Flash (with actionscript)? My goal is to have the transitions occur as smoothly as possible.</p>
<p>Currently i'm using the netStream class and capturing the onStatus events to play the next video when the current video has reached it's end duration... | <p>The issue is most likely in the implementation of the query provider.</p>
<p>pcm.PostId == 1 </p>
<p>and</p>
<p>pcm.PostId == postId </p>
<p>actually have a big difference. In the expression tree the first is generated as a ConstantExpression which doesnt need to be evaulated.</p>
<p>With the second, the compil... | <p>The problem is not the linq itself,
you need to be sure that the context or provider object is able to fetch the data.
try testing the </p>
<pre><code>subnusMVCRepository<Categories> categories = new subnusMVCRepository<Categories>();
subnusMVCRepository<Post_Category_Map> postCategoryMap = new su... | 36,925 |
<p>.NET newbie here... I'd like to make a button in a Windows form that displays a progress or "cooldown" effect. That is, when the button is pressed, it becomes disabled. As some event or timer is progressing, the button shows the progress graphically. When the progress is finished, the graphic completes and the bu... | <p>The easiest approach is to create an instance of the progress bar control and then you do not need to perform any custom coding/custom painting. If you really need to display everything inside the button control then you have two options. You can keep changing the Image property of the button or go the whole hog and... | <p>The easiest approach is to create an instance of the progress bar control and then you do not need to perform any custom coding/custom painting. If you really need to display everything inside the button control then you have two options. You can keep changing the Image property of the button or go the whole hog and... | 23,851 |
<p>I'm not a usability specialist, and I really don't care to be one.</p>
<p>I just want a small set of rules of thumb that I can follow while coding my user interfaces so that my product has decent usability.</p>
<p>At first I thought that this question would be easy to answer "Use your common sense", but if it's so... | <p><img src="https://i.stack.imgur.com/G5Xcl.png" alt="simplicity"/></p>
<p>Source: <a href="http://stuffthathappens.com/blog/wp-content/uploads/2008/03/simplicity.png" rel="nofollow noreferrer">http://stuffthathappens.com/blog/wp-content/uploads/2008/03/simplicity.png</a></p>
| <p>What information does your user need, put that on the screen and nothing else. If you cannot define what the user needs - get another user.</p>
| 7,392 |
<p>I'm not sure if many people know about this text-editor?</p>
<p>jEdit was kinda big in 2004, but now, Notepad++ seems to have taken the lead(on Windows)
Many of the plugins haven't been updated since 2003 and the overal layout and usage is confusing...</p>
<p>I'm sure jEdit has many nifty features, but I'll be dam... | <p>I've been using jEdit for a few years now, mainly on windows, but also on Ubuntu.
I use it for: SQL, awk, batch files, html, xml, javascript...
Just about everything except .NET stuff (for which I use Visual Studio).<br />
I love it.</p>
<h2>summary</h2>
<p>I use jEdit because it has the right balance for me of <str... | <p>I had to use during my vocational education for XML and XSLT. It had a lot of bugs and didn't work always. I couldn't get to like it, but if I had to test some XSLT I'd give it another shot. I found Notepad++ and I am more than happy with it for what I need.</p>
<p>To your question: Did you take a look at <a href="... | 9,684 |
<p>I wrote a simple Windows Forms program in C#. I want to be able to input a windows user name and password and when I click a login button to run code run as the user I've entered as input.</p>
| <p>You can use the WindowsIdentity.Impersonate method to
achieve this. This method allows code to impersonate a different Windows
user. Here is a link for more information on this method with a good sample:</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.security.principal.windowsidentity.impersonate.... | <p>Impersonate will change the Thread context. If you want to change the identity and launch a separate process, you will have to use runas command.</p>
<p>The .NET Developer's Guide to Windows Security by Keith Brown is an excellent read which describes all the security scenarios.
<a href="http://alt.pluralsight.com/... | 7,104 |
<p>I'm working on a project were we need more performance. Over time we've continued to evolve the design to work more in parallel(both threaded and distributed). Then latest step has been to move part of it onto a new machine with 16 cores. I'm finding that we need to rethink how we do things to scale to that many cor... | <p>A couple of other books that are going to be helpful are:</p>
<ul>
<li><a href="https://rads.stackoverflow.com/amzn/click/com/0131972596" rel="noreferrer" rel="nofollow noreferrer" title="Synchronization Algorithms and Concurrent Programming">Synchronization Algorithms and Concurrent Programming</a></li>
<li><a hre... | <p>Take a look at <a href="http://www.hoard.org/" rel="nofollow noreferrer">Hoard</a> if you are doing a lot of memory allocation.</p>
<p>Roll your own <a href="http://www.boyet.com/Articles/LockfreeFreeList.html" rel="nofollow noreferrer">Lock Free List</a>. A good resource is here - it's in C# but the ideas are port... | 2,853 |
<p>Consider this code...</p>
<pre><code>using System.Threading;
//...
Timer someWork = new Timer(
delegate(object state) {
//Do some work here...
},
null, 0, 60000);
HttpContext.Current.Application["SomeWorkItem"] = someWork;
</code></pre>
<p>Could this be dangerous? Caching a timer in the Applic... | <p>This would generally be a bad idea, as System.Threading.Timer uses threads from the ThreadPool, the same as ASP.Net.</p>
<p>If for what ever reason your timer delegate blocks or stops, the timer will simply begin a new Thread after the timeout period, which eats in to the Threads available for ASP.net.</p>
<p>If t... | <p>That makes sense, but just for fun, what if the work doesn't need to run if the site gets shut down? If it's associated with the Application_Start event and only needs to run while people are browsing the site, what are the risks at that point?</p>
<p>Good answers, I'm just curious a little more about how that work... | 14,286 |
<p>We have a lot of open discussions with potential clients, and they ask frequently about our level of technical expertise, including the scope of work for our current projects. The first thing I do in order to gauge the level of expertise on staff they have now or have previously used is to check for security vulnera... | <p>I would say that surprising people by suddenly penetration-testing their software may bother people if simply for the fact that they didn't know ahead of time. I would say if you're going to do this (and I believe it's a good thing to do), inform your clients ahead of time that you're going to do this. If they seem ... | <p>I think the problem with this would be, that it would be quite hard to do checks on XSS without messing up their site. Also, things like SQL injection could be quite dangerous. If you stuck with appending selects, you might not have too much of a problem, but then the question is, how do you know it's even executin... | 7,617 |
<p>Is there any way to monitor/log thread interactions in the .NET runtime much like VisualVM does for Java? I don't have a specific need at the moment but I think it would be nice to see how all the threads in my application interact.</p>
<p><img src="https://visualvm.dev.java.net/images/threads.png" alt="https://vi... | <p>I am unfamiliar with VisualVM in Java....but....</p>
<p>If you are trying to accomplish this programmatically...check out the WMI Performance Counters. I am currently working with them myself!</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa392397(VS.85).aspx" rel="noreferrer">MSDN Link to WMI Performanc... | <p>The <a href="http://www.codeproject.com/KB/dotnet/threadmonitor.aspx" rel="nofollow noreferrer">.NET Diagnostics C# Thread Monitoring Application</a> appears to do what you need. </p>
<p>Edit: If you're new to C#, there's a <a href="http://en.csharp-online.net/" rel="nofollow noreferrer">neat wiki</a> you may want ... | 44,000 |
<p>How do I get the sequence number of the row just inserted?</p>
| <p>insert ... returning.</p>
<pre><code>declare
s2 number;
begin
insert into seqtest2(x) values ('aaa') returning seq into s2;
dbms_output.put_line(s2);
end;
</code></pre>
<p>"seq" here refers to the name of the column whose value you want to store into variable s2. </p>
<p>in python:</p>
<pre><code>myse... | <p><strong>Edit:</strong> as Mark Harrison pointed out, this assumes that you have control over how the id of your inserted record is created. If you have full control and responsibility for it, this <em>should</em> work...</p>
<hr>
<p>Use a stored procedure to perform your insert and return the id.</p>
<p>eg: for a... | 47,148 |
<p>Given a simple (id, description) table t1, such as</p>
<pre><code>id description
-- -----------
1 Alice
2 Bob
3 Carol
4 David
5 Erica
6 Fred
</code></pre>
<p>And a parent-child relationship table t2, such as</p>
<pre><code>parent child
------ -----
1 2
1 3
4 5
5 6
</code></... | <p>In your query, replace T2 with a subquery that joins T1 and T2, and returns parent, child and child description. Then in the sys_connect_by_path function, reference the child description from your subquery.</p>
| <pre><code>SELECT parent, child, parents.description||sys_connect_by_path(childs.description, '/') AS "path"
FROM T1 parents, T1 childs, T2
WHERE T2.parent = parents.id
AND T2.child = childs.id
CONNECT BY PRIOR parent = child
</code></pre>
| 14,315 |
<p>Why do computers use RGB (red, <em>green</em>, and blue) values for color composition rather than the primary hues, red, <em>yellow</em>, and blue?</p>
| <p>The hues of magenta, yellow, and cyan are primary for subtractive combination (e.g. paints or inks) rather than additive combination such as light where red, green, and blue are primary.</p>
<p><a href="http://en.wikipedia.org/wiki/Primary_colors" rel="noreferrer">Wikipedia has more detail on the whys and wherefore... | <p>Because combining light sources (which computer monitors do) does not work the same way as combining printed ink. It's just a guess.</p>
| 28,265 |
<p>Tools like 'ps' and 'top' report various kinds of memory usages, such as the VM size and the Resident Set Size. However, none of those are the "real" memory usage:</p>
<ul>
<li>Program code is shared between multiple instances of the same program.</li>
<li>Shared library program code is shared between all processes... | <p>On OSX the Activity Monitor gives you actually a very good guess.</p>
<p>Private memory is for sure memory that is only used by your application. E.g. stack memory and all memory dynamically reserved using malloc() and comparable functions/methods (alloc method for Objective-C) is private memory. If you fork, privat... | <p>For a question that mentioned Freebsd, surprised no one wrote this yet : </p>
<p>If you want a linux style /proc/PROCESSID/status output, please do the following : </p>
<pre><code>mount -t linprocfs none /proc
cat /proc/PROCESSID/status
</code></pre>
<p>Atleast in FreeBSD 7.0, the mounting was not done by defaul... | 14,402 |
<p>Our application is a hybrid Win32 unmanaged application and a .NET 2.0 managed application. The Win32 part is the main executable, which at some point loads and hosts the .NET 2.0 runtime and loads some managed modules to open new winforms windows.</p>
<p>We've had our share of CASPOL-type problems, but today we ha... | <p>My first stab would be to run process monitor from MS-Sysinternals, and look what calls/results are different for these two occasions.
Maybe that would give you some hints to work on (different results for the same call, some errors in the problem run that are not in the good one...)</p>
<p>You can download process... | <p>My first thought is that you need to make sure there are no relative/absolute paths defined in the program for references to assemblies, files, etc. which are causing trouble when you move the application root directory.</p>
| 15,352 |
<p>I am developing a Java desktop application and would like to have an external configuration.xml.<br>
I am developing the application using Netbeans and tried to add the configuration.xml file in the dist directory so that it resides in the application work folder. But when Netbeans executes its clean operation it de... | <p>You can add this to your build.xml : </p>
<pre><code><target name="-post-jar">
<copy todir="${dist.jar.dir}">
<fileset dir="resources" includes="**"/>
</copy>
</target>
</code></pre>
<p>You can now put your configuration.xml file in the folder 'resources' (that yo... | <p>I was able to get this to work, but I couldn't get -post-jar to trigger without explicitly entering it as a dependency in the main build config. This is in Netbeans 7.0.1 for a Rich Client project.</p>
<p>Instead, in build.xml for the Netbeans module where I want to have external resource files (mainly .txt files ... | 38,641 |
<p>Supposing you have a form that collects and submits sensitive information and you want to ensure it is never accessed via insecure (non-HTTPS) means, how might you best go about enforcing that policy?</p>
| <p>If you're running Apache, you can put a <code>RewriteRule</code> in your <code>.htaccess</code>, like so:</p>
<pre><code>RewriteCond %{HTTPS} "off"
RewriteRule /mypage.html https://example.com/mypage.html
</code></pre>
| <p>Take a look at this: <a href="http://www.dotnetmonster.com/Uwe/Forum.aspx/asp-net/75369/Enforcing-https" rel="nofollow noreferrer">http://www.dotnetmonster.com/Uwe/Forum.aspx/asp-net/75369/Enforcing-https</a></p>
<p>Edit: This shows solutions from an IIS point of view, but you should be able to configure about any ... | 7,871 |
<p>I'm so sick of the pass-callback-data-as-void*-struct anti-pattern. Boost bind solves it nicely, but is an unacceptable dependency. What's a lightweight alternative? How would I write it myself as simply as possible?</p>
| <p>First, I question your assertion that it's far too heavy for you to use.</p>
<p>Second, roll your own template, if you need to control the behavior.</p>
<p>Third, if you're afraid of rolling your own template, I question your ability to judge that <code>boost::bind</code> is too heavy for you to use.</p>
| <p>There is <a href="http://libsigc.sourceforge.net/" rel="nofollow noreferrer">libsigc++</a>. The license is LGPL, but the implementation is about what Boost.Signal does (I'm reading "too heavyweight" to mean "installing all of Boost is too heavyweight" not "Boost.Signal is too slow").</p>
| 49,985 |
<p>What tools, preferably open source, are recommended for driving an automated test suite on a FLEX based web application? The same tool also having built in capabilities to drive Web Services would be nice.</p>
| <p>Adobe distributes a test framework themselves: <a href="http://opensource.adobe.com/wiki/display/flexunit/FlexUnit" rel="noreferrer">FlexUnit</a>.</p>
| <p>My preferred tool is Selenium Remote Control. There is a plug-in I discovered a few months ago:</p>
<p><a href="http://code.google.com/p/flash-selenium/" rel="nofollow noreferrer">http://code.google.com/p/flash-selenium/</a></p>
<p>This required 'hooks' to be written on the server side (ActionScript/Flex). Once ... | 9,807 |
<p>I have to interface with a slightly archaic system that doesn't use webservices. In order to send data to this system, I need to post an XML document into a <i>form</i> on the other system's website. This XML document can get very large so I would like to compress it.
The other system sits on IIS and I use C# my en... | <p>I see no way to compress the data on one side and receiving them uncompressed on the other side without actively uncompressing the data..</p>
| <p>No idea if this will work since all of the examples I could find were for download, but you could try using gzip to compress the data, then set the Content-Encoding header on the outgoing message to <code>gzip</code>. I believe that the Length should be the length of the zipped message, although you may want to pla... | 45,923 |
<p>I'm a bit flabbergasted at this, so I'm wondering if any SOers have encountered it before.</p>
<p>I have an essentially flat page with a number of input=text seeded in the markup with default values of say A,B,C,D,E in order. The markup looks like this in view source:</p>
<pre><code><td class="action invoice"&g... | <p>I would wager that it's related to the mapped url not having a file extension and so the content type isn't being properly deduced by firefox. Try explicitly setting the content type to "text/html" in the ASP code and see if that fixes it.</p>
| <p>Did you mean C,A,B,D,E? My bet is that an unquoted or mismatched " in an attribute is messing up the parsing of the td tag for C. When there's a tag in a table that's not properly contained in tr/td/etc, firefox moves it up to earlier in the page.</p>
| 42,003 |
<p>When building a multi-lingual website (with ASP.NET web forms), I'll use an HTTP module to rewrite the URLs to end up with something friendly (for humans & search engines) like:</p>
<pre><code>uk/products/product_category_one/sub_category_one/index.aspx
uk/products/product_category_one/sub_category_one/widget_m... | <p>The URL can take almost any other form you like. For more info, check <a href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx" rel="noreferrer">ASP.NET MVC Framework (Part 2): URL Routing</a>. Just for starting (since I am not sure if it is the optimum solution), you ... | <p>You can do this, but keep in mind that not all countries are languages. For example, en-gb is the usual representation for British English, or more specifically, the Great Britain locale for English content, for example. If you can, it's worth following the RFC1766-derived conventions for language-LOCALE.</p>
<p>Se... | 37,163 |
<p>I have the following in my Global.asax.cs</p>
<pre><code>routes.MapRoute(
"Arrival",
"{partnerID}",
new { controller = "Search", action = "Index", partnerID="1000" }
);
routes.MapRoute(
"Default",
"{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = "" }
);
</code... | <p>IIS 5.1 interprets your url such that its looking for a folder named 1000 under the folder named Test. Why is that so?</p>
<blockquote>
<p>This happens because IIS 6 only
invokes ASP.NET when it sees a
“filename extension” in the URL that’s
mapped to aspnet_isapi.dll (which is a
C/C++ ISAPI filter respons... | <p>There are a number of considerations when using virtual directories in your application. </p>
<p>One is particular is that most browsers will not submit cookies that came from one virtual directory to another, even if the apps reside on the same server. </p>
| 22,111 |
<p>How does the C/C++ compiler manipulate the escape character ["\"] in source code? How is compiler grammar written for processing that character? What does the compiler do after encountering that character?</p>
| <p>Most compilers are divided into parts: the compiler front-end is called a <a href="http://en.wikipedia.org/wiki/Lexical_analyzer" rel="noreferrer">lexical analyzer</a> or a scanner. This part of the compiler reads the actual characters and creates tokens. It has a state machine which decides, upon seeing an escape c... | <p>escape character with a following character (like <code>\n</code>) is a single character for C compiler - scanner presents it to parser as character token, so there is no need in special syntax rules in parser for escape character.</p>
| 41,861 |
<p>I need to create an Aggregate Field in a TClientDataSet, but as said in the docs:</p>
<blockquote>
<p>Choose OK. The newly defined aggregate
field is automatically added to the
client dataset and its Aggregates
property is automatically updated to
include the appropriate aggregate
specification.</p>
</b... | <p>I think you may be getting confused between TAggregate and TAggregateField objects, and the Delphi documentation probably isn't helping.</p>
<p>AFAICT, TAggregateField objects are automatically 'recalculated' and can be bound to data-aware controls like TDBText, but don't have any OnUpdate event. </p>
<p>"TAggrega... | <p>Which version of Delphi ? I just tried clean D7 application and TAggregateField was added. </p>
| 4,221 |
<p>On a class library project, I set the "Start Action" on the Debug tab of the project properties to "Start external program" (<a href="http://en.wikipedia.org/wiki/NUnit" rel="noreferrer">NUnit</a> in this case). I want to set an environment variable in the environment this program is started in. How do I do that? (I... | <p>In Visual Studio 2008 and Visual Studio 2005 at least, you can specify changes to environment variables in the project settings.</p>
<p>Open your project. Go to Project -> Properties... Under Configuration Properties -> Debugging, edit the 'Environment' value to set environment variables.</p>
... | <p>Set up a batch file which you can invoke. Pass the path the batch file, and have the batch file set the environment variable and then invoke NUnit.</p>
| 12,583 |
<p>This is making me kind of crazy: I did a mysqldump of a partitioned table on one server, moved the resulting SQL dump to another server, and attempted to run the insert. It fails, but I'm having difficulty figuring out why. Google and the MySQL forums and docs have not been much help.</p>
<p>The failing query lo... | <p>It turned out to be an SElinux issue - all my filesystem permissions were fine, but there was a higher-level policy set against MySQL accessing that disk partition.</p>
<p>Lesson: When you have a permissions issue but ownership and filesystem permissions are obviously correct, look to SElinux.</p>
| <p><a href="http://bugs.mysql.com/bug.php?id=19557" rel="nofollow noreferrer">http://bugs.mysql.com/bug.php?id=19557</a></p>
<blockquote>
<p>You will also receive an error message
of the MySQL user ID running the query
does not have "DATA FILE" privileges
that allows the user ID to write to
the file system.<... | 43,054 |
<p>Say I have a class that's meant to perform a single function. After performing the function, it can be destroyed. Is there any reason to prefer one of these approaches?</p>
<pre><code>// Initialize arguments in constructor
MyClass myObject = new MyClass(arg1, arg2, arg3);
myObject.myMethod();
// Pass arguments to ... | <p>I used to love utility classes filled up with static methods. They made a great consolidation of helper methods that would otherwise lie around causing redundancy and maintenance hell. They're very easy to use, no instantiation, no disposal, just fire'n'forget. I guess this was my first unwitting attempt at creating... | <p>One more important issue to consider is whether the system would be running at a multithreaded environment, and whether it would be thread-safe to have a static method or variables...</p>
<p>You should pay attention to the system state. </p>
| 25,199 |
<p>After a resin print completes, what is the expected process to finish the print? Is some cleaning expected? I also some manufacturers sell UV chambers to cure the print surface, is this required?</p>
<p>I purchased a low-cost printer from China that is quite high-quality hardware, but sadly short on documentation. I... | <p>I don't think it is the thermistor degrading. To answer your question directly, all my thermistors have failed because the tiny wire has broken off, and generally the fail is “hard” not soft.</p>
<p>It is more likely you’re experiencing absorbed humidity in the filament from it being out on the spool too long. this ... | <p>It is indeed possible that the thermistor is broken (yet not sure). I am aware of two types of issues with thermistors:</p>
<ol>
<li><p>The contact (soldering) is broken, usually due to the temperature extreme variations. The thermistor will indicate the maximum temperature in case of PTC or minimum temperature in c... | 1,727 |
<p>Java is nearing version 7. It occurs to me that there must be plenty of textbooks and training manuals kicking around that teach methods based on older versions of Java, where the methods taught, would have far better solutions now.</p>
<p>What are some boilerplate code situations, especially ones that you see peop... | <p>Enums. Replacing </p>
<pre><code>public static final int CLUBS = 0;
public static final int DIAMONDS = 1;
public static final int HEARTS = 2;
public static final int SPADES = 3;
</code></pre>
<p>with</p>
<pre><code>public enum Suit {
CLUBS,
DIAMONDS,
HEARTS,
SPADES
}
</code></pre>
| <p>It is worth noting that Java 5.0 has been out for five years now and there have only been minor changes since then. You would have to be working on very old code to be still refactoring it.</p>
| 32,334 |
<p>I think my eclipse's ctrl+clicking links might benefit greatly...</p>
<p><b>Edit:</b> I'm using eclipse PDT.</p>
<p><b>Edit 2:</b> I'm very happy with the solution of putting docblocks before functions (and variables) with an @return or @var statement, I've just updated the documentation of my app and now eclipse ... | <pre><code>// [...]
/**
* Return the Request object
*
* @return Zend_Controller_Request_Abstract
*/
public function getRequest()
{
return $this->_request;
}
// [...]
</code></pre>
<p>works perfectly with Eclipse PDT. Which plugin do you use?</p>
| <p>The only way to hint return type in PHP is to use a good IDE like Eclispe PDT or Zend Studio with standard comment block. PHP simply can n not predict return type because it is dynamically typed language so type checking is done in the run time unlike for the statically typed languages like C#, JAVA and C++.</p>
| 39,662 |
<p>I am working with Reporting Services and Sharepoint, I have an application that leverages reporting services however a client would like our application integrated into sharepoint. Currently we are tightly coupled to the ReportService.asmx webservice which exposes various methods for performing operations. Reporting... | <p>Here's a list of differences. I've highlighted Oracle-specific features, and hopefully the community can add in other vendors' specific difference also. Differences that are common to most vendors can go directly below the headings, with differences highlighted below.</p>
<p><hr></p>
<h1>General Overview</h1>
<p>... | <p>TRUNCATE is fast, DELETE is slow.</p>
<p>Although, TRUNCATE has no accountability.</p>
| 16,890 |
<p>I got an image with which links to another page using <code><a href="..."> <img ...> </a></code>.</p>
<p>How can I make it make a post like if it was a button <code><input type="submit"...></code>?</p>
| <p>More generic approatch using <strong><a href="http://jquery.com/" rel="noreferrer">JQuery</a></strong> library <a href="http://api.jquery.com/closest/" rel="noreferrer">closest</a>() and <a href="http://api.jquery.com/submit/" rel="noreferrer">submit</a>() buttons.
Here you do not have to specify whitch form you wan... | <p>We replace the submit button with this all the time on forms:</p>
<pre><code><form method="post" action="whatever.asp">
<input type=...n
<input type="image" name="Submit" src="/graphics/continue.gif" align="middle" border="0" alt="Continue">
</form>
</code></pre>
<p>Clicking the image submits... | 34,660 |
<p>I am still learning sql server somewhat and recently came across a select query in a stored procedure which was causing a very slow fill of a dataset in c#. At first I thought this was to do with .NET but then found a suggestion to put in the stored procedure:</p>
<p>set implicit_transactions off</p>
<p>this seems... | <p>This is the page out of SQL Server Books Online (BOL) that you want. It explains all the SET statements that can be used in a session.
<a href="http://msdn.microsoft.com/en-us/library/ms190356.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms190356.aspx</a></p>
| <p>I think you need to look deeper into your stored procedure. I don't think that SET IMPLICIT_TRANSACTIONS is really going to be what's sped up your procedure, I think it's probably a coincidence.</p>
| 39,989 |
<p>Is there a Linux version of Oracle XE?</p>
<p>I could not find any info on Oracles official site.</p>
| <p>Yes, it's available <a href="http://www.oracle.com/technology/software/products/database/xe/htdocs/102xelinsoft.html" rel="nofollow noreferrer">here</a>.</p>
<p>You will find it in RPM and Deb packages.</p>
| <p>Seems a bit useless that they don't supply an x86_64 version; i386 is only really useful for toy servers.</p>
| 47,628 |
<p>Im using vs2008 and Im also using the autogenerated object model / entity classes from linq to sql (.dbml).</p>
<p>Is it possible / recommended to change the autogenerated .cs file. Eg change the behaviour of Equals (in the partical class Courses)?</p>
<p>I do know that Equals should be reflexive, symmetric, trans... | <p>It's not suggested to change the generated file directly as it will be regenerated and overwrite your changes if you edit the DBML. The generated classes will be declared as <code>partial</code> so you can change them by creating another file and declaring a <code>partial</code> class with the same name and adding y... | <p>You can also add a common base class for your entities where you implement your custom code, but the Linq to Sql visual editor doesn't support it so you must edit your .dbml file manually. </p>
<p>In visual studio you can right-click the .dbml file in the solution explorer, select Open With, and then Xml Editor. </... | 49,840 |
<p>I recently started to develop using Flex 3 and Adobe Air and I wanted to know what features you want to be in futures releases of Adobe Air ?<br />
The ones that I miss are:<br /></p>
<ul>
<li>Cross-systems way of launching a local file (shellExec) right from an Air application (although you can do this using worka... | <ul>
<li><p>Ability to call out to native code - you currently have to ship a server written in another language and make calls to that to do anything more than Air gives you.</p></li>
<li><p>Modal windows. There's a hack you can do which involves setting Application.application.enabled = false, setting dialog.nativeWi... | <p>"Call native code", "Modal windows", agree-agree.
loadLibrary would be really great :)</p>
<p>ps.:
<br> if we can not have this features in AIR, if would be awesome to have an opportunity <br> to embed flash(AIR) graphics engine into your own app. in that case we'll get <br> ... | 30,613 |
<p>Can I return it as an object if I am doing a </p>
<pre><code>Select OneItem from Table Where OtherItem = "blah"?
</code></pre>
<p>Is there a better way to do this?</p>
<p>I am building a constructor to return an object based on its name rather than its ID.</p>
| <p><code>query.UniqueResult<T>()</code> returns just one <strong>T</strong></p>
| <p>Or using LINQ you can have <code>query.First()</code>, <code>query.SingleOrDefault()</code>, <code>query.Min(predicate)</code> etc...</p>
| 7,571 |
<p>How can I print wstring in gdb?</p>
| <p><code>call printf %ls</code> only works sometimes, but to get it to work at all in gdb 6.3 you need the <code>void</code> cast and linefeed <code>\n</code> shown here:</p>
<pre>call (void)printf("\"%ls\"\n",str.c_str())</pre>
<p>here is a more reliable command you can put in your .gdbinit that also shows non-ASCII... | <p>I did some research, and this is gdb <a href="http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view&database=gdb&pr=716" rel="nofollow noreferrer">PR716</a>, <a href="http://sourceware.org/cgi-bin/gnatsweb.pl?cmd=view&database=gdb&pr=1998" rel="nofollow noreferrer">PR1998</a>, <a href="http://sourceware... | 13,114 |
<p>Need to parse some basic XML (one root element, 3-4 subelements, 1-3 attributes each) from a ksh script (ideally stick to ksh, given the script already exists and it's just trying to read some extra configuration created in XML by another program).</p>
<p>I know I can use sed and do pattern matching, but it's not f... | <p>You might want to take a look at this <a href="http://www.linuxfromscratch.org/pipermail/alfs-discuss/2006-January/007537.html" rel="nofollow noreferrer">pure bash implementation</a>, if keeping it all in shell script is that important.</p>
<p>That said, other scripting languages such as Python and Perl are also hi... | <p>Can't do it entirely in ksh, but try python xml?</p>
<p>If you want lightweight, you might try libxml2 and a small C program.</p>
| 8,802 |
<p>In Java, what would the best way be to have a constantly listening port open, and still send upon receipt of a packet. I am not particularly savvy with network programming at the moment, so the tutorials I have found on the net aren't particularly helpful.</p>
<p>Would it make sense to have the listening socket as ... | <p>If you can afford the threading, try this (keep in mind I've left out some details like exception handling and playing nice with threads). You may want to look into <code>SocketChannels</code> and/or NIO async sockets / selectors. This should get you started.</p>
<pre><code>boolean finished = false;
int port = 1000... | <p>I'd need to go back to the basics for this one too. I'd recommend O'Reilly's excellent <em>Java in a Nutshell</em> that includes code examples for just such a case (available <a href="http://oreilly.com/catalog/javanut/examples/" rel="nofollow noreferrer">online</a> as well). See Chapter 7 for a pretty good overview... | 6,757 |
<p>I am looking for the VB.NET equivalent of</p>
<pre><code>var strings = new string[] {"abc", "def", "ghi"};
</code></pre>
| <pre><code>Dim strings() As String = {"abc", "def", "ghi"}
</code></pre>
| <p><code>Dim strings As String() = {"abc", "def", "ghi"}</code></p>
| 37,165 |
<p>What are some tiny open source operating systems? I'm looking for something several orders of magnitude smaller than Puppy Linux, Feather Linux, DSL, etc. I want to run a command-line text editor and compiler; anything else is extraneous. I'm looking for a system I can take apart and acquire a fairly good understand... | <p>If you're trying to understand the kernel, look at Minix. The Linux kernel is too big for an academic exercise.</p>
| <p><a href="http://www.toms.net/rb/" rel="nofollow noreferrer">tomsrtbt</a>: "The most GNU/Linux on 1 floppy disk."</p>
| 33,051 |
<p>I'm having trouble getting a rotary encoder to work properly with AVR micro controllers. The encoder is a mechanical <a href="http://no.farnell.com/1520815/passives/product.us0?sku=alps-ec12d1524401" rel="noreferrer">ALPS encoder</a>, and I'm using <a href="http://www.atmel.com/dyn/resources/prod_documents/doc2545.p... | <p>I have a webpage about <a href="http://www.ubasics.com/adam/electronics/doc/rotryenc.shtml" rel="nofollow noreferrer">rotary encoders and how to use them</a>, which you might find useful.</p>
<p>Unfortunately without more information I can't troubleshoot your particular problem. </p>
<p>Which microcontroller pins ... | <p>What exactly are you having problems with? I assume you've been able to hook the pins of the encoder to your PIC as per the technical specifications linked on the Farnell page you gave, so is the problem with reading the data? Do you not get any data from the encoder? Do you not know how to interpret the data you're... | 5,512 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.