instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>This isn't my code; I am trying to figure out what exactly this does. This is a part of a big, ancient system written in C (actually it was written 4 years ago, but most likely written by a late 80s programmer mentality). Part of the code:</p> <pre><code>char DestFile[256]; char DestFile2[256]; //This part is just...
<p>You are correct.</p> <p>In C a string is an array of chars terminated by a character with ASCII code 0.</p> <p>So, first, DestFile is copied to DestFile2</p> <p>Then a scan from the right is performed, to find the right-most occurrence of '.' This returns a pointer to the char that matches, or null if no occurren...
<p>Maybe the ".gz" extension was to be removed as in ".tar.gz" to make the extension simple, like for DOS or something? Actually I can't tell from looking. Then again if the compound extension was even available in the first place that might not be it.</p>
37,029
<p>I was just curious how others work with this kind of WinForm code in C#. Lets say I have a Form lets call it Form1. And I have a DataGridView called dgvMain.</p> <p>Where do you put the code: </p> <pre><code>this.dgvMain.CellEndEdit += new DataGridViewCellEventHandler(dgvMain_CellEndEdit); </code></pre> <p>Do yo...
<p>Short answer is yes.</p> <p>Longer answer is that .designer.cs is there for code generated by the designer. if you put your own code in there, it has a chance of getting overwritten, screwing up the design time stuff in visual studio, and lowers maintainability because nobody expects custom code to be in there.</p>...
<p>I use the <strong>Designer</strong> for all event related to Component.</p> <p>I use the <strong>code</strong> for all object event.</p>
43,035
<p>I know a little about SNMP, but not enough. I need to develop an application that can read standard SNMP MIBs and read/write the various properties. The network end is no problem, but the actual MIBs and exactly what they may contain is something of a black art to me.</p> <p>I believe I should be able to use LIBSMI...
<p>At the risk of throwing you in the deep end, you might want to take a look at <a href="http://www.net-snmp.org/" rel="nofollow noreferrer">net-snmp</a>. The default installation contains a number of standard mibs with their associated implementation. It also contains a utility (mib2c) that will generate boilerplate ...
<p>Muonics <a href="http://www.muonics.com/Docs/MIBSmithy/UserGuide/" rel="nofollow">Mib Smithy User Guide</a> provides a good overview of how to build a MIB, which can help you understand the necessary elements for parsing. </p> <p>You should also look at the <a href="https://www.itu.int/rec/T-REC-X.690-201508-I/en" ...
26,661
<p>I would like to secure my hotend thermistor in a more reliable way (now it is just thermistor plugged in the hotend :D). I want to have a stainless steel tip for it to fix it inside hotend with a screw (The same approach as used for the heating cartridge). I have thermistors, but I cannot find any tips to buy separa...
<p>The two most important things you can do are:</p> <ul> <li>Provide adequate cooling to solidify the plastic quickly</li> <li>Minimize layer height</li> </ul> <p>Cooling is really obvious. You need the plastic to solidify before it has a chance to sag. PLA in particular has to shed a lot of heat before it is fully ...
<p>There's an answer <a href="https://3dprinting.stackexchange.com/questions/519/how-to-improve-face-that-are-printed-on-support?answertab=oldest#tab-top">here</a> that holds some of the same concepts. Regarding your questions: </p> <ul> <li><strong>Does lowering the temperature help? Raising it?</strong> : Yes, lower...
210
<p>I always have this notion that writing SQL queries in the code behind is not good compared to writing it using a SqlDataSource</p> <pre><code>SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Categories", myConnection); DataSet ds = new DataSet(); ad.Fill(ds, "Categories"); myGridView.DataSource = ds; myGri...
<p>I wouldn't write SQL queries in code behind full stop. How about a data access layer? </p> <p>What happens if you want to change your backing store? You're going to have to re-write all your code-behind. </p> <p>What happens where you need to use the data in more than one place? You duplicate code.</p> <p>You nee...
<p>DataSource controls are great for most things. They support paging in grids and serverside caching and may save trips to the database. However one downfall is that if you are doing anything complicated with db transactions, you wont be able to use a transaction across more than one sqldatasource, at least not easily...
39,449
<pre><code>Apache/2.2.6 (Unix) DAV/2 mod_python/3.2.8 Python/2.4.4 configured ... </code></pre> <p>One of apache processes spawns some long-running python script asynchronously, and apparently doesn't seem to collect its child process table entry. After that long-run-in-subprocess python script finishes - defunct pyth...
<p>I've done this by messing with the .csproj file: either move the attribute into the configuration-specific property groups, or just use Condition. Example:</p> <pre><code>&lt;AssemblyName&gt;MyApp&lt;/AssemblyName&gt; &lt;AssemblyName Condition=" '$(Configuration)' == 'Debug' "&gt;MyAppDebug&lt;/AssemblyName&gt; <...
<p>Sure you can add a post-build event to rename the assembly. This will work if your solution has only one assembly.</p> <p>But if your solution consists of several projects, you normally have one project referencing the assembly generated by another problem. Imagine your solution has has two projets: the first one c...
25,522
<p>I'm looking for way to grab the content of my opengl (as UIImage) and then save it into a file. I'm now giving glReadPixels a try though I'm not sure I'm doing the right thing as of what kind of malloc I should be doing. I gather that on OSX it's GL_BGRA but on the iPhone that doesn't work...</p>
<p>All OpenGL|ES complient GL-implementations have to support GL_RGBA as a parameter to glReadPixels. </p> <p>If your OpenGL|Es supports the </p> <pre><code>GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES </code></pre> <p>extension you can also query the native format. glReadPixels will understand this format as a paramete...
<p>Get the data out of the OpenGL ES view:</p> <pre><code>-(UIImage *) snapshot { NSInteger myDataLength = backingWidth * backingHeight * 4; // allocate array and read pixels into it. GLubyte *buffer = (GLubyte *) malloc(myDataLength); glReadPixels(0, 0, backingWidth, backingHeight, GL_RGBA, GL_UNSIGNE...
40,535
<p>I have a file (called "number.txt") which I want to read to an array in Java. How exactly do I go ahead and do this? It is a straight-forward "1-dimensional" file, containing 100 numbers.</p> <p>The problem is that I get an exception every time. Apparently it can't find it (I am sure its spelled correctly). When lo...
<p>Here is some example code to help you get started:</p> <pre><code>package com.acme; import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; import java.util.ArrayList; import java.util.List; public class FileArrayProvider { public String[] readLines(String filename) throws IOExc...
<p>You should be able to use forward slashes in Java to refer to file locations.</p> <p>The BufferedReader class is used for wrapping other file readers whos read method may not be very efficient. A more detailed description can be found in the <a href="http://java.sun.com/javase/6/docs/api/java/io/BufferedReader.htm...
36,286
<p>What tool (preferably free) can be used with Visual C++ 2008 Express Edition to create Win32 GUI applications? As you know the Express Edition does not include a GUI resource editor.</p>
<p>It doesn't, but that doesn't stop you from creating a Win32 GUI app; you can still do this in code.</p> <p>If that's unappealing for you, just do a Google search for "win32 Resource Editor." There are a few available. Any tool that creates .rc files can be compiled into your C++ project.</p>
<p>You can create Win32 GUI applications using the <a href="http://wtl.sourceforge.net/" rel="nofollow noreferrer">WTL</a>, <a href="http://www.wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a>, or <a href="http://trolltech.com/" rel="nofollow noreferrer">Qt</a> libraries, among others. These have been discussed ...
43,933
<p>Is anyone familiar with a tool that generates code stubs <em>with meaningful names</em> from class and javadoc?</p> <p>The real question should've been "I have classes without debug information and a matching javadoc, but my IntelliJ IDEA 8.0.1 (please, no IDE wars) doesn't take into account the javadoc and shows m...
<p>I suggest to file a bug against IDEA along these lines: If a class has no debug information but has JavaDocs, IDEA should use the JavaDoc to determine the names of the parameters.</p> <p>Btw. Eclipse has the same problem. :)</p>
<p>Go to Project Structure (in 8.x that's Ctrl+Alt+Shift+S) -> Modules -> (select the module you're coding) -> Dependencies. Select the dependency (either JAR file or directory) that contains the third party component. Click on the "Edit..." button, a new window will pop up. If you have a JAR file or a folder on your c...
49,411
<p>I have a Java service which now will execute in a batch mode. Multi threaded support is added to the service so for every batch request a thread pool will be dedicated to execute the batch. The question is how do I test this? I have functional tests that pass under the threaded version of the service but, somehow, I...
<p>There really isn't a "good" way to do this. The best thing I can suggest would be TestNG, which allows you to annotate your test methods and cause them to be executed in <em>n</em> threads concurrently. For example:</p> <pre><code>@Test(invocationCount=10, threadPool=10) public void testSomethingConcurrently() { ...
<p>I agree with Daniel, concurrency testing is indeed very difficult.</p> <p>I don't have a solution for concurrency testing, but I will tell you what I do when I want to test code involving multi-threading. Most of my testing is done using JUnit and JMock. Since JMock doesn't work well with multiple threads, I use a ...
27,231
<p>I have never clearly understood the usage of <code>MAXDOP</code>. I do know that it makes the query faster and that it is the last item that I can use for Query Optimization.</p> <p>However, my question is, when and where it is best suited to use in a query?</p>
<p>As Kaboing mentioned, <code>MAXDOP(n)</code> actually controls the number of CPU cores that are being used in the query processor.</p> <p>On a completely idle system, SQL Server will attempt to pull the tables into memory as quickly as possible and join between them in memory. It could be that, in your case, it's b...
<p>Adding my two cents, based on a performance issue I observed.</p> <p>If simple queries are getting parellelized unnecessarily, it can bring more problems than solving one. However, before adding MAXDOP into the query as &quot;knee-jerk&quot; fix, there are some server settings to check.</p> <p>In <a href="https://ww...
19,815
<p>I have a list of items (blue nodes below) which are categorized by the users of my application. The categories themselves can be grouped and categorized themselves.</p> <p>The resulting structure can be represented as a <a href="http://en.wikipedia.org/wiki/Directed_acyclic_graph" rel="nofollow noreferrer">Directed...
<p>If at all possible, avoid the GAC. It lends itself to DLL Hell. The VBAssembly may actually be unmanaged, and may have been removed from the <code>WINDOWS/system32</code> directory.</p>
<p>A starting point is to try to use the <a href="https://stackoverflow.com/questions/221803/visual-studio-2008-clean-solution-option">'Clean Solution'</a> option and then build the solution.</p>
41,493
<p>In an Open Source <a href="http://honeypot.net/project/pgdbf" rel="nofollow noreferrer">program I wrote</a>, I'm reading binary data (written by another program) from a file and outputting ints, doubles, and other assorted data types. One of the challenges is that it needs to run on 32-bit and 64-bit machines of bo...
<p>I highly suggest you read <a href="http://cellperformance.beyond3d.com/articles/2006/06/understanding-strict-aliasing.html" rel="nofollow noreferrer">Understanding Strict Aliasing</a>. Specifically, see the sections labeled "Casting through a union". It has a number of very good examples. While the article is on ...
<p><em>Edit:<br> Removed comments regarding how to effectively store data always big endian and swapping to machine endianess, as questioner hasn't mentioned another program writes his data (which is important information).<br><br>Still if the data needs conversion from any endian to big and from big to host endian, nt...
27,419
<p>I want to index a computed column in my database table which uses a number of user defined functions. However I just learned that my column is non-deterministic.</p> <p>Without indexing its going to be way to slow to run queries that I need.</p> <p>What's the best way of tracing through user defined functions to d...
<p>Try:</p> <pre><code>SELECT * FROM INFORMATION_SCHEMA.ROUTINES WHERE IS_DETERMINISTIC = 'NO' AND ROUTINE_TYPE = 'FUNCTION' </code></pre> <p>or</p> <pre><code>SELECT OBJECTPROPERTY(OBJECT_ID('schemaname.functionname'), 'IsDeterministic') </code></pre> <p>Sorry, IIRC, SQL Server 2000 did not allow non...
<p>I figured out why my function is non-deterministic. It relies on Convert statements with style codes 1, 3, and then others above 100.</p> <p>According to msdn Convert is:</p> <p>Deterministic unless one of these conditions exists:</p> <p>Source type is sql_variant.</p> <p>Target type is sql_variant and its sourc...
38,969
<p>I'm fairly new to JavaScript. </p> <p>Given a local machine's folder path (Windows), I was wondering how you can extract the names of all the possible folders in the current path, without the knowledge of how many folders there are or what they are called.</p> <p>Thank you very much in advance.</p>
<p>Here is a little script to get you started with FileSystemObject in conjuction with JScript:</p> <pre><code>var fso = new ActiveXObject("Scripting.FileSystemObject"); var shell = new ActiveXObject("WScript.Shell"); var path = "%ProgramFiles%"; var programFiles = fso.GetFolder(shell.ExpandEnvironmentStrings(path...
<p>If you're executing JavaScript in a web browser then you can't, because in this scenario JavaScript has no access to the local file system for security reasons.</p>
28,145
<p>I've just done my first little webapp in django and I love it. I'm about to start on converting an old production PHP site into django and as part its template, there is a navigation bar.</p> <p>In PHP, I check each nav option's URL against the current URL, in the template code and apply a CSS class if they line up...
<p>I use template inheritance to customize navigation. For example:</p> <p>base.html</p> <pre><code>&lt;html&gt; &lt;head&gt;...&lt;/head&gt; &lt;body&gt; ... {% block nav %} &lt;ul id=&quot;nav&quot;&gt; &lt;li&gt;{% block nav-home %}&lt;a href=&quot;{% url 'home' %}&quot;&...
<p>Here's my go at it. I ended up implementing a class in my views that contains my navigation structure (flat with some metadata). I then inject this to the template and render it out.</p> <p>My solution deals with i18n. It probably should be abstracted out a bit more but I haven't really bothered with that really.</...
44,288
<p>I am trying to use ASP to create a connection to my database and i have the following connection code:</p> <pre><code>Set objConn = ConnectDB() Set objRS = objConn.Execute(query) </code></pre> <p>I have an include file that I have at the top of my page:</p> <pre><code>&lt;!--#include FILE=dbcano.inc--&gt; </cod...
<p>I think you need a multi-process batch URL fetching daemon. PHP does not support multithreading, but there's nothing stopping you from spawning multiple PHP daemon processes.</p> <p>Having said that, PHP's lack of a proper garbage collector means that long-running processes can leak memory.</p> <p>Run a daemon whi...
<p>If you don't mind going into really low level stuff, you could send pipelined raw HTTP 1.1 requests using the socket functions.</p> <p>It'd help to know where the bottleneck is in what you're currently using - network, CPU, etc...</p>
47,135
<p>I'm experimenting with WCF Services, and have come across a problem with passing Interfaces.</p> <p>This works:</p> <pre><code>[ServiceContract] public interface IHomeService { [OperationContract] string GetString(); } </code></pre> <p>but this doesn't:</p> <pre><code>[ServiceContract] public interface I...
<p>You need to tell the WCF serializer which class to use to serialize the interface</p> <pre><code>[ServiceKnownType(typeof(ConcreteDeviceType)] </code></pre>
<p>I initially tried to pass an interface to a WCF method but couldn't get the code to work using the answers provided on this thread. In the end I refactored my code and passed an abstract class over to the method rather than an interface. I got this to work by using the KnownType attribute on the base class e.g.</p...
39,962
<p>If you call javascript window.open and pass a url to a .xls file it open on some machines in the browser window. How can you force it into Excel?</p>
<p>Only the users machine can "force" it into Excel. That said, 99% of the time if you send the correct mime-type and a user has Excel, then it will open in Excel assuming they approve.</p> <p>And only the server can send the correct mime-type. The document type you pass to a JavaScript window.open call will have no...
<p>AFAIK you can't do this with JavaScript alone. If you have some sort of scripting language on the server's side you can alter the header to force a download.</p> <p><a href="http://www.sometricks.com/2006/04/23/download-pdf-jpg-gif-directly-from-the-web-browser" rel="nofollow noreferrer">Here</a>'s a simple tutoria...
14,671
<p>I'm cheap and don't want to pay for ReSharper or TestDriven.NET, is there a free visual Studio addin for NUnit?</p>
<p>You can create a blank project (Choose console application for example) and in the property of the project you can select DEBUG tag and select "Start External Program". Put the path of Nunit. Then, in the start option, the command line arguments select the DLL that contains all your tests (mine is always in the nuni...
<p>I haven't used it, but NUnitit is a free Visual Studio Add-in for NUnit.</p> <p><a href="http://nunitit.codeplex.com" rel="nofollow">http://nunitit.codeplex.com</a></p> <p>From my experience, the best add-in for visual studio is resharper. TestDriven.Net is also good for unit tests. Hope that helps</p>
30,796
<p>I need to quickly (and forcibly) kill off all external sessions connecting to my oracle database without the supervision of and administrator.</p> <p>I don't want to just lock the database and let the users quit gracefully.</p> <p>How would I script this?</p>
<p>This answer is heavily influenced by a conversation here: <a href="http://www.tek-tips.com/viewthread.cfm?qid=1395151&amp;page=3" rel="noreferrer">http://www.tek-tips.com/viewthread.cfm?qid=1395151&amp;page=3</a></p> <pre><code>ALTER SYSTEM ENABLE RESTRICTED SESSION; begin for x in ( select...
<p>If Oracle is running in Unix /Linux then we can grep for all client connections and kill it </p> <p>grep all oracle client process:</p> <p>ps -ef | grep LOCAL=NO | grep -v grep | awk '{print $2}' | wc -l</p> <p>Kill all oracle client process :</p> <p>kill -9 <code>ps -ef | grep LOCAL=NO | grep -v grep | awk '{pr...
7,908
<p>I'm using the latest version of the <a href="https://jqueryui.com/tabs/" rel="nofollow noreferrer">jQuery UI tabs</a>. I have tabs positioned toward the bottom of the page. </p> <p>Every time I click a tab, the screen jumps toward the top.</p> <p>How can I prevent this from happening?</p> <p>Please see this examp...
<p>If you're animating your tab transitions (ie. <code>.tabs({ fx: { opacity: 'toggle' } });</code>), then here's what's happening:</p> <p>In most cases, the jumping isn't caused by the browser following the '#' link. The page jumps because at the midpoint of the animation between the two tab panes, both tab panes are...
<p>Did you tryed:</p> <pre><code>fx: {opacity:'toggle', duration:100} </code></pre>
30,205
<p>When creating a criteria in NHibernate I can use</p> <p>Restriction.In() or<br> Restriction.InG()</p> <p>What is the difference between them?</p>
<p>InG is the generic equivalent of In (for collections)</p> <p>The signatures of the methods are as follows (only the ICollection In overload is shown):</p> <pre><code>In(string propertyName, ICollection values) </code></pre> <p>vs.</p> <pre><code>InG&lt;T&gt;(string propertyName, ICollection&lt;T&gt; values) </co...
<p>Restriction.In definately creates a subquery with whatever criteria you pass to the .In() method, but not sure what InG() does. never seen it.</p>
5,137
<p>In the linker the binary destination is specified as:</p> <p>$(OutDir)\$(ProjectName).exe</p> <p>I've looked through every setting and I can't see where OutDir is defined. How do I change this?</p>
<p>First option in the "General" section underneath "Configuration Properties".</p>
<p>It's on the very first page of the project properties</p>
23,932
<p>Given two datetimes. What is the best way to calculate the number of working hours between them. Considering the working hours are Mon 8 - 5.30, and Tue-Fri 8.30 - 5.30, and that potentially any day could be a public holiday.</p> <p>This is my effort, seem hideously inefficient but in terms of the number of iterati...
<p>Before you start optimizing it, ask yourself two questions.</p> <p>a) Does it work?</p> <p>b) Is it too slow?</p> <p>Only if the answer to both question is "yes" are you ready to start optimizing.</p> <p>Apart from that</p> <ul> <li>you only need to worry about minutes and hours on the start day and end day. In...
<pre><code>Dim totalMinutes As Integer = 0 For minute As Integer = 0 To DateDiff(DateInterval.Minute, contextInParameter1, contextInParameter2) Dim d As Date = contextInParameter1.AddMinutes(minute) If d.DayOfWeek &lt;= DayOfWeek.Friday AndAlso _ d.DayOfWeek &gt;= DayOfWeek.Monday AndAlso _ d.Hou...
17,080
<p>For a product in long run (may be 0.5-1 million users) is it good to use java instead of .net from the cost/profitability perspective. To elaborate more..consider web farm scenario in which one will have to purchase windows + Sql server + some antivirus licenses for .net applications. But for java it's almost free. ...
<p>I would expect bandwidth to cost more than software licences is you're reasonably successful - although obviously that will depend somewhat on the kind of app, and I haven't run any figures.</p> <p>Are you just starting this up yourself, with little firm idea that it will take off? If so, I suggest you go with what...
<p>Whenever this topic comes up, I'm reminded of the part of yahoo that used to be written in lisp, and used lisp very effectively in its design.</p> <p><a href="http://www.algo.be/cl/TEE-lisp/3212824097309629/index.htm" rel="nofollow noreferrer">http://www.algo.be/cl/TEE-lisp/3212824097309629/index.htm</a></p> <p>Li...
25,791
<p>Typically in Arduinos, most of the 5&nbsp;V outputs that have a limited amount of current (40&nbsp;mA). </p> <p>Are there any 3D printer boards, or is there even a more usual spot, where you can get a 5&nbsp;V output that isn't capped by the microcontroller?</p> <p>I know that USB 2.0 is (typically) limited to 500...
<p>Any pin that is labeled as "5&nbsp;V" can supply the full amount of current. Looking at, for example, the <a href="http://domoticx.com/wp-content/uploads/2016/05/Arduino-MEGA-pinout.jpg" rel="nofollow noreferrer">Arduino MEGA pinout</a>, we can see several pins labeled in red with "5&nbsp;V". These are the pins you ...
<p>Any 5&nbsp;V "output" on those main boards would be used to power a USB host. This is because the electronics actually runs on 3.3 volts. It would be better to splice the input power (the 12 to 24&nbsp;V) and use a buck converter to get down to your required 5&nbsp;V. Select the right one, and you can have all the c...
1,671
<p>I'll preface this by saying that I usually work in C#/.Net.</p> <p>Normally, I use a naming scheme that puts common, reusable components into a namespace that reflects our organization and project-specific components into a namespace tied to the project. One of the reasons I do this is that I sometimes share my co...
<p>My department got his name changed thrice in the last five years, so we're all glad that someone decided against using namespaces with organisational names...</p> <p>Our namespaces are organised by project names. Reusable stuff is put into the <code>Toolbox</code> namespace. Perhaps a bit crude, but it works quite ...
<p>I use the organisation, followed by the product eg Acme.Crm. When grouping classes together in a subnamespace always use a plural or action so that it cant clash with a class. eg</p> <ul> <li>Acme.Crm.Letters</li> <li>Acme.Crm.Invoicing</li> </ul> <p>I follow Microsoft's convention by not capitalising acronyms eg ...
29,711
<p>I am building a C#/ASP.NET app with an SQL backend. I am on deadline and finishing up my pages, out of left field one of my designers incorporated a full text search on one of my pages. My "searches" up until this point have been filters, being able to narrow a result set by certain factors and column values. </p> ...
<p>First off, you need to enabled Full text Searching indexing on the production servers, so if thats not in scope, your not going to want to go with this.</p> <p>However, if that's already ready to go, full text searching is relatively simple.</p> <p>T-SQL has 4 predicates used for full text search:</p> <ul> <li>FR...
<p>"How hard is it" is a tough question to answer. For example, someone who's already done it 10 times will probably reckon it's a snap. All I can really say is that you're likely to find it a lot easier if you use something like <a href="http://sourceforge.net/projects/nlucene" rel="nofollow noreferrer">NLucene</a> ra...
24,754
<p>I'd like to combine a photo and some sound file together and upload to youtube, not sure how to do it.</p> <p>Any suggestion will be greatly helpful.</p> <p>Thanks.</p>
<p>In my opinion on windows the free Movie Maker is the best solution for small youtube videos.</p>
<p>Thanks. </p> <p>That's user interface tool, I hope I could find some web API tools, so that my application could call it programmatically.</p> <p>btw, I found one site: <a href="http://www.mediaconverter.org/" rel="nofollow noreferrer">http://www.mediaconverter.org/</a> do the manual upload.</p> <p>Any suggestion...
35,535
<p>First off, I know next to nothing about language theory, and I barely know any other languages except Java, but I had an idea that I think would be cool, but I need you guys to tell me:<br> a: why it sucks<br> b: how language x has had that for years<br> c: how my mind sucks<br> d: all of the above</p> <p>The idea ...
<p>It sounds cool but I think it makes for some horrible language constructs. Obviously there is a problem if you declare more than one 'composition' of the same class, but even if you forbid that what about the case where a call matches a method in more than one of the (different) composed classes? You would have to s...
<p>There's also the difference between <em>composition</em> and <em>aggregation</em> to consider. How does the compiler know whether you mean 'is-a' or 'has-a' relationships?</p> <ul> <li>Does the whole object graph become eligible for garbage collection or only the head of the graph?</li> </ul> <p>A couple of the OR...
31,717
<p>As the title says, is there a way to run the same Adobe AIR app more than once? I have a little widget I wrote that shows thumbnails from a couple of photo streams, and I'd like to fix it so I can look at more than one stream at a time. Thanks!</p>
<p>It seems that this is not possible. From the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=app_launch_1.html" rel="nofollow noreferrer">documentation</a>:</p> <blockquote> <p>Only one instance of an AIR application is started. When an already running application is invoked again, AIR dispatches...
<p>Last time I checked, an AIR app can only run a single instance. You could open multiple windows, but your app itself would have to support that. I hope they change this soon.</p>
6,121
<p>Let me preface this by saying I'm a complete amateur when it comes to RegEx and only started a few days ago. I'm trying to solve a problem formatting a file and have hit a hitch with a particular type of data. The input file is structured like this:</p> <pre> Two words,Word,Word,Word,"Number, number" </pre> <p>Wha...
<p><code>s/,([^ ])/","$1/</code> will match a "<code>,</code>" followed by a "not-a-space", capturing the not-a-space, then replacing the whole thing with the captured part.</p> <p>Depending on which regex engine you're using, you might be writing <code>\1</code> or other things instead of <code>$1</code>.</p> <p>If ...
<p>This question is similar to: <a href="https://stackoverflow.com/questions/180793/replace-patterns-that-are-inside-delimiters-using-a-regular-expression-call" title="Replace patterns that are inside delimiters using a regular expression call">Replace patterns that are inside delimiters using a regular expression call...
21,864
<p>I have to build small (for now) admin app in Silverlight2, and would like to use some pattern for binding UI with my BL/DAL.<br> I found view-model-viewmodel and mvp/mvc patterns, where first one (V/M/VM) is specially suited for WPF apps, because it uses rich capabilities of WPF data-binding options. What do you sug...
<p>Nikhil Kothari has a great set of examples (with code) on M-V-VM in Silverlight as well as a framework built with some very nice extra features. You should definitely check them out. <a href="http://nikhilk.net/Silverlight-ViewModel-Pattern.aspx" rel="nofollow noreferrer" title="M-V-VM in Silverlight">M-V-VM in Silv...
<p>Norwegian developer Gjøran had a very nice presentation/demo at MSDN Live about writing business apps in WPF. Really it was about using Presentation Model with Silverlight/WPF. Have a look at <a href="http://blog.goeran.no/PermaLink,guid,5e9eb4c4-163d-47aa-bbba-753700e848da.aspx" rel="nofollow noreferrer">the source...
28,046
<p>Is there a class in the standard library of .NET that gives me the functionality to create random variables that follow Gaussian distribution? </p>
<p>Jarrett's suggestion of using a Box-Muller transform is good for a quick-and-dirty solution. A simple implementation:</p> <pre><code>Random rand = new Random(); //reuse this if you are generating many double u1 = 1.0-rand.NextDouble(); //uniform(0,1] random doubles double u2 = 1.0-rand.NextDouble(); double randStd...
<p>You could try Infer.NET. It's not commercial licensed yet though. Here is there <a href="http://research.microsoft.com/en-us/um/cambridge/projects/infernet/" rel="nofollow">link</a></p> <p>It is a probabilistic framework for .NET developed my Microsoft research. They have .NET types for distributions of Bernoull...
26,822
<p>Is there a .NET library I can use to programmatically generate my own GIF images?</p> <p>At a minimum I'd like to build it pixel-by-pixel. Better would be support for text and shapes.</p> <p>Here's an example of what I'm trying to do. I mocked this up in Photoshop&hellip;</p> <p><a href="http://img143.imageshac...
<pre><code>Bitmap bmp = new Bitmap(xSize, ySize, PixelFormat.Format32bppArgb); using (Graphics g = Graphics.FromImage(bmp)) { // Use g and/or bmp to set pixels, draw lines, show text, etc... } bmp.Save(filename, ImageFormat.Gif); </code></pre> <p>Job done</p>
<p>Why not use a chart control instead of trying to generate GIFs? Unless the requirements are strictly to generate this particular GIF, I think using a chart control offers you more flexibility. </p>
45,604
<p>I'm working on a website that uses lots of png24 files, for transparency.</p> <p>I need to replace them with png8 files, as all the png fix style javascript workarounds for png24 cause IE6 to lock up randomly. </p> <p>See this link to get an idea of the symptoms IE6 displays - <a href="http://blogs.cozi.com/tech/2...
<p>The <code>file</code> utility on OSX can tell you the colour depth in a PNG file, e.g:</p> <pre><code>% file foo.png foo.png: PNG image data, 1514 x 1514, 8-bit grayscale, non-interlaced </code></pre>
<p>Perhaps <a href="http://www.imagemagick.org/" rel="nofollow noreferrer">imagemagick</a> helps you out at converting png24 files to png8 files.</p>
36,996
<p>Does full trust mean the same as Run As Administrator? I have read things stating that "for this to work, the application must be a full-trust application." Is that the same as you must have administrator privileges to run the application? If not, what's the difference? How can you tell if an app is "full-trust"...
<p>No. Full-trust is a .NET term used to indicate that it's not running in a reduced-priviledge .NET sandbox. In .NET prior to 3.5 SP1, this included running from a network share (in the default configuration). It also includes running as a ClickOnce application that has not requested additional permissions, or in s...
<p>Basically Full Trust means that the C# code has total control over the current (.Net) process and all processes running under the Application Pool account.</p> <p>It is the same as running a C++ dll</p> <p>Admin access will depend on the IIS settings (ie. if you run the website under System or an admin account)</p...
12,784
<p>For example, I'm trying to convert 2008-09-26T01:51:42.000Z to 09/26/2008. What's the simplest way of accomplishing this?</p>
<p>The easiest way is to use <a href="http://labix.org/python-dateutil" rel="noreferrer">dateutil</a>.parser.parse() to parse the date string into a timezone aware datetime object, then use strftime() to get the format you want.</p> <pre><code>import dateutil.parser d = dateutil.parser.parse('2008-09-26T01:51:42.000Z...
<pre><code>def datechange(datestr): dateobj=datestr.split('-') y=dateobj[0] m=dateobj[1] d=dateobj[2] datestr=d +'-'+ m +'-'+y return datestr </code></pre> <p>U can make a function like this which take date object andd returns you date in desired dateFormat....</p>
26,401
<p>In C/C++, how would I turn a blocking socket into a non blocking socket in both WinSocks and *nix; so that select() would work correctly. You can use the pre-processor for the platform specific code.</p>
<p>On linux:</p> <pre><code>fcntl(fd, F_SETFL, O_NONBLOCK); </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/ms738573.aspx" rel="nofollow noreferrer">Windows</a>:</p> <pre><code>u_long on = 1; ioctlsocket(fd, FIONBIO, &amp;on); </code></pre>
<p>select() is supposed to work on <em>blocking</em> sockets. It returns when a read() would return immediately, which is always the case with non-blocking sockets.</p>
20,612
<p>What are the pro/cons of doing web development on your local machine rather than on a centralized development server? For those that do dev on your local machine, how do you keep an updated db architecture for local development when multiple developers are involved?</p> <p>In particular, I'm currently experimenting...
<ul> <li>Always, always develop on a local setup. </li> <li>Always use source control.</li> <li>Always put everything under source control, including the database schema.</li> </ul> <p>There seems to be a lot people who like to have one central server that everyone uses for development -- I don't really understand why...
<p>Typically you would have a local development server that everyone shares.</p>
31,109
<p>Basically I'm converting local dates stored in the database into UTC. But I've read somewhere that daylight saving rules have changed in 2007. So does the Date.ToUniversalTime() function still work correctly. Basically the dates before 2007(when the new rules came into effect) would be converted correctly but the da...
<p>It will depend on which version of .NET you're using and possibly which version of Windows you're using. .NET 3.5 has the <a href="http://msdn.microsoft.com/en-us/library/system.timezoneinfo.aspx" rel="nofollow noreferrer">TimeZoneInfo</a> class which includes historical changes etc - before then, the support was fa...
<p>See if <a href="http://geekswithblogs.net/ewright/archive/2004/09/14/11180.aspx" rel="nofollow noreferrer">http://geekswithblogs.net/ewright/archive/2004/09/14/11180.aspx</a> helps you at all.</p>
27,350
<p>I am reworking some ui in an application written by freelance .Net developers from another country. </p> <p>I am not going to go into how bad the code is and entangled the code with structure content and presentation are... </p> <p>But one of the things I notice is that menu for accessing the parts of the app is ...
<p>You could re-style the buttons to look like links, then you can maintain any server-side code, and not have to rely on javascript like the LinkButton does.</p> <pre><code>.linkButton { background-color: transparent; border-style: none; color: /* Something nice */ cursor: pointer; text-align: left; ...
<p>A LinkButton is just that--an anchor tag with javascript that submits the page's form. If you don't want that behavior, don't use a link button. Just use a standard anchor tag.</p> <p>I've used LinkButtons in the past because its a very easy way to merge the behavior of a button with the style of a regular html l...
37,023
<p>This is more of an academic inquiry than a practical question. Are there any language or framework features that can, or will in future, allow a heterogeneous typed dcitionary, e.g. </p> <pre><code>myDict.Add("Name", "Bill"); myDict.Add("Height", 1.2); </code></pre> <p>where myDict now contains not two <code>ob...
<p>The only way you'll be able to do this if you have a custom collection with generic overloads for Add and Get methods. But that would mean you can ask for the wrong type when reading the key out, so it doesn't gain you much (if anything) over doing the cast yourself when you call your Get method.</p> <p>However, if...
<p>Any reason you can't make a class / struct and put that into a list or dictionary? Otherwise you could just wrap the dictionary class with your own and put the restrictions in that way.</p>
41,899
<p>Thanks a million everyone for everyone's response. Unfortunately, none of the solutions appear to be working on my end, and my guess is that the example I've provided is messed up.</p> <p>So let me try again.</p> <p>My table looks like this:</p> <pre><code> contract project activity row1 1000 8000 ...
<p><strong>Updated to use your newly provided data:</strong></p> <p>The solutions using the original data may be found at the end of this answer.</p> <p>Using your new data:</p> <pre><code>DECLARE @T TABLE( [contract] INT, project INT, activity INT ) INSERT INTO @T VALUES( 1000, 8000, 10 ) INSERT INTO @T VALU...
<p>Sorry old post I know but I had the same issue, couldn't get any of the above to work for me, however I figured it out.</p> <p>This worked for me:</p> <p>SELECT DISTINCT [column]As UniqueValues FROM [db].[dbo].[table]</p>
27,695
<p>I am trying to remotely run a DTSX package from a bat file with this command:</p> <pre><code>DTEXEC /DTS "\File System\MY_PACKAGE_NAME" /SERVER MY_SERVER_NAME /MAXCONCURRENT " -1 " /CHECKPOINTING OFF /REPORTING V </code></pre> <p>This is working fine locally but failing remotely (I do have admin rights on the mac...
<p>After a bit of research it looks like it is impossible to run DTEXEC remotely (it needs to be run locally - remote execution is not supported).</p> <p>To overcome this limitation the following method seems to be broadly implemented:</p> <ol> <li>set up a SQL job to run the DTSX package</li> <li>set up a Stored Pro...
<p>SSIS also exposes a web service on the hosting server. You could via code, query a machine for packages, run packages via database or file system and add / modify variables of the package programmatically via any programming platform you like.</p> <p>That being said you could also set up your webservice to call you...
20,077
<p>I am using <a href="http://htmlpurifier.org" rel="nofollow noreferrer">HTML Purifier</a> in my PHP project and am having trouble getting it to work properly with user input.</p> <p>I am having users enter in HTML using a WYSIWYG editor (<a href="http://tinymce.moxiecode.com/" rel="nofollow noreferrer">TinyMCE</a>),...
<p>The non-breaking space isn't being saved in your database as one weird foreign character, it's being saved as <em>two</em> characters. The Unicode non-breaking space character is encoded in UTF-8 as <code>0xC2 0xA0</code>, which in ISO-8859-1 looks like " " (i.e. a weird foreign character followed by a non-breaking...
<p>It may also help you to know that <code>&amp;#160;</code> is an alternate for <code>&amp;nbsp;</code> which you will likely require if you ever output any human readable XML ;)</p>
49,695
<p>There's a lot of conflicting information about this topic. So let's try to agree on a definitive answer:</p> <p>Which one of these random number generator in C create better randomness: rand, random or arc4random?</p> <p>note: Just to make the question clear, this is not a question about true randomness, it's only...
<p>Of these functions, only rand is part of standard C. random is part of POSIX, and arc4random is only provided in BSD (and derived). So only rand is "in C".</p> <p>For rand, the C standard says nothing about the quality of the generator, i.e. returning always the same number would be conforming. It says that the num...
<p>The implementation of rand() is not specified by the C standard, however most compilers use a linear congruential generator. random() and arc4random() aren't standard C either, but they are better than the usual implementation of rand()</p> <p>I'd say: arc4random() is better than random() is better than rand() </p>...
42,623
<p>Hi I want to have two tables each have an INT "id" column which will auto-increment but I don't want either "id" columns to ever share the same number. What is this called and what's the best way to do it? Sequence? Iterator? Index? Incrementor?</p> <p>Motivation: we're migrating from one schema to a another and ha...
<p>Just configure the identity increment to be >1 e.g. table one uses IDENTITY (1, 10) [1,11,21...] and table two uses IDENTITY (2, 10) [2,12,22...]. This will also give you some room for expansion if needed later.</p>
<p>I don't know what you would call it. </p> <p>If you don't want to use a GUID or a separate table, you could also create a function that looked at the max values of the ids from both tables and added one to the that value (or something like that). </p> <p>You could then call that function in an insert trigger on ...
20,219
<p>and can it be configured not to happen?</p> <p>I'm usually finding myself saving a result of a query as a .csv and processing it later on my Unix machine. The characters being null separated makes me have to filter those chars and is a bit of a pain.</p> <p>So, these are the questions:</p> <ul> <li>Why is this so...
<p>The file is being outputted in Unicode, not ASCII. Unicode uses twice as many bits to represent each character, hence the preceding 00's.</p> <p>There might be an option to save as ANSI or ASCII, which should use 8 bit characters.</p>
<p>On Unix, I suggest the use of <code>iconv -futf-16le -tutf-8</code> to filter your output. :-)</p>
25,510
<p>I am reading image files in Java using</p> <pre><code>java.awt.Image img = Toolkit.getDefaultToolkit().createImage(filePath); </code></pre> <p>On some systems this doesn't work, it instead throws an AWTError complaining about sun/awt/motif/MToolkit.</p> <p>How else can you create a java.awt.Image object from an i...
<p>I read images using <a href="http://java.sun.com/javase/6/docs/api/javax/imageio/ImageIO.html" rel="noreferrer">ImageIO</a>.</p> <pre><code>Image i = ImageIO.read(InputStream in); </code></pre> <p>The javadoc will offer more info as well.</p>
<p>On some systems adding "-Djava.awt.headless=true" as java parameter may help.</p>
14,576
<p>I'm curious about conventions for type-punning pointers/arrays in C++. Here's the use case I have at the moment:</p> <blockquote> Compute a simple 32-bit checksum over a binary blob of data by treating it as an array of 32-bit integers (we know its total length is a multiple of 4), and then summing up all values a...
<p>As far as the C++ standard is concerned, <a href="https://stackoverflow.com/questions/346622/opinions-on-type-punning-in-c#346675">litb</a>'s answer is completely correct and the most portable. Casting <code>const char *data</code> to a <code>const uint3_t *</code>, whether it be via a C-style cast, <code>static_ca...
<p>I know this thread has been inactive for a while, but thought I'd post a simple generic casting routine for this kind of thing:</p> <pre><code>// safely cast between types without breaking strict aliasing rules template&lt;typename ReturnType, typename OriginalType&gt; ReturnType Cast( OriginalType Variable ) { ...
45,100
<p>How do I query the iPhone's current IP address?</p>
<p>If you want the <strong>external</strong> IP address (the one used to connect from outside the local network), you need to query a server on the external network. A quick search yielded the following: <a href="http://checkip.dyndns.org" rel="noreferrer">http://checkip.dyndns.org</a>, <a href="http://www.whatismyip.c...
<p>You can try to use similar to this service: <a href="http://automation.whatismyip.com/n09230945.asp" rel="nofollow noreferrer">Whatismyip</a> and capture the string :)</p> <p>Credit to Erica Sadun's iPhone Developer's Cookbok, 2nd ed, page 555.</p>
32,562
<p>I need to store user entered changes to a particular table, but not show those changes until they have been viewed and approved by an administrative user. While those changes are still in a pending state, I would still display the old version of the data. What would be the best way of storing these changes waitin...
<p>Size is your enemy. If you are dealing with lots of data and large numbers of rows, then having the historical mixed in with the current will hammer you. You'll also have problems if you join out to other data with making sure you've got the right rows.</p> <p>If you need to save the historical data to show chang...
<p>I think the second way is the better approach, simply because it scales better to multiple tables. Also, the extra processing would be minimal, as you can create an index to the table based on the 'approved' bit, and you can specialize your queries to either pull approved (for viewing) or unapproved (for approving) ...
12,942
<p>I like InnoDB's safety, consistency, and self-checking.</p> <p>But I need MyISAM's speed and light weight.</p> <p>How can I make MyISAM less prone to corruption due to crashes, bad data, etc.? It takes forever to go through a check (either CHECK TABLE or myisamchk). </p> <p>I'm not asking for transactional securi...
<p>MyISAM's supposed speed benefits can actually go away pretty quickly - the fact that it lacks row-level locking means small updates can cause large amounts of data to be locked, and queries to block. Because of that, I'm skeptical of claimed MyISAM speed benefits: start doing several UPDATEs, and the queries per se...
<p>Are you married to MySQL? <a href="http://www.postgresql.org/" rel="nofollow noreferrer">Postgres</a> is ACID-compliant (like innoDB) and (when well-tuned) nearly as speedy as MyISAM.</p>
10,152
<p>Hey. I have an object that has a string property called BackgroundColor. This string is the hexidecimal representation of a color. I cannot change this object.</p> <p>I'm binding a collection of these objects to a listView. What I would like to do is bind the background of the listview's row to the BackgroundColor ...
<p>I think using a <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx" rel="nofollow noreferrer">IValueConverter</a> is the appropriate solution. You could make a HexConverter that converts the string hex value to Color. That link should get you started.</p>
<p>I think using a <a href="http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx" rel="nofollow noreferrer">IValueConverter</a> is the appropriate solution. You could make a HexConverter that converts the string hex value to Color. That link should get you started.</p>
47,033
<p>The application that I am working on generates files dynamically with use. This makes backup and syncronization between staging,development and production a real big challenge. One way that we might get smooth solution (if feasable) is to have a script that at the moment of backing up the database can backup the d...
<p>Do you mean that the application is storing a files as blobs in the MySQL database, and/or creating lots of temporary tables? Or that you just want temporary files - themselves unrelated to a database - to be stored in MySQL as a backup?</p> <p>I'm not sure that trying to use MySQL as an net-new intermediary for ba...
<p>the should be trivial to accomplish using PHP, perl, python, etc. are you looking for someone to write this for you?</p>
49,677
<p>I have the following code which adapts linq entities to my Domain objects:</p> <pre><code>return from g in DBContext.Gigs select new DO.Gig { ID = g.ID, Name = g.Name, Description = g.Description, StartDate ...
<p>Your inner LINQ query returns several objects, not just one. You want to wrap it with a call like:</p> <pre><code>Venue = (from v in DBContext.Venues where v.ID == g.VenueID select new DO.Venue { ID = v.ID, Name = v.Name, Address ...
<p>Why are you doing a join and a sub select? You can just use the results of your join in the creation of a new Venue. Be aware that if there is not a one to one relationship between gigs and venues you could run into trouble.</p> <p>Try this:</p> <pre><code>return from g in DBContext.Gigs join venue in DBConte...
47,860
<p>I need to generate random numbers in the range 1 - 10000 continuously with out duplication. Any recommendations?</p> <p>Description: we are building a new version for our application, which maintains records in Sqlite DB. in the last version of our application, we did not had unique key for each record. But now wi...
<p>Well, eventually you'll either have to stop generating them, or you're going to star duplicating them.</p> <p>On a computer your options are pretty limited to Pseudo Random Number Generators (PRNGs), and given your constraint that they never repeat then a PRNG is your best option - real random data will occasionall...
<p><a href="http://btjunkie.org/torrent/eBook-Numerical-Recipes-in-C-1992-Math-pdf/43241d28de86e4e032a41841fd3508ca03cd9f8e2ce1" rel="nofollow noreferrer">Numerical Recipes in C</a> has a whole chapter dedicated to random number generation. There are a few implementation there. From simple and straight forward to compl...
23,066
<p>I'm stuck on what appears to be a CSS/z-index conflict with the YouTube player. In Firefox 3 under Windows XP, Take a look at this page: <a href="http://spokenword.org/program/21396" rel="noreferrer">http://spokenword.org/program/21396</a> Click on the Collect button and note that the pop-up &lt;div> appears <em>und...
<p>Try to add the <code>wmode</code> parameter to be <code>opaque</code> like this:</p> <p>(Note that it's included in <em>both</em> a <code>&lt;param&gt;</code> tag <strong>and</strong> a <code>wmode</code> attribute on the <code>&lt;embed&gt;</code> tag.)</p> <pre><code>&lt;object width='425' height='344'&gt; ...
<p>I've noticed that wmode="opaque" terribly affects on usage of CPU. Chrome make on my notebook 50% CPU usage (without opaque ~8%).<br> So be careful with this option.</p>
42,260
<p>I have a GridView populated from an ObjectDataSource with two items in its DataKeyNames field. One is the primary key, ID, the other is a category field (the category field is used to add header rows to delineate categories).</p> <p>Displaying works fine, but I'm trying to create a Delete action. The object's del...
<p>All of the DataKey values will always be passed to the Delete method because the fields named by <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.datakeynames.aspx" rel="noreferrer">DataKeyNames</a> are intended to be the field or fields that uniquely identify that item in the Grid...
<p>When using the default declarative delete method, GridView will pass both values to the ObjectDataSource. </p> <p>If you really don't like the extra parameter, an alternative is to cancel the declarative method and use your own one (you can remove the unnecessary parameter there), but it requires more code.</p>
42,268
<p>I know that the compiler will sometimes initialize memory with certain patterns such as <code>0xCD</code> and <code>0xDD</code>. What I want to know is <strong>when</strong> and <strong>why</strong> this happens.</p> <p><H2>When</H2></p> <p>Is this specific to the compiler used?</p> <p>Do <code>malloc/new</code>...
<p>A quick summary of what Microsoft's compilers use for various bits of unowned/uninitialized memory when compiled for debug mode (support may vary by compiler version):</p> <pre class="lang-none prettyprint-override"><code>Value Name Description ------ -------- ------------------------- 0xCD...
<p>The IBM XLC compiler has an "initauto" option that will assign automatic variables a value that you specify. I used the following for my debug builds:</p> <p><code>-Wc,'initauto(deadbeef,word)'</code></p> <p>If I looked at the storage of an uninitialized variable, it would be set to 0xdeadbeef</p>
48,355
<p>Polyglot, or multiple language, solutions allow you to apply languages to problems which they are best suited for. Yet, at least in my experience, software shops tend to want to apply a "super" language to all aspects of the problem they are trying to solve. Sticking with that language come "hell or high water" ev...
<p>I've been lucky to work in small projects with the possibility to suggest a suitable language for my task. For example C as a low-level language, extending Lua for the high-level/prototyping has served very well, getting up to speed quickly on a new embedded platform. I'd always prefer two languages for any bigger p...
<p>One issue that I've run into is that Visual Studio doesn't allow multiple languages to be mixed in a single project, forcing you to abstract things out into separate DLLs for each language, which isn't necessarily ideal.</p> <p>I suspect the main reason, however, is the perception that switching back and forth betw...
11,166
<p>I think the question says it all. I have several monthly processes in stored procedures which take anywhere from a minute to an hour. If I declare them <code>WITH RECOMPILE</code>, an execution plan will be generated each time.</p> <p>If the underlying indexes or statistics or views are changed by the DBA, I don'...
<p>Under the circumstances, it would be completely harmless, and probably a good idea.</p>
<p>As I understand it, an SP should be re-compiled if needed automatically. So your concern about underlying changes doesn't really matter. </p> <p>However, the server tries to cache compiled SP plans. Using <code>WITH RECOMPILE</code> will free the memory that would have been used to cache the compiled procedures ...
44,498
<p>I installed WSS Infrastructure Update and MOSS Infrastructure Update (<a href="http://technet.microsoft.com/en-us/office/sharepointserver/bb735839.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/office/sharepointserver/bb735839.aspx</a>) and now I can't restore the content database on an older ver...
<p>There are no supported methods to uninstall updates in MOSS or WSS. Your only option is to restore a backup, which is why you should always back up everything and test the integrity of the backup before installing updates.</p>
<p>There is no such an option, as others pointed out, the only option is to restore from a backup.</p> <p>When you are trying to restore a content database to a different box both should have the same set of updates installed, otherwise you might experience all kind of problems.</p>
10,965
<p>The company I work for are currently undergoing a site wide renovation and I'm involved in the 'consultation' on what the R&amp;D work spaces are going to be like.</p> <p>There is no scope for individual private offices - so lets not start on that topic. </p> <p>One big requirement is that the office layout can be...
<p>If you're gonna be doing any pair-programming then I would recommend you avoid corner desks as they hamper the ability for 2 people to work side by side.</p> <p>What about curved desks? A team of four with curved desks (curving away from you, not around you) would form a circular formation ideal for group discussio...
<p>All of our cube/offices have desk lining 2 adjacent walls, so there is always a corner that can be used if a person so desires. That said however, I can't say I've ever seen someone here with their setup in the corner. I personally think it's way more comfortable not in a corner.</p>
19,582
<p>I am using the SoundEngine sample code from Apple in the CrashLanding sample to play back multiple audio files. Using the sample caf files included with CrashLanding everything works fine but when I try and use my own samplesconverted to CAF using afconvert all I get is a stony silence ;)</p> <p>Does anyone have se...
<pre><code>afconvert -f caff -d LEI16@44100 -c 1 in.wav out.caf </code></pre> <p>References:</p> <ul> <li>Apple's <a href="https://developer.apple.com/library/ios/documentation/audiovideo/conceptual/multimediapg/usingaudio/usingaudio.html#//apple_ref/doc/uid/TP40009767-CH2-SW28" rel="noreferrer">Multimedia Programmin...
<p>thanks for the info.</p> <p>also, if you're looking into additional compression with openAL, this might be of interest:</p> <p>"iPhone, OpenAL, and IMA4/ADPCM" <a href="http://www.wooji-juice.com/blog/iphone-openal-ima4-adpcm.html" rel="nofollow noreferrer">http://www.wooji-juice.com/blog/iphone-openal-ima4-adpcm....
31,682
<p>I'm using a JComboBox with an ItemListener on it. When the value is changed, the itemStateChanged event is called twice. The first call, the ItemEvent is showing the original item selected. On the second time, it is showing the item that has been just selected by the user. Here's some tester code:</p> <pre><code>pu...
<p>Have a look at this source:</p> <pre><code>import javax.swing.*; import java.awt.*; import java.awt.event.*; public class Tester { public Tester(){ JComboBox box = new JComboBox(); box.addItem("One"); box.addItem("Two"); box.addItem("Three"); box.addItem("Four"); ...
<p><code>JComboBox.setFocusable(false)</code> will do the trick.</p>
42,828
<p>Pexpect can be used to automate tasks in python (does not need TCL to be installed). One of the simplest routines of this class is the 'run()' routine. It accepts a dictionary of expected question patterns as keys and the responses as values. For example</p> <p>pexpect.run ('scp foo myname@host.example.com:.', even...
<p><a href="https://docs.python.org/library/re.html#regular-expression-syntax" rel="nofollow noreferrer">https://docs.python.org/library/re.html#regular-expression-syntax</a></p> <blockquote> <p>(?...) This is an extension notation (a "?" following a "(" is not meaningful otherwise). The first character aft...
<p><a href="https://docs.python.org/library/re.html#regular-expression-syntax" rel="nofollow noreferrer">https://docs.python.org/library/re.html#regular-expression-syntax</a></p> <blockquote> <p>(?...) This is an extension notation (a "?" following a "(" is not meaningful otherwise). The first character aft...
27,456
<p>I am wondering what methods people are using for validating check boxes in ASP.NET MVC (both client and server side).</p> <p>I am using JQuery currently for client side validation but I am curious what methods people are using, ideally with the least amount of fuss (I am looking for a new solution).</p> <p>I shoul...
<p>If you go on to the validation website and download the whole package that included the demo files, you can find the one with example of validating check boxes and radio buttons. The link is here: <a href="http://jquery.bassistance.de/validate/jquery.validate.zip" rel="nofollow noreferrer">http://jquery.bassistance....
<p>I assume you simply check whether or not the name of the checkbox was posted to the server or not. Not being an ASP coder myself, I can't help, though this is how it would be done in PHP (of course, depending on how you map validations).</p> <pre><code>&lt;?php echo isset($_POST['checkbox_name']) ? 'checked' : 'not...
12,368
<p>I'm looking for a server which is:</p> <ul><li>Lightweight, <li>Non-buggy, Supports .NET, <li>Runs on client for testing, <li>Runs on Windows</ul> <p><br /> Cassinni is too buggy, IIS is too expensive, Apache is hard to setup, XSP is linux only <br /> Visual Web Developer's is cutting it.</p>
<p>IIS. That's the only server that supports .Net really well. You can go with Mod_Mono on Apache, but that's probably not going to be as stable as running IIS.</p>
<p><a href="http://httpd.apache.org/" rel="nofollow noreferrer">Apache</a> and <a href="http://www.mono-project.com/Mod_mono" rel="nofollow noreferrer">Mod_mono</a>.</p>
44,437
<p>I am developing an application which will be connected to Access database at the beginning and the plan is to switch to MS SQL or SQL Express in the near future. The datatables structures are same for both types of databases and I am trying to avoid duplicating the code and trying to find the way to minimize the cod...
<p>You could make this even simpler by making it all happen in one main page. Instead of having a list of hyperlinks, just have the main page have one frame that loads one of the autocreated pages in it. Put a couple of buttons at the bottom - a "Keep this page" and a "Delete this page." When you click either button, t...
<p>You would have to write the web page in Python. There are many Python web frameworks out there (e.g. Django) that are easy to work with. You could convert your entire scripting framework to a web application that has a worker thread going and crawling through html pages, saving them to a particular location, indexin...
31,948
<p>I guess I'm really after an aid to help people who forget, Cruise Control sends out the details of commits to everyone, so people are keen to add a meaningful comment, but sometimes forget.</p>
<p>You can write a <a href="http://www.pragmaticautomation.com/cgi-bin/pragauto.cgi/Monitor/LettingCVSPullTheTrigger.rdoc" rel="nofollow noreferrer">pre-commit hook</a> that checks this. This requires access to the CVS server.</p>
<p>We use Subversion and Tortoise and it is possible to do this.</p> <p>Basically you need to set the tsvn:logminsize parameter on the trunk folder. This will allow you to set a minimum length for a comment (anything > 1 will result in mandatory comments)</p>
35,588
<p>I'm trying to use some data from a PlanPlusOnline account. They only provide a java web services API. The server for the site where the data will be used does not allow me to install Tomcat (edit: or a JVM for that matter). I'm not going to lie, I am a Java software engineer, and I do some web work on the side. ...
<p>To follow up with jodonnell's comment, a Web service connection can be made in just about any server-side language. It is just that the API example they provided was in Java probably because PlanPlusOnline is written in Java. If you have a URL for the service, and an access key, then all you really need to do is fig...
<p>Are you trying to implement a client to a web service hosted somewhere else? If so, Java's not necessary. You can do web service clients in <a href="http://www.dotnetjunkies.ddj.com/Tutorial/4D13CEFA-D0FD-44BE-8749-8D17B5757564.dcik" rel="nofollow noreferrer">.NET</a>, <a href="http://sourceforge.net/projects/nuso...
7,671
<p>I frequently work with multiple instances of Visual Studio, often working on different branches of the same solution.</p> <p><a href="https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B#Strictly_32-bit_versions" rel="noreferrer">Visual C++ 6.0</a> used to display the full path of the current source file in its t...
<p>There is not a native way to do it, but you can achieve it with a macro. The details are described here in full: <em><a href="https://www.helixoft.com/blog/how-to-show-full-file-path-or-anything-else-in-vs-2005-title-bar.html" rel="nofollow noreferrer">How To Show Full File Path (or Anything Else) in VS 2005 Title B...
<p>File &gt; Preferences &gt; Settings &gt;&gt; Window:Title</p> <p>I just changed ${activeEditorShort} =&gt; ${activeEditorLong}</p> <p>within the setting: ${dirty}${activeEditorLong}${separator}${rootName}${separator}${appName}</p> <p>Worked immediately when I clicked a file.</p> <p>Great help right in the setting .....
5,038
<p>Is there a way to change all the numeric keys to &quot;Name&quot; without looping through the array (so a php function)?</p> <pre><code>[ 0 =&gt; 'blabla', 1 =&gt; 'blabla', 2 =&gt; 'blblll', // etc ... ] </code></pre>
<p>If you have an array of keys that you want to use then use <a href="http://ca3.php.net/manual/en/function.array-combine.php" rel="noreferrer"><code>array_combine</code></a></p> <p>Given $keys = array('a', 'b', 'c', ...) and your array, $list, then do this:</p> <pre><code>$list = array_combine($keys, array_values($...
<p>You could create a new array containing that array, so:</p> <pre><code>&lt;?php $array = array(); $array['name'] = $oldArray; ?&gt; </code></pre>
39,772
<p>I have a MOJO I would like executed once, and once only after the test phase of the last project in the reactor to run.</p> <p>Using:</p> <pre><code>if (!getProject().isExecutionRoot()) { return ; } </code></pre> <p>at the start of the execute() method means my mojo gets executed once, however at the very...
<p>The best solution I have found for this is:</p> <pre><code>/** * The projects in the reactor. * * @parameter expression="${reactorProjects}" * @readonly */ private List reactorProjects; public void execute() throws MojoExecutionException { // only execute this mojo once, on the very last project in the r...
<p>Normally, this is a matter of configuration. You might have to setup a project just for the mojo and make it dependent on all of the other projects. Or you could force one of the child projects to be last by making it dependent on all of the other children.</p>
16,105
<p>Given two integers <code>a</code> and <code>b</code>, how would I go about calculating the repeating decimal of <code>a / b</code>? This can be in any language; whatever it's easiest for you to express it in.</p>
<p>You can do it with long division. Calculate a single digit at a time and subtract to get a remainder, which you multiply by 10 to get the numerator for the next step. When this new numerator matches one of the previous numerators, you know you're going to repeat from that point forward. You just need to keep a sta...
<p>I'm not an expert, and I think this solution may be not efficient, but at least it is easy to do:</p> <pre><code>#you want to get a/b from fractions import Fraction: print float(Fraction(a,b)) </code></pre> <p>Comments are well accepted</p>
31,002
<p>I have created a class for a dashboard item which will hold information such as placement on the dashboard, description, etc. I am currently using a pair of Collections to hold those dashboard items contained in the "library" and those items showing on the dashboard itself. I have been asked to make this dashboard...
<pre><code>List&lt; List&lt;Placement&gt;&gt; ListofListOfPlacements = new List&lt; List&lt;Placement&gt;&gt; (); List&lt;Placement&gt; dashboard1 = new List&lt;Placement&gt;(); List&lt;Placement&gt; dashboard2 = new List&lt;Placement&gt;(); List&lt;Placement&gt; dashboard3 = new List&lt;Placement&gt;(); List&lt;Place...
<p>I think you should go with composition, as below</p> <p>Per user Dashboard-home(having multiple tabs) object containing list of dashboard objects containing list of dashboard item objects having various operations on them defined. Again the dashboard item can be a usercontrol having all possible events defined whic...
29,707
<p>In C++ you can initialize a variable in an if statement, like so:</p> <pre><code>if (CThing* pThing = GetThing()) { } </code></pre> <p>Why would one consider this bad or good style? What are the benefits and disadvantages?</p> <p>Personally i like this style because it limits the scope of the pThing variable, so ...
<p>The important thing is that a declaration in C++ is not an expression.</p> <pre><code>bool a = (CThing* pThing = GetThing()); // not legit!! </code></pre> <p>You can't do both a declaration and boolean logic in an if statement, C++ language spec specifically allows either an expression or a declaration.</p> <pre>...
<p>You can also enclose the assignment in an extra set of ( ) to prevent the warning message.</p>
16,525
<p>Creating a CSV file in a winforms application, it is to be improted into Excel.</p> <p>The file output looks like:</p> <p>"header1", "header2", "header3", 1,2,3, 4,5,6</p> <p><b>What should I use to signify a newline character when generating the CSV file?</b></p>
<p>I'd suggest using <a href="http://msdn.microsoft.com/en-us/library/system.environment.newline.aspx" rel="nofollow noreferrer">Environment.NewLine</a>.</p>
<p>use \r\n although it will work with just \n</p>
28,581
<p>In Linqtosql how do I show items from multiple rows in a single field.</p> <p>eg I have a 3 table setup for tagging(entity, tag, entitytag) all linked via foreign keys.</p> <p>For each entity I would like to return the name in one field and then all relevant tags in 2nd field.</p> <p>eg Item1, tag1; tag2; tag3 ...
<p>Okay, not sure if this is the most efficient way but it works.</p> <pre><code>Dim dc As New DataContext Dim query = From i In dc.Items _ Let tags = (From t In dc.ItemTags _ Where t.ItemID = i.ID _ Select t.Tag.Name).ToArray _ Select i.ItemName...
<p>With this answer I am assuming you have your tables setup similar to the following, names are not great, just for illustration:</p> <p>AnEntity: Id, Name<br/> ATag: Id, TagName<br/> EntityTag: EntityId (FK to AnEntity.Id), TagId (FK to ATag.Id)<br/></p> <p>You might try this:</p> <pre><code>var entityTags = from ...
40,590
<p>I have 7-8 xml files. Each one is approximately 50 MB in size. What is the best way to merge files programmatically in C# without getting System.OutOfMemory Exception? So far I have tried reading each file in a StringBuilder and than putting it in an array of string builder but I still get system.outofmemoery excep...
<p>The thing about stringbuilder is you're still trying to keep the entire contents in memory. You want to only keep a small portion in memory at a time, and that means using filestreams. Don't read an entire file into memory, open a stream on it and keep reading from the stream.</p> <p>The problem with xml is that ...
<p>It depends what you mean by merge, since you haven't posted any information about the schema.</p> <p>In the simplest case of homogeneous simple elements in a single collection, you would just merge directly to a new file on disk avoiding much in-memory work, ensuring that the outer containing elements are stripped ...
17,988
<p>Ruby on Rails has <a href="http://wiki.rubyonrails.com/rails/pages/Timestamping" rel="nofollow noreferrer">magic timestamping fields</a> that are automatically updated when a record is created or updated. I'm trying to find similar functionality in Entity Framework. I've considered database triggers and a SavingChan...
<p>The <code>-w</code> options seems to work better with the <code>-S</code> option. Otherwise there are additional results which don't seem related to the userid. Perhaps someone can explain it.</p> <pre><code>cvs log -N -S -w&lt;userid&gt; -d"1 day ago" </code></pre> <p>With that I have been getting reasonable su...
<p>This might be way overkill, but you could use <a href="http://www.kernel.org/pub/software/scm/git/docs/git-cvsimport.html" rel="nofollow noreferrer">git-cvsimport</a> to import the CVS history to a Git repository and search it using Git's tools. Not only can you search for text within commit messages, but you can al...
14,406
<p>I'm working on a client site who is using Umbraco as a CMS. I need to create a custom 404 error page. I've tried doing it in the IIS config but umbraco overrides that. </p> <p>Does anyone know how to create a custom 404 error page in Umbraco? Is there a way to create a custom error page for runtime errors?</p>
<p>In <code>/config/umbracoSettings.config</code> modify <code>&lt;error404&gt;1&lt;/error404&gt;</code> "<em>1</em>" with the id of the page you want to show.</p> <pre><code>&lt;errors&gt; &lt;error404&gt;1&lt;/error404&gt; &lt;/errors&gt; </code></pre> <p>Other ways to do it can be found at <a href="http://our....
<p>Currently <code>umbracoSettings.conf</code> has to be configured the following way in order to make it work in a multilingual way:</p> <pre><code> &lt;errors&gt; &lt;!-- the id of the page that should be shown if the page is not found --&gt; &lt;!-- &lt;errorPage culture="default"&gt;1&lt;...
16,958
<p>Is there any way to use this kind of format in .Net (C#)? I want to use the same skin format that uTorrent uses in my app, but i can't get the transparent background. Any ideas? Thanks for your time.</p>
<p>The PixelFormat enumeration lists the formats of 'bitmaps' you can create in .Net, so you'd want PixelFormat.Format32bppArgb:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixe...
<p>The PixelFormat enumeration lists the formats of 'bitmaps' you can create in .Net, so you'd want PixelFormat.Format32bppArgb:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixe...
6,283
<p>I'm trying to set up a virtual host on a new VPS using apache 2.x on a Ubuntu server.</p> <p>When starting apache I get the error " xxx.241.214.xxx:80 has no VirtualHosts", and the url for the site still points to the default location which means my virtual host file isn't taking effect:</p> <pre><code>&lt;Virtual...
<p>I know its been a while since you posted your question but I thought id throw in my thoughts</p> <p>We currently run a few internal sites here for different purposes, all of them listen of standard port 80 and apache is set up simply as follows</p> <pre><code>Listen 80 NameVirtualHost *:80 # Site 1 Comment &lt;...
<p>I always use</p> <pre><code>&lt;VirtualHost *&gt; </code></pre> <p>(and ISTR always having problems specifying the IP and port number, which I think is why I do it that way now).</p>
25,772
<p>I am using Dojo 1.2 to implement some functionality on my customer's webpage. One of the widgets I use is the <code>dijit.layout.TabContainer</code>, which inherits <code>StackContainer</code>. The <code>StackContainer</code> subscribes on keyboard events and creates a few hotkeys, like arrow left to move one tab to...
<p>Simply override _onKeyPress with an empty body:</p> <pre> &lt;div dojoType='dijit.layout.TabContainer'&gt; &lt;script type='dojo/method' event='_onKeyPress'&gt;&lt;/script&gt; ... &lt;div&gt; </pre> <p>Works like a charm.</p>
<p>I'm just coding off the cuff here, and I didn't test it out at all. I'm making this wikified, so post the correct source if there are any problems, please.</p> <p>Use the following javascript within a file called <code>com/stackoverflow/KeyPresslessTabContainer.js</code>:</p> <pre><code>dojo.provide(&quot;com.stack...
49,907
<p>I want to be able to rewrite a URL from:</p> <pre><code>// examples http://example.com/location/New York, NY --&gt; http://example.com/location/index.html?location=New York, NY http://example.com/location/90210 --&gt; http://example.com/location/index.html?location=90210 http://example.com/location/Texas --&gt...
<p>Your last example should work; I'd also check the condition to be case-insensitive (to avoid /LoCation/indeX.htmL from being parsed), terminate rewrite with [L] (to prevent infinite loops) and add QSA (for appending queries):</p> <pre><code>RewriteEngine on RewriteCond %{REQUEST_URI} !location/index.html [NC] Rewri...
<p>Just to reiterate, the solution posted by Piskvor does work as expected. As per the comments on that, you're using javascript to pick up the query string, which is the problem. As far as javascript is concerned, the original URL is the one it sees. You can confirm this for yourself quickly:</p> <pre><code>alert(doc...
32,400
<p>I believe the architecture type (x86 vs x64) is abstracted away for you when making .Net programs, but are there any other considerations that can cause problems?</p>
<p>Beware of third-party COM libraries or third party .NET libraries that secretly make win32 calls. That's where we had our biggest headaches.</p>
<p>In my experience porting an Asp.NET application was basically flawless. Run on 32 bit machine and on 64 bit and no problem happens, beside having more memory available. This happens because a lot of the issues already mentioned (registry, threading and so on) have been managed by Asp.NET and you need to properly fix...
17,488
<p>As a pet-project, I'd like to attempt to implement a basic language of my own design that can be used as a web-scripting language. It's trivial to run a C++ program as an Apache CGI, so the real work lies in how to parse an input file containing non-code (HTML/CSS markup) and server-side code.</p> <p>In my undergra...
<p>You want to look at start conditions. For example:</p> <pre><code>"&lt;?" { BEGIN (PHP); } &lt;PHP&gt;[a-zA-Z]* { return PHP_TOKEN; } &lt;PHP&gt;"&gt;?" { BEGIN (0); } [a-zA-Z]* { return HTML_TOKEN; } </code></pre> <p>You start off in state 0, use the BEGIN macro to change states. To match...
<p>PHP doesn't differentiate between the scanning and the Markup. It simply outputs to buffer when in Markup mode, and then switches to parsing when in code mode. You don't need a two pass scanner, and you can do this with just a single flex lexer. </p> <p>If you are interested in how PHP itself works, download the...
13,057
<p>I am trying something very simple, but for some reason it does not work. Basically, I need to rename some nodes in an XML document. Thus, I created an XSLT file to do the transformation.</p> <p>Here is an example of the XML:</p> <p>EDIT: Addresses and Address elements occur at many levels. This is what caused me t...
<h2>Why might an XSLT fail?</h2> <p>An XSLT will fail because of obvious things like typos. However, the most likely situation relates to namespace usage. If you declared a default namespace for your XML but don't include that in your XSLT, the XSLT won't match the templates as you might expect.</p> <p>The following ...
<p>Maybe this, if the data you show is really like what you got to work with</p> <pre><code>&lt;xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"&gt; &lt;xsl:template match="Businesses"&gt; &lt;Businesses&gt; &lt;xsl:apply-templates/&gt; &lt;/Businesses&gt; &lt;/xsl:template&gt; &lt;x...
34,102
<p>We currently deploy web applications by creating a database and running SQL scripts through query analyzer. Then we copy the output from "publish website" and set up that website in IIS.</p> <p>We have seen websetup in visual studio, but that part seems to be thinly documented. For example, we are not clear how t...
<p>Avoid Visual Studio deployment, and automate as much as possible. Web Deployment Projects and NAnt can be your friends! </p> <p>Briefly, our deployment setup:</p> <ol> <li><p>We use RedGate SQL to script differences between dev and live database.</p></li> <li><p>An NAnt build file which calls MSBUILD to build the ...
<p>I deploy mostly ASP.NET apps to Linux servers. Here is my standard workflow:</p> <ul> <li>I use a source code repository (like Subversion)</li> <li>On the server, I have a bash script that does the following: <ul> <li>Checks out the latest code</li> <li>Does a build (creates the DLLs)</li> <li>Filters the files do...
8,832
<p>I have a WPF application in VS 2008 with some web service references. For varying reasons (max message size, authentication methods) I need to manually define a number of settings in the WPF client's app.config for the service bindings.</p> <p>Unfortunately, this means that when I update the service references in t...
<p>Create a .Bat file which uses svcutil, for proxygeneration, that has the settings that is right for your project. It's fairly easy. Clicking on the batfile, to generate new proxyfiles whenever the interface have been changed is easy.</p> <p>The batch can then later be used in automated builds. Then you only need to...
<p>Somehow I prefer using svcutil.exe directly than to use the "Add Service Reference" feature of Visual Studio :P This is what we're doing on our WCF projects.</p>
9,445
<p>The "core" .NET languages are integrated into VS2008 - C#, VB.NET, and C++. I'm not sure about current support for J# and JScript.</p> <p>But there are a number of other .NET languages out there - A#, Boo, Oxygene, F#, IronLisp/IronScheme, IronPython, IronRuby, Nemerle, Phalanger, P#, PowerShell, and <a href="http:...
<p>I suspect it's pretty simple: IDE integration is no simple task, if you want to do it well. I would guess that most of these languages are done in spare time rather than having commercial funding. The amount of effort required is just prohibitively expensive - and not necessarily due to Visual Studio making things p...
<p>I do agree it would be nice if there were a little broader language support in VS. However, I think they should add support some other non-.NET related languages too. It would be nice if there were support (even if only added via a downloadable addon) for interpreted languages like: Ruby, PHP and Classic ASP.</p> <...
37,427
<p>After a repository is imported from VSS to SVN, there are some files which I guess might be VSS specific - .vsssc and .vssscc files for the solution and .vspscc for projects. They seem to be related to VSS project binding. Are they needed (or useful) for SVN as well?</p>
<p>The .vsssc and .vspscc files contain references to the visal sourcesafe server in which the solution/project was kept. Subversion doesn't need this information as this information (and more) is stored in the .svn areas of your working copy.</p> <p>For the data in the .sln and project files it depends on whether you...
<p>No. No they aren't</p>
34,697
<p>i have the following javascript code:</p> <p><a href="http://www.nomorepasting.com/getpaste.php?pasteid=22561" rel="nofollow noreferrer">http://www.nomorepasting.com/getpaste.php?pasteid=22561</a></p> <p>Which works fine(the makewindows function has been changed to show it is a php variable), however the html cont...
<p><code>json_encode</code> expects strings to be UTF-8 encoded byte streams. You'll have to either use utf-8 encoded strings internally (Which is the only current way to deal with unicode characters in PHP anyway), or use <a href="http://framework.zend.com/manual/en/zend.json.html" rel="nofollow noreferrer">a differen...
<p>i don't think you need json_encode. json_encode encodes PHP arrays and objects to readable JavaScript format. If you send plain text or html within ajax you don't need json_encode</p>
45,488
<p>After making it through the major parts of an introductory Lisp book, I still couldn't understand what the special operator <code>(quote)</code> (or equivalent <code>'</code>) function does, yet this has been all over Lisp code that I've seen. </p> <p>What does it do?</p>
<p><strong>Short answer</strong> Bypass the default evaluation rules and do <em>not</em> evaluate the expression (symbol or s-exp), passing it along to the function exactly as typed.</p> <p><strong>Long Answer: The Default Evaluation Rule</strong></p> <p>When a regular (I'll come to that later) function is invoked, a...
<p>Quote returns the internal representation of its arguments. After plowing through way too many explanations of what quote <em>doesn't</em> do, that's when the light-bulb went on. If the REPL didn't convert function names to UPPER-CASE when I quoted them, it might not have dawned on me.</p> <p>So. Ordinary Lisp f...
16,337
<p>I have the following (shortened query):</p> <pre><code>SELECT `Statistics`.`StatisticID`, COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount` FROM `Statistics` LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID` WHERE `FlagCount` = 0 GROUP BY `Statistics`.`StatisticID` ORDER BY `Submitted...
<p>Use <a href="http://dev.mysql.com/doc/refman/5.0/en/select.html" rel="nofollow noreferrer"><code>HAVING COUNT(DISTINCT Flags.FlagType) = 0</code></a>.</p>
<p>Try this:</p> <pre><code>SELECT `Statistics`.`StatisticID`, COUNT(DISTINCT `Flags`.`FlagType`) AS `FlagCount` FROM `Statistics` LEFT JOIN `Flags` ON `Statistics`.`StatisticID` = `Flags`.`StatisticID` And `FlagCount` = 0 GROUP BY `Statistics`.`StatisticID` ORDER BY `SubmittedTime` DESC ...
40,262