instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I see them all the time and always ignore them. Can someone explain to me why they have become so prevalent? If I'm using a site that allows me to explore it via tags (e.g., this one, del.icio.us, etc.) that's what I will do. Why would I need a "cloud" of tags upon which to click? I can just type that tag(s) into...
<p>It's more of a browse assist than a search assist. If you see a large or bold tag in a tag cloud that interests you it my lead to some knowledge discovery that wouldn't have otherwise been sought out with a deliberate search. When I am browsing del.ico.us or stackoverflow I appreciate the tags as they sometimes le...
<p>Tags give a way of explicitly labelling something with what it is about instead of relying on computers to extract this information.</p> <p>For example, you might be interested in on questions about stackoverflow. If you search for "stackoverflow" you will get all kinds of questions that are not about stackoverflow...
8,519
<p>I have an external DLL whose source code is C#. From the documentation for the DLL, I determined that it writes its debug messages to the console using <code>Console.WriteLine</code>.</p> <p>I'd like to use this DLL within a WinForms application. However, what I have discovered is that I cannot see the debug messag...
<p>Call <a href="http://msdn.microsoft.com/en-us/library/system.console.setout.aspx" rel="noreferrer">Console.SetOut</a> with a TextWriter you control (e.g. a StringWriter).</p>
<p>You would be best served using the System.Diagnostics namespace and Debug.WriteLine instead. Debug supports 'listeners' that can be added at run-time or via the app/web.config files. For example:-</p> <pre><code> Debug.Listeners.Add(new ConsoleTraceListener()) </code></pre> <p>If you implement any custom debug lo...
47,820
<p>I'm currently working on a school project, in java, and I'm coding a database application. Something like the MySQL Monitor where you type in queries and get results / whatever.</p> <p>In applications I've coded before, I used databases to store data, like user profiles, settings, etc. Now, obviously, I can't use a...
<p>Sure, you could create your own database with a file system since that is how actual databases are implemented. For example, you could decide to store your data in fixed or variable length raw data files, and then create a separate index file with file pointers into that other file for quick indexed access for any q...
<p>StackOverflow isn't for homework.</p> <p>Having said that, here's the Quick and Dirty way to an efficient, flexible database.</p> <ol> <li><p>Design a nice Map (HashMap, TreeMap, whatever) that does what you want to do. Often, you'll have a "Record" class with your data, and a number of "Index" objects which are e...
17,896
<p>I have been hired to help write an application that manages certain information for the end user. It is intended to manage a few megabytes of information, but also manage scanned images in full resolution. Should this project use a database, and why or why not?</p>
<p>Any question "Should I use a certain tool?" comes down to asking exactly what you want to do. You should ask yourself - "Do I want to write my own storage for this data?"</p> <p>Most web based applications are written against a database because most databases support many "free" features - you can have multiple web...
<p>My gut reaction is "why not?" A database is going to provide a framework for storing information, with all of the input/output/optimization functions provided in a documented format. You can go with a server-side solution, or a local database such as SQLite or the local version of SQL Server. Either way you have ...
10,254
<p>I'd like to return an object with the following signature</p> <pre><code>class AnonClass{ string Name {get;} IEnumerable&lt;Group&gt; Groups {get;} } </code></pre> <p>I have tried the following query, but g only returns a single entity, not all the joined entities</p> <pre><code>var q = from t in dc.Theme...
<p>Xcode is the IDE for Mac OS X, you can download the latest version by joining the Apple Developer Connection with a free Online membership.</p> <p>I don't believe there are any supported APIs for controlling wireless networking adaptors. The closest thing would be the System Configuration framework, but I don't kn...
<p>Xcode is used a lot, as far as I know the combination editor (e.g. <a href="http://macromates.com/" rel="nofollow noreferrer">Textmate</a>), command line gcc is in fairly heavy use too. (that's what I do on OS X)</p> <p>For all API needs head to <a href="http://developer.apple.com" rel="nofollow noreferrer">Apple's...
31,640
<p>I'm getting the following error when trying to build my app using Team Foundation Build:</p> <blockquote> <p>C:\WINDOWS\Microsoft.NET\Framework\v3.5\Microsoft.Common.targets(1682,9): error MSB3554: Cannot write to the output file "obj\Release\Company.Redacted.BlahBlah.Localization.Subsystems. Startup_Shutdown_P...
<p>You need to edit the build working directory of your Build Agent so that the begging path is a little smaller. To edit the build agent, right click on the "Builds" node and select "Manage Build Agents..."</p> <p>I personally use something like c:\bw\$(BuildDefinitionId). $(BuildDefinitionId) translates into the i...
<p>you have to checkout the build script file, from the source control explorer, and get your elbows dirty replacing the path.</p>
12,986
<p>Is the standard Java 1.6 <a href="http://java.sun.com/javase/6/docs/api/javax/xml/parsers/DocumentBuilder.html" rel="noreferrer">javax.xml.parsers.DocumentBuilder</a> class thread safe? Is it safe to call the parse() method from several threads in parallel?</p> <p>The JavaDoc doesn't mention the issue, but the <a h...
<p>Even though DocumentBuilder.parse appears not to mutate the builder it does on the Sun JDK default implementation (based on Apache Xerces). Eccentric design decision. What can you do? I guess use a ThreadLocal:</p> <pre><code>private static final ThreadLocal&lt;DocumentBuilder&gt; builderLocal = new ThreadLocal...
<p>You can also check this code to make further optimization <a href="https://svn.apache.org/repos/asf/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java" rel="nofollow">https://svn.apache.org/repos/asf/shindig/trunk/java/common/src/main/java/org/apache/shindig/common/xml/XmlUtil.java</a...
8,081
<p>How can I reset the <code>@@FETCH_STATUS</code> variable or set it to 0 in a stored procedure?</p> <p>Also, can you bind FETCH_STATUS to a particular cursor?</p>
<p>I am able to reproduce the <a href="http://msdn.microsoft.com/en-us/library/ms187308.aspx" rel="nofollow"><code>@@FETCH_STATUS</code></a> issue you describe, this is once you <code>DECLARE</code> a <code>CURSOR</code> and iterate through the rows by calling <code>FETCH NEXT</code> until your <code>@@FETCH_STATUS = -...
<p>You can't:</p> <blockquote> <p>@@FETCH_STATUS (Transact-SQL)</p> <p>Returns the status <strong>of the last cursor</strong> FETCH statement <strong>issued against any cursor</strong> currently opened by the connection.</p> </blockquote> <p>So basically it's not bound to any cursor.</p>
20,574
<p>We use a grid control from Infragistics at work. Are there others? Pay or free?</p>
<p>I'd second Telerik, which is what MS used for office, IIRC. I don't know if they have gone WPF though, but they have a good track record. I am also a fan of <a href="http://www.devexpress.com/Products/NET/Controls/WPF/Grid/" rel="nofollow noreferrer">DevExpress</a>, and their support is great, but the wpf grid is ...
<p>Definitely the <a href="http://xceed.com/Grid_WPF_Demo.html" rel="nofollow">Xceed DataGrid for WPF</a>, check their online demo here: <a href="http://xceed.com/Grid_WPF_Demo.html" rel="nofollow">http://xceed.com/Grid_WPF_Demo.html</a></p>
17,431
<p>I have a really simple search form with the following</p> <ul> <li>Label ("Search")</li> <li>Textbox (fixed width)</li> <li>Submit button</li> <li>"Advanced" link</li> </ul> <p>Label, textbox and submit are all on one horizontal line and centered. Now I would like my advanced link to be under the submit button.</p...
<p>If I understand the question you want:</p> <pre><code> Search [xxxxxxxxxxxxxxxx] [Submit] Advanced </code></pre> <p>You'll have to add some more elements in to do that:</p> <pre><code>&lt;div style="width: 300px; margin: auto; text-align: center;"&gt; Searc...
<pre><code>&lt;style type="text/css"&gt; #searchpanel { width: &lt;displaywidth of controls&gt;px; text-align: center; } #button { text-align: right; } &lt;/style&gt; &lt;div ="searchpanel"&gt; &lt;label for="textbox"&gt;Search&lt;/label&gt;&lt;input type="text" id="...
31,063
<p>I just downloaded MVC and I am going through a tutorial. Everything goes fine until I try to declare a DataContext object.</p> <p>My dbml is named <strong>db.dbml</strong> (tried another on named test.dbml) and when I try this:</p> <pre><code>public dbDataContext db = new dbDataContext(); </code></pre> <p>I get:...
<p>This is a sp1 bug if you are using partial classes, see the following and work-arounds: <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361577" rel="nofollow noreferrer">https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=361577</a></p>
<p>once you add the class just build the solution.you ll find your classes in the list</p>
29,198
<p>At the moment I check in all my files (including dll's, VS solution files, images, etc). I often need to checkout these files to a staging server or to a another developer and so having these files there means the project is setup there all ready to go.</p> <p>Whats the best practice here?</p> <p>EDIT: If I don't ...
<p>I usually only checkin files that are not generated - so source, config files, project files, but not object files - dll's exe's jar's etc.</p>
<p>I check in everything that is part of the project or is a dependancy of the project, including but not limited to assemblies it is dependant upon, SQL Scripts to generate the db and test data, unit tests, docs, diagrams, pretty much anything else a dev would need. As far as what I dont include is dll's that will be ...
22,527
<p>Is there a way to pre-compute an array of values based on templates? In the following example I would like the 'powers_of_2' array to have 256 values computed at compile-time if that is possible without having to type all of the values.</p> <pre><code>#include &lt;iostream&gt; using namespace std; template &lt;in...
<p>Unless you plan on using a big integer package you will overflow the integer type at 2^32 (or 2^64, depending), but to answer your real question look at this wikipedia article on <A href="http://en.wikipedia.org/wiki/Template_metaprogramming" rel="nofollow noreferrer">template metaprogramming</A>.</p>
<p>You could easily write a small script to prepopulate the array for you using your preferred scripting language. Depending on the compiler and preprocessor you use, you should also be able to do it as a macro.</p>
34,317
<p>I've been using a resin printer for some time now, and am looking for a filament printer to compliment it. It will mostly be used to print scenery or bases to match 3-6&quot; models printer on the resin printer.</p> <p>I'm aiming for an entry level printer, or possible a mid level one on black Friday sale if I can f...
<p>Most &quot;auto-leveling&quot; is not leveling but compensation for a non-flat or non-level bed surface. It's helpful to beginners who don't understand bed leveling or evaluating bed surface flatness and replacing a bad bad, for the sake of being able to get started without prints failing to adhere, but it will nece...
<p>FWIW, what I consider the primary entry-level filament printer, the Creality Ender 3 (under $200 any, sometimes lower depending on daily exchange rates) is sold with <em>heated bed included</em>.</p> <p>Beyond that, a so-called self-leveling system is IMO overrated. For 20-25 dollars you can get a glass build surfa...
2,021
<p>I am using &quot;Pretty PETG&quot; along with PrusaSlicer's consecutive print mode.</p> <p>What I am noticing is that upon finishing the first print, the printer hits <code>MINTEMP BED Fixed</code>. I'm not sure if it's immediate because I let the prints run overnight but I assume the bed cools down and then the err...
<p>0.2 mm and 0.4 mm are half the diameter, but the maximum flow is not just half: Flow scales with the area. The 0.4 mm nozzle has an area 4 times as the 0.2 mm one:</p> <p><span class="math-container">$\frac{A_1} {A_2}=\frac {0.2^2}{0.1^2}=4$</span></p> <p>You need to reduce <code>print speed</code> or the <code>volu...
<p>The discussion about slowing the print speed is important, but in my experience it is not at the root of the problem, and slowing down printing may make it worse.</p> <p>If ny &quot;heater&quot; you mean the complete hot-end, then I suspect you are jamming in the cooler part of the hot-end. This cooler part is sepa...
1,744
<p>I have a table with a credit and debit column.</p> <p>I need to get the highest balance out of that, and I think a stored procedure is the way to do it, but I have no idea how.</p> <p>I need to start with the first row, add the debits, subtract the credits and store the value A.</p> <p>Second row is A+debit-credi...
<p>It seems to me that you'd want the running total to be <code>A+credit-debit</code> but switch them if needed.</p> <pre><code>SET @balance := 0; SET @high := 0; SELECT @high := GREATEST(@balance := @balance+credit-debit, @high) FROM mytable; SELECT @high; </code></pre> <p><strong>edit:</strong> In response to your...
<p>May</p> <pre><code>select max(debit-credit) from yourtable </code></pre> <p>work?</p> <p>Try to test it.</p>
41,136
<p>In ASP.NET webforms we have server components, that can be encapsulated into an external assembly and shipped as product. In ASP.NET MVC we don't have server components, so what's the best option for external components?</p> <p>Looking around it seems like the only possible option is making an <strong>Html helper</...
<p>Since the server-side logic is completely decoupled from the client side logic it's not really useful to make a both server- and clientside component for Asp.Net MVC. You can better make pure Html/Javascript components and that are usable on multiple platforms (Ruby on rails, php, python, java) and with a tutorial h...
<p>ASP.NET MVC fully supports custom controls and user controls in addition to Html helpers. Nothing stops you from developing a custom control (for a fancy grid, let's say), encapsulating it in an assembly, and shipping it. Am I missing the point of the question?</p>
31,787
<p>I am trying to understand the process of declaration and assignment of a primitive type at the back stage.</p> <ol> <li><code>int i;</code></li> <li><code>i = 3;</code></li> </ol> <p>For 1), on the memory stack, it assigns a space for storing an int type value named i For 2), it assigns the value 3 to the space ...
<p>There are not always addresses involved. The compiler can put variables into registers if it finds that their address is never taken by the programmer. So you wouldn't need any access to the main memory. For example in your code above, what the compiler could generate could be as simple as </p> <pre><code>add $2, $...
<p>How else do stack buffer overflows occur? :) someone's got to be writing to a pointer to the stack.</p>
40,826
<p>I've got a table, called faq_questions with the following structure:</p> <pre><code>id int not_null auto_increment, question varchar(255), sort_order int </code></pre> <p>I'm attempting to build a query that given a sort order, selects the row with the next highest sort order. </p> <p>Example:</p> <pre><code>id...
<p>It seems too simple, but it looks like what you need: </p> <pre><code>SELECT id,question FROM `questions` WHERE `sort_order` &gt; sort_order_variable ORDER BY sort_order ASC LIMIT 1 </code></pre>
<pre><code>SELECT id, question, sort_order FROM faq_questions WHERE sort_order in (SELECT MIN(sort_order) FROM faq_questions WHERE sort_order &gt; ?); </code></pre> <p>That seems to work</p>
47,108
<p>What's the best way to maintain a multiple databases across several platforms (Windows, Linux, Mac OS X and Solaris) and keep them in sync with one another? I've tried several different programs and nothing seems to work!</p>
<p>I think you should ask yourself why you have to go through the hassle of maintaining multiple databases across several platforms and have them in sync with one another. Sounds like there's a lot of redundancy there. Why not just have one instance of that database, since I'm sure it can be made accessible (e.g. via S...
<p>Why go through the hassle? Management claims it's more expensive? </p> <p>Here's how to prove them wrong.</p> <p>Pick one database, call it the "master" or "system of record". </p> <p>Write scripts to export data from the master and load it into your copies. If you have a nice database (MySQL, SQL/Server, Ora...
13,836
<h2>Question</h2> <p>Alright, I'm confused by all the buzzwords and press release bingo going on.</p> <ul> <li>What is the relationship between flash and flex: <ul> <li>Replace flash (not really compatible)</li> <li>Enhance flash</li> <li>The next version of flash but still basically compatible</li> <li>Separate tec...
<p>The term <strong>Flash</strong> can include any of the other terms defined below, and I find that saying "Flash" without specifying exactly what you mean can be confusing and misleading. Case in point: I'm not sure what you specifically mean when you say "Flash" in your question. Is it Flash Player? The authoring to...
<p>"Adobe Flex is a collection of technologies released by Adobe Systems for the development and deployment of cross platform rich Internet applications based on the proprietary Adobe Flash platform."</p> <p><a href="http://en.wikipedia.org/wiki/Adobe_Flex" rel="nofollow noreferrer">Adobe Flex</a></p>
8,353
<p>I have a number of data classes representing various entities. </p> <p>Which is better: writing a generic class (say, to print or output XML) using generics and interfaces, or writing a separate class to deal with each data class?</p> <p>Is there a performance benefit or any other benefit (other than it saving me ...
<p>There's a significant performance benefit to using generics -- you do away with <a href="http://en.wikipedia.org/wiki/Boxing_(Computer_science)#Boxing" rel="noreferrer">boxing and unboxing</a>. Compared with developing your own classes, it's a coin toss (with one side of the coin weighted more than the other). Roll ...
<p>Not only can you do away with boxing but the generic implementations are somewhat faster than the non generic counterparts with reference types due to a change in the underlying implementation. </p> <p>The originals were designed with a particular extension model in mind. This model was never really used (and would...
14,254
<p>Does anyone know a mechanism to calculate at compile-time the LCM (Least Common Multiple) and/or GCD (Greatest Common Denominator) of at least two number in <strong>C</strong> (<strong>not C++</strong>, I know that template magic is available there)?</p> <p>I generally use <strong>GCC</strong> and recall that it ca...
<p>I figured it out afterall...</p> <pre><code>#define GCD(a,b) ((a&gt;=b)*GCD_1(a,b)+(a&lt;b)*GCD_1(b,a)) #define GCD_1(a,b) ((((!(b)))*(a)) + (!!(b))*GCD_2((b), (a)%((b)+!(b)))) #define GCD_2(a,b) ((((!(b)))*(a)) + (!!(b))*GCD_3((b), (a)%((b)+!(b)))) #define GCD_3(a,b) ((((!(b)))*(a)) + (!!(b))*GCD_4((b), (a)%((b)+!...
<pre><code> int gcd(int n1,int n2){ while(n1!=n2){ if(n1 &gt; n2) n1 -= n2; else n2 -= n1; } return n1; } int lcm(int n1, int n2){ int total =n1*n2; return total/gcd(n1,n2); } </code></pre>
10,196
<p>If yes, on which operating system, shell or whatever?</p> <p>Consider the following java program (I'm using java just as an example, any language would be good for this question, which is more about operation systems):</p> <pre><code>public class ExitCode { public static void main(String args[]) { Syst...
<h3>Using <code>wait()</code> or <code>waitpid()</code></h3> <p>It is not possible on Unix and derivatives using POSIX functions like <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/wait.html" rel="nofollow noreferrer"><code>wait()</code></a> and <a href="http://pubs.opengroup.org/onlinepubs/9699919...
<p>Windows has many more exit codes, over 14,000. (I'm sure you often saw some of them on your own screen).</p> <p>Here comes:</p> <ul> <li><a href="http://www.hiteksoftware.com/knowledge/articles/049.htm" rel="nofollow noreferrer">A list of Windows exit codes</a>.</li> <li><a href="http://blogs.msdn.com/powershell/a...
21,658
<p>I'm using JBoss Seam Framework, but it's seems to me isn't very popular among java developers. I want to know how many java programmers here are using it, and in what kind of projects. Is as good as django, or RoR?</p>
<p>In our <a href="http://www.lunatech-research.com/archives/2007/12/14/javapolis-2007-seam" rel="noreferrer">JBoss Seam in Action presentation</a> at the Javapolis conference last year, my colleague and I said that 'Seam is the next Struts'. This needed some explanation, which I later wrote-up as <a href="http://www.l...
<p>I have used JBoss Seam on two commercial projects for two different clients. Yet JBoss Seam is still a new approach to developing JSF Web Applications. One measure is the results from a Indeed Job Search. </p> <p><a href="http://www.indeed.com/jobs?q=jboss+seam&amp;l=" rel="nofollow noreferrer">Indeed Job Search</a...
5,014
<p>I have a lot of Java source code that requires custom pre-processing. I'd like rid of it but that's not feasible right now so I'm stuck with it. Given that I have an unfortunate problem that shouldn't have existed in the first place, how do I solve it using maven? </p> <p>(For the full story, I'm replacing a python...
<p>This is something that is very doable and I've done something very similar in the past.</p> <p>An example from a project of mine, where I used the antrun plug-in to execute an external program to process sources:</p> <pre><code> &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;groupId&gt;org.apache.ma...
<p>Maven plugins can hook into the build process at pre-compile time yes, as for whether or not any existing ones will help I have no idea. </p> <p>I wrote a maven plugin a couple of years ago as part of a university project though, and while the documentation was a bit lacking at the time, it wasn't too complicated. ...
22,717
<p>Are there any unit testing solutions for Flex? or actionscript 3?</p> <p>If so, what are their features? Any UI testing abilities? Functional testing? Any pointers, examples, libraries or tools that you can share?</p>
<p>FlexUnit is pretty awesome - <a href="http://opensource.adobe.com/wiki/display/flexunit/FlexUnit" rel="nofollow noreferrer">http://opensource.adobe.com/wiki/display/flexunit/FlexUnit</a></p> <p>Also ASUnit - <a href="http://asunit.org" rel="nofollow noreferrer">http://asunit.org</a></p> <p>They are both pretty sim...
<p>For asynchronous unit testing dpUint is pretty useful. However FlexUnit is the way to go, if you wish to integrate unit testing with a Maven build. Asynchronous testing (e.g. Cairngorm events) can also be done with FlexUnit, but is not as elegant as with dpUint.</p>
17,239
<p>My app (winforms .net 2.0 / vs2008) works fine on my dev machine but on one of test machines i'm getting this exception. Has anybody encountered something similar?</p> <pre> ************** Exception Text ************** Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report proc...
<p>The value after the hash is not transmitted to the server. There's another SO question about that somewhere, but I'm having trouble finding it. Likewise it's taken me a while to find a decent reference to cite, but <a href="http://en.wikipedia.org/wiki/Fragment_identifier" rel="nofollow noreferrer">this Wikipedia ar...
<p><a href="http://msdn.microsoft.com/en-us/library/system.uri.fragment.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/system.uri.fragment.aspx</a></p>
44,311
<p>I am using a mock object in RhinoMocks to represent a class that makes calls to MessageQueue.GetPublicQueues. I want to simulate the exception thrown when message queueing is operating in workgroup mode, which is a MessageQueueException, to ensure that I am catching the exception correctly</p> <p>The MessageQueueEx...
<p>Reflection can break the accessibility rulez. You <em>will</em> void the warranty, a .NET update can easily break your code. Try this:</p> <pre><code>using System.Reflection; using System.Messaging; ... Type t = typeof(MessageQueueException); ConstructorInfo ci = t.GetConstructor(BindingFlags.NonP...
<p>You can cause this by trying to create an invalid queue. Probably safer then being held captive by framework changes (through using private/protected constructors):</p> <pre><code>MessageQueue mq = MessageQueue.Create("\\invalid"); </code></pre>
29,160
<p>I have been working on a script with PHP4 that relies on NuSOAP. Now, I'm trying to move this to PHP5, and use the buildin support for SOAP there.</p> <pre><code>$wsdlPath = ""; // I have obviously set these variables to something meaningful, just hidden for the sake of security $apiPath = ""; $username = ""; $p...
<p>Make sure NuSoap and PHPv5-SOAP are running on the same server. If I'm not totally wrong, both libraries uses the same class-name. Maybe it will work better if you make sure none NuSopa-files are included? And also verify that the SOAP-library are loaded:</p> <pre><code>if(!extension_loaded('soap')){ dl('soap.so'...
<p>Without testing it, I have two suggestions:</p> <p>First, put your error_reporting to the highest possible (before creating the SoapClient):</p> <pre><code>error_reporting( E_ALL ); </code></pre> <p>If there's something wrong with the authentication on the server's side, PHP will throw warnings. In most of the ca...
41,747
<p>Before I start, I'll give you my setup:</p> <ul> <li>Ender 3 Pro</li> <li>Marlin 2.0.7.2</li> <li>Material/Nozzle: PETG 0.4 mm @ 215 °C</li> <li>Bed: Glass @ 80 °C</li> <li>Default printing speed: 70 mm/s</li> <li>Standard part cooling fan</li> </ul> <p>Since I've updated the Marlin FW on from factory default to 2.0...
<p>It turned out, it was a faulty heater, that wasn't able to reach and maintain temperatures over 195 °C in a stable manner. The order came, had a new 50 W heater, thermistor and a PTFE-Bowden tube. It works just fine again, now!</p>
<p>Wrap all the heat system (above nozzle) with heat tape. I solved my problem with this!</p>
1,803
<p>I'm trying to make the case for click-once and smart client development but my network support team wants to keep with web development for everything.</p> <p>What is the best way to convince them that click-once and smart client development have a place in the business?</p>
<p>We use ClickOnce where I work; in terms of comparison to a web release I would base the case around the need for providing users with a rich client app, otherwise it might well actually be better to use web applications.</p> <p>In terms of releasing a rich client app ClickOnce is fantastic; you can set it up to enf...
<p>They have a place in the Windows environment but not in any other environment and so if you intend on writing applications for external clients, then your probably best sticking with Web based development.</p> <p>I heard this "Write Once, Run Many" before from Microsoft when Asp.net 1.1 was released, it never happe...
5,887
<p>Am looking for C# open source NMEA parser. </p>
<p>Well, I'm not familiar with it myself, but some quick searches show one on <a href="http://www.codeproject.com/KB/cs/NMEAtoOSG.aspx" rel="noreferrer">CodeProject</a>, which links to 2 other such, <a href="http://www.codeproject.com/KB/mobile/WritingGPSApplications1.aspx" rel="noreferrer">here</a> and <a href="http:/...
<p>One more (support several devices) <a href="http://www.codeproject.com/Articles/279647/NMEA-sentence-parser-builder" rel="nofollow">http://www.codeproject.com/Articles/279647/NMEA-sentence-parser-builder</a></p>
20,905
<p>Tackling a strange scenario here. </p> <p>We use a proprietary workstation management application which uses mySQL to store its data. Within the application they provide number of reports, such as which user logged into which machine at what time, all the software products installed on the monitored machines, so on...
<p>You'll want to use the MySQL password recovery process. Follow <a href="http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-windows" rel="nofollow noreferrer">these instructions</a>, except replace the password reset query with a query to <a href="http://dev.mysql.com/doc/refman/5...
<p>Do you have access to the MySQL server in question?</p> <p>As in, what access do you have beyond what a regular user would? You should try to go through those routes before you "hack" your way in there, since that may or may not be feasible with that software.</p>
13,113
<p>I have this code :-</p> <pre><code>using (System.Security.Cryptography.SHA256 sha2 = new System.Security.Cryptography.SHA256Managed()) { .. } </code></pre> <p>Do I need to put this line of code, just BEFORE I leave that dispose scope .. or does the dispose 'call' that already.</p> <pre><code>sha2.Clear(); </...
<p>Since AFAIK the Clear() method just calls Dispose, the using block should be enough to ensure that the resources used are released.</p>
<p>Dispose() is good enough.</p> <p>I am not sure how .NET works. But addition function call or "set null" will degrade the performance in Java.</p> <p>The CLR/Java VM will(and must) able to cleanup all dereferenced managed object from "roots" in the next garbage collection.</p> <p>PS. Dispose() does cleanup "unmana...
42,593
<p>I can never remember the order of the shorthand property for setting the margin or padding in one declaration. That is:</p> <pre><code>margin-top: 2px; margin-bottom: 4px; margin-left: 3px; margin-right: 8px; </code></pre> <p>may be written as</p> <pre><code>margin: 2px 8px 4px 3px; </code></pre> <p>Yes I unde...
<p>If you don't get it right, there will be TRouBLe</p>
<p>If you're old enough to remember the original Star Trek TV series (you know, with Capt Kirk), well first of all, you're too damn old. But there is "<strong>The Trouble with Tribbles</strong>" episode. Both nouns in the title work. I've used that in the past, but also prefer the clock analogy.</p>
46,517
<p>I searched the net and handbook, but I only managed to learn what is the masked package, and not how to install it. I did find some commands, but they don't seem to work on 2008 (looking at it, it seems those are for earlier versions). I have something like this:</p> <pre><code>localhost ~ # emerge flamerobin Calcu...
<p>Simply mkdir /etc/portage and edit as mentioned here: <a href="http://gentoo-wiki.com/TIP_Dealing_with_masked_packages#But_you_want_to_install_the_package_anyway" rel="nofollow noreferrer">http://gentoo-wiki.com/TIP_Dealing_with_masked_packages#But_you_want_to_install_the_package_anyway</a>...</p>
<p>These days there's also a more 'automated' solution, called "autounmask". No more file editing needed to unmask!</p> <p>The great benefit of the package is, it also unmasks / handles keywords of dependencies if needed. It's provided in the package app-portage/autounmask.</p> <p><em>/etc/portage/package.keywords</e...
13,699
<p>I have a c# application that runs as a windows service controlling socket connections and other things. Also, there is another windows forms application to control and configure this service (systray with start, stop, show form with configuration parameters).</p> <p>I'm using .net remoting to do the IPC and that wa...
<p>Two separate processes that communicate using your technology of choice. Services with UI is a <strong>bad idea</strong>. Don't go down this road - you'll regret it.</p> <p>I've had very good results having service communication through a simple socket connection - document your service protocol well, keep it as ...
<p>It is very simply - your need to create one thread for perform application events. Like this( source code for C++ with CLR, but your can make this in C#):</p> <pre><code>ref class RunWindow{ public: static void MakeWindow(Object^ data) { Application::EnableVisualStyles(); Application::SetCom...
19,244
<p>So this question will get technical – eventually – but first check out <a href="http://www.hanselminutes.com/default.aspx?showID=153" rel="noreferrer">Hanselminutes</a> with Atwood (et. al.) where Scott basically invites developers to try to hack this site. It’s a hoot. I first thought (out loud of course, because...
<p>I really enjoyed the podcast, and found it refreshing to hear someone of Jeff's reputation sharing the same business/cost driven reality that so many of us face. I often find books/podcasts/presentations a little Utopian.</p> <p>Making it work is still the primary goal. Beautiful code, perfect abstraction, NSA le...
<p>Well, it's not as though this site <em>hasn't</em> <a href="http://www.codinghorror.com/blog/archives/001167.html" rel="nofollow noreferrer">been cracked</a>. So yes, it's probably worthwhile to chase better security.</p>
39,616
<p>I'm reading data from a device which measures distance. My sample rate is high so that I can measure large changes in distance (i.e. velocity) but this means that, when the velocity is low, the device delivers a number of measurements which are identical (due to the granularity of the device). This results in a 'ste...
<p>The wikipedia entry from moogs is a good starting point for smoothing the data. But it does not help you in making a decision.</p> <p>It all depends on your data, and the needed processing speed.</p> <p><strong>Moving Average</strong> Will flatten the top values. If you are interrested in the minimum and maximum v...
<p>You could use a <a href="http://en.wikipedia.org/wiki/Moving_average" rel="nofollow noreferrer">moving average</a> to smooth out the data.</p>
24,983
<p>Is it possible to split large ASP.NET-pages into pieces? JSP has the <a href="http://java.sun.com/products/jsp/tags/11/syntaxref1112.html" rel="nofollow noreferrer">jsp:include</a> directive. Is there any equivivalent in ASP.NET</p> <p>I'm not interested in reusing the pieces. I just want to organize the HTML/ASP c...
<p>The <a href="http://msdn.microsoft.com/en-us/library/wtxbf3hh.aspx" rel="noreferrer">MasterPage model</a> and <a href="http://msdn.microsoft.com/en-us/library/y6wb1a0e.aspx" rel="noreferrer">UserControls</a> are the two out-of-box solutions to this. </p>
<p>You should take a look at ASP.NET User Controls which allow you to encapsulate UI functionality into smaller more manageable chunks.</p> <p><a href="http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/userctrl/default.aspx" rel="nofollow noreferrer">http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlre...
21,538
<p><strong>I am using the term "Lexical Encoding" for my lack of a better one.</strong></p> <p>A Word is arguably the fundamental unit of communication as opposed to a Letter. Unicode tries to assign a numeric value to each Letter of all known Alphabets. What is a Letter to one language, is a Glyph to another. Unic...
<p>This question impinges on linguistics more than programming, but for languages which are highly synthetic (having words which are comprised of multiple combined morphemes), it can be a highly complex problem to try to "number" all possible words, as opposed to languages like English which are at least somewhat isola...
<p>Actually you only need about 600 words for a half decent vocabulary.</p>
20,564
<p>I am using activemq to pass requests between different processes. In some cases, I have multiple, duplicate message (which are requests) in the queue. I would like to have only one. Is there a way to send a message in a way that it will replace an older message with similar attributes? If there isn't, is there a way...
<p>This sounds like an ideal use case for the <a href="http://activemq.apache.org/camel/idempotent-consumer.html" rel="nofollow noreferrer">Idempotent Consumer</a> which removes duplicates from a queue or topic. </p> <p>The following example shows how to do this with <a href="http://activemq.apache.org/camel/" rel="no...
<p>You could browse the queue and use selectors to identify the message. However, unless you have a small amount of messages this won't scale very well. Instead, you message should just be a pointer to a database-record (or set of records). That way you can update the record and whoever gets the message will then acc...
29,067
<p>Academia has it that table names should be the singular of the entity that they store attributes of. </p> <p>I dislike any T-SQL that requires square brackets around names, but I have renamed a <code>Users</code> table to the singular, forever sentencing those using the table to sometimes have to use brackets. </...
<p>I had same question, and after reading all answers here I definitely stay with SINGULAR, reasons:</p> <p><s><strong>Reason 1</strong> (Concept). You can think of bag containing apples like &quot;AppleBag&quot;, it doesn't matter if contains 0, 1 or a million apples, it is always the same bag. Tables are just that, c...
<p>I solved the same problem by naming the table "Employee" (actually "Employees"). I try to stay as far away as possible from any conflict with possibly reserved words. Even "Users" is uncomfortably close for me.</p>
43,888
<p>In win32, are thread input queues global to all applications? So Application A can attach itself to application B's thread input queue?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms681956(VS.85).aspx" rel="nofollow noreferrer">AttachThreadInput</a> will do it in fact. A thread in application A can attach itself to the message queue owned by a thread in application B, IF the two processes exist on the same desktop AND process B is not at a high...
<p>There's an API that will let you merge your spyware's input queue with the user's banking application. This kind of thing is gradually getting closed down.</p>
29,576
<p>I'm coming from a C# background and I really like the type inference that C# 3.0 has. I'm trying to do similar things in VB.NET (some of which appear possible), but in some cases the compiler seems to be not nearly as good at inferring the type.</p> <p>For example, I have a method that returns an object of type S...
<p>I'm assuming by "played with the VB.NET project settings" you mean you already did this: <a href="http://www.emadibrahim.com/2007/07/28/type-inference-in-vbnet-90/" rel="nofollow noreferrer">Type Inference in VB.NET</a></p> <p>If not, may help</p>
<p>If VB is infering the type as Object, you need to turn Option Strict On at the top of your class file at least. Once you do that, you should see that class fields do not support type inferencing. The following raises the compiler error "Option Strict On requires all variable declarations to have an As clause".</p> ...
44,074
<p>I've never really understand why a web service implementer would choose one over the other. Is XML-RPC generally found in older systems? Any help in understanding this would be greatly appreciated.</p>
<p>Differences?</p> <p>SOAP is more powerful, and is much preferred by software tool vendors (MSFT .NET, Java Enterprise edition, that sort of things).</p> <p>SOAP was for a long time (2001-2007ish) seen as the protocol of choice for SOA. xml-rpc not so much. REST is the new SOA darling, although it's not a protocol....
<p>Kate Rhodes has a great essay on the differences at <a href="http://weblog.masukomi.org/2006/11/21/xml-rpc-vs-soap" rel="noreferrer">http://weblog.masukomi.org/2006/11/21/xml-rpc-vs-soap</a></p>
10,555
<p>I'm refactoring some client-server code and it uses the terms Response, Result &amp; Reply for the same thing (an answer from the server). And although its not really that important it's become hard to guess which word to use while writing new code, so I'd like to unify the three terms into one and do the appropriat...
<p>Both response and result should be ok, because they can be shortened to "res". </p> <p>Whereas reply would be "rep", which is ambiguous with repeat.</p> <p>Maybe just follow the HTTP, call them request and response.</p>
<p>If you want to stick to standard ISO/OSI terminology, it's either "Indication" or "Confirmation". For an unconfirmed service, the initiator of the communication issues the "Request" (requesting that data be sent to the other side), which is delivered to the other side as an "Indication". For a confirmed service, t...
48,380
<p>He want's to know our opinions on whether we should have flexitime, allow non-work related internet access etc.</p> <p>We've got about 200 people in the company, half are programmers half are sales. We all want the workplace to be productive and fun.</p> <ul> <li>What issues should I bring up?</li> <li>What are th...
<p>If you don't treat your employees like adults, then only children will want to work for you. That means that you let people set their own hours, visit whatever web sites they want, etc, but it also means that if they aren't available when they're needed, are looking at inappropriate web sites or offend a customer, ...
<p>The office should be suitable for concentrated intellectual effort - well conditioned and ventilated, with reasonable lighting and quiet. Quiet is usually quite hard. You'll have to make everyone understand that preparation for a hike is okay, but discussing it aloud so that twenty people not involved hear it uncond...
36,000
<p>I have an array of integers:</p> <pre><code>int[] number = new int[] { 2,3,6,7 }; </code></pre> <p>What is the easiest way of converting these into a single string where the numbers are separated by a character (like: <code>&quot;2,3,6,7&quot;</code>)?</p> <p>I'm using C# and .NET 3.5.</p>
<pre><code>var ints = new int[] {1, 2, 3, 4, 5}; var result = string.Join(&quot;,&quot;, ints.Select(x =&gt; x.ToString()).ToArray()); Console.WriteLine(result); // prints &quot;1,2,3,4,5&quot; </code></pre> <p>As of (at least) .NET 4.5,</p> <pre><code>var result = string.Join(&quot;,&quot;, ints.Select(x =&gt; x.ToStr...
<p>You can do </p> <pre><code>ints.ToString(",") ints.ToString("|") ints.ToString(":") </code></pre> <p>Check out</p> <p><a href="http://www.codemeit.com/linq/c-array-delimited-tostring.html" rel="nofollow noreferrer">Separator Delimited ToString for Array, List, Dictionary, Generic IEnumerable</a></p>
17,583
<p>I can't find an answer to this question on the "mother" meta website; hope this is not related to my choice of words in the search box. </p> <p>The statistics of the <a href="https://3dprinting.stackexchange.com/">3D Printing</a> on <a href="http://area51.stackexchange.com/proposals/82438/3d-printing">Area51</a> sh...
<p>This post, <a href="https://3dprinting.meta.stackexchange.com/questions/197/3d-printing-se-beta-status">3D Printing SE Beta Status</a>, by tbm0115 highlights the <em>three main</em> sticking points (IMHO clearer than the Area 51 page):</p> <ul> <li>Questions per day</li> <li><strike>Users vs Reputation</strike></li>...
<p>One thing that I noticed about the stats for this site when I first came across it was how high the number of registered users and visits is, compared with the number of active users and questions.</p> <p>For some time, I felt the site had either picked up some bad stats, or was in the final stages of fading away. ...
47
<p>I had a working solution using ASP.NET MVC Preview 3 (was upgraded from a Preview 2 solution) that uses an untyped ViewMasterPage like so:</p> <pre><code>public partial class Home : ViewMasterPage </code></pre> <p>On Home.Master there is a display statement like this:</p> <pre><code>&lt;%= ((GenericViewData)ViewD...
<p>We made that change because we wanted a bit of symmetry with the [] indexer. The Eval() method uses reflection and looks into the model to retrieve values. The indexer only looks at items directly added to the dictionary.</p>
<p>I've decided to replace all instances of ViewData["blah"] with ViewData.Eval("blah"). However, I'd like to know the cause of this change if possible because:</p> <ol> <li>If it happens on my other projects it'd be nice to be able to fix.</li> <li>It would be nice to leave the deployed working code and not overwrite...
8,712
<p>I have a mindmp file from a target's application crash. Is it possible for me to rebuild the dll/pdb files for a version of software and have windbg load symbols correctly? </p> <p>My problem is that our pdb files are only kept for major releases (unfortunately). This is a daily build, which I can rebuild myself, b...
<p>In my experience probably not.</p> <p>If you have the exact build directory and build with the <strong>exact same</strong> compiler settings then this might work. You definitely will not be able to load symbols from a debug build against a release crash dump.</p> <p>You will need to turn on the 'load anything' op...
<p>This is too late to help Doug, but for the sake of anyone who comes across this question, another thread (<a href="https://stackoverflow.com/questions/3660084/is-it-possible-to-load-mismatched-symbols-in-visual-studio">Is it possible to load mismatched symbols in Visual Studio?</a>) pointed out a way to get WinDbg t...
16,332
<p>I know a Haskell module name, but I can't figure out in what package it is defined. This is bad because I can't compile without a package exposing this module.</p> <p>Specificaly it is Text.Regex that I can't locate, but I would like to know how to solve that problem in general.</p>
<p><a href="http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html" rel="noreferrer">http://www.haskell.org/ghc/docs/latest/html/users_guide/packages.html</a></p> <p>ghc-pkg find-module Text.Regex</p> <p>But that only works for (a) recent GHCs, and (b) packages installed on your system.</p> <p>You can...
<p>If you are using Debian and the Debian-provided packages, there is a global documentation index at <code>/usr/share/doc/ghc-doc/html/libraries/index.html</code> which lists the package in the last column.</p>
17,143
<p>I would like to give a class a unique ID every time a new one is instantiated. For example with a class named Foo i would like to be able to do the following</p> <pre><code>dim a as New Foo() dim b as New Foo() </code></pre> <p>and a would get a unique id and b would get a unique ID. The ids only have to be uniq...
<p>This design is vulnerable to multithreading issues. I'd strongly suggest using Guids for your IDs (Guid.NewGuid()). If you absolutely must use ints, check out the <a href="http://msdn.microsoft.com/en-us/library/system.threading.interlocked.aspx" rel="nofollow noreferrer">Interlocked</a> class. You can wrap all in...
<p>It's likely throwing an error because you're never initializing _nextId to anything. It needs to have an initial value before you can safely add 1 to it.</p>
8,944
<p>I've been using make and makefiles for many many years, and although the concept is sound, the implementation has something to be desired.</p> <p>Has anyone found any good alternatives to make that don't overcomplicate the problem?</p>
<p>check out <a href="http://www.scons.org/" rel="noreferrer">SCons</a>. For example Doom 3 and Blender make uses of it.</p>
<p>I'm not sure if you are asking the correct question here.</p> <p>Are you after a simplified make? In which case, you need to get someone who is very familiar with make to create a series of (M|m)akefiles that will simplify your problem.</p> <p>Or are you wanting to look at the underlying technology? Are we wanting...
9,235
<p>In PHP I can name my array indices so that I may have something like:</p> <pre><code>$shows = Array(0 =&gt; Array('id' =&gt; 1, 'name' =&gt; 'Sesame Street'), 1 =&gt; Array('id' =&gt; 2, 'name' =&gt; 'Dora The Explorer')); </code></pre> <p>Is this possible in Python?</p>
<p>This sounds like the PHP array using named indices is very similar to a python dict:</p> <pre><code>shows = [ {"id": 1, "name": "Sesaeme Street"}, {"id": 2, "name": "Dora The Explorer"}, ] </code></pre> <p>See <a href="http://docs.python.org/tutorial/datastructures.html#dictionaries" rel="noreferrer">http://do...
<p>I did it like this:</p> <pre><code>def MyStruct(item1=0, item2=0, item3=0): """Return a new Position tuple.""" class MyStruct(tuple): @property def item1(self): return self[0] @property def item2(self): return self[1] @property def item...
21,469
<p>I am a fresh graduate student in 3D metal printing. My undergraduate major is mechanical engineering. Later research will focus on the process of metal 3D printing. I hope that you can recommend some excellent 3D metal printing books for learning.</p>
<p>This is a free ebook that I have perused briefly which it looks interesting, and it is free (did I say that already?)</p> <ul> <li><a href="https://www.mdpi.com/books/pdfview/book/384" rel="nofollow noreferrer">3D Printing of metals</a> <ul> <li>Manoj Gupta</li> <li>ISBN 978-3-03842-591-5 (Pbk); </li> <li>ISBN 978...
<p>Just wanted to add that ultimately you get a lot more quick practical knowledge from your machine's manufacturer or DMLS service provider so don't forget to look at publications from the industry leaders. They have incentive to make sure you succeed when using their products. Just beware the salesmanship.</p> <p>...
1,461
<p>I want to digest a multipart response in C++ sent back from a PHP script. Anyone know of a very lightweight MIME parser which can do this for me?</p>
<p>I know this may be too little, too late, but I had a similar need. I wanted a mime parser that just did the encoding and decoding of the MIME. For the sake of completeness and for Google-ability I thought I should put my findings here. Keep in mind that I was not interested in send and receiving mail, just encodi...
<p>Better cut what you need with regex from mime multipart data faster. And don't need learn new libs. There is simple php parser <a href="https://github.com/breakermind/PhpMimeParser/blob/master/PhpMimeParser_class.php" rel="nofollow noreferrer">https://github.com/breakermind/PhpMimeParser/blob/master/PhpMimeParser_cl...
26,827
<p>My license for Whole Tomatoes Visual AssistX is about to expire and I'm not really planning on renewing it. I use it for spell checking but that's about it. The refactoring abilities have been a little disappointing. Before I just jump into Resharper though what are your thoughts on other possible plugins?</p>
<p>The other major player would be DevExpress and their CodeRush and Refactor products. <a href="http://www.devexpress.com/Products/Visual_Studio_Add-in/Refactoring/" rel="nofollow noreferrer">Found here.</a></p>
<p><a href="http://mztools.com/index.aspx" rel="nofollow noreferrer">MZ-Tools</a> is really good as well.</p>
3,262
<p>I mean, this is <a href="http://sakaiproject.org/portal" rel="nofollow noreferrer">Sakai</a>, the open source project of a learning management system. But, really I'm clueless trying to estimate the hidden costs in one implementation project (on the technology side, not the pedagogy-stuff) in a small-medium scale in...
<p>I work on support staff for a large uni that uses Blackboard. All the support people are students working part time, so salary can be pretty low per hour. You'll want to have someone on permanent staff as an administrator, who could also be the developer/deployment guy. Perhaps only part time if your institution is ...
<p><a href="http://jira.sakaiproject.org/jira/secure/IssueNavigator.jspa?reset=true&amp;&amp;pid=10280&amp;sorter/field=issuekey&amp;sorter/order=ASC" rel="nofollow noreferrer">Sakai Deployments</a> lists details of some Sakai deployments, but be careful to check the last updated date as I would look a deployment data ...
12,305
<p>I am getting a " Thread was being aborted " Exception in an ASP.NET page.I am not at all using any Response.Redirect/Server.Transfer method.Can any one help me to solve this ?</p>
<p>This can happen if the web app is being shut down or forcefully restarted while your code executes. I have seen this happen when your web app writes files to the web directory in which it's hosted, causing a recompile of the web app.</p>
<p><strong>Error</strong>: Thread was being aborted. at System.Threading.Thread.AbortInternal() at System.Threading.Thread.Abort(Object stateInfo) at System.Web.HttpResponse.End()</p> <p>This error occurs mainly If You Use Response.End, Response.Redirect, or Server.Transfer</p> <p><strong>Cause</strong>: The Response...
42,946
<p>I'm currently developing an html/ajax air app and am about to invest some effort into making animations using jQuery. I could do this quite a bit easier using the css animations if air had that recent a version of WebKit. </p> <p>I know some people have alpha/beta versions of air 1.5. If you do, can you let me know...
<p>squirrelfish isn't available on safari releases as of yet, so i think it's safe to say if AIR 1.5 is using a webkit build with squirrelfish, it will support at least (if not more) of the CSS capabilities of the latest safari browser.</p> <p>slightly off-topic, any idea if AIR 1.5 has squirrelfish extreme though?</p...
<p>I don't know offhand what AIR 1.5's CSS capabilities are, but it is a build with SquirrelFish, if that helps you track it down.</p>
32,934
<p>I recently stumbled across <a href="http://googletesting.blogspot.com/2008/08/by-miko-hevery-so-you-decided-to.html" rel="noreferrer">this entry in the google testing blog</a> about guidelines for writing more testable code. I was in agreement with the author until this point:</p> <blockquote> <p>Favor polymorph...
<p>Actually this makes testing and code easier to write.</p> <p>If you have one switch statement based on an internal field you probably have the same switch in multiple places doing slightly different things. This causes problems when you add a new case as you have to update all the switch statements (if you can find...
<p>It really depends on your style of programming. While this may be correct in Java or C#, I don't agree that automatically deciding to use polymorphism is correct. You can split your code into lots of little functions and perform an array lookup with function pointers (initialized at compile time), for instance. In C...
29,021
<p>I have multiple classes that all derive from a base class, now some of the derived classes will not be compiled depending on the platform. I have a class that allows me to return an object of the base class, however now all the names of the derived classes have been hard coded.</p> <p>Is there a way to determine wh...
<p>Are you looking for C++ runtime class registration? I found this <a href="http://meat.net/2006/03/cpp-runtime-class-registration/" rel="nofollow noreferrer">link</a> (<a href="http://web.archive.org/web/20100618122920/http://meat.net/2006/03/cpp-runtime-class-registration/" rel="nofollow noreferrer">backup</a>).</p>...
<p>If every class has its own dynamic library, just check if the library exists.</p>
10,324
<p>I am using Apache's Velocity templating engine, and I would like to create a custom Directive. That is, I want to be able to write "#doMyThing()" and have it invoke some java code I wrote in order to generate the text.</p> <p>I know that I can register a custom directive by adding a line</p> <pre><code>userdirecti...
<p>Block directives always accept a body and must end with #end when used in a template. e.g. #foreach( $i in $foo ) this has a body! #end</p> <p>Line directives do not have a body or an #end. e.g. #parse( 'foo.vtl' )</p> <p>You don't need to both with setLocation() at all. The parser uses that.</p> <p>Any other ...
<p>Block directives always accept a body and must end with #end when used in a template. e.g. #foreach( $i in $foo ) this has a body! #end</p> <p>Line directives do not have a body or an #end. e.g. #parse( 'foo.vtl' )</p> <p>You don't need to both with setLocation() at all. The parser uses that.</p> <p>Any other ...
19,270
<p>I've been thinking about the number of projects we have in-house that are still being developed using visual studio 6 and how best to migrate them forward onto visual studio 2008. The projects range in flavours of C/C++ and VB.</p> <p>Is it better to let VS2008 convert the work-spaces into solutions, fix any compil...
<p>The Microsoft p&amp;p team has recommended some <a href="http://msdn.microsoft.com/en-us/library/ms978506.aspx" rel="nofollow noreferrer">strategies</a> that answers this. Basically they recommend something like the project by project approach you mention. Of course, they're assuming a neatly architected application...
<p>When I had to convert a VB6 app to VS2003 several years ago, I ran the converter and it produced something that basically compiled, but wasn't very good at all. I ended up having to modify a big chunk of the code it generated.</p> <p>I would start with a clean solution, then run the converter on a project and copy ...
7,922
<p>I'm working on a little web crawler that will run in the system tray and crawl a web site every hour on the hour.</p> <p>What is the best way to get .NET to raise an event every hour or some other interval to perform some task. For example I want to run an event every 20 minutes based on the time. The event would b...
<p><a href="http://msdn.microsoft.com/en-us/library/system.timers.timer.interval.aspx" rel="noreferrer">System.Timers.Timer</a>. If you want to run at specific times of the day, you will need to figure out how long it is until the next time and set that as your interval.</p> <p>This is just the basic idea. Depending...
<p>My goal is to run an import around 03:00 every night.</p> <p>Here's my approach, using System.Timers.Timer:</p> <pre><code>private Timer _timer; private Int32 _hours = 0; private Int32 _runAt = 3; protected override void OnStart(string[] args) { _hours = (24 - (DateTime.Now.Hour + 1)) + _runAt; _timer = n...
39,630
<p>Good day, </p> <p>We just converted our web application .NET 1.1 to .NET 2.0. We have a major problem sending emails.</p> <p>We are using distribution group (eg: WebDeveloppersGroup) to send emails to all the developpers in the company. These groups don't end with '@ something.com'. These groups are created in Lo...
<p>I believe you can interact with Lotus Notes from .net and query it to get you the xyz@xyz.xyz addresses in the group. I'm not very familiar with it but you could start here:</p> <ul> <li><p><a href="http://www.codeproject.com/KB/cs/lotusnoteintegrator.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/cs...
<p>I have to assume here that if this was allowed <em>and</em> working in .Net 1.1 it was because either .Net or the OS were appending the domain onto the group name "WebDeveloppersGroup", which is probably "WebDeveloppersGroup@yourdomain.com". The group may not be displayed that way in Lotus, but to receive external ...
43,777
<p>Before I jump headlong into C#...</p> <p>I've always felt that C, or maybe C++, was best for developing drivers on Windows. I'm not keen on the idea of developing a driver on a .NET machine.</p> <p>But .NET seems to be the way MS is heading for applications development, and so I'm now wondering:</p> <ul> <li>Are...
<p>You can not make kernel-mode device drivers in C# as the runtime can't be safely loaded into ring0 and operate as expected.</p> <p>Additionally, C# doesn't create binaries suitable for loading as device drivers, particularly regarding entry points that drivers need to expose. The dependency on the runtime to jump i...
<p>Microsoft has a number of research projects in the area of having a managed-code OS, in other words kill with Win32 API.</p> <p>See Mary Jo Foley's article: <a href="http://reddevnews.com/features/article.aspx?editorialsid=2555" rel="nofollow noreferrer">Rebuilding a Legacy</a></p>
10,153
<p>I am trying to make stencils of Japanese Kanji characters with my 3D Printer.</p> <p>I am very new to Autodesk Fusion360 so I am running into some barriers: </p> <ol> <li><p>I am having trouble sketching a rectangle and then a text character and extruding them separately. If I extrude one they both disappear. Ther...
<p>As I see it, for a stencil you want the brown part with the white part(s) cut out.</p> <p>This is easily doable. You can do this one sketch at a time, extrude it, and cut it out of the brown part.</p> <p>To connect the inner brown parts to the rest of the brown, you'll need to cut a thin rectangle in the white cha...
<p>May I suggest an alternative? Create your characters in a document editor (such as Word or OpenOffice), using a very large font size. Save the characters to an image file. Go to one of many converter sites, such as <a href="http://www.embossify.com/" rel="nofollow noreferrer">embossify</a> or <a href="https://ww...
879
<p>I have a shop system that integrates PayPal in the usual way, i.e. the user is redirected to paypal.com to log in and confirm the payment after which the user is directed back at a confirmation page in my shop system.</p> <p>Now my customer is asking if the entire process can be run inside the shop itself.</p> <p>...
<p>This is from a few months ago, so may have been changed, but from what I remember Paypals APIs do not allow you to integrate a Paypal interface completely into a shop. This is because once you are off the paypal servers they lose control and can be liable for misuse of the API.</p> <p>From what I remember of it usi...
<p>Vendors rarely do this, but you can customize the appearance of your PayPal pages so that they sorta kinda match your web site. I'm glad they rarely do this, because the customized pages generally resemble butt. The MySpace-type experience does not fill me with financial confidence.</p> <p>I think people that hav...
34,211
<p>I'm suffering from early RSI symptoms and am looking for a way to avoid injury. My physiotherapist has determined that the worst thing I seem to be doing is using my mouse at such a weird angle. The problem for me is, I keep my keyboard positioned such that my left and right forearms are angled in the same amount,...
<p><a href="http://www.thehumansolution.com/keyboards.html" rel="nofollow noreferrer">http://www.thehumansolution.com/keyboards.html</a></p> <p>I've been looking here at some keyboards (I've got severe Carpal Tunnel). The Kinesis keyboards are nice, but there where a few there with the number pad in the middle.</p> ...
<p>I don't know of any keyboards like that, but what might help is a keyboard with a built-in touchpad (like for a laptop) that you can use instead of your other mouse for <em>some</em> of your mousing: small adjustments, quick taps to click, etc, to avoid having to go out to the mouse.</p>
14,732
<p>Any python libs for parsing apache config files or if not python anyone aware of such thing in other languages (perl, php, java, c#)? As i'll be able to rewrite them in python.</p>
<p>Red Hat's Emerging Technologies group has <A HREF="http://augeas.net/" rel="nofollow noreferrer">Augeas</A> (written in C, but with Python bindings available), a generic system configuration tool with "lenses" for reading and writing several different configuration file formats. I would consider investigating the av...
<p>ZConfig, I think, used to ship with a schema for parsing Apache configuration files; it doesn't seem to anymore, but it's oriented around parsing those types of files and turning the config into a Python object. A quick glance at the documentation suggests it wouldn't be too hard to set up a ZConfig schema correspon...
29,355
<p>Can anyone give me some pointers on how to display the results of an XPath query in a textbox using code (C#)? My datascource <i>seems</i> to (re)bind correctly once the XPath query has been applied, but I cannot find how to get at the resulting data.<br /><br /> Any help would be greatly appreciated.</p>
<p>XMLDataSource is designed to be used with data-bound controls. ASP.NET's TextBox is not a data-bound control. So to accomplish what you want you either have to find a textbox control with data binding or display the result in some other way. </p> <p>For example, you could use a <a href="http://msdn.microsoft.com/en...
<p>Some more information would be nice to have to be able to give you a decent answer. Do you have any existing code snippets you could publish here?</p> <p>The general idea is to use the XmlDataSource.XPath property as a filter on the XmlDataSource.Data property. Did you try displaying the contents of the Data prop i...
7,448
<p>I have collection of objects. Each object represents a coordinate range (ie, a block). What I want is to find the object near another coordinate in a given direction.</p> <p>Is there a way to do this without traversing the whole collection all the time?</p>
<p>You may want to look into <a href="http://en.wikipedia.org/wiki/Binary_space_partitioning" rel="nofollow noreferrer">Binary Space Partitioning</a>, and similar algorithms (<a href="http://en.wikipedia.org/wiki/Quadtree" rel="nofollow noreferrer">Quadtree</a> comes to mind, along with variations on <a href="http://ww...
<p>While inserting the objects .. sort them by the cordinates then use divide and conquer algorithm to search for your nearest possibility</p>
33,202
<p>As a novice developer who is getting into the rhythm of my first professional project, I'm trying to develop good habits as soon as possible. However, I've found that I often forget to test, put it off, or do a whole bunch of tests at the end of a build instead of one at a time.</p> <p>My question is what rhythm do...
<p>Well, if you want to follow the TDD guys, <strong>before you start to code</strong> ;)</p> <p>I am very much in the same position as you. I want to get more into testing, but I am currently in a position where we are working to &quot;get the code out&quot; rather than &quot;get the code out right&quot; which scares ...
<p>When hacking something together for myself, I test at the end. Bad practice, but these are usually small things that I'll use a few times and that's it.</p> <p>On a larger project, I write tests before I write a class and I run the tests after every change to that class.</p>
4,303
<p>I'm playing with the new geography column in SQL Server 2008 and the STGeomFromText function. Here is my code (works with AdventureWorks2008)</p> <pre><code>DECLARE @region geography; set @region = geography::STGeomFromText('POLYGON(( -80.0 50.0, -90.0 50.0, -90.0 25.0, -80.0 25.0, -80.0 50...
<p>So I ended up talking with an ex-military guy yesterday who was a radar/mapping specialist. Basically, he knew exactly what that number (4326) was, where it came from, and why it is there. </p> <p>It is an industry standard for computing geography. The problem is that the earth is not a perfect sphere (it bulges ...
<p>The distance returned depends on the <a href="http://technet.microsoft.com/en-us/library/bb964707.aspx" rel="nofollow noreferrer">"Spatial Reference Identifier (SRID)"</a> you define for your geography types.</p> <p>In the example below, the default <a href="http://technet.microsoft.com/en-us/library/bb964707.aspx"...
48,854
<p>How can I check which version of Apache is installed on a Debian machine? </p> <p>Is there a command for doing this?</p>
<p>Try apachectl -V:</p> <pre><code>$ apachectl -V Server version: Apache/2.2.9 (Unix) Server built: Sep 18 2008 21:54:05 Server's Module Magic Number: 20051115:15 Server loaded: APR 1.2.7, APR-Util 1.2.7 Compiled using: APR 1.2.7, APR-Util 1.2.7 ... etc ... </code></pre> <p>If it does not work for you, run the co...
<p>works in debian 11 bullseye</p> <pre><code>/usr/sbin/apache2 -v </code></pre>
36,885
<p>Is it possible to upload a file from a client's computer to the server through a web service? The client can be running anything from a native desktop app to a thin ajax client.</p>
<p>It's certainly possible to send binary files via web services (eg. SOAP), but you usually have to do some kind of encoding such as base64, which increases the amount of data to send. One of the most efficient ways to send an arbitrary binary file is via an HTTP PUT operation, since there is no encoding overhead. Not...
<p>I'm not a master in "webservice", but if you develop the webservice (and the client), you always can convert the binary file to <a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">BASE64</a> in the client (can do in java... and i soupose in ajax too) and transfer as "string", in the other side, i...
3,288
<p>I am implementing a database design that has a vehicle table, vehicle engine and vehicle gear table with SQL 2005.</p> <p>Each table has an ID that is a SQL identity number, and each engine and gear has a relation with the vehicle ID. So before I create a vehicle I must create an engine and gear.</p> <p>How could ...
<p>Whichever, there's no need to create rows in any of the tables for which you don't have data. It's fine to, for instance, have an engine row that is unmatched to a vehicle. You can add what's missing when you find it.</p> <p>I think I understand the design. Each vehicle can have one engine and one transmission. But...
<p>If you really can't create each entity at diferent moments, you should create them within a transaction, explicitly showing at are the necessary steps to create each entity.</p> <p>The trigger solution, which is many times the easier to implement, would be the hardest to mantain, because it "hides" behind the curti...
46,780
<p>Second Life is fun to play with, and some developers are creating content there, but I was wondering what useful resources (if any) are available in Second Life for professional software developers.</p> <ul> <li>Discussion groups</li> <li>Education/training</li> <li>Vendor support</li> <li>Development-related prese...
<p>They have a site about some of these uses: <a href="http://secondlifegrid.net/programs/api/" rel="nofollow noreferrer">http://secondlifegrid.net/programs/api/</a> and some pages on the language they kind of grew: <a href="http://wiki.secondlife.com/wiki/LSL_Portal" rel="nofollow noreferrer">http://wiki.secondlife.co...
<p><a href="http://swedenisland.se" rel="nofollow noreferrer">Look &amp; Feel team</a> Scripting, it's mine. Common 3D trouble is confusing camera center between camera or actor. A designer may think camera center is world when it should be actor. </p>
22,272
<p>Before you answer, this question is complicated:</p> <ol> <li>We are developing in asp.net / asp.net mvc / jQuery but I'm open to solutions on any platform using any framework</li> <li>I think logic like sorting / hiding columns / re-arranging columns / validation (where it makes sense) should be on the client-side...
<p>On two; you should always have server side validation as well as client side validation</p> <p>On three; if you can find a way to manipulate the DB on the client side that would be impressive ;)</p> <p>I don't know how ASP.net works though, so I am solely speaking from my PHP experience.</p> <p>I would write cont...
<p>... It depends...</p> <p>Actually the best things is developing the UI using a css / javascript / html for a style / behaviour / structure + data, in these days people wants ajax interactions (they see that cooly things everywhere so they expectation is that they don't have to reload entire pages everytime) so I t...
26,242
<p>Do you know if there is a built-in function to build a dictionary from an arbitrary object? I'd like to do something like this:</p> <pre><code>&gt;&gt;&gt; class Foo: ... bar = 'hello' ... baz = 'world' ... &gt;&gt;&gt; f = Foo() &gt;&gt;&gt; props(f) { 'bar' : 'hello', 'baz' : 'world' } </code></pre> <p><...
<p>Note that best practice in Python 2.7 is to use <em><a href="https://www.python.org/doc/newstyle/" rel="noreferrer">new-style</a></em> classes (not needed with Python 3), i.e.</p> <pre><code>class Foo(object): ... </code></pre> <p>Also, there's a difference between an 'object' and a 'class'. To build a dictiona...
<h2>PYTHON 3:</h2> <pre><code>class DateTimeDecoder(json.JSONDecoder): def __init__(self, *args, **kargs): JSONDecoder.__init__(self, object_hook=self.dict_to_object, *args, **kargs) def dict_to_object(self, d): if '__type__' not in d: return d type = d...
8,675
<p>I'm writing server-side programs in PHP for an iPhone app. And I have no iPhone. :P</p> <p>The iPhone app requests XML files from the site whenever a user runs the iPhone app. You may visit <a href="http://www.appvee.com/iphone/ads" rel="nofollow noreferrer">http://www.appvee.com/iphone/ads</a> or <a href="http://w...
<p>We use <a href="http://axtls.cerocclub.com.au/" rel="nofollow noreferrer">axTLS</a> which works great on both our server (.NET) and our embedded systems (Linux and uClinux). We had problems getting OpenSSL to work well on uClinux.<br> axTLS is not as feature complete as OpenSSL yet so make sure it meets your require...
<p>I would suggest not spending your time trying to implement an SSL function in your app. Instead, you could just use an existing SSL-tunnel software, which creates an SSL tunnel in front of your existing socket application.</p> <pre><code>Internet --- [SSLTunnel] --- Your App </code></pre> <p>For example, you could...
22,632
<p>We have a git project which has quite a big history.</p> <p>Specifically, early in the project there were quite a lot of binary resource files in the project, these have now been removed as they're effectively external resources.</p> <p>However, the size of our repository is >200MB (the total checkout is currently...
<p>You can remove the binary bloat and keep the rest of your history. Git allows you to reorder and 'squash' prior commits, so you can combine just the commits that add and remove your big binary files. If the adds were all done in one commit and the removals in another, this will be much easier than dealing with each ...
<p>Is <code>git-fast-export</code> what you are looking for?</p> <pre><code>NAME git-fast-export - Git data exporter SYNOPSIS git-fast-export [options] | git-fast-import DESCRIPTION This program dumps the given revisions in a form suitable to be piped into git-fast- import(1). You can use it as a hum...
31,130
<p>Does anybody know if it is possible to migrate separate projects from a TFS 2005 server to a TFS 2008 Server?</p>
<p>I've upgraded a TFS server from 2005 to 2008, but never migrated projects from one to the other. I can tell you that I have projects that use VS2005 in my VS2008 server and it works with no problems.</p>
<p>I've upgraded a TFS server from 2005 to 2008, but never migrated projects from one to the other. I can tell you that I have projects that use VS2005 in my VS2008 server and it works with no problems.</p>
45,164
<p>I am trying to integrate the SSRS report to my web page. The code is as follows:</p> <pre><code>ReportViewer1.ProcessingMode = rocessingMode.Remote; ReportViewer1.ServerReport.ReportServerUrl = new Uri("http://localhost/reportserver"); ReportViewer1.ServerReport.ReportPath = "/Report Project1/Reconciliation"; List&...
<p>To clarify Erikk's answer a little bit. </p> <p>The particular set of security permissions you want to set to fix this error (there are at least another two types of security settings in Reports Manager) are available in the "security" menu option of the "Properties" tab of the reports folder you are looking at.</p...
<p>The problem is that your ASP.NET worker process does not have the permissions to do what you want.</p> <p>Edit this user on the server (MACHINENAME\ASPNET), and give it more permissions (It may need write permissions etc).</p> <p>You also will need to add MACHINENAME\ASPNET as a user to the SQL database SSRS is wo...
16,557
<p>I used jQuery to set hover callbacks for elements on my page. I'm now writing a module which needs to temporarily set new hover behaviour for some elements. The new module has no access to the original code for the hover functions.</p> <p>I want to store the old hover functions before I set new ones so I can restor...
<p>Calling an event <code>bind</code> method (such as <code>hover</code>) does not delete old event handlers, only adds your new events, so your idea of 'restoring' the old event functions wouldn't work, as it wouldn't delete your events.</p> <p>You can add your own events, and then remove them without affecting any o...
<p>I'm not sure if this is what you mean, but you can bind custom events and then trigger them.</p> <p><a href="http://docs.jquery.com/Events/bind" rel="nofollow noreferrer">http://docs.jquery.com/Events/bind</a></p> <p>So add your hover event, script the functionality you need for that hover, then trigger your custo...
7,135
<p><a href="http://www.google.com/search?q=how%20to%20mock%20sealed%20class" rel="noreferrer">Mocking sealed classes</a> can be quite a pain. I currently favor an <a href="http://en.wikipedia.org/wiki/Adapter_pattern" rel="noreferrer">Adapter pattern</a> to handle this, but something about just keeps feels weird. </p...
<p>My general rule of thumb is that objects that I need to mock should have a common interface too. I think this is right design-wise and makes tests a lot easier (and is usually what you get if you do TDD). More about this can be read in the Google Testing Blog <a href="http://googletesting.blogspot.com/2008/08/by-mik...
<p>Is there a way to implement a sealed class from an interface... and mock the interface instead?</p> <p>Something in me feels that having sealed classes is wrong in the first place, but that's just me :)</p>
2,822
<p>I have written a database application using a binary file as storage. it is accessed via powershell cmdlets.</p> <p>You can put information into the database using the put- and you can read information using get-.</p> <p>The problem is synchronisation. What is the best way to ensure that the cmdlets don't access t...
<p>Add a timestamp querystring variable to the URL of the dialog content - number of ticks since 1/1/08 or something - IE will treat it as a new page and ignore the cache.</p>
<p>One of the strange quirks of IE is that setting no-cache at the beginning of the file doesn't seem to work, but moving that section to after the original HTML often does. Still best to send it as an HTTP header, but the following will work in most cases:</p> <pre><code>&lt;html&gt; &lt;head&gt;&lt;title&gt;Blah...
42,834
<p>On a Unix systems it's very easy to compile the CLASSPATH by using find:</p> <pre><code>LIBDIR=`find lib/ -name \*.jar` for DIR in $LIBDIR: do CLASSPATH="$CLASSPATH:$DIR" done java -classpath $CLASSPATH com.example.MyClass </code></pre> <p>What would be the aquivalent in a Windows batchfile?</p>
<p>The same can be achieved from Windows XP on with:</p> <pre><code>setlocal ENABLEDELAYEDEXPANSION FOR /R .\lib %%G IN (*.jar) DO set CLASSPATH=!CLASSPATH!;%%G java -classpath %CLASSPATH% com.example.MyClass </code></pre>
<p>The only way to do it is to use delayed environment variable expansion. You can do that by running </p> <pre><code>cmd /v </code></pre> <p>Then you can run:</p> <pre><code>set var=. FOR /r %%d IN (*.jar) DO SET var=!var!;%%d set CLASSPATH=%var% </code></pre>
46,847
<p>Thanks to a Q&amp;A on stackoverflow. I just found out how to determine the installed version on my hosting provider's server. Now I need to know what that number means.</p> <p>Using <code>&lt;%=Environment.Version%&gt;</code> on my local machine returns 2.0.50727.3053.</p> <p>Can someone give me a list of the ver...
<p><a href="https://en.wikipedia.org/wiki/.NET_Framework_version_history" rel="nofollow noreferrer">List of .NET Framework versions</a>.</p>
<p>When you refer to a given .NET framework then all below can have different version at a given point of time:</p> <ul> <li>.NET Framework</li> <li>Common Language Run-time(CLR): Virtual Execution Environment of a process running a .NET EXE</li> <li>C#: The programming language you're using to write code</li> <li>ASP...
5,821
<p>I'm trying to make a database and so far, I've been using strings to store my entries from a text file into an array, but this just isn't working out. Thus, I began thinking of a new way of doing it.<br/> </p> <p>What I want to do:</p> <p>Lets say I have a text file with the following database...</p> <p>John Smi...
<p>As TomWij says, you do ifstream then strtok, but I'd recommend you escape your strings with "", not just spaces, that way you can store "something like this, for example a note about the user", that's how its done with CSV (comma separated values).</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; #i...
<p>Read one line at a time with <a href="http://www.cplusplus.com/reference/iostream/ifstream/" rel="nofollow noreferrer"><code>ifstream</code></a> and then use <a href="http://www.cplusplus.com/reference/clibrary/cstring/strtok.html" rel="nofollow noreferrer"><code>strtok</code></a> to split each line, use the whitesp...
49,793
<p>my goal is to get lots of rows from a translation table. I use an ID to get a subset of the table (say 50 rows) then I use another ID to the rows I want from this subset. Using typed datasets I do the following to get the main dataset: </p> <pre><code>funderTextsDS.tbl_funderTextsDataTable fd = (funderTextsDS.tbl_...
<p>Ah, so in the TableAdapter method, you're pulling rows into memory and then querying those in-memory rows further. That's easy to do in LINQ.</p> <pre><code>myDataContext dc = new myDataContext(); List&lt;FunderText&gt; myList = myDataContext.tbl_funderTexts.ToList(); List&lt;string&gt; result1 = new List&lt;stri...
<p>I'm not sure if this will help but try and use a .where instead of .single. Somthing like this:</p> <pre><code>var data = mDB.tbl_funderTexts.where(f =&gt; f.funderID == funderid &amp;&amp; f.eng_code == element) var fundertext = data.single().funderText </code></pre>
38,127
<p>I was hoping to do something like this, but it appears to be illegal in C#:</p> <pre><code>public Collection MethodThatFetchesSomething&lt;T&gt;() where T : SomeBaseClass { return T.StaticMethodOnSomeBaseClassThatReturnsCollection(); } </code></pre> <p>I get a compile-time error:</p> <blockquote> <p>'T' is a...
<p>In this case you should just call the static method on the constrainted type directly. C# (and the CLR) do not support virtual static methods. So:</p> <pre><code>T.StaticMethodOnSomeBaseClassThatReturnsCollection </code></pre> <p>...can be no different than:</p> <pre><code>SomeBaseClass.StaticMethodOnSomeBaseCla...
<p>Here, i post an example that work, it's a workaround</p> <pre><code>public interface eInterface { void MethodOnSomeBaseClassThatReturnsCollection(); } public T:SomeBaseClass, eInterface { public void MethodOnSomeBaseClassThatReturnsCollection() { StaticMethodOnSomeBaseClassThatReturnsCollection() } } ...
23,890
<p>I have done some searches looking for information about how to do logging with the Spring Framework.</p> <p>We currently have an application that has no logging in it except for system.out statements (very bad way).</p> <p>What I would like to do, is add logging, but also want to be able to control the logging at ...
<p>I would use <a href="http://commons.apache.org/logging/" rel="nofollow noreferrer">Commons Logging</a> and <a href="http://logging.apache.org/log4j/1.2/index.html" rel="nofollow noreferrer">Log4j</a>. This is not really a question for Spring, however the Springframework source does uses Commons Logging as well. If ...
<p>here's a sample file for configuring log4j for a console and file logger. if this file is on the classpath it will get read by log4j automatically. However, since you're inside an app server, there may be another preferred way of configuring logging. I remember inside JBoss there was an xml file you had to modify...
14,455
<p>At the moment, I have some functions which look like this:</p> <pre><code>private bool inFunction1 = false; public void function1() { if (inFunction1) return; inFunction1 = true; // do stuff which might cause function1 to get called ... inFunction1 = false; } </code></pre> <p>I'd like to be a...
<p>Instead of using a bool and setting it directly, try using a long and the Interlocked class:</p> <pre><code>long m_InFunction=0; if(Interlocked.CompareExchange(ref m_InFunction,1,0)==0) { // We're not in the function try { } finally { m_InFunction=0; } } else { // We're already in the function ...
<p>You may want to consider avoiding re-entrancy by modifying your design so that it will never call function1() before its previous invocation completes. To me it seems that a layer is missing from above function1().</p>
40,482
<p>As a self-taught computer programmer, I'm often at a loss to estimate the O() value for a particular operation. Yeah, I know off the top of my head most of the important ones, like for the major sorts and searches, but I don't know how to calculate one when something new comes along, unless it's blindingly obvious....
<p>It's called <a href="http://en.wikipedia.org/wiki/Big_O_notation" rel="nofollow noreferrer">Big O Notation</a>, and it's used in <a href="http://en.wikipedia.org/wiki/Computational_complexity_theory" rel="nofollow noreferrer">Computational Complexity Theory</a>.</p> <p>The wikipedia articles are a pretty good start...
<blockquote> <p><em>Your links takes me to a site in</em> <em>Russian that seems to want a userid</em> <em>and password. Legitimate mistake, or</em> <em>troll? Paul Tomblin</em></p> </blockquote> <p>The site is in Bulgarian and you shouldn't need a password to access the list of files I linked to and download ...
8,820
<p>Does anyone know of any good basic articles for creating Sharepoint Web Parts.</p> <p>I have found a couple, but most of them jumped in a little quick.</p> <p>Thanks.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms367238.aspx" rel="noreferrer">MSDN: Developing Web Parts in Windows SharePoint Services</a></p> <p><a href="http://www.codeguru.com/csharp/.net/net_asp/webforms/article.php/c12293/" rel="noreferrer">Write Custom WebParts for SharePoint 2007</a></p> <p><a href="htt...
<p>It's pretty much the same as ASP.NET 2.0 web parts. If you're having trouble getting started, you can check out the <a href="http://quickstarts.asp.net/QuickStartv20/aspnet/doc/webparts/default.aspx" rel="nofollow noreferrer">ASP.Net 2.0 tutorials</a>.</p> <p>There's also a way to load UserControls into your webpar...
28,074