instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I'm using Visual Studio 2008 and the built-in installation tools for a C# client application. How can I use this installer to install a font on the client machine (if it's not already there)?</p>
| <p>In VS2005 (so I assume 2008 as well), right click on the File System on Target Machine, Add Special Folder -> Fonts Folder, then place your font file there.</p>
| <p>I'm using InnoSetup to deliver my VS applications. It allows you to install fonts from your system to the client system.</p>
<p>I never tested in Windows 7 or Vista (probably you'll have some permission issues).</p>
<p>Remember that not all the fonts are freely distributable.</p>
| 15,399 |
<p>2 days into a 5-day build, I came home from work and found the build ruined because the build plate had slipped.</p>
<p>I'm using a Raise 3D N2 Plus printer, with the standard glass build plate that comes with it, attached via 4 clips: two stationary ones at the back, and two standard binder clips at the front, whi... | <p>Your nozzle may have caught up with the print somehow pushing the binder clip off by moving the glass slate. </p>
<p>Apparently this is a more <a href="https://www.3dhubs.com/talk/thread/raise3d-n2-plus-glass-bed-not-secure" rel="nofollow noreferrer">common</a> problem. Try adding more binder clips, this has been r... | <p>Your nozzle may have caught up with the print somehow pushing the binder clip off by moving the glass slate. </p>
<p>Apparently this is a more <a href="https://www.3dhubs.com/talk/thread/raise3d-n2-plus-glass-bed-not-secure" rel="nofollow noreferrer">common</a> problem. Try adding more binder clips, this has been r... | 923 |
<p>I'm looking to generate a random number and issue it to a table in a database for a particular user_id. The catch is, the same number can't be used twice. There's a million ways to do this, but I'm hoping someone very keen on algorithms has a clever way of solving the problem in an elegant solution in that the follo... | <p>No your algorithm is not scalable. What I've done before is to issue numbers serially (+1 each time) and then pass them through an XOR operation to jumble the bits thus giving me a seemingly random numbers. Of course they aren't really random, but they look so to users eyes.</p>
<hr>
<p><strong>[Edit]</strong> Add... | <p>PHP already has a function for this, <a href="http://us.php.net/uniqid" rel="nofollow noreferrer">uniqid</a>. It generates a standard uuid which is great if you have to access the data from elsewhere. Don't reinvent the wheel.</p>
| 41,315 |
<p>if A is extension use case (not base use case), can A be directly referenced by the actor?</p>
| <p>YES
The user can as said above, but does not indirectly reference/use it, it must be explicitly modeled.</p>
<p>Drive Truck extends Drive Steering Based Vehicle. It make sense that the Actor could reference either.</p>
| <p>You can make the case that there are two kinds of use cases:</p>
<ul>
<li><p>Abstract -- not directly experience by an actor, but extensions ("subclasses") are.</p></li>
<li><p>Concrete -- experienced by an actor.</p></li>
</ul>
| 33,370 |
<p>Stateless beans in Java do not keep their state between two calls from the client. So in a nutshell we might consider them as objects with business methods. Each method takes parameters and return results. When the method is invoked some local variables are being created in execution stack. When the method returns t... | <p>Pooling does several things.</p>
<p>One, by having one bean per instance, you're guaranteed to be threads safe (Servlets, for example, are not thread safe).</p>
<p>Two, you reduce any potential startup time that a bean might have. While Session Beans are "stateless", they only need to be stateless with regards to ... | <p>Life cycle of the Statelesss session beans are Doesnot exist, Passive and MethodReady(Passive or Inactive) state.To optimize on perormance, instead of traversing the bean all through from create to method ready state, container manages the bean between active and passive states through the container callbacks - ejbA... | 16,320 |
<p>Given a moderately complex XML structure (dozens of elements, hundreds of attributes) with no XSD and a desire to create an object model, what's an elegant way to avoid writing boilerplate from_xml() and to_xml() methods? </p>
<p>For instance, given:</p>
<pre><code><Foo bar="1"><Bat baz="blah"/></Fo... | <p>You could use Builder instead of creating your to_xml method, and you could use XMLSimple to pull your xml file into a Hash instead of using the from _xml method. Unfortunately, I'm not sure you'll really gain all that much from using these techniques.</p>
| <p>Could you define a method missing that allows you to do:</p>
<p>@bar = el.bar? That would get rid of some boilerplate. If Bat is always going to be defined that way, you could push the XPath into the initialize method,</p>
<pre><code>class Bar
def initialize(el)
self.from_xml(XPath.first(el, "./bat"))
end
... | 11,254 |
<p>So i'm not really sure why this is happening but I'm running through some DataRows where I have the control name, property, and value that I want to set. Everything works fine except when I set the TEXT property of a button. For some reason, the click event is called...</p>
<p>Here's some of the code I've got:</p>
... | <p>I can't reproduce this with a simple short but complete program:</p>
<pre><code>using System;
using System.Drawing;
using System.Reflection;
using System.Windows.Forms;
class Test
{
static void Main()
{
Button goButton = new Button {
Text = "Go!",
Location = new Point(5, 5)... | <p>Sadly, no I couldn't reproduce it either. I'm not sure what was causing it but all I did to fix it was delete the button and put it back on there.</p>
<p>not sure what it was, but thanks for the code.</p>
<p>You didn't write that in .Net2.0 did you?</p>
| 39,899 |
<p>Is there any benefit in using a <code><blockquote></code> element over a <code><div></code>? I was looking at a website's markup to learn CSS and I couldn't figure out why the <code><blockquote></code> was being used.</p>
<p>EDIT: Yeah sorry I didn't clarify, it was used to hold the <code><div&... | <p>In theory, HTML should be as "semantic" as possible - meaning that every element should indicate something about its content. <code><h1></code><em>s</em> should enclose the most important headline; <code><p></code><em>s</em> should surround paragraphs; <code><em></code> should indicate emphasis, ... | <p>As mentioned, <code><blockquote></code> is for quoting. Similarly you will use several <code><p></code> blocks for paragraphs within one <code><div></code> that holds page content or whatever. HTML5 proposal will have lot more block elements (i.e same as divs) which purpose will be to add a semanti... | 6,450 |
<p>I'm working on an application controller for a program that is spitting text directly to /dev/tty.</p>
<p>This is a production application controller that must be able to catch all text going to the terminal. Generally, this isn't a problem. We simply redirect stdout and stderr. This particular application is makin... | <p>I can't quite determine whether the <code>screen</code> program mentioned by @flolo will do what you need or not. It may, but I'm not sure whether there is a logging facility built in, which appears to be what you need.</p>
<p>There probably is a program out there already to do what you need. I'd nominate <a href... | <pre><code> screen -D -m yourEvilProgram
</code></pre>
<p>should work. Much time passed sinced I used it, but if you need to read some of its output it could even be possible that you could utilize some sockets to read it.</p>
<p>[<em>Added</em>: two links, <a href="http://www.rackaid.com/resources/linux-tutorials/ge... | 39,498 |
<p>I have a list of strings displayed by a Silverlight ItemsControl. The DataTemplate is a Border control with a TextBlock as its child. How can I access the border control corresponding to an item? For example, I might want to do this to change the background color.</p>
| <p>An easier way to do this is to grab the Parent of the textblock and cast it as a Border. Here is a quick example of this:</p>
<p>Xaml</p>
<pre><code><Grid>
<ItemsControl x:Name="items">
<ItemsControl.ItemTemplate>
<DataTemplate>
<Border>
... | <p>You can override the ItemsControl.GetContainerForItemOverride method and save the object-container pairs in a dictionary.</p>
| 36,014 |
<p>I got a little problem I can't figure out. I have a server side MarshalByRefObject that I'm trying to wrap a transparent proxy around on the client side. Here's the setup:</p>
<pre><code>public class ClientProgram {
public static void Main( string[] args ) {
ITest test = (ITest)Activator.GetObject( type... | <p>Got it. your comment put me on the right track. The key is to unwrap the proxy and call invoke on it. THANK YOU!!!!!</p>
<pre><code>public class ClientProgram {
public static void Main( string[] args ) {
ITest test = (ITest)Activator.GetObject( typeof( ITest ), "http://127.0.0.1:8765/Test.rem" )... | <p>I did that a while ago and forgot exact procedure, but try using RemotingServices.GetRealProxy to get proxy from <em>test</em> object and pass this into your MyProxy and call invoke on it.</p>
<p>Something like this:</p>
<pre><code>ITest test = (ITest)Activator.GetObject( typeof( ITest ), "http://127.0.0.1:8765/Te... | 26,995 |
<p>I have a number of users with multi-megabyte files that need to be processed before they can be uploaded. I am trying to find a way to do this without having to install any executable software on their machines. </p>
<p>If every machine shipped with, say, Python it would be easy. I could have a Python script do eve... | <p>Would Google Gears work here? Yes, users have to install something, but I think the experience is fairly frictionless. And once it's installed, no more worries.</p>
| <p>The application that I maintain and develop for work is an <a href="http://msdn.microsoft.com/en-us/library/ms536471.aspx" rel="nofollow noreferrer">HTML Application</a> or <a href="http://msdn.microsoft.com/en-us/library/ms536471.aspx" rel="nofollow noreferrer">HTA</a>, linked with a SQL Server 2005 backend. This a... | 6,245 |
<p>We are looking to do some heavy security requirements on our project, and we need to do a lot of encryption that is highly performant.</p>
<p>I think that I know that PKI is much slower and more complex than symmetric encryption, but I can't find the numbers to back up my feelings.</p>
| <p>Yes, purely asymmetric encryption is much slower than symmetric cyphers (like DES or AES), which is why real applications use <a href="http://en.wikipedia.org/wiki/Hybrid_cryptosystem" rel="noreferrer">hybrid cryptography</a>: the expensive public-key operations are performed only to encrypt (and exchange) an encryp... | <p>Perhaps you can add some details about your project so that you get better quality answers. What are you trying to secure? From whom? If you could explain the requirements of your security, you'll get a much better answer. Performance doesn't mean much if the encryption mechanism isn't protecting what you think ... | 14,418 |
<p>I have a regex that is going to end up being a bit long and it'd make it much easier to read to have it across multiple lines.</p>
<p>I tried this but it just barfs.</p>
<pre><code>preg_match(
'^J[0-9]{7}:\s+
(.*?) #Extract the Transaction Start Date msg
\s+J[0-9]{7}:\s+Project\sname:\s+
... | <p>You can use the extended syntax:</p>
<pre><code>preg_match("/
test
/x", $foo, $bar);
</code></pre>
| <p>In PHP the comment syntax looks like this:<pre>(?# Your comment here)</pre></p>
<pre><code>preg_match('
^J[0-9]{7}:\s+
(.*?) (?#Extract the Transaction Start Date msg)
\s+J[0-9]{7}:\s+Project\sname:\s+
(.*?) (?#Extract the Project Name)
... | 4,259 |
<p>I am working on rails project and I am trying to get exceptions to be logged to the rails log files. I know I can call <code>logger.error $!</code> to get the first line of the exception logged to the file. But, I want to get the entire trace stack logged as well. How do I log the entire trace back of an exceptio... | <pre><code>logger.error $!.backtrace
</code></pre>
<p>Also, don't forget you can </p>
<pre><code>rescue ErrorType => error_name
</code></pre>
<p>to give your error a variable name other than the default <code>$!</code>.</p>
| <p>You can also use ruby's default variables, like this:</p>
<pre><code>logger.error "Your error message. Exception message:#{$!} Stacktrace:#{$@}"
</code></pre>
| 28,269 |
<p>In Prusa i3 clones the Z axis is often problematic. Mechanically unsynchronized dual Z axises which are driven by the same stepper driver easily misalign. Using only one Z motor makes the whole gantry sag on one side. And Z lead screws that aren't perfectly straight lead to z wobble.</p>
<p>The other day I had a sim... | <p>This concept already exists, it is e.g. found in some high quality 3D printers. Instead of a winch, a belt system (of several belts) is used.</p>
<p>An interesting point from <a href="https://3dprinting.stackexchange.com/a/16289/8884">this answer</a> already mentions that a winch isn't a good mechanism to lower/rais... | <p>Unless your gantry is extremely heavy, I don't think this will work. The Z motion system needs to not only lift, but to hold the nozzle rigidly at the desired distance from the bed/previous layer. Otherwise I would expect poor layer bonding and possibly even collisions between the nozzle and already-printed material... | 1,939 |
<p>I heard Joel and Jeff talking about <a href="http://www.mikeindustries.com/blog/sifr/" rel="nofollow noreferrer">sIFR</a> in one of the <a href="https://stackoverflow.fogbugz.com/default.asp?W12621" rel="nofollow noreferrer">early podcasts</a>. I've been using it on <a href="http://www.american-data.com" rel="nofol... | <p>You use sIFR moderately, say for headlines. Try not to use it for links, because links in Flash don't work as well as normal HTML links. It also makes little sense to use sIFR only for text that never changes, an image would work a lot better.</p>
<p>I haven't heard about the upside-down problem in a few years now,... | <p>I had plenty of headaches after implementing <a href="http://www.mikeindustries.com/blog/sifr/" rel="nofollow noreferrer">sIFR</a> on my last website project. Most of the problems were to do with browser inconsistencies like you are describing. Text would appear in odd places, not wrap properly or just not display t... | 3,853 |
<p>I am curious about how many of you folks incorporate mocking of objects (frameworks like JMock, NMock, RhinoMocks hand in hand with unit testing frameworks) into your daily development process. What are your experiences?</p>
<p>You see, I develop on top of a GIS (geographic information systems) platform, in which m... | <p>On a recent project that I worked on we used mock objects extensively in our unit testing approach. The project was 100% Java and moderately sized (about 100,000 lines of non-commented code). It was a Swing-based desktop application - and the only effective way that we found to test the user interface logic was thro... | <p>Mocking can be useful in some kind of project. But, sometimes mocking is very time consuming and the ROI of it is low.</p>
| 10,849 |
<p>Also, how do <code>LEFT OUTER JOIN</code>, <code>RIGHT OUTER JOIN</code>, and <code>FULL OUTER JOIN</code> fit in?</p>
| <p>Assuming you're joining on columns with no duplicates, which is a very common case:</p>
<ul>
<li><p>An inner join of A and B gives the result of A intersect B, i.e. the inner part of a <a href="http://en.wikipedia.org/wiki/Venn_diagram" rel="noreferrer">Venn diagram</a> intersection.</p>
</li>
<li><p>An outer join o... | <p><strong>in Inner join</strong>, We can retrieve the data where we have the same/related data in different tables</p>
<p>SELECT Sname, Tname
FROM student s
JOIN teacher t
ON s.id = t.id;</p>
<p>if you also want to get other data information from a different table in that case, we can go for outer join</p>
<p>we have... | 5,943 |
<p>This may be a simple fix - but I'm trying to sum together all the nodes (Size property from the Node class) on the binary search tree. Below in my BST class I have the following so far, but it returns 0:</p>
<pre><code> private long sum(Node<T> thisNode)
{
if (thisNode.Left == null && t... | <p>It's because you're returning zero when you reach a leaf node. You should be returning the size stored in that leaf node.</p>
<p>In addition, if your non-leaf nodes also have a size, you'll need to process them as well thus:</p>
<pre><code>private long sum(Node<T> thisNode)
{
if (thisNode.Left == null &... | <p>Maybe you meant </p>
<pre><code> if (thisNode.Left == null && thisNode.Right == null)
return thisNode.Size;
</code></pre>
<p>?</p>
| 28,293 |
<p>I have a script that renders graphs in gnuplot. The graphs all end up with an ugly white background. How do I change this? (Ideally, with a command that goes into a gnuplot script, as opposed to a command-line option or something in a settings file)</p>
| <p>You can change the background color by command <code>set object 1 rectangle from screen 0,0 to screen 1,1 fillcolor rgb"green" behind</code> to set the background color to the the color you specified (here is green).</p>
<p>To get more knowledge about setting the background in gnuplot, you can visit this <a href="... | <p>According to the <a href="http://www.gnuplot.info/documentation.html" rel="nofollow noreferrer">official documentation</a>, as of version 5.4 the right way to set the background color in a gnuplot script is something like the following:</p>
<pre><code>set term wxt background rgb "gray75"
</code></pre>
<p>N... | 9,487 |
<p>Is there a way (in C#) to access the systray?
I am not talking about making a notify icon.
I want to iterate through the items in the tray (I would guess through the processes but I don't know how to determine what is actually in the tray and what is just a process) and also represent the items with their icons in m... | <p>How do you feel about Win32 interop? I found <a href="http://skyscraper.fortunecity.com/gigo/311/winprog/shellico.txt" rel="nofollow noreferrer" title="this C/Win32 code">C/Win32 code</a> that might do the trick for you. (Actually, it looks like an interesting problem so I might try to tackle it myself, just not n... | <p>It was perfectly possible to achieve it in Windows 2000/Xp.
Unfortunately in Windows 7 it seems to be not feasible any more.</p>
<p>Trick was simple: you have to find tray window handle:</p>
<pre><code> static IntPtr GetSystemTrayHandle()
{
IntPtr hWndTray = FindWindow("Shell_TrayWnd", null);
... | 33,100 |
<p>I need a way to represent a 2-D array (a dense matrix) of doubles in C++, with absolute minimum accessing overhead. </p>
<p>I've done some timing on various linux/unix machines and gcc versions. An STL vector of vectors, declared as:</p>
<pre><code>vector<vector<double> > matrix(n,vector<double>(... | <p>If you're using GCC the compiler can analyze your matrix accesses and change the order in memory in certain cases. The magic compiler flag is defined as:</p>
<pre><code>-fipa-matrix-reorg
</code></pre>
<blockquote>
<p>Perform matrix flattening and
transposing. Matrix flattening tries
to replace a m-dimension... | <p>There is the uBLAS implementation in Boost. It is worth a look.</p>
<p><a href="http://www.boost.org/doc/libs/1_36_0/libs/numeric/ublas/doc/matrix.htm" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_36_0/libs/numeric/ublas/doc/matrix.htm</a></p>
| 18,430 |
<p>Subreports overlap in this example -- what am I doing wrong? The second one is supposed to "float" below the first one, with its 'y' attribute being ignored, but it isn't.</p>
<p>Thanks !!</p>
<pre class="lang-xml prettyprint-override"><code><?xml version="1.0" encoding="UTF-8"?>
<jasperReport xmlns="http... | <p>I got the answer! (I'm the one who asked, different IP I guess)
According to the documentation, the floating element would have its y attribute ignored. I had taken that literally, tried arbitrary values for y and saw that everytime the element was placed at the specified position.</p>
<p>But no, you need to set y ... | <p>Make Position Typt to "float" and make Stretch Type to "no stretch"</p>
| 46,101 |
<p>I have 2 strings that I'd like to compare, and return the positions of the different characters in the second string. </p>
<p>For example, if I have </p>
<ol>
<li><code>"The brown fox jumps over the lazy dog"</code></li>
<li><code>"The quick brown fox jumped over the lazy dog"</code></li>
</ol>
<p>I want it to hi... | <p>This might do the trick:</p>
<p><a href="http://software.zuavra.net/inline-diff/" rel="nofollow noreferrer">PHP Inline Diff</a></p>
<p><a href="http://pear.php.net/package/Text_Diff" rel="nofollow noreferrer">Text_Diff</a></p>
| <p>The algorithm you're looking for is the "longest common substring problem". From there it is easy to determine the differences. See Wikipedia:</p>
<p><a href="http://en.wikipedia.org/wiki/Diff#Algorithm" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Diff#Algorithm</a></p>
| 11,527 |
<p>I think the direct answer to the question is 'No' but I'm hoping that someone has written a real simple library to do this (or I can do it...ugh...)</p>
<p>Let me demonstrate what I am looking for with an example.
Suppose I had the following:</p>
<pre><code>class Person {
string Name {get; set;}
int NumberOfCa... | <p>Edit: You don't have to implement IFormattable for each object...that'd be a PITA, severely limiting, and a fairly large maintenance burden. Just use Reflection and a IFormatProvider with ICustomFormatter and it'll work with <em>any</em> object. String.Format has an overload to take one as a parameter.</p>
<p>I've ... | <p>This is something that many do in the Python world by using "someString % locals()." What you're suggesting though has a couple of fundamental breaks from how string.format works:</p>
<ul>
<li><p>normally the placeholder notation has string formatting information after the colon, whereas you want to do property ac... | 46,608 |
<p>I have a bunch of enum types in some library header files that I'm using, and I want to have a way of converting enum values to user strings - and vice-versa. </p>
<p>RTTI won't do it for me, because the 'user strings' need to be a bit more readable than the enumerations.</p>
<p>A brute force solution would be a b... | <p>If you want the enum names themselves as strings, see <a href="https://stackoverflow.com/questions/201593/is-there-a-simple-script-to-convert-c-enum-to-string#201792">this post</a>.
Otherwise, a <code>std::map<MyEnum, char const*></code> will work nicely. (No point in copying your string literals to std::strin... | <p>I recently had the same issue with a vendor library (Fincad). Fortunately, the vendor provided xml doucumentation for all the enums. I ended up generating a map for each enum type and providing a lookup function for each enum. This technique also allows you to intercept a lookup outside the range of the enum.</p>
... | 25,501 |
<p>I would like to show some links only to authenticated users in an asp.net mvc web application.</p>
<ul>
<li>I use the template for an asp.net mvc web application in Visual Studio 2008 that came with the beta release of asp.net mvc.</li>
<li>I use forms authentication.</li>
<li>I would like to add something like the... | <p>The following should work. You'll also need to do something similar in the controller action for this in case the user inputs the URL by hand in their browser. Or, as you say, you could restrict access to the action in the web.config.</p>
<pre><code> <% if (HttpContext.Current.Request.IsAuthenticated) { %>
... | <pre><code><%if (Page.User.Identity.IsAuthenticated){ %>
<p>show change password link</p>
<% }
else
{ %>
<p> show login link</p>
<% } %>
</code></pre>
| 42,445 |
<p>I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed.</p>
<p>I was kind of hoping that this would work</p>
<pre><code>int? val = stringVal as int?;
</code></pre>
<p>But that won't work, so the way I'm doing it now is I've... | <p><code>int.TryParse</code> is probably a tad easier:</p>
<pre><code>public static int? ToNullableInt(this string s)
{
int i;
if (int.TryParse(s, out i)) return i;
return null;
}
</code></pre>
<p><strong>Edit</strong> @Glenn <code>int.TryParse</code> is "built into the framework". It and <code>int.Parse<... | <p>You should <em>never</em> use an exception if you don't have to - the overhead is horrible.</p>
<p>The variations on TryParse solve the problem - if you want to get creative (to make your code look more elegant) you could probably do something with an extension method in 3.5 but the code would be more or less the s... | 6,682 |
<p>I am working on a project that is replacing an old portal system (Plumtree) with sharepoint and we want to make the transition as smooth as possible.</p>
<p>One thing we are look at currently is taking all the gadgets (Plumtree term for WebParts) and making sure they appear in the same place on the users new MySite... | <p>You are right, messing directly with databases are not supported nor recommended. </p>
<p>Unfortunately, there are not much ways to modify MySites, the best way I know come from the MOSS Team Blog: <a href="http://blogs.msdn.com/sharepoint/archive/2007/03/22/customizing-moss-2007-my-sites-within-the-enterprise.asp... | <p>The way we did it was pretty much what is described in the link above (<a href="http://blogs.msdn.com/sharepoint/archive/2007/03/22/customizing-moss-2007-my-sites-within-the-enterprise.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/sharepoint/archive/2007/03/22/customizing-moss-2007-my-sites-within-the-enterp... | 27,839 |
<p>I'm hoping this question isn't too obscure <em>cross fingers</em></p>
<p>I'm looking for a decent reference for <a href="http://netsuite.com" rel="noreferrer">netsuite</a> scripting and api (both of which are based on ASP)</p>
<p>does anybody know where to find this stuff? The netsuite help pages are mediocre at b... | <p>As a ex NetSuite employee I was frustrated by this time and time again, even internally there is no good refs other than the published pdf's in dev docs.</p>
<p>One of the best places for snippets of code and clues of how to do things is the NS User Groups as well as the not so good sample apps.</p>
<p>A lot of it... | <p>I second Corey in utilizing the NS user group (recently migrated to <a href="https://usergroup.netsuite.com/users/index.php" rel="nofollow">https://usergroup.netsuite.com/users/index.php</a>? where I am waiting on approval). Also paying the premium for NS phone support has been helpful in resolving issues. Outside o... | 28,249 |
<p>I am starting to build a new web application that will require user accounts. Now that I have an OpenID that I am using for this site I thought it would be cool if I could use OpenID for authentication in my application. Are there any good tutorials on how to integrate OpenID with an ASP.NET site?</p>
| <p>See <a href="http://www.hanselman.com/blog/TheWeeklySourceCode25OpenIDEdition.aspx" rel="noreferrer">Scott Hanselman's post on using DotNetOpenID</a> in ASP.NET. <a href="http://blog.nerdbank.net/" rel="noreferrer">Andrew Arnott's blog</a> is full of samples on using DotNetOpenID with ASP.NET, including ASP.NET MVC.... | <p>You should check out the <a href="http://www.dotnetnuke.com" rel="nofollow noreferrer">DotNetNuke</a> codebase as well, they have been using OpenID for the last several revisions, and you'll find working code for implementing it there.</p>
| 3,741 |
<p>I haven't got a unique problem, but for the life of me I can't figure out what I'm doing wrong.</p>
<p>I have a page that has a series of sections. Part of the section is a little image. When the image is clicked, I want to show a custom control. Showing the control is trivial, set the z-index a bit higher to en... | <p><a href="https://stackoverflow.com/users/6144/scunliffe">scunliffe</a> was the closest (answered in a comment I can't link to). The custom control is inside of a relatively positioned div (several down actually). the blanket was simply appended onto the end of the body. Therefore it was outside the relatively pos... | <p>Here is how we do oppacity on our project:</p>
<pre><code>.SomeStyle
{
filter:alpha(opacity=10);
-moz-opacity:.10;
opacity:.10;
}
</code></pre>
<p>That tests fine on IE 6 & 7 and FF 2 & 3. I believe it works in Safari as well.</p>
| 49,183 |
<p>This question is specifically related to overriding the equals() method for objects with a large number of fields. First off, let me say that this large object cannot be broken down into multiple components without violating OO principles, so telling me "no class should have more than x fields" won't help. </p>
<... | <p>If you did want to whitelist for performance reasons, consider using an annotation to indicate which fields to compare. Also, this implementation won't work if your fields don't have good implementations for <code>equals()</code>.</p>
<p>P.S. If you go this route for <code>equals()</code>, don't forget to do somethi... | <p>Take a look at org.apache.commons.EqualsBuilder:</p>
<p><a href="http://commons.apache.org/proper/commons-lang/javadocs/api-3.2/org/apache/commons/lang3/builder/EqualsBuilder.html" rel="nofollow noreferrer">http://commons.apache.org/proper/commons-lang/javadocs/api-3.2/org/apache/commons/lang3/builder/EqualsBuilder... | 15,154 |
<p>What is the most efficient way to store large arrays (10000x100) in a database, say, hsqldb? I need to do this for a certain math program that I'm writing in java. Please help.
The whole array will be retrieved and stored often (not so much individual elements). Also, some meta-data about the array needs to be store... | <p>Great question.</p>
<p>Unless you want to translate your arrays into a set of normalized tables, which it sounds like you don't, you might want to contemplate serialization.</p>
<p>Serialization is a fancy word for turning objects into some format that you can save to disk or a database. The two major formats for ... | <p>Define a table with the data your array holds and insert the array values into a table.</p>
<p>This is very simple data access/storage. Will your array dimensions always be the same?</p>
| 26,275 |
<p>I need to determine the number of pages in a specified PDF file using C# code (.NET 2.0). The PDF file will be read from the file system, and not from an URL. Does anyone have any idea on how this could be done? Note: Adobe Acrobat Reader is installed on the PC where this check will be carried out.</p>
| <p>You'll need a PDF API for C#. iTextSharp is one possible API, though better ones might exist.</p>
<p><strong>iTextSharp Example</strong></p>
<p>You must install iTextSharp.dll as a reference. Download iTextsharp from SourceForge.net This is a complete working program using a console application.</p>
<pre><code>us... | <p>I have good success using CeTe Dynamic PDF products. They're not free, but are well documented. They did the job for me.</p>
<p><a href="http://www.dynamicpdf.com/" rel="nofollow noreferrer">http://www.dynamicpdf.com/</a></p>
| 41,427 |
<p>Having a relative path, how do I turn it into an absolute one from the location where the elisp file that I'm loading is. That is, I have an elisp file that I'm loading, it has an relative path and I need an absolute one.</p>
| <pre><code>'file-truename
</code></pre>
<p>From the documentation:</p>
<blockquote>
<p>Return the truename of FILENAME, which
should be absolute. The truename of a
file name is found by chasing symbolic
links both at the level of the file
and at the level of the directories
containing it, until no links a... | <p>You can use the <code>expand-file-name</code> function to convert a relative filename or path into an absolute filename/path. Look <a href="https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Name-Expansion.html#File-Name-Expansion" rel="nofollow noreferrer">here</a> for additional information.</p>
| 37,251 |
<p>I have been wondering about 3D metal printing (steel, aluminium), but after a short research on google I found only too expensive printers (markforged, desktop metal and a few other industrial ones). Is there any less expensive printer that is able to print metal parts on the market ?</p>
| <p>Anzalone and friends published <a href="https://ieeexplore.ieee.org/document/6678531/" rel="noreferrer">A Low-Cost Open-Source Metal 3-D Printer</a> in <em>IEEE Access</em>:</p>
<blockquote>
<p>This paper reports on the development of a open-source metal 3-D printer. The metal 3-D printer is controlled with an op... | <p>You can do lost-PLA investment casting, the actual gear to do it is kind of pricey unless you're willing to create your own DIY forge for melting aluminum.</p>
<p>Check it out though, you don't need a special printer to do it.</p>
<p>There's also a way to coat your prints with metal it would require an electric cu... | 983 |
<p>How can I pipe the new password to smbpasswd so I can automate my installation process.</p>
| <p>Thanks to Mark I found the answer:</p>
<pre><code>(echo newpassword; echo confirmNewPassword) | smbpasswd -s
</code></pre>
<p>BTW: (echo oldpasswd; echo newpasswd) | smbpasswd -s does not work.</p>
| <p>using either <a href="http://en.wikipedia.org/wiki/Pipeline_(Unix)" rel="nofollow noreferrer">pipelines</a> or <a href="http://en.wikipedia.org/wiki/Redirection_(Unix)" rel="nofollow noreferrer">redirection</a>.</p>
| 3,312 |
<p>When receiving a bug report or an it-doesnt-work message one of my initials questions is always what version? With a different builds being at many stages of testing, planning and deploying this is often a non-trivial question.</p>
<p>I the case of releasing Java JAR (ear, jar, rar, war) files I would like to be ab... | <p>Use the <em>svnversion</em> command in your Ant script to get the revision number:</p>
<pre><code><exec executable="svnversion" outputproperty="svnversion" failonerror="true">
<env key="path" value="/usr/bin"/>
<arg value="--no-newline" />
</exec>
</code></pre>
<p>Then use the <em>${svn... | <p>I store the absolute repository revision as a part of my full version number. This gives people a quick glance to see if a given change is in a given version or not.</p>
<p>We also store the version number / build date / etc in the manifest file of the ear as custom properties, these are mostly informational only. ... | 20,716 |
<p>On our TFS source control server, a lot of source files are checked out by people, which are not employed any more.</p>
<p>Is there a central way where I can undo check out on all files in TFS?</p>
<p>I'm not even sure that they exists in Active Directory anymore.</p>
| <p>Best thing to do is to delete their workspace using with the command line tool (tf.exe) or the <a href="http://www.attrice.info/cm/tfs/" rel="noreferrer">TFS Sidekicks from Attrice</a>.</p>
<p>See the following blog post I did on the topic when it happened to me, and I detailed the command line version:</p>
<p><a ... | <p>There are command line tools that can do this.</p>
<p>However, I find the <a href="http://www.attrice.info/cm/tfs/" rel="noreferrer">sidekicks</a> tool much easier to use (it is free and stable.)</p>
<p>You can undo check out easily. There's much more in there that makes it well worth the installation.</p>
| 32,223 |
<p>I did calibrate the extruder to extrude exactly 50/100 mm and it is fine.
I have replaced the old (prehistorical) extruder that was giving me the problem with a new one.
The issue does not go away. It is severely under extruded.
The nozzle is a 0.4 mm, if I extrude manually the extrusion is nice and clean but when p... | <p>Assuming your filament dimension settings are correct and your extruder is correctly calibrated...</p>
<p><strong>Your extruder temperature may be too low.</strong> While 184C can be hot enough, it is very near the bottom of the range for PLA and it appears your filament isn't melting quickly enough to keep up wit... | <p>Looks to me like you have your slicer set to 3mm filament when you're using 1.75mm filament. Confirm that your slicer has its filament setting set to 1.75mm and not 3mm (this obviously assumes you are using 1.75mm filament..)</p>
<p>Failing this:</p>
<ul>
<li>Test extruder steps/mm</li>
<li>Ensure nozzle diameter ... | 407 |
<p>I have a table with 7M records I want to trim down to 10k for dev. I tried a delete, but the whole world was nearly overpowered by the transaction log size, so I truncated the table.</p>
<p>Now I wish to insert 10k records from the original table, into my dev table, but it has a identity column, and many, many oth... | <p>There's really no need to use SSIS to do this. You should be able to insert the records using SQL. First, you will need to set IDENTITY_INSERT to on. Then, you should be able to execute something like this:</p>
<p>SET IDENTITY_INSERT db.schema.dev_table ON</p>
<p>INSERT INTO dev_table SELECT TOP (10000) * FROM ... | <p>Did you try closing and reopening the package? I wouldn't expect you to have to do this though. My first thought would be it is a security issue - that you haven't granted yourself select on it.</p>
| 43,460 |
<p>I want to store a string in memory and read it later:</p>
<pre><code>$$->desc.constant->base.id = (char*)malloc(200);
sprintf($$->desc.constant->base.id, "%f", $1);
printf("->%s\n", $$->desc.constant->base.id); //LINE A
printf("->%i\n", $$->desc.constant); //LINE B
//SOME OTHER CODE
//... | <pre><code>printf("->%i\n", $$->desc.constant); //LINE B
</code></pre>
<p>That is invalid. As you show the line prior to it that <code>constant</code> is actually a pointer, you cannot treat it as if it were of type <code>int</code>. They don't necassarily have the same sizeof and alignment. Use the format used ... | <p>Maybe between the time of the two pieces of code you have since <code>free</code>d the string?</p>
<pre><code>$$->desc.constant->base.id = (char*)malloc(200);
sprintf($$->desc.constant->base.id, "%f", $1);
printf("->%s\n", $$->desc.constant->base.id); //LINE A
printf("->%i\n", $$->desc.c... | 45,082 |
<p>I would like to print <em>only</em> the contents of a textarea element from a website page. In particular, I would like to ensure that nothing gets clipped by the boundary of the textarea as the contents will be quite large.</p>
<p>What is the best strategy for tackling this?</p>
| <p>Make a print stylesheet where all of the elements <em>except</em> the textarea are set in CSS to display: none;, and for the textarea, overflow: visible.</p>
<p>Link it to the page with the link tag in the header set to media="print".</p>
<p>You're done.</p>
| <p>Did the overflow: visible; on textarea actually work for any of you? FF3 seems to ignore that rule on textarea in print sheets. Not that it's a bug or anything.</p>
| 34,331 |
<p>What is the difference between Introspection and Reflection in .NET</p>
| <p>They're two parts of the same whole.</p>
<p>Introspection refers to the ability of a class to look 'inside' itself and see, for example, what parameters a method takes, what the names of its members are, etc.</p>
<p>Reflection is the specific name for how .NET implements introspection. Other languages may call it... | <p>They're two parts of the same whole.</p>
<p>Introspection refers to the ability of a class to look 'inside' itself and see, for example, what parameters a method takes, what the names of its members are, etc.</p>
<p>Reflection is the specific name for how .NET implements introspection. Other languages may call it... | 9,903 |
<p>Has anyone seen this before - and can anything be done about it? This link is to a PNG screen shot of a list display in IE - if you look closely, the line height of each element is getting a little bigger for each successive item. The web site look is entirely controlled by CSS.</p>
<p><strike>Screen Shot</strike... | <p>Looks like a bug in IE7.</p>
<p>I just tested on IE8, works as expected in IE8 mode, but exhibits the same behaviour in compatibility mode.</p>
<p>Update: messing about, it seems it the <code>overflow:hidden</code> style causing that.</p>
| <p>I see your page is XHTML and it validates...
But like allmost any XHTML page it's served as <code>text/html</code> and not <code>application/xhtml+xml</code> (if it were IE would not recognize it, and ask if you wanted to save the file). So allthoug it's a nice idea to use XHTML, every browser gets served XHTML and... | 44,135 |
<p>I'm currently using default implementation of STL for VS2005 and I'm <a href="https://stackoverflow.com/questions/186494/ifstr1str2-versus-ifstr1lengthstr2length-str1str2">not really satisfied</a> with it. Perhaps there is something better?</p>
| <p>The Dinkumware STL implementation (supplied with VS2005) is actually quite good. The STL is a general purpose library and so it is almost always possible to write something better for very specific use cases.</p>
<p>I'm aware of the following alternative implementations, but I've never used them with VS2005:</p>
<... | <p>How about STLPort?</p>
<p><a href="http://www.stlport.org/" rel="nofollow noreferrer">http://www.stlport.org/</a></p>
| 23,974 |
<p>Surprisingly as you get good at vim, you can code even faster than standard IDEs such as Eclipse. But one thing I really miss is code completion, especially for long variable names and functions.</p>
<p>Is there any way to enable code completion for Perl in vim?</p>
| <p><kbd>Ctrl</kbd>-<kbd>P</kbd> (Get Previous Match) and <kbd>Ctrl</kbd>-<kbd>N</kbd> (Get Next Match) are kind of pseudo code completion. They basically search the file (Backwards for <kbd>Ctrl</kbd>-<kbd>P</kbd>, Forwards for <kbd>Ctrl</kbd>-<kbd>N</kbd>) you are editing (and any open buffers, and if you are using T... | <p><kbd>Ctrl</kbd>+<kbd>N</kbd></p>
<p>This is explained in the Perl Hacks book, along with how to do Package completion. Highly recommended.</p>
| 7,771 |
<p>I've written a simple calendar control to allow for selecting single days, weeks, months and so on. The simplicity comes from the fact that I don't really do any drawing myself, opting instead to create a bunch of boxes and labels to act as date cells for the calendar. </p>
<p>When a date or a date range is select... | <p>Are you using callLater() at all?</p>
<p>If you use callLater() it may impove your visuals as it batches up changes until it needs to draw a frame or you force a frame draw with validateNow() or similar. It might be enough in your case.</p>
| <p>This may not be exactly what you're looking for, but David Coletta at Adobe has posted <a href="http://www.colettas.org/?p=237" rel="nofollow noreferrer">a video explaining an EventCoalescer</a> that they use in Buzzword for deferring events that update specific areas of the app UI until the user has stopped moving ... | 32,221 |
<p>The application I'm writing is almost complete and I'd like people who speak different languages to use it.</p>
<p>I'm not sure where to start, what's the difference between globalisation and culture in regards to programming?</p>
<p>How does one take uncommon phrases such as "this application was built to do this... | <p>Microsoft already has a very good <a href="http://msdn.microsoft.com/en-us/goglobal/bb688096" rel="nofollow noreferrer">tutorial</a></p>
| <p>For a very simple system, create an interface which defines methods like GetSaveText(), etc. and allow assemblies like this to be plugged in to your application.</p>
| 11,546 |
<p>I'd like to rank a collection of landscape images by making a game whereby site visitors can rate them, in order to find out which images people find the most appealing.</p>
<p>What would be a good method of doing that?</p>
<ul>
<li><strong>Hot-or-Not style</strong>? I.e. show a single image, ask the user to rank... | <p>As others have said, ranking 1-10 does not work that well because people have different levels.</p>
<p>The problem with the <strong>Pick A-or-B</strong> method is that its not guaranteed for the system to be transitive (A can beat B, but B beats C, and C beats A). <strong>Having nontransitive comparison operators ... | <p><strong>Pick A-or-B</strong> its the simplest and less prone to bias, however at each human interaction it gives you substantially less information. I think because of the bias reduction, Pick is superior and in the limit it provides you with the same information.</p>
<p>A very simple scoring scheme is to have a co... | 19,922 |
<p>I am looking for a robust way to copy files over a Windows network share that is tolerant of intermittent connectivity. The application is often used on wireless, mobile workstations in large hospitals, and I'm assuming connectivity can be lost either momentarily or for several minutes at a time. The files involved ... | <p>I've used <a href="http://en.wikipedia.org/wiki/Robocopy" rel="noreferrer">Robocopy</a> for this with excellent results. By default, it will retry every 30 seconds until the file gets across.</p>
| <p>SMS if it's available works.</p>
| 3,878 |
<p>I have a page with a few fields and a runtime-generated image on it. The contents of this page are inside an UpdatePanel. There is a button to take the user to a secondary page, which has a button that calls javascript:history.go(-1) when clicked.</p>
<p>The problem is, the first page does a full request instead of... | <p>@Ryan is on the right track if you want to use jQuery (and I would), but I'd suggest something more along the lines of:</p>
<pre><code>$('fieldset#fieldset1 > input[type=text]').each( function() {
... do something for text inputs }
);
$('fieldset#fieldset1 > input[type=radio]').each( function() {
... | <p>Haven't tested this and don't know how it would work, but you could use JQuery here to select all the elements into a JQuery object</p>
<pre><code>//$("input select textarea").each(function() {
$(":input").each(function() { //even better
// do stuff here
});
</code></pre>
<p>this would at least cleanup the cod... | 39,898 |
<p>I am writing a basic word processing application and am trying to settle on a native "internal" format, the one that my code parses in order to render to the screen. I'd like this to be XML so that I can, in the future, just write XSLT to convert it to ODF or XHTML or whatever.</p>
<p>When searching for existing st... | <p>As you are sure about needing to represent the <em>presentational</em> side of things, it may be worth looking at the <a href="http://www.w3.org/TR/xsl/" rel="noreferrer">XSL-FO</a> W3C Recommendation. This is a full-blown page description language and the (deeply unfashionable) other half of the better-known XSLT.<... | <p>XML is an <em>external</em> format, not <em>internal</em>.</p>
<p>What's wrong with <a href="http://www.w3.org/TR/xhtml1/" rel="nofollow noreferrer">XHTML</a>? It's simple and it's ubiquitous (at least HTML is). Your implementation would be easy to debug, and your users will be eternally greatful.</p>
| 5,113 |
<p>I want to automate several tasks (eg. simulate eclipse style <kbd>ctrl</kbd>-<kbd>shift</kbd>-<kbd>R</kbd> open dialog for other editors). The general pattern is: the user will press some key combination, my program will detect it and potentially pop up a dialog to get user input, and then run a corresponding comman... | <p>Found the answer using pyHook and the win32 extensions:</p>
<pre><code>import pyHook
import pythoncom
def OnKeyboardEvent(event):
print event.Ascii
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
while True:
pythoncom.PumpMessages()
</code></pre>
| <p>You may want to look at <a href="http://www.autoitscript.com/autoit3/" rel="nofollow noreferrer">AutoIt</a>. It does everything that AutoHotKey can do, but the language syntax doesn't make you want to pull your hair out. Additonally, it has COM bindings so you can use most of it's abilities easily in python if you... | 37,565 |
<p>I would like to embed Flash Player directly inside a C++ or Java application.</p>
<p>I found an article that describes how to do this for C#:
<a href="http://www.adobe.com/devnet/flash/articles/stock_history03.html" rel="noreferrer">http://www.adobe.com/devnet/flash/articles/stock_history03.html</a></p>
<p>Unfortu... | <p>I don't know how to embed flash in C++, but Christopher Deckers (of <a href="http://swtswing.sf.net" rel="nofollow noreferrer">SWTSwing</a> fame) has developed an interesting hack which allows it to be embedded in Java. You can find more information in <a href="http://www.javalobby.org/java/forums/t105291.html" rel... | <p>I personally haven't tried this but say in case of SWT/Java you could embed SWT browser window in you SWT/Java application and in the browser view you could put content with flash content, then communicate say with Merapi bridge with flash movie and java.</p>
| 26,354 |
<p>I've got a div that uses overflow:auto to keep the contents inside the div as it is resized and dragged around the page. I'm using some ajax to retrieve lines of text from the server, then append them to the end of the div, so the content is growing downwards. Every time this happens, I'd like to use JS to scroll th... | <p><code>scrollHeight</code> should be the total height of content. <code>scrollTop</code> specifies the pixel offset into that content to be displayed at the top of the element's client area.</p>
<p>So you really want (still using jQuery):</p>
<pre><code>$("#thediv").each( function()
{
// certain browsers have a... | <p>I had a div wrapping 3 divs that were floating left, and whose contents were being resized. It helps to turn funky-colored borders/background on for the div-wrapper when you try to resolve this. The problem was that the resized div-content was overflowing outside the div-wrapper (and bled to underneath the area of... | 3,432 |
<p>Does Mono .NET support and compile C++ / CLI?</p>
<p>If not, do you know if they have any plans of supporting it?</p>
| <p>We don't have a compiler for C++/CLI, it would be a very large undertaking for a very small userbase. Consider also that the C++/CLI spec is inherently flawed and non-portable, so being able to compile it wouldn't help much in the general case.</p>
<p>You can compile using the MS .NET compiler and run in mono with ... | <p>go <a href="http://www.mono-project.com/Languages" rel="nofollow noreferrer" title="here">here</a> and look under "Missing Languages". But just because you cant compile does not mean that you cant <em>run</em>. You can compile your C++ code using the framework sdk and try running it using mono. Worth trying anywa... | 22,167 |
<p>How to match a single quote in sed if the expression is enclosed in single quotes:</p>
<pre><code>sed -e '...'
</code></pre>
<p>For example need to match this text:</p>
<pre><code>'foo'
</code></pre>
|
<p>You can either use:</p>
<pre class="lang-none prettyprint-override"><code>"texta'textb" (APOSTROPHE inside QUOTATION MARKs)
</code></pre>
<p>or</p>
<pre class="lang-none prettyprint-override"><code>'texta'\''textb' (APOSTROPHE text APOSTROPHE, then REVERSE SOLIDUS, APOSTROPHE, then APOSTROPHE more text APOSTROP... | <p>You can also use <code>[']</code> to match a literal single quote without needing to do any shell quoting tricks.</p>
<pre><code>myvar="stupid computers can't reason about life"
echo "$myvar" | sed -e "s/[']t//"
</code></pre>
Outputs:
<pre><code>stupid computers can reason about life
</... | 11,640 |
<p>WPF's view model oriented way of doing things makes it very tempting to just use business objects in the UI. Have you seen any issues with this? Why or why wouldn't you do this?</p>
| <p>The guidance from Microsoft's product teams (e.g., that's what the Blend team is using) is the Model-View-ViewModel architecture, a variant of the popular MVC pattern. A good starting point is <a href="http://blogs.msdn.com/johngossman/archive/2005/10/08/478683.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/j... | <p>Not being a WPF guru, I can't be sure, but the usual reason for separating your M, V and C is so you can test the controller independent of the view, and the other way around.</p>
<p>Nothing stopping you, of course, but it should be a lot more testable (ie, unit tests) if it's separate. The MVP pattern, which is us... | 32,388 |
<p>I am having a real problem at work with a highly ingrained developer obsessed with ms access. Users moan about random crashes, locking errors, freeze's, the application slowing down (especially in 2007) but seem to be very resistant to moving it. Most of the time they blame the computer and can't be convinced it's t... | <p>how about the <strong>random, crashes, locking errors, freeze's, slow downs</strong> (sic). </p>
<p>A quick search on the web finds some useful materials:</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/aa167840.aspx" rel="noreferrer">Best Practices When Using Microsoft Office Access 2003 in a Multi-... | <p>Try bechmarking and showing the stats to him</p>
| 27,163 |
<p>I have been using an Anycubic i3 Mega for about a month now and it worked fine. But when I designed a simple model in Fusion 360 and sliced it with Cura it started to have issues sticking to the bed. I thought the problem was the model so I tried to print a Benchy, but the same problem occurred. I readjusted the bed... | <p>The proper answer could be not related to Fusion, as you already noticed.</p>
<p>I suppose the issue is that the Ultrabase surface (or any other glass surface you have installed) was <strong>not cleaned during the first month</strong>? So it should be cleaned from grease and possibly dust. The general cleaning metho... | <p>A "hack" I used was to print with a raft. I decreased the width of the raft in Cura so I'm not printing with excess plastic and the raft ensures my print always sticks.</p>
<p>Another thing to look at is to look at the print speed, a slightly slower speed might help with the build plate adhesion. This is s... | 1,883 |
<p>I receive an error message when exposing an ADO.NET Data Service using an Entity Framework data model that contains an entity (called "Case") with an internal setter on a property. If I modify the setter to be public (using the entity designer), the data services works fine.</p>
<p>I don’t need the entity "Case" ex... | <p>I recently ran into a similar issue, and the fix in my case was changinghe the name of the EntitySetAccessRule to "*", like this:</p>
<pre><code>public static void InitializeService(DataServiceConfiguration config)
{
config.SetEntitySetAccessRule("*", EntitySetRights.All);
config.DataServiceBehavior.MaxProtocol... | <p>I had a similar problem, and it was caused by passing the wrong class to DataService. You need to pass the data entities class of the data model.</p>
<pre><code>public class WebDataService : DataService< DataModel.DataEntities >
</code></pre>
| 33,471 |
<p>I'm trying to develop an application that will use getImageData in javascript in Firefox 3, but I am getting a "<code>NS_ERROR_DOM_SECURITY_ERR</code>" on the getImageData call. The javascript and the image are both currently being served from by hard drive, which is apparently a security violation? When this is liv... | <p>You could try installing a local webserver such as Apache (on unix) or IIS (on Windows). That will ultimately give you the best local test bench for web-related stuff, because as you have found out browsers treat files from the filesystem quite differently than content served from a webserver.</p>
| <p>I had the same problem while using <code>getImageData</code> in FireFox 11.0 ...
All my files and codes were on my server and there was nothing on my local computer.</p>
<p>I thought maybe this helps someone who has the same problem as me. </p>
<p>It looks like that Firefox treats </p>
<pre><code>http://mySite.c... | 46,754 |
<p>Is there a reason why most function definition in device driver in linux code is defined as static? Is there a reason for this? </p>
<p>I was told this is for scoping and to prevent namespace pollution, could anyone explain it in detail why static definition is used in this context?</p>
| <p>Functions declared static are not visible outside the translation unit they are defined in (a translation unit is basically a .c file). If a function does not need to be called from outside the file, then it should be made static so as to not pollute the global namespace. This makes conflicts between names that are ... | <p>For the same reasons you use static in any code. You should only 'publish' your API calls, anything else opens you up to abuse, such as being able to call internal functions from outside the driver, something that would almost certainly be catastrophic.</p>
<p>It's good programming practice to only make visible to ... | 45,407 |
<p>I'm looking for a pattern for performing a dynamic search on multiple tables.</p>
<p>I have no control over the legacy (and poorly designed) database table structure.</p>
<p>Consider a scenario similar to a resume search where a user may want to perform a search against any of the data in the resume and get back a... | <p>As far as I understand (and I'm also someone who has written against a horrible legacy database), there is no such thing as dynamic WHERE clauses. It has NOT been solved. </p>
<p>Personally, I prefer to generate my dynamic searches in code. Makes testing convenient. Note, when you create your sql queries in cod... | <p>Search and normalization can be at odds with each other. So probably first thing would be to get some kind of "view" that shows all the fields that can be searched as a single row with a single key getting you the resume. then you can throw something like <a href="http://lucene.apache.org/java/docs/" rel="nofollow n... | 3,108 |
<p>This is my first Latex doc. Using Latex8.sty I'm trying to include a 5 column table. I've commented out everything but the introdution and the table. When I make the pdf it shows the introduction but no table. Any tips? </p>
<pre><code>\begin{tabular}{|ll||l|c|r|rr}
Mass&a1&a2&Fprime1&Fprime2\\
\h... | <p>with gnome, you have <a href="http://ekiga.org" rel="nofollow noreferrer">ekiga</a>. You can cross compile it for win32 too. It uses OPAL (Open Phone Abstraction Library) underneath. Maybe the tool itself will suit your needs, otherwise you can adapt it (OSS) or you can only keep low level API</p>
| <p>I agree with PW.</p>
<ul>
<li>OPAL is an excellent choice. </li>
<li>It supports audio and video devices</li>
<li>It compiles on windows, linux, and a few others</li>
</ul>
<p>Also
- I recommend using the SIP protocol (as opposed to H323)
- You don't need to use Ekiga. Ekiga is a front-end to OPAL. You can take a ... | 23,097 |
<p>I found in MYSQL and apparently other database engines that there is a "greatest" function that can be used like: greatest(1, 2, 3, 4), and it would return 4. I need this, but I am using IBM's DB2. Does anybody know of such an equivalent function, even if it only accepts 2 parameters?</p>
<p>I found somewhere tha... | <p>Why does MAX not work for you?</p>
<p>select max(1,2,8,3,1,7) from sysibm.sysdummy1</p>
<p>gives me</p>
<pre><code> 1
---------------
8
1 record(s) selected.
</code></pre>
| <p>Please check with following query:</p>
<pre><code>select * from table1 a,
(select appno as sub_appno,max(sno) as sub_maxsno from table1 group by appno) as tab2
where a.appno =tab2.sub_appno and a.sno=tab2.sub_maxsno
</code></pre>
| 29,066 |
<p>What is the best practice for creating re-usable control templates. </p>
<p>For example. I want to start with the standard checkbox and modify its template for re-use accross multiple future projects.</p>
<p>I understand how to modify the template in Blend, but it always wants to save the template to App.xaml of ... | <p>Implicit Style Manager might be helpful.</p>
<p>The Silverlight controls team and others have been blogging a bit recently about ISM which allows alternative style sets to be applied across the board to standard controls. Try <a href="http://jesseliberty.com/2008/10/31/themes-revisited-the-implicit-style-manager-up... | <p>I don't think you can have a ControlTemplate as a separate entity, without it being attached to a Control. For your control library you can create custom controls that have the appropriate custom templates and reuse the controls.</p>
| 43,741 |
<p>im currently overiding the <code>WM_NCPAINT</code>, <code>WM_NCCALCSIZE</code> and <code>WM_NCACTIVATE</code> to paint my own color/themed title bar for an application im working on. Now this is working great however the min, max and close buttons still are xp default theme.</p>
<p>I looked into what controls them ... | <p>I think your best bet here is to disable the buttons and redraw them with something akin to to <a href="https://stackoverflow.com/questions/106912/how-to-draw-custom-button-in-window-titlebar-with-windows-forms#107437">the code I posted in this answer</a>. It's in C# with WinForms, but the vast majority of it is ove... | <p>This also helped: <a href="http://www.catch22.net/tuts/titlebar" rel="nofollow noreferrer">http://www.catch22.net/tuts/titlebar</a></p>
| 20,693 |
<p>What is the default XSLT processor for IE6. Does it support EXSLT? Is there anyway to make it support it?</p>
| <p>The default XSLT processor for IE6 is MSXML 3.0. You can forget about doing XSLT in MSXML 3. What it supports is not even a subset of XSLT, but an older draft. However, most people will have MSXML 4 or higher installed, either through a software update, ms office or some other way. XSLT in MSXML 4 and up is really f... | <p>You have awakened a tormentor from my past.</p>
<p>MSXML, it was installed as a service update, and the XSLT processor originally included in MSIE6 did not support much of anything other than a very general level of draft functionality. The service update improved on it greatly.</p>
<p>Because of requiring the pr... | 28,644 |
<p>I want to make Polyurethane molds for <strong>concrete</strong> using 3D printed PLA or ABS master object. like this video:</p>
<p><div class="youtube-embed"><div>
<iframe width="640px" height="395px" src="https://www.youtube.com/embed/UhkrEm5XtRU?start=0"></iframe>
</div></div> (this ... | <p>In my experience, polyurethane sticks to PLA like super glue, not good. But silicone and alginate doesn't stick at all.</p>
<p>What I do is print the model of the mold with PLA or ABS, no matter. Then, cast a mold of the PLA model of the mold with alginate, then you have the negative of your mold.</p>
<p>Now with th... | <h2>Temperature</h2>
<p>As polyurethane cures (or hardens), it undergoes a chemical bonding reaction, linking the mono- and oligomer strings in the components into long polyurethane chains. <a href="http://www.essentialchemicalindustry.org/polymers/polyurethane.html" rel="nofollow noreferrer">The chemical reaction is e... | 1,481 |
<p>I checked out a project from SVN and did not specify the project type, so it checked out as a "default" project. What is the easiest way to quickly convert this into a "Java" project?</p>
<p>I'm using Eclipse version 3.3.2.</p>
| <p>Open the .project file and add java nature and builders.</p>
<pre class="lang-xml prettyprint-override"><code><projectDescription>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments&g... | <ol>
<li>Right click on project</li>
<li>Configure -> 'Convert to Faceted Form'</li>
<li>You will get a popup, Select 'Java' in 'Project Facet' column.</li>
<li>Press Apply and Ok.</li>
</ol>
| 21,636 |
<p>Given the email address: "Jim" <jim@example.com></p>
<p>If I try to pass this to MailAddress I get the exception:</p>
<blockquote>
<p>The specified string is not in the form required for an e-mail address.</p>
</blockquote>
<p>How do I parse this address into a display name (Jim) and email address (jim@ex... | <p>If you are looking to parse the email address manually, you want to read RFC2822 (<a href="https://www.rfc-editor.org/rfc/rfc822.html#section-3.4" rel="nofollow noreferrer">https://www.rfc-editor.org/rfc/rfc822.html#section-3.4</a>). Section 3.4 talks about the address format.</p>
<p>But parsing email addresses cor... | <pre><code>new MailAddress("jim@example.com", "Jimbo");
</code></pre>
<p>to parse out the string you gave:</p>
<pre><code>string input = "\"Jimbo\" jim@example.com";
string[] pieces = input.Split(' ');
MailAddress ma = new MailAddress(pieces[1].Replace("<", string.Empty).Replace(">",string.Empty), pieces[0].Rep... | 19,672 |
<p>I am currently building an internal web application used in a factory/warehouse type location. The users will be sharing a single PC between several people, so we need to have a fairly short session timeout to stop people wandering off and leaving the application logged in where someone else can come to the PC and d... | <p>Keep the server informed about the fact that the user is actively entering information.
For instance send a message to the server if the user presses the TAB key or clicks with a mouse on a field.
The final solution is up to you.</p>
| <p>As an alternative for the technical solutions, you could make your application in such a way that everytime a particular job is done, for example filling in a form, you ask the user if he wants to continue doing another job or if he's done. Yould could have a startscreen with menu options and if the user chooses an ... | 13,965 |
<p>After being told by at least 10 people on SO that version control was a good thing even if it's just me I now have a followup question.</p>
<p>What is the difference between all the different types of version control and is there a guide that anybody knows of for version control that's very simple and easy to under... | <p>Eric Sink has a <a href="http://www.ericsink.com/scm/source_control.html" rel="nofollow noreferrer">good overview of source control</a>. There are also some <a href="https://stackoverflow.com/questions/871/why-is-git-better-than-subversion">existing</a> <a href="https://stackoverflow.com/questions/2658/version-contr... | <p>Just start using source control, no matter what type you use. What you use doesn't matter; it's the use of it that is important</p>
| 2,590 |
<p>It's kind of a C puzzle. You have to tell if the program finish its execution, if so, how much time it takes to run and what it returns to the OS.</p>
<pre><code>static unsigned char buffer[256];
int main(void)
{
unsigned char *p, *q;
q = (p = buffer) + sizeof(buffer);
while (q - p)
{
p = buffer... | <p>Despite the fact that this is a horrible interview question, it is actually quite interesting:</p>
<pre><code>static unsigned char buffer[256];
int main(void)
{
unsigned char *p, *q;
q = (p = buffer) + sizeof(buffer);
/* This statement will set p to point to the beginning of buffer and will
set q to poi... | <pre><code>unsigned char *p, *q;
</code></pre>
<p>Isn't this worng on many levels? First of all, is there such a thing as an unsigned char? Second, and I may be wrong here, so don't quote me, but doesn't char *p, <em>q produce funky results? It's either that, or it makes it easy to do char</em> p, q, which would be... | 35,374 |
<p>I'm planning on creating a game that contains a landscape with objects on it. The landscape will be defined using a heightfield, and the objects will move about on top of, and fly over the terrain. If you've ever played the old games <a href="http://en.wikipedia.org/wiki/Marble_Madness" rel="nofollow noreferrer">Mar... | <p>Here is a more complete list, Xbox, Zune and Windows...</p>
<ul>
<li><a href="http://www.codeplex.com/FarseerPhysics" rel="noreferrer">Farseer</a> - 2d only.
</li><li><a href="http://www.codeplex.com/JigLibX" rel="noreferrer">JigLibX</a>
</li><li><a href="http://bulletphysics.com/" rel="noreferre... | <p>Check out <a href="http://www.newtondynamics.com/" rel="nofollow noreferrer">Newton Game Dynamics</a>, there is a <a href="http://www.tamedtornado.com/devblog/?p=58" rel="nofollow noreferrer">port of their physics engine</a> for XNA. The only caveat is that it only works under Windows.</p>
| 13,652 |
<p>Basically, what I want to is be able to explore an ActiveX DLL.
I normally fire up VB 6, add the DLL to the "References" of the project, and use Object Explorer.</p>
<p>However, in this particular machine I can't install VB / VS.<br>
I'm sure there's a tool out there that does this. Does anyone know of one?</p>
<p... | <p>If the machine has Microsoft Office installed, you can go into the built-in Visual Basic for Applications IDE and load the object there:</p>
<p>Tools menu -> Macro -> Visual Basic Editor (or press Alt+F11)</p>
<p>Then when inside the VBA window, Tools menu -> References -> Browse to locate your DLL</p>
<p>and Vie... | <p>Is it possible to download the component from that machine and examine it locally in Visual Studio? (That'd be my first suggestion.) (And BTW, the .NET versions of Visual Studio also feature a VB6-like Object Explorer which works nicely for this.)</p>
<p><del>Alternatively, and it's not free, but you might try <a h... | 32,794 |
<p>I'm a new to MSBuild and wanted to play around with it a bit, but I just cannot figure out why this isn't working.</p>
<p>So my solution has two projects: "Model" and "BuildTasks". BuildTasks just has a single class:</p>
<pre><code>using Microsoft.Build.Utilities;
namespace BuildTasks
{
public class Test : T... | <p>We tried this and we found that you have to place the UsingTask at the top of the project file (and have all your paths right). However once thats in place and the task loads up it will only work once. After that the build starts failing because it cant copy the DLL that the task is in. We are actually running a pos... | <p>Are you sure you have your path write? Shouldn't it be in the <code>bin\Configuration Type\BuildTasks.dll</code>?</p>
<p>I found this link: <a href="http://bartdesmet.net/blogs/bart/archive/2008/02/15/the-custom-msbuild-task-cookbook.aspx" rel="nofollow noreferrer">http://bartdesmet.net/blogs/bart/archive/2008/02/1... | 35,794 |
<p>I have a custom application that was built to send opt-in newsletters and marketing emails. It does a pretty good job sending mail, but it doesn't respond at all to bounces or unsubscribe requests. It seems to me that rather than building that functionality myself I should use a mailing list manager such as LISTSERV... | <p>LISTSERV does have a powerful (if baroque) programming interface; see <a href="http://www.lsoft.com/manuals/15.5/LISTSERV15.5_AdvancedTopicsManual.pdf" rel="nofollow noreferrer"><a href="http://www.lsoft.com/manuals/15.5/LISTSERV15.5_AdvancedTopicsManual.pdf" rel="nofollow noreferrer">http://www.lsoft.com/manuals/15... | <p>I see from another question there are <a href="https://stackoverflow.com/questions/7231/automatically-check-bounced-emails-via-pop3">tools to check a POP3 account for bounced emails</a> and classify them as hard bounces, out-of-office replies, unsubscribes, etc. </p>
<p>If I give up on a finding a MLM and write my ... | 24,892 |
<p>I'm looking for a general solution for upgrading database schema with ORM tools, like JPOX or Hibernate. How do you do it in your projects?</p>
<p>The first solution that comes to my mind is to create my own mechanism for upgrading databases, with SQL scripts doing all the work. But in this case I'll have to rememb... | <p><a href="http://www.liquibase.org" rel="noreferrer">LiquiBase</a> is an interesting open source library for handling database refactorings (upgrades). I have not used it, but will definitely give it a try on my next project where I need to upgrade a db schema.</p>
| <p>I think your best bet is to use an ORM-tool that includes database migration like <a href="http://subsonicproject.com/" rel="nofollow noreferrer">SubSonic</a>:</p>
<p><a href="http://subsonicproject.com/2-1-pakala/subsonic-using-migrations/" rel="nofollow noreferrer">http://subsonicproject.com/2-1-pakala/subsonic-u... | 8,964 |
<p>I am developing a little app that retrieves an XML file, located on a remote server (<code>http://example.com/myfile.xml</code>)
This file is relatively big, and it contains a big list of geolocations with other information that I need to use for my app.
So I read this file remotely once and insert it into a little ... | <p>Load the big XML file, convert it into an appropriate different data structure, save it to a file in an efficient format. (XML really isn't terribly efficient.)</p>
<p>I believe <a href="http://code.google.com/p/protobuf-net/" rel="nofollow noreferrer">Marc Gravell's Protocol Buffers</a> implementation works on the... | <p>Why would you pull the entire file down to the CE device for this? It's a bandwidth waste and certainly doing the lookup on an embedded processor is going to be <em>way</em> slower than on the server regardless of storage format. You should have a service (Web, WCF or whatever) that allows you to ask it for the si... | 22,723 |
<p>The question is, should we design applications/forms using headers or stick to spans and divs? When the world was using html to link documents, these header tags looked like the 'Table of contents'. In the new era where html is used for applications, using header tags in the orthodox fashion (i.e. h1 contains h2, h2... | <p>h1, h2, h3, etc. are semantic. Divs and spans are not. Using headers means that agents can easily determine which pieces of content are headers, giving precedence to them in, for example, screen readers or search results. You can read more about the specific accessibility importance of header tags at the <a href="... | <p>Other than the browsers where settings are such that the browser style overrides your CSS (user styles), I don't think that there are any other problems if you use h2 before h1 or vice versa.</p>
<p>Also, as you said using headers formats your document to an extent without even having CSS.</p>
| 24,557 |
<p>Does anyone know of any documentation by MS or someone else that lays out the best practices for developing a 3 tier architecture in ASP.NET. I am in the process of trying to convince my boss that the current architecture needs rethought and reworked to provide a flexible and reusable system. I have found a lot of... | <p>Microsoft's <a href="http://msdn.microsoft.com/en-us/practices/default.aspx" rel="nofollow noreferrer">Patterns & Practices group</a> has published various whitepapers and documents in the form of "architectural guidance" that can be helpful. They recently published a number of <a href="http://www.codeplex.com/A... | <p>I would highly recommend looking into <a href="http://www.asp.net/mvc/" rel="nofollow noreferrer">ASP.NET MVC</a>. It's a far better option for n-tier appliactions as it allows for a greater degree of Seperation Of Concerns. This leads to a more testable and maintanable application that can be achieved with ASP.NE... | 41,609 |
<p>How do you look up a user in Active Directory?</p>
<p>Some example usernames are:</p>
<ul>
<li>avatopia\ian</li>
<li>avatar\ian</li>
<li>ian@avatopia.com</li>
<li>ian@avatopia.local</li>
<li>avatopia.com\ian</li>
</ul>
<p>It's important to note that i don't know the name of the domain, <a href="https://stackoverf... | <p>This works for me.</p>
<p>You should be able to differentiate between different users on different domain controllers (ie domain/username) because the ldappaths will be different. And according to you, you don't care because you are <a href="https://stackoverflow.com/questions/192366/how-to-grab-ad-credentials-from-... | <p>I don't know of a pure .net method. But you can use win32's <a href="http://msdn.microsoft.com/en-us/library/aa375175(VS.85).aspx" rel="nofollow noreferrer">CredUIParseUserName</a>.</p>
| 42,028 |
<p>I really want to know if I'm missing anything obvious in the software I'm developing.</p>
<p>What User Interface features that you consider important are often missing in most software?</p>
| <p>These are some of the UI features that I often find are done badly, or are even missing:</p>
<ul>
<li><a href="http://miksovsky.blogs.com/flowstate/2005/10/the_fractal_nat.html" rel="noreferrer">Restoring window state properly</a>.</li>
<li>Conforming to the average (non-beginner, non-expert) user's mental model.</... | <p>Kind of too general a question. It would depend on what does the application do. One thing I see often missing from gui applications is an easy way undo mistakes and not only in the object you're manipulating but also on program UI elements. Closing some floating options panel or toolbar by mistake and then having n... | 41,751 |
<p>I know that having diamond inheritance is considered bad practice. However, I have 2 cases in which I feel that diamond inheritance could fit very nicely. I want to ask, would you recommend me to use diamond inheritance in these cases, or is there another design that could be better.</p>
<p><strong>Case 1:</strong>... | <p>Inheritance is the second strongest (more coupling) relations in C++, preceded only by friendship. If you can redesign into using only composition your code will be more loosely coupled. If you cannot, then you should consider whether all your classes should really inherit from the base. Is it due to implementation ... | <p>For case 2, isn't a <code>OneCommand</code> just a special case of <code>CompositeCommand</code>? If you eliminate <code>OneCommand</code> and allow <code>CompositeCommand</code>s to only have one element, I think your design gets simpler:</p>
<pre><code> CommandAbstraction
/ ... | 49,656 |
<pre><code>#include <iostream>
using namespace std;
int main()
{
double u = 0;
double w = -u;
cout << w << endl;
return 0;
}
</code></pre>
<p>Why does this great piece of code output <code>-0</code> and not <code>0</code>, as one would expect?</p>
| <p>The IEEE 754 standard for floating-point numbers has the sign bit separate from the mantissa, which allows for zero to be negative. <a href="http://en.wikipedia.org/wiki/IEEE_754" rel="nofollow noreferrer">Wikipedia</a> should be able to help explain this.</p>
| <p>Because "negative zero" is a valid number!</p>
<p><a href="http://en.wikipedia.org/wiki/%E2%88%920_(number)" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/%E2%88%920_(number)</a></p>
| 9,942 |
<p>I need specifically to load a JPG image that was saved as a blob. GDI+ makes it very easy to retrieve images from files but not from databases...</p>
| <p>Take a look at <a href="http://msdn.microsoft.com/en-us/library/ms535410(VS.85).aspx" rel="nofollow noreferrer">Image::Image(IStream *, BOOL)</a>. This takes a pointer to a COM object implementing the IStream interface. You can get one of these by allocating some global memory with <a href="http://msdn.microsoft.c... | <p>First fetch your blog into a byte array then use something like this:</p>
<pre><code>public static Image CreateImage(byte[] pict)
{
System.Drawing.Image img = null;
using (System.IO.MemoryStream stream = new System.IO.MemoryStream(pict)) {
img = System.Drawing.Image.FromStream(stream);
}
return img;... | 23,350 |
<p>What's the Hi/Lo algorithm?</p>
<p>I've found this in the <a href="http://en.wikipedia.org/wiki/NHibernate" rel="noreferrer">NHibernate</a> documentation (it's one method to generate unique keys, section 5.1.4.2), but I haven't found a good explanation of how it works.</p>
<p>I know that Nhibernate handles it, and... | <p>The basic idea is that you have two numbers to make up a primary key- a "high" number and a "low" number. A client can basically increment the "high" sequence, knowing that it can then safely generate keys from the entire range of the previous "high" value with the variety of "low" values.</p>
<p>For instance, supp... | <p>I found the Hi/Lo algorithm is perfect for multiple databases with replication scenarios based in my experience. Imagine this. you have a server in New York (alias 01) and another server in Los Angeles (alias 02) then you have a PERSON table...
so in New York when a person is create... you always use 01 as the HI va... | 35,716 |
<p>I have a core file generated on a remote system that I don't have direct access to. I also have local copies of the library files from the remote system, and the executable file for the crashing program.</p>
<p>I'd like to analyse this core dump in gdb.</p>
<p>For example:</p>
<pre><code>gdb path/to/executable p... | <p>Start gdb without specifying the executable or core file, then type the following commands:</p>
<pre><code>set solib-absolute-prefix ./usr
file path/to/executable
core-file path/to/corefile
</code></pre>
<p>You will need to make sure to mirror your library path exactly from the target system. The above is meant f... | <p>One important note:</p>
<p>if you're doing a cross compiling and trying to debug with gdb, then
after you've done <br><code>file ECECUTABLE_NAME</code> if you see smth. like :</p>
<pre><code>Using host libthread_db library "/lib/libthread_db.so.1"
</code></pre>
<p>then check whether you have libthread_db for your... | 10,996 |
<p>In SVN, <code>trunk</code> is the recommended place for the main development and I use this convention for all of my projects. However, this means that <strong>trunk is sometimes unstable, or even broken</strong>. This happens for instance when</p>
<ul>
<li>I commit something by mistake</li>
<li>When the trunk simp... | <p>Your trunk should ALWAYS compile, if you need to make breaking changes you should use a branch and merge the changes back later.</p>
<p>Read this chapter of the SVN book: <a href="http://svnbook.red-bean.com/nightly/en/svn.branchmerge.html" rel="noreferrer">http://svnbook.red-bean.com/nightly/en/svn.branchmerge.htm... | <p>In our company, we have a nightly build of the trunk. It is expected that everybody test their code so that it at the very least compiles before they check it in. If the nightly build fails, the offending code is removed until fixed.</p>
<p>I think the most important part is for everybody to understand the role o... | 18,577 |
<p>I remember that in the late 1990s and early 2000s Aspect Oriented Programming (AOP) was supposed to be the "Next Big Thing". Nowadays I see some AOP still around, but it seems to have faded into the background.</p>
| <p>There has maybe been a lot of hype in the early 2000's, and what happened is the following: there has been a lot of attempts to create aspect-oriented frameworks, and these attempts have merged into two significant projects in the Java sphere: AspectJ and Spring AOP. AspectJ is complete, complex, academic, somewhat ... | <p>I'm going to suggest that it wasn't big enough. It sounds very appealing, but does it really make coding any easier? I've been wanting to try it out and find what benefits it really holds, but I don't think I do enough coding where I need the relationships that it provides. I don't think it is as beneficial as it so... | 40,815 |
<p>Which is the best timer approach for a C# console batch application that has to process as follows:</p>
<ol>
<li>Connect to datasources</li>
<li>process batch until timeout occurs or processing complete. "Do something with datasources"</li>
<li>stop console app gracefully.</li>
</ol>
<p>related question: <a href="... | <p>Sorry for this being an entire console app... but here's a complete console app that will get you started. Again, I appologize for so much code, but everyone else seems to be giving a "oh, all you have to do is do it" answer :)</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Threading;
... | <p>When you say "until timeout occurs" do you mean "keep processing for an hour and then stop"? If so, I'd probably just make it very explicit - work out at the start when you want to finish, then in your processing loop, do a check for whether you've reached that time or not. It's incredibly simple, easy to test etc. ... | 22,548 |
<p>I have a problem. </p>
<p>I'm working on another guy's code and there is a JFrame with lots of JSeparators(he used them as borders for 'panels') now I'm replacing them for a JBorderedPanel class that follows the same border style of the whole application.</p>
<p>The problem is that some of his separators are not c... | <p>Take a look at <a href="https://swingexplorer.dev.java.net/" rel="nofollow noreferrer">Swing Explorer</a>. It's quite a handy swing debugging tool. There's a plugin for Eclipse that will instrument your code on the fly and launch.</p>
<p>With it you can view the swing object heirarchy, right click on it, and render... | <p>I guess the previous guy used somekind of GUI editor.</p>
<p>My first try will be the GUI editor in Netbeans or Eclipse.
They may able to parse and render it correctly, unless the code is really ugly.</p>
<p>If it can be open, you can trace where they are by select them on UI.</p>
| 45,494 |
<p>I'm giving my first steps on Python. I saw that we don't have switch case statement,
so I would you guys implement a text Menu in python?</p>
<p>Thanks</p>
| <p>You might do something like this:</p>
<pre><code>def action1():
pass # put a function here
def action2():
pass # blah blah
def action3():
pass # and so on
def no_such_action():
pass # print a message indicating there's no such action
def main():
actions = {"foo": action1, "bar": action2, "ba... | <p>To your first question I agree with Ali A.</p>
<p>To your second question :</p>
<p>import sys<br>
sys.exit(1)</p>
| 42,457 |
<p>than just to call the parameter as it is?</p>
| <p>If you mean fields, then no. The compiler injects "this" (<a href="http://msdn.microsoft.com/en-us/library/system.reflection.emit.opcodes.ldarg_0(VS.95).aspx" rel="nofollow noreferrer">ldarg.0</a>) whether you use it explicitly (this.foo) or implicitly (foo).</p>
<p>It does, however, take 5 more characters in your ... | <p>I do not know, if it uses more memory, but I don't think so, its only a clear reference, something that would be done under the hood as well by the compiler.</p>
| 45,939 |
<p>Is there a way to shutdown a computer using a built-in Java method?</p>
| <p>Create your own function to execute an OS command through the <a href="http://www.computerhope.com/shutdown.htm" rel="nofollow noreferrer">command line</a>?</p>
<p>For the sake of an example. But know where and why you'd want to use this as others note.</p>
<pre><code>public static void main(String arg[]) throws IOE... | <p>On Windows Embedded by default there is no shutdown command in cmd.
In such case you need add this command manually or use function ExitWindowsEx from win32 (user32.lib) by using JNA (if you want more Java) or JNI (if easier for you will be to set priviliges in C code).</p>
| 4,522 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.