instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>What's the most elegant templating (preferably in pure PHP!) solution you've seen?</p> <p>Specifically i'm interested in handling:</p> <ol> <li>Detecting in a repeating block whether it's the first or last element</li> <li>Easy handling of odd/even cases, like a zebra striped table, or similar</li> <li>Other modul...
<p>You don't need to open the tags more than once. You can also make a function out of it if you do the same thing multiple times:</p> <pre><code>&lt;?php function makeul($items, $classes) { $c = count($classes); $out = ""; if (isset($items) &amp;&amp; count($items) &gt; 0) { $out = "&lt;ul&gt;\n"; for...
<p>I use Modulo like you did in your example all the time.</p>
19,807
<p>Has anyone connected to MSN Messenger from an ASP.NET page? We found this component: <a href="http://www.xihsolutions.net/dotmsn/" rel="nofollow noreferrer">http://www.xihsolutions.net/dotmsn/</a>, but it works only for desktop applications and we couldn't make it work in our web site.</p> <p>Are there any working ...
<p>Yep -> <a href="http://dev.live.com/" rel="nofollow noreferrer">Windows Live Services</a>. More specifically, the <a href="http://dev.live.com/messenger/" rel="nofollow noreferrer">Messenger service</a> and <a href="http://msdn.microsoft.com/en-us/library/bb936682.aspx" rel="nofollow noreferrer">this link</a> is the...
<p>Have you opened port 1863 (= the port messenger uses) in the firewall/router/proxy/... ?</p>
39,765
<p>I'm writing a database application that connects to SQL server. I'd like to implement a similar connection dialog box like the one in SQL Management Studio. I've already found a way to get the list of databases on a server, but I'd really like to get the list of available servers on the network so end users won't ha...
<p>If you are developing your program in .Net you can use the SMO objects to do this. Use the Microsoft.SqlServer.Management.Smo.SmoApplication.EnumAvailableSqlServers method to get a list of all sql servers running in your local network.<br> The scanning taKes a few seconds, but its not very slow.</p>
<p>Not sure if there is a proper way but one hack would be to try to connect to port 1433 (default mssqlserver port) to machines in your network.</p>
47,449
<p>I was just writing some quick code and noticed this complier error </p> <blockquote> <p>Using the iteration variable in a lambda expression may have unexpected results.<br> Instead, create a local variable within the loop and assign it the value of the iteration variable.</p> </blockquote> <p>I know what it me...
<p>Consider this code:</p> <pre class="lang-cs prettyprint-override"><code>List&lt;Action&gt; actions = new List&lt;Action&gt;(); for (int i = 0; i &lt; 10; i++) { actions.Add(() =&gt; Console.WriteLine(i)); } foreach (Action action in actions) { action(); } </code></pre> <p>What would you expect this to prin...
<h1>Theory of Closures in .NET</h1> <p><a href="https://web.archive.org/web/20100123174756/http://www.panopticoncentral.net/archive/2006/03/28/11552.aspx" rel="nofollow noreferrer">Local variables: scope vs. lifetime (plus closures)</a> (Archived 2010)</p> <p>(Emphasis mine)</p> <blockquote> <p>What happens in this cas...
28,198
<p>I have the following property in a custom control:</p> <pre><code>List&lt;myClass&gt; _items; public List&lt;myClass&gt; Items{ get { return _items; } set { _items= value; } } </code></pre> <p>In my codebehind, I add items to the collection as in...</p> <pre><code>myCustomControl.items.Add(new myClass());...
<p>Yikes! Don't put a List&lt;> into the ViewState! It'll be massive!</p> <p>If you add a List&lt;string&gt; that contains two elements - "abc" and "xyz" into the ViewState, it'll grow by 312 bytes.</p> <p>If instead you add a string[] that contains the same two elements, it'll only grow by 24 bytes.</p> <p>And tha...
<p>if you are talking about persisting the data across postbacks of the same page then you can manually add the items to the ViewState and the retrieve them On Load. </p>
47,480
<p>When editing XAML in VS2008 SP1, the editor is really slow. devenv process seems to be around at 40% CPU (the machine I’m using at the moment is only dual core, so that’s almost maxing out one core) most of the time. It spikes up a bit more when I switch to another XAML file. I do also have ReSharper installed, but ...
<p>You can speed it up a lot by only viewing the XML view. Tools / Options / Text Editor / XAML / Always open documents in full XAML view (check this box).</p>
<p>Maybe you can edit the XAML file outside Visual Studio. Use tools like:</p> <ul> <li><a href="http://blogs.msdn.com/llobo/archive/2008/08/25/xamlpadx-4-0.aspx" rel="nofollow noreferrer">XamlPadX 4</a></li> <li><a href="http://www.kaxaml.com/" rel="nofollow noreferrer">Kaxaml</a></li> </ul>
6,004
<p>I am currently working in C#, and I need to insert a new record into one table, get the new primary key value, and then use that as a foreign key reference in inserting several more records. The Database is MS SQL Server 2003. All help is appreciated!</p>
<p>The way to get the identity of the inserted row is with the <code>SCOPE_IDENTITY()</code> function. If you're using stored procedures then this would look something like the following to return the row identity as an output parameter.</p> <pre><code>CREATE PROCEDURE dbo.MyProcedure ( @RowId INT = NULL OUTPUT ) ...
<p>The best way of doing this is the use SCOPE_IDENTITY() function in TSQL. This should be executed as part of the insert i.e.</p> <pre><code>SqlCommand cmd = new SqlCommand(@" INSERT INTO T (Name) VALUES(@Name) SELECT SCOPE_IDENTITY() As TheId", conn); cmd.AddParameter("@Name", SqlDbType.VarChar, 50).Value =...
40,795
<p>One problem I've been toying with off and on is a service that requires my server to produce a screenshot of a webpage at a given url. The problem is that I don't have any idea how I would accomplish this. I mostly use a LAMP software stack, so answers that were given with that in mind would be the most helpful. Aga...
<p>You might also want to take a look at <a href="http://webkit.org/" rel="nofollow noreferrer">webkit</a>, it's known for being easier to embed (used by Adobe for AIR, by Google for Chrome, by Apple for the iPhone...) then other rendering engines. This might take a little more work to setup, but it would be a lot more...
<p>A non-free solution for Java is <a href="http://www.webrenderer.com/" rel="nofollow noreferrer">WebRenderer</a>. Interesting feature: it can emulate Safari, IE or Firefox browsers when rendering. They have a desktop version and a headless server version. Also they have example code showing how to render a screens...
14,490
<p>My webapp is part of a larger EAR that is deployed into a websphere server. The server hosts number of other apps on the same virtual server. My webapp has some initialisation/health checks in a servletContextListener->contextInitialized method. I want to make the webapp unavailable if initialisation/health checks f...
<p>I'd recommend throwing a <code>RuntimeException</code> from <code>ServletContextListener.contextInitialized</code>.</p> <p>Servlet 2.3 wasn't very clear on this, but Servlet 2.4 added the following detail:</p> <blockquote> <p>Some exceptions do not occur under the call stack of another component in the appli...
<p>Throwing a RuntimeException will probably make only that servlet unavailable. A safer way might be to implement something like a Spring interceptor that will forward to an error page or something if the checks didn't pan out. That way, you don't need to prevent the app from loading, but can handle it more graceful...
34,258
<p>I was looking through Mozilla's <a href="http://mxr.mozilla.org/mozilla/source/js/narcissus/jsexec.js" rel="nofollow noreferrer">JS in JS</a> code and came across the <a href="http://mxr.mozilla.org/mozilla/source/js/narcissus/jsexec.js#137" rel="nofollow noreferrer">snarf function</a>. It's not defined in the javas...
<p>No, it is not standard. It is the part of Mozilla's Narcissus (JS in JS interpreter implemented on top of SpiderMonkey). <code>snarf(filename)</code> grabs the content of the file and returns it as a string for further processing (e.g., evaluation).</p>
<p>It loads a file and returns the contents of the file in a string.</p>
47,737
<pre><code>&lt;asp:RadioButton GroupName="EndorsementType" runat="server" ID="rdoAddProperty" Text="Add Property to TIV" /&gt; &lt;asp:RadioButton GroupName="EndorsementType" runat="server" ID="rdoRemoveProperty" Text="Remove Property from TIV" /&gt; &lt;asp:RadioButton GroupName="EndorsementType" runat="server" ID="rd...
<p>If your radios are contained within something like a DIV, and because your asp:RadioButtons will render as HTML inputs, you could do something like:</p> <pre><code>&lt;script type="text/javascript" language="javascript"&gt; function Validate() { var l_elemsRadios = document.getElementById("MyRadios"...
<p>You will have to put your client id out to the form, as with INamingContainer your ID can change in relation to the other information that is stored on the server.</p>
46,096
<p>Is there a C# port of the <a href="http://www.python.org/doc/2.5.2/lib/module-optparse.html" rel="noreferrer">optparse (command line option parser)</a> module from Python available under some <a href="http://www.opensource.org/licenses/alphabetical" rel="noreferrer">OSI-approved license</a>?</p>
<p>Have you already looked at <a href="http://csharpoptparse.sourceforge.net/" rel="nofollow noreferrer">http://csharpoptparse.sourceforge.net/</a> ? I did not read the licensing, but since it it's on sourceforge, I would guess it is OSI approved.</p>
<p>check NOptFunc at <a href="https://github.com/charlescook/noptfunc" rel="nofollow">https://github.com/charlescook/noptfunc</a></p> <p>Author blogged about it here when he started it.. <a href="http://cookcomputing.com/blog/archives/000599.html" rel="nofollow">http://cookcomputing.com/blog/archives/000599.html</a></...
44,500
<p>I'm writing (in C# with .NET 3.5) an administrative application which will poll multiple Windows systems for various bits of data. In many cases it will use WMI, but in some cases it may need to read remote registry or remotely execute some command or script on the polled system. This polling will happen at repeatin...
<p>The answer is here:</p> <p><a href="https://stackoverflow.com/questions/40853/how-to-store-passwords-in-winforms-application#40867">How to store passwords in Winforms application?</a></p>
<p>Well it seems that your program needs to impersonate a user other than the context under which it is already running. Although, it does look like a pretty automated process, but if it's not, can you simply not ask the administrator to put in username and password at the time this 'black-sheep' computer is being poll...
6,949
<p>How to get the relative path in t sql? Take for example a <code>.sql</code> file is located in the folder <code>D:\temp</code>, I want to get path of the file hello.txt in the folder <code>D:\temp\App_Data</code>. How to use the relative path reference?</p> <p>Let's say I am executing the sql file inside the SQL se...
<p>The server is executing the t-sql. It doesn't know where the client loaded the file from. You'll have to have the path embedded within the script.</p> <pre><code>DECLARE @RelDir varchar(1000) SET @RelDir = 'D:\temp\' ... </code></pre> <p>Perhaps you can programmatically place the path into the SET command within...
<p>well it's not a Microsoft thing first off... it's an industry standard thing. second your solution for running T-SQL with a relative path is to use a batch script or something to inject your path statement IE:</p> <pre><code>@echo OFF SETLOCAL DisableDelayedExpansion FOR /F "usebackq delims=" %%a in (`"findstr /n ^...
16,850
<p>In <code>Eclipse PDT</code>, <code>Ctrl-Shift-F</code> reformats code. However, it doesn't modify comments at all. Is there some way to reformat ragged multi-line comments to 80 characters per line (or whatever)?</p> <p>i.e. convert</p> <pre><code>// We took a breezy excursion and // gathered Jonquils from the ...
<p>You probably need to configure the Java formatter to include comments.</p> <p>Preferences -> Java -> Code Style -> Formatter -> Edit... -> Comments</p> <p>Make sure that "Enable XXX comment formatting" is enabled.</p>
<p>I've never really been able to get the Eclipse formatter to format my code <em>exactly</em> how I want, and this is just one of several shortcomings I've encountered. I've heard the Jalopy formatter is much better. There's both a <a href="http://www.triemax.com/" rel="nofollow noreferrer">commercial</a> and <a href=...
16,070
<p>It's common to have a table where for example the the fields are account, value, and time. What's the best design pattern for retrieving the last value for each account? Unfortunately the last keyword in a grouping gives you the last physical record in the database, not the last record by any sorting. Which means...
<p>The subquery option sounds best to me, something like the following psuedo-sql. It may be possible/necessary to optimize it via a join, that will depend on the capabilities of the SQL engine.</p> <pre><code>select * from table where account+time in (select account+max(time) from table ...
<p>@shs<br> yes, that select last(value) SHOULD work, but it doesn't... My understanding although I can't produce an authorative source is that the last(value) gives the last physical record in the access file, which means it could be the first one timewise but the last one physically. So I don't think you should use...
6,964
<p>When I first load data into a Silverlight DataGrid control, how can I make the screen look exactly as if the user had just clicked the header of the first column? In other words, the data should be sorted in ascending order according to that column's values, AND the little sort arrow should be displayed in the firs...
<p>I needed to do this as well, and looked hard and deep at whether the DataGrid could do this.</p> <p>There IS in fact an appropriate method on the DataGridColumnHeader class, namely InvokeProcessSort, but it's internal and not surfaced anywhere else in the DataGrid classes.</p> <p>All I've been able to do is pre-so...
<p>There exists a CollectionViewSource in Silverlight 3+</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource(v=vs.95).aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/system.windows.data.collectionviewsource(v=vs.95).aspx</a></p> <p>There is an easy way to defi...
27,999
<p>First, two examples:</p> <pre><code>// This works int foo = 43; long lFoo = foo; // This doesn't object foo = (int)43; long? nullFoo = foo as long?; // returns null long lFoo = (long)foo; // throws InvalidCastException if (foo.GetType() == typeof(int)) Console.WriteLine("But foo is an int..."); // This gets wr...
<pre><code>object foo = (int) 43; long lFoo = ((IConvertible) foo).ToInt64(null); </code></pre>
<p>Its not just you, however tryparse does not raise an exception.</p> <pre><code>object foo = (int)43; long outVal; if(long.TryParse(foo.ToString(),out outVal)) { //take action with correct value of long } else { //maybe passed you another type of object } </code></pre>
21,322
<p>I am not sure if I formulated the question right, but still ...</p> <p>I have a view that shows a flash embed and this flash take as parameter a <code>/controller/action</code> URL that generates a XML. I nee to send, from this view, an array to the XML generator action. How is the best way ? Is there some <code>he...
<p>If the array is small enough, serialize then urlencode it and add it as a paramter to the url to your generate action:</p> <p>player.ctp</p> <pre><code>so.addVariable('file','/xml/generate/&lt;?php echo urlencode(serialize($array)); ?&gt;'); </code></pre> <p>then read it back:</p> <pre><code>public function gene...
<p>You can send an array with data from a view to a controller in CakePHP like this.</p> <p>To the link you can pass arguments:</p> <pre><code>www.site.com/model/action/param1:foo/param2:test </code></pre> <p>You can then retrieve them in the controller action in the following way:</p> <pre><code>$yourarray = $this...
19,564
<p>I have two LINQ objects which have exactly the same columns and I would like to be able to update one with the fields from the other. I first create a new object from some data in a file, then I query the database for an existing item with the same ID. What I would like to be able to do is update the existing obje...
<p>I do this sort of thing when I create an instance of an object from a template. Basically I have a method that iterates over the public properties of the template, finds the corresponding property in the object being created, and invokes the property setter on the new object, all via reflection.</p>
<p>I haven't tested this yet but this is what I have come up with.</p> <pre><code> Dim _OldCallerProperties = OldCaller.GetType().GetProperties(Reflection.BindingFlags.Public) Dim _NewCallerProperties = NewCaller.GetType.GetProperties(Reflection.BindingFlags.Public) For Each Prop In _OldCallerP...
27,660
<p>I have been working with a <code>string[]</code> array in C# that gets returned from a function call. I could possibly cast to a <code>Generic</code> collection, but I was wondering if there was a better way to do it, possibly by using a temp array.</p> <p><strong>What is the best way to remove duplicates from a C#...
<p>You could possibly use a LINQ query to do this:</p> <pre><code>int[] s = { 1, 2, 3, 3, 4}; int[] q = s.Distinct().ToArray(); </code></pre>
<pre><code>using System; using System.Collections.Generic; using System.Linq; namespace Rextester { public class Program { public static void Main(string[] args) { List&lt;int&gt; listofint1 = new List&lt;int&gt; { 4, 8, 4, 1, 1, 4, 8 }; List&lt;int&gt; updatedlist= rem...
3,106
<p>I get an <code>error: printer halted. (kill() called!</code> Any time I home my machine's X or Y axis. I have just installed a 3D touch auto bed level sensor, ironically it works fine. I was using Sprinter firmware but it doesn't support auto bed level, so thus I'm using Marlin. I am using the latest version of Marl...
<p><a href="https://i.stack.imgur.com/gMDDx.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/gMDDx.png" alt="enter image description here"></a></p> <p>That's a filament cleaner/oiler combo. The black bottle is a variety of machine oil. </p> <p>The effect of oilers on prints is heavily disputed in th...
<p>For really long Bowden tubes, some people use Teflon lubricant in a cleaner bead.</p> <p>Never used it myself, since I use a small tube my printer with the stepper on top of one of the Z axis steel rod mounting plates (Anet A8).</p> <p>Off topic, but by cooking and being a vaper, I vouch that organic compounds lea...
1,171
<p>I am having my web application deployed on Tomcat5.5 and I use it in integration with eclipse 3.2.Each time I close the eclipse and restart it, I need to republish the application even when it hasn't been modified. </p> <p>Is there a way to avoid this or any step I am missing ?</p>
<p>Go to Preferences->Server->Launching . Remove option 'Automatically Publish When Starting Server'</p>
<p>Do eclipse 3.3 or 3.4, or later versions of WTP behave the same way for you?</p>
15,327
<p>Why is it that in a C# switch statement, for a variable used in multiple cases, you only declare it in the first case?</p> <p>For example, the following throws the error "A local variable named 'variable' is already defined in this scope".</p> <pre><code>switch (Type) { case Type.A: string variable...
<p>If you want a variable scoped to a particular case, simply enclose the case in its own block:</p> <pre><code>switch (Type) { case Type.A: { string variable = "x"; /* Do other stuff with variable */ } break; case Type.B: { string variable = "y"; /* Do other st...
<p>The initialization takes place in the case, but the declaration is effectively done at the top of the scope. (Psuedo-code)</p> <pre><code>switch (Type) { string variable; case Type.A: variable = "x"; break; case Type.B: variable = "y"; break; } </code...
27,467
<p>I am using a custom validator to compare value in two text box. This is comparing the values fine. But it says "025" and "25" are different.. can this do a float comparision.</p> <p>the custom validator i am using is </p> <pre><code>&lt;asp:CompareValidator id="compval" runat="server" ControlToValidate="txtBox1" ...
<p>Use System.Double.Parse(value) to convert both to a floating point number, and compare those numbers.</p> <p>You can also use TryParse if you don't want to handle exceptions if the value is not a valid floating point number.</p> <p>See also: </p> <ul> <li><a href="http://msdn.microsoft.com/en-us/library/system.do...
<p>use a compare validator with a type of int?</p>
39,749
<p>I have faced this problem quite often during the last couple of months, during which I've been building this system. The scenario is this: I have this kind of object that essentially is a list of other objects, but has some other properties specific of its nature. For example:</p> <ul> <li>Class <code>Tests</code>:...
<p>Contrary to most of the answers here I wouldn't subclass from List in most cases. I found that inheriting from a class to reuse functionality usually causes problems later.</p> <p>I usually just have a property of type List (or IList) that returns a reference to the list. Usually you only need a get property here. ...
<p>In your example you said "Class Tests contains many Test objects", not "Class Tests is a collection of Tests objects". IMO it is not necessary to subclass List in this scenario unless you need to have List-like interface for this class.</p> <p>However, answer really depends on context of Tests class. If it behaves ...
26,748
<p>I'm attempting to debug my web application with FireFox3. However, when a JSON feed comes from my application, Firefox wants to open up the "application/json" in a new program. Is there a way to configure FireFox3 to handle JSON like regular text files and open up the JSON in the current tab?</p> <p>Thanks.</p>
<p>Try the <a href="http://www.spasche.net/openinbrowser/" rel="noreferrer">Open in browser extension</a>.</p> <p>[edit 30.05.2010 - updated the link]</p>
<p>Having JSON sent with an application/json mimetype is correct and changing that would be wrong.</p> <p>text/javascript is considered obsolete.</p>
12,037
<p>We maintain a system that has over a million lines of COBOL code. Does someone have suggestions about how to migrate to a GUI (probably Windows based) without losing all the business logic we have written in COBOL? And yes, some of the business logic is buried inside the current user interface.</p>
<p>If it was me I would look into something like this:</p> <p><a href="http://www.adtools.com/products/windows/cobol.htm" rel="nofollow noreferrer">NetCobol for Windows</a></p> <p>It should be fairly easy to wrap your COBOL with an interface that exposes the functionality (if it isn't already written that way) and t...
<p><a href="http://www.microfocus.com/" rel="nofollow noreferrer">Microfocus</a> provide a tool called Enterprise Server which allows COBOL to interact with web services.</p> <p>If you have a COBOL program A and another COBOL program B and A calls B via the interface section, the tool allows you to expose B's interfac...
6,931
<p>I am just starting a new ASP.NET project and using the MVP pattern. I did consider the MS MVC but it is not released yet and would be a big learning curve for some people on the team, so I opted for MVP now and possibly future projects MVC.</p> <p>Anyway, it seems I will have a single Controller/Presenter class for...
<p>This seems to be a common misconception -> "More files/classes == more complex"</p> <p>The reason we chose to follow a UI separation pattern is to help separate concerns, make code easier and cheaper to change and maintain and (big, important <strong>and</strong>) we can unit test the complex parts and still keep t...
<p>I think a lot of it depends but in most cases that is really the way it ends up going.</p> <p>I personally use a n-tier architecture with data, business, presentation code. (Who knows what actual format I follow). I do get a lot more files than if I did everything in the aspx, but the code is much easier to manag...
27,604
<p>When writeing unit tests for a single class that contains other objects what's the best way to use </p> <p>mock objects to avoid tests dependant on other classes. </p> <p>Example 1:</p> <pre><code>public class MyClass { protected MyObject _obj; public MyClass() { _obj = new MyObject(); } p...
<p>I recommend that you take a look at dependency injection. One thing is using mock objects, but unless you're using something like TypeMock, which basically lets you modify you code on the fly, you want to have a way to inject the instances your class depends on if you want to get rid of the dependencies. So in examp...
<p>Have you tried deriving a UTMyClass from MyClass? </p>
39,495
<p>I'm trying to subtract a polyhedron from a cube, but it is not working (the cube remains solid). However, I can see the cut-out poly in preview mode (but not after a full render).</p> <p><strong>Preview</strong> -- poly cutout shows on the top (and bottom).</p> <p><a href="https://i.stack.imgur.com/Zk1Z5.png" rel="n...
<p>Usually when there's an overlap in two objects during a difference action, F6 render will resolve the problem. There's something more than that involved here, as reducing the height of the cube creates a non-manifold object from the difference. user R..'s answer has merit but is not going to solve the problem.</p> <...
<p>If the polyhedron surface and top surface of the cube are exactly coplanar, which they seem to be, it won't work; OpenSCAD operates numerically rather than analytically and which is &quot;inside&quot; or &quot;outside&quot; the other is subject to numerical instability. Whenever using differences you need to make th...
1,784
<p>I've set the MaxDate and MinDate properties of a DateTimePicker. However, when I test the control at runtime, there is no way to tell the invalid dates from the valid ones. The only difference is that clicking on an invalid date does nothing.</p> <p>This is not very intuitive for the user. I want to be able to tell...
<p>I have a similar issue. I've extended the DateTimePicker control to run a validate process whenever the value changes and to either revert to the previous value or to the nearest legal value in the event of an illegal choice. </p> <p>The logical extension to this is to flash up a warning dialog or label to inform t...
<p>Im not sure that there is without extending the control yourself, and owner drawing which would be an effort.</p> <p>If you cant find the functionality your after, I would consider the use of an ErrorProvider control and validating the users input as an option.</p>
16,181
<p>Hi i need to generate 9 digit unique account numbers. Here is my pseudocode:</p> <pre><code>function generateAccNo() generate an account number between 100,000,000 and 999,999,999 if the account number already exists in the DB call generateAccNo() /* recursive call */ else return n...
<p>You realize this could very well cause a stack overflow, right? As the number of customesr increases, the probability of not finding a an acceptable account number increases. </p> <p>Also, why can't you just do sequential account numbers and just increase by one every time? With this approach, you'd just have to r...
<p>You do not need to use recursion here. A simple loop would be just as fast and consume less stack space.</p>
12,388
<p>Here I have:</p> <pre><code>Public Structure MyStruct Public Name as String Public Content as String End Structure Dim oStruct as MyStruct = New MyStruct() oStruct.Name = ... oStruct.Content = ... Dim alList as ArrayList = new ArrayList() alList.Add(oStruct) </code></pre> <p>I'd like to convert the ArrayLi...
<p>You have to cast the result of <code>ToArray</code></p> <pre><code>MyStruct[] structs = (MyStruct[]) alList.ToArray(typeof(MyStruct)); </code></pre>
<p>This worked for me</p> <pre><code>Dim array As MyStruct() = alList.ToArray(GetType(MyStruct)) </code></pre>
22,808
<p>Is this still the recommended library in use? ThickBox 3.1</p>
<p>The <code>rel</code> attribute is supposed to describe the relationship of the link to the current document. It should have one of the values described <a href="http://www.w3.org/TR/html401/types.html#type-links" rel="nofollow noreferrer">here</a>. A DIV is a block-level grouping element, whereas a SPAN is an inli...
<p>The rel attribute isn't typically used by many UAs (user agents) however it specifies what relation the linked page is to the current page.</p> <p>Certain pseudo-standards have popped up around the place for example Mozilla uses the <a href="http://simonwillison.net/2002/Oct/17/mozillaPrefetching/" rel="nofollow no...
43,708
<p>I have a web application that uses the current version of JQuery that needs to get some JSON objects back from a REST web service. I'm using the following call to $.getJSON:</p> <p>$.getJSON("<a href="http://localhost:17245/Service.svc/?format=json" rel="nofollow noreferrer">http://localhost:17245/Service.svc/?form...
<p>I had a similar issue. The signature $.getJSON is (url, data, callback) and I was not passing the data argument either. Try this:</p> <pre><code>$.getJSON("http://localhost:17245/Service.svc/?format=json", {}, function(data) {alert(data.id);}); </code></pre>
<p>I was running into problems using web services from jQuery for a while until I found the <a href="http://blog.dogma.co.uk/search/label/ajaxdotnet" rel="nofollow noreferrer" title="ajaxdotnet">ajaxdotnet</a> plugin.</p>
46,649
<p>When I <kbd>Alt</kbd>+<kbd>Tab</kbd> to my VM from my host the VM does not get keyboard input until I click inside it. This is causing me an issue as it looks like the VM has control of the input (as the cursor is flashing away). If while in this state, VMWare server has the focus rather then the application insid...
<p>This will not remove the key binding from VmWare, but you could set the option to "Grab keyboard and mouse intput on key press" in the VmWare preferences. VmWare help explicitly states that this will disable the system accelerator key sequences.</p>
<p>You could use a resource editor on <code>vmware.exe</code> to remove the keybinding for <kbd>Ctrl</kbd>+<kbd>Z</kbd>. Obviously not for the faint of heart.</p>
23,979
<p><em>This is javascript, but a virtually identical regex is failing in PHP too, so I don't think it's language specific</em></p> <pre><code>var r = new RegExp( "^(:19|20)?[0-9][0-9]" // optional 19/20 start followed by 2 numbers + "-" // a hyphen + "(:0?[1-9]|1[0-2]...
<p>I think your non-capturing blocks should be e.g. <code>(?:19|20)</code> rather than <code>(:19|20)</code></p>
<p>Correct; your regular expression would actually work with <code>?:</code></p> <p><code>?</code> when used a prefix indicates that you're going to do something about capturing. Either not capture the block <code>(:)</code>, capture ahead <code>(=)</code>, behind <code>(&lt;=)</code>, etc.</p>
32,208
<p>This is re-posted from something I posted on the DDD Yahoo! group.</p> <p>All things being equal, do you write phone.dial(phoneNumber) or phoneNumber.dialOn(phone)? Keep in mind possible future requirements (account numbers in addition to phone numbers, calculators in addition to phones).</p> <p>The choice tends t...
<p><code>phone.dial()</code>, because it's the phone that does the dialing.</p> <p>Actor.Verb( inputs ) -> outputs.</p>
<p>Not to be the negative one here, but these kinds of questions are very academic. It completely depends on the application. I can think of very good reasons for doing it either way, and I've seen too many good programmers get bogged down in this kind of moot design details.</p>
9,415
<p>How do I convert a date string, formatted as <code>"MM-DD-YY HH:MM:SS"</code>, to a <code>time_t</code> value in either C or C++? </p>
<p>Use <code>strptime()</code> to parse the time into a <code>struct tm</code>, then use <code>mktime()</code> to convert to a <code>time_t</code>.</p>
<pre><code> static time_t MKTimestamp(int year, int month, int day, int hour, int min, int sec) { time_t rawtime; struct tm * timeinfo; time ( &amp;rawtime ); timeinfo = gmtime ( &amp;rawtime ); timeinfo-&gt;tm_year = year-1900 ; timeinfo-&gt;tm_mon = month-1; timeinfo-&gt;tm_mday = day;...
41,652
<p>I have often wondered why it is that non-English speaking programmers are forced to use a different language when programming when it would seem to be so easy to offer an IDE that could replace keywords with localized versions. Why can't the Germans use a "während..macht" loop?</p> <p>Do programmers in Japan, Germa...
<p>In most programming languages, keywords are reserved, so they can't be used for variable names etc.</p> <p>Now suppose the keywords changed every time you changed culture - code written in one culture couldn't be ported to another without changing identifiers. Ick. Furthermore, when anyone copied their code onto a ...
<p>This is the same as air traffic control. It's been pretty much standardized in English. While that may make flying slightly more difficult if your native language isn't English, it's not too difficult to learn the specific subset of English necessary to get the job done... but could you imagine what would happen if ...
36,657
<p>I'm trying to find the replacement for kicker.bundle that was found in /System/Library/SystemConfiguration in OS X pre 10.5 (Leopard). I can't seem to find any sort of official documentation on the matter. Does anyone know what the replacement is?</p> <p>Thanks, k.</p>
<p>I've spent a fair amount of time looking for a solution. Doesn't seem like there is a direct replacement for kicker.bundle and kicker.xml to help launch a script when a network change occurs. That said I have found another solution that will probably do the trick:</p> <p><a href="http://tech.inhelsinki.nl/locationc...
<p>The Apple source code to configd contains a kicker plugin, I tried to compile it but it loads with some kind of circular reference error. Maybe some slick programmer could figure it out.</p>
46,731
<p>I've seen projects where the classes in the DB layer have just static functions in them and other projects where those classes need to be instantiated to get access to the member functions. </p> <blockquote> <p>Which is "better" and why?</p> </blockquote>
<p>I like a single object to be correlated to a single record in the database, i.e. an object must be instantiated. This is your basic <a href="http://martinfowler.com/eaaCatalog/activeRecord.html" rel="nofollow noreferrer">ActiveRecord</a> pattern. In my experience, the one-object-to-one-row approach creates a much ...
<p>It depends which model you subscribe to. ORM (Object Relational Model) or Interface Model. ORM is very popular right now because of frameworks like nhibernate, LINQ to SQL, Entity Framework, and many others. The ORM lets you customize some business constraints around your object model and pass it around with out ...
3,702
<p>In what segment (.BSS, .DATA, other) of an executable file are static variables stored so that they don't have name collision? For example:</p> <pre><code> foo.c: bar.c: static int foo = 1; static int foo = 10; void fooTest() { void barTest() { static int bar = 2; ...
<p>Where your statics go depends on whether they are <em>zero-initialized</em>. <em>zero-initialized</em> static data goes in <a href="http://en.wikipedia.org/wiki/.bss" rel="noreferrer">.BSS (Block Started by Symbol)</a>, <em>non-zero-initialized</em> data goes in <a href="http://en.wikipedia.org/wiki/Data_segment" re...
<p>you already know either it store in bss(block start by symbol) also referred as uninitialized data segment or in initialized data segment.</p> <p>lets take an simple example</p> <pre><code>void main(void) { static int i; } </code></pre> <p>the above static variable is not initialized , so it goes to uninitialize...
11,850
<p>We are using the MVC framework (release 5) and the CrystalReportViewer control to show our reports. I cannot get any of the buttons at the top of the report viewer control to work.</p> <p>If I'm working with the report 'HoursSummary'. If I hover over any of the buttons on the report viewer in IE the displayed lin...
<p>You're looking for the <code>sealed</code> keyword. It does exactly what the <code>final</code> keyword in Java does. Attempts to inherit will result in a compilation error.</p>
<p>The <code>sealed</code> keyword would work, but still you can derive from the class using reflection IIRC.</p>
18,704
<p>Is anyone aware of any gems, tutorials, or solutions enabling a user to sign in to a website at one domain and automatically given access to other partner domains in the same session? </p> <p>I have two rails apps running, let's call them App-A and App-B. App-A has a database associated with it, powering the regist...
<p>You can set the same session_key in both apps. In appA environment.rb change the session_key, like this</p> <pre><code>Rails::Initializer.run do |config| ... config.action_controller.session = { :session_key =&gt; '_portal_session', :secret =&gt; '72bf006c18d459acf51836d2aea01e0afd0388f860fe4b07a9a...
<p>If you want to create single sign-on solution for your applications then I recommend to take a look at <a href="http://code.google.com/p/rubycas-server/" rel="nofollow noreferrer">RubyCAS</a> solution. It could be used also to provide single sign-on for other non-Rails applications as well as you can integrate authe...
34,565
<p>What is the right way to perform some static finallization? </p> <p>There is no static destructor. The <code>AppDomain.DomainUnload</code> event is not raised in the default domain. The <code>AppDomain.ProcessExit</code> event shares the total time of the three seconds (default settings) between all event handlers,...
<p>Basically, you can't. Design your way around it to the fullest extent possible.</p> <p>Don't forget that a program can <em>always</em> terminate abruptly anyway - someone pulling out the power being the obvious example. So anything you do has to be "best effort" - in which case I'd certainly <em>hope</em> that <cod...
<p>To port Michael Damatov's answer (C#) which is based on Herfried K. Wagner. (VB.NET) here is the C++/CLI version:</p> <pre><code>ref class MyClass { ref class StaticFinalizer sealed { !StaticFinalizer(); }; static initonly StaticFinalizer^ stDestr = gcnew StaticFinalizer(...
31,955
<p>I have a grid that is binded to a collection. For some reason that I do not know, now when I do some action in the grid, the grid doesn't update.</p> <p>Situation : When I click a button in the grid, it increase a value that is in the same line. When I click, I can debug and see the value increment but the value do...
<p>In order for the binding to be bidirectional, from control to datasource and from datasource to control the datasource must implement property changing notification events, in one of the 2 possible ways:</p> <ul> <li><p>Implement the <a href="https://learn.microsoft.com/en-us/dotnet/api/system.componentmodel.inotif...
<p>It sounds like you need to call DataBind in your update code.</p>
14,367
<p>I have a class that after it does some stuff, sends a JMS message. I'd like to unit test the "stuff", but not necessarily the sending of the message. <br><br>When I run my test, the "stuff" green bars, but then fails when sending the message (it should, the app server is not running). What is the best way to do this...
<p>The simplest answer I would use is to stub out the message sending functionality. For example, if you have this:</p> <pre><code>public class SomeClass { public void doit() { //do some stuff sendMessage( /*some parameters*/); } public void sendMessage( /*some parameters*/ ) { /...
<p>This is the perfect candidate to use jMock unit testing since your server is not running but you would use jMock to simulate interaction with the server.</p>
43,539
<p>I just came over this syntax in some of the questions in this forum, but Google and any other searchengine tends to block out anything but letters and number in the search so it is impossible to search out "=>".</p> <p>So can anyone tell me what it is and how it is used? </p>
<p>It's the lambda operator.</p> <p>From C# 3 to C# 5, this was only used for <a href="http://msdn.microsoft.com/en-us/library/bb397687.aspx" rel="noreferrer">lambda expressions</a>. These are basically a shorter form of the <a href="http://msdn.microsoft.com/en-us/library/0yw3tz5k.aspx" rel="noreferrer">anonymous met...
<p>It basically means "goes into", like a parameter</p> <pre><code>MyObjectReference =&gt; MyObjectReference.DoSomething() </code></pre> <p>Usually you use them to pass functions into methods as parameters, or in LINQ statements</p> <pre><code>MyCollection.Where(myobj =&gt; myobj.Age&gt;10) </code></pre> <p>For exa...
36,964
<p>Can anyone recommend a good resource -- book, website, article, etc -- to help me learn SQL Server Analysis services.</p> <p>I have no knowledge of this technology right now but I do constantly work with SQL server in the traditional sense. </p> <p>I want to learn about Cubes and Using Reporting Services with it. ...
<p>Take a look <a href="https://stackoverflow.com/questions/101242/nice-book-on-sql-server-analysis-services">Here</a> for a list of AS resources I compiled in answer to a similar question.</p>
<p>Here's a link to <a href="http://msdn.microsoft.com/en-us/library/ms175609(SQL.90).aspx" rel="nofollow noreferrer">Analysis Services Books online</a>. It's a decent resource, and completely free. </p>
12,821
<p>Does anyone know of any free tools that can assist in converting an <code>SQL2005</code> database back to <code>SQL2000</code> format? I know that you can script all the objects and then do a dump of the data, but this is a lot of work to do manually.</p>
<p>Reviewing some other related questions I just found Microsoft's <a href="http://www.codeplex.com/sqlhost/Wiki/View.aspx?title=Database%20Publishing%20Wizard" rel="nofollow noreferrer">Database Publishing Wizard</a>. It does most of what I need, although I have used nVarChar(max) in a couple of places and it simply ...
<p>Have you considered using DTS to transfer the data across? It should be independant of the version.</p>
6,457
<p>What are best tools available for Data Capturing from Scanned Images? Doesn't matter they are free or paid. They should be able to convert scanned images to data (text, image, tables etc.). <strong>Most importantly they should have API to integrate with .NET 2.0 for automation.</strong></p> <p> <strong>Edit: The in...
<p>Here are some example products:</p> <p><a href="http://asprise.com/product/ocr/index.php?lang=csharp" rel="nofollow noreferrer">Aspire</a></p> <p><a href="http://www.ocrtools.com/" rel="nofollow noreferrer">Ocrtools</a></p> <p><a href="http://sourceforge.net/search/?type_of_search=soft&amp;words=ocr+c%23" rel="no...
<p>You mean <a href="http://en.wikipedia.org/wiki/Optical_character_recognition" rel="nofollow noreferrer">OCR (Optical Character Recognition)</a>?</p>
44,640
<p>There are many ways of doing debugging, using a debugger is one, but the simple one for the humble, lazy, programmer is to just add a bunch of print statements to your code.</p> <p>i.e.</p> <pre><code> def foo(x): print 'Hey wow, we got to foo!', x ... print 'foo is returning:', bar return ba...
<p>Yes - it's known as <strong><code>printf()</code> debugging</strong>, named after the ubiquitous C function:</p> <blockquote> <p>Used to describe debugging work done by inserting commands that output more or less carefully chosen status information at key points in the program flow, observing that inf...
<p>Manual Assertions? Debugger Phobia?</p>
22,998
<p>As already discussed in "<a href="https://stackoverflow.com/questions/250151/lua-as-a-general-purpose-scripting-language">Lua as a general-purpose scripting language?</a>" Lua currently probably isn't the best scripting language for the desktop environment.</p> <p>But what do you think about the future? Will Lua ge...
<p>I think it has a great future, a lot of projects are starting to adopt it for it's simplicity and usefulness.</p> <p><strong>Example:</strong> <strong><a href="http://awesome.naquadah.org/" rel="noreferrer">Awesome WM</a></strong> (Window Manager)</p> <p>The project recently released version 3, incorporating a new c...
<p>Warhammer Online, and World of Warcraft use it for their addon language I believe.</p> <p>I think it's hot! I'm just no good at it!</p>
33,917
<p>I have a folder in my web server used for the users to upload photos using an ASP page.</p> <p>Is it safe enough to give IUSR write permissions to the folder? Must I secure something else? I am afraid of hackers bypassing the ASP page and uploading content directly to the folder.</p> <p>I'm using ASP classic and I...
<p>also, I would recommend not to let the users upload into a folder that's accessible from the web. Even the best MIME type detection may fail and you absolutely don't want users to upload, say, an executable disguised as a jpeg in a case where your MIME sniffing fails, but the one in IIS works correctly.</p> <p>In t...
<p>You'll have to grant write permissions, but you can check the file's mime type to ensure an image. You can use FSO as so:</p> <pre><code>set fs=Server.CreateObject("Scripting.FileSystemObject") set f=fs.GetFile("upload.jpg") 'image mime types or image/jpeg or image/gif, so just check to see if "image" is instr if ...
4,256
<p>In Sharepoint, is it possible to deny regular users the possibility of removing web parts and/or web part zones? If yes; how?</p>
<p>The options to deny users from closing/moving a web part are in the 'Advanced' section of the web part's tool pane in sharepoint (Accessed via the 'Modify Shared Web Part' option in the web part's menu).</p> <p>Alternatively you can modify the permission levels for the site (Site settings > Permissions > Settings >...
<p>This can be controlled through site roles. By default, the available roles are Full Control, Design, Contribute, Read, and Limited Access.</p> <p>Users that are not members of Contribute or higher will not be able to remove web parts or web part zones for that site.</p>
41,872
<p>Has anyone managed to use <code>ItemizedOverlays</code> in Android Beta 0.9? I can't get it to work, but I'm not sure if I've done something wrong or if this functionality isn't yet available. </p> <p>I've been trying to use the <code>ItemizedOverlay</code> and <code>OverlayItem</code> classes. Their intended purpo...
<p>For the sake of completeness I'll repeat the discussion on Reto's post over at the <a href="http://groups.google.com/group/android-developers/browse_thread/thread/36fe0648dabfe745#" rel="noreferrer">Android Groups here</a>.</p> <p>It seems that if you set the bounds on your drawable it does the trick:</p> <pre><co...
<p>try :</p> <pre><code>Drawable defaultMarker = r.getDrawable(R.drawable.icon); defaultMarker.setBounds(0, 0, defaultMarker.getIntrinsicWidth(), defaultMarker.getIntrinsicHeight()); MyItemizedOverlay markers = new MyItemizedOverlay(defaultMarker); overlays.add(markers); </code></pre>
4,592
<p>I'm refactoring some objects that are serialized to XML but need to keep a few properties for backwards compatibility, I've got a method that converts the old object into the new one for me and nulls the obsolete property. I want to use the <code>Obsolete</code> attribute to tell other developers not to use this pro...
<p><em>EDIT</em>: <a href="https://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=94241&amp;wa=wsignin1.0" rel="noreferrer">After reading a MS Connect article</a>, it appears that .Net 2.0 has a 'feature' where it makes ObsoleteAttribute equivalent to XmlIgnoreAttribute without any notificatio...
<p>You may try the following workaround:</p> <p>add a method named</p> <pre><code>ShouldSerializeOldObject () { return true; } ShouldSerializeAnotherOldObject () { return true } </code></pre> <p>this may override the obsolete Attribute</p>
42,876
<p>I've worked on a few projects managed through the use of a Gantt chart. Some of these have has a massive number of tasks and the project manager spends all their time wrestling with MS Project instead of making good choices.</p> <p>I can see the point if there are a number of separate teams working towards somethi...
<p>Micromanaging software development projects using MS Project is one of the more stupid things someone can do, especially in an agile environment. Too many things that take 1/10th or 10x the time that you predicted, too many things that overrun, and too many project planning meetings eating up useful work time.</p> ...
<p>A Gantt chart is only useful if it has sufficient details for a project manager to see what is the status of the project, and to have dependencies and resources properly accounted for.</p> <p>You can always stick several sheets together with sticky tape.</p> <p>The discipline of analyzing the project - breaking it...
16,867
<p>How can I display a tooltip over a button using <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="noreferrer">Windows Forms</a>?</p>
<p>The ToolTip is a <strong>single</strong> WinForms control that handles displaying tool tips for <strong>multiple</strong> elements on a single form.</p> <p>Say your button is called MyButton.</p> <ol> <li>Add a ToolTip control (under Common Controls in the Windows Forms toolbox) to your form.</li> <li>Give it a name...
<p>Sure, just handle the mousehover event and tell it to display a tool tip. t is a tooltip defined either in the globals or in the constructor using:</p> <pre><code>ToolTip t = new ToolTip(); </code></pre> <p>then the event handler:</p> <pre><code>private void control_MouseHover(object sender, EventArgs e) { t.Sh...
20,347
<p>Imagine the following</p> <p>A type T has a field Company. When executing the following method it works perfectly:</p> <pre><code>Type t = typeof(T); t.GetProperty("Company") </code></pre> <p>Whith the following call I get null though</p> <pre><code>Type t = typeof(T); t.GetProperty("company", BindingFlags.Ignor...
<p>You've overwritten the default look-up flags, if you specify new flags you need to provide all the info so that the property can be found. For example: <code>BindingFlags.IgnoreCase | BindingFlags.Public | BindingFlags.Instance</code></p>
<p>Thanks, this really helped me out in a pinch today. I had audit information saved, but with incorrect casing on the property names. (The auditing is built into a datalayer.) Anyway so I had to add IgnoreCase as a binding flag, but then it still didn't work, till my coworker found this answer. The resulting funct...
33,172
<p>About 5000 computers will be making a call to a central server, and they will be passing in a GUID to the central server.</p> <p>The server will then return True/False back to the client.</p> <p>Is there a big difference in <strong>performance</strong> between a web service and a regular Http request to a Url on t...
<p>I assume by Web Serivce you mean SOAP. My experience with various SOAP stacks on different platforms (Java, .NET, Ruby, PHP) is that in this case you're probably looking at an order of magnitude difference in processing such a simple message. There's usually a good deal of overhead with SOAP, which is negligible if ...
<p>SOAP and REST Web Services imply some overhead, but are certainly the way to go if you think you'll need to scale up to returning some other information other than true/false.</p> <p>An HTTP response of just 1/0 or true/false will be much smaller, and therefore theoretically faster.</p>
22,929
<p>I frequently run into problems of this form and haven't found a good solution yet:</p> <p>Assume we have two database tables representing an e-commerce system.</p> <pre><code>userData (userId, name, ...) orderData (orderId, userId, orderType, createDate, ...) </code></pre> <p>For all users in the system, select t...
<p>This should work, you'll have to adjust the table / column names:</p> <pre><code>select ud.name, order1.order_id, order1.order_type, order1.create_date, order2.order_id, order2.order_type, order2.create_date from user_data ud, order_data order1, order_data o...
<p>Their newest you mean all new in the current day? You can always check with your createDate and get all user and order data if the createDate >= current day.</p> <pre><code>SELECT * FROM "orderData", "userData" WHERE "userData"."userId" ="orderData"."userId" AND "orderData".createDate &gt;= current_date; </code></...
18,640
<p>Is there an automatic way in SQL Server 2005 to create a database from several tables in another database? I need to work on a project and I only need a few tables to run it locally, and I don't want to make a backup of a 50 gig DB.</p> <p><strong>UPDATE</strong></p> <p>I tried the Tasks -> Export Data in Manageme...
<p>You can use the <a href="http://www.codeplex.com/sqlhost/wiki/view.aspx?title=database%20publishing%20wizard" rel="nofollow noreferrer">Database Publishing Wizard</a> for this. It will let you select a set of tables with or without the data and export it into a .sql script file that you can then run against your oth...
<ol> <li>Create new database</li> <li>Right click on it,</li> <li>Tasks -> Import Data</li> <li>Follow instructions</li> </ol>
4,415
<p>I have a folder, '/var/unity/conf' with some properties files in it, and I'd like the Caucho's Resin JVM to have that directory on the classpath.</p> <p>What is the best way to modifiy resin.conf so that Resin knows to add this directory to the classpath?</p>
<p>With Resin 3.1.6 and above, use</p> <pre><code>&lt;server-default&gt; ... &lt;jvm-classpath&gt;/var/unity/conf/...&lt;/jvm-classpath&gt; ... &lt;/server-default&gt; </code></pre> <p>(I know, very late to the game, I was searching for the answer to this myself and found this post here, as well as the so...
<p>cd %RESIN_HOME%/lib | ln -s /var/unity/conf/....</p>
18,226
<p>I have a database with names in it such as John Doe etc. Unfortunately some of these names contain quotes like Keiran O'Keefe. Now when I try and search for such names as follows:</p> <pre><code>SELECT * FROM PEOPLE WHERE SURNAME='O'Keefe' </code></pre> <p>I (understandably) get an error.</p> <p>How do I preven...
<p>The escape character is ', so you would need to replace the quote with two quotes.</p> <p>For example,</p> <p><code>SELECT * FROM PEOPLE WHERE SURNAME='O'Keefe'</code></p> <p>becomes</p> <p><code>SELECT * FROM PEOPLE WHERE SURNAME='O''Keefe'</code></p> <p>That said, it's probably incorrect to do this yourself. ...
<p>Found in under 30s on Google...</p> <p><a href="http://www.orafaq.com/wiki/SQL_FAQ#How_does_one_escape_special_characters_when_writing_SQL_queries.3F" rel="nofollow noreferrer">Oracle SQL FAQ</a></p>
4,944
<p>I'm trying to program ARM using Eclipse + CDT + yagarto (gnu toolchain) + OpenOCD. In several sample projects (from yagarto site for example) I found linker scripts (*.ld) where a lot of linking information specified (along with sections definitions). Actually I haven't faced this files before (IAR doesn't need them...
<p>My guess is every third person has a different script or solution. There are a number of problems that have to be solved, different linkers are going to solve those in different ways. I think GNU has made it way too difficult if not black magic.</p> <p>For an embedded system you are often going to have a flash or...
<p>There is not a universal linker script. These scripts are very important, since they define where in memory (RAM or ROM) the various data and program sections will be placed. There is something equivalent in IAR compilers (xcl files if I remember correctly). You've obviously only used the default ones until now. </p...
27,758
<p>I have a .net web application that has a Flex application embedded within a page. This flex application calls a .net webservice. I can trace the execution proccess through the debugger and all looks great until I get the response:</p> <pre><code> soap:ReceiverSystem.Web.Services.Protocols.SoapException: Server wa...
<p>It looks like you might be sending a poorly formed XML document to the service. Can you use Fiddler or something like that to get a copy of the actual call that is going to the web service? That would be a huge help in figured out what the issue is.</p>
<p>Are you using Flex 3? If so, you can set a breakpoint when the webservice is executed and actually step through the Flex framework as it encodes your request. Look in mx.rpc.soap.SoapEncoder and you'll be able to see exactly what is going to be sent over the wire. </p>
3,472
<p>There is a space of x*y for text to go on $im (GD Image Resource) how can I choose a font size (or write text such that) it does not overflow over that area?</p>
<p>Given the way types are loaded, that surprises me. Where did you hear this from?</p> <p>The <a href="http://msdn.microsoft.com/en-us/library/3ahwab82.aspx" rel="nofollow noreferrer">docs for System.Type.Equals(Type)</a> suggest that it's comparing via the <a href="http://msdn.microsoft.com/en-us/library/system.type...
<p>Looking at the source code in Reflector, I can't see how Type.Equals(t1,t2) would be handled any differently than t1 = t2. (There is actually no Type.Equals; it will actually call Object.Equals).</p> <p>In C#, T1 == T2 works just fine.</p>
36,932
<p>Where can I find a complete reference of the ncurses C API?</p>
<p>I found this question a while back, but none of the answers so far answer the original question. The complete freely available API reference is available through the . . . </p> <p><a href="http://invisible-island.net/ncurses/man/ncurses.3x.html">NCURSES MAN PAGES</a></p>
<p>You can buy this book. I have it and recommend: John Strang, Programming with curses, O'Reilly, ISBN 0-937175-02-1</p> <p>The best online source information: <a href="http://invisible-island.net/ncurses/ncurses-intro.html" rel="nofollow noreferrer">http://invisible-island.net/ncurses/ncurses-intro.html</a></p> <p>...
13,510
<p>Is there any python module to convert PDF files into text? I tried <a href="http://code.activestate.com/recipes/511465/" rel="noreferrer">one piece of code</a> found in Activestate which uses pypdf but the text generated had no space between and was of no use. </p>
<p>Try <a href="http://www.unixuser.org/~euske/python/pdfminer/index.html" rel="noreferrer">PDFMiner</a>. It can extract text from PDF files as HTML, SGML or "Tagged PDF" format.</p> <p>The Tagged PDF format seems to be the cleanest, and stripping out the XML tags leaves just the bare text.</p> <p>A Python 3 version ...
<p>Found that solution today. Works great for me. Even rendering PDF pages to PNG images. <a href="http://www.swftools.org/gfx_tutorial.html" rel="nofollow">http://www.swftools.org/gfx_tutorial.html</a></p>
4,528
<p>I need to detect the device resolution automatically, right now I have a global var &amp; hardwire the resolution:</p> <pre><code>Public gDeviceRes As String = "640" 'Public gDeviceRes As String = "320" </code></pre> <p>then recompile for each device, does anyone have a quick snippit of code for this??</p>
<p>Depending on your exact needs, you can check the current screen dimensions with <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.primaryscreen.aspx" rel="noreferrer">Screen.PrimaryScreen</a> or you can P/Invoke <a href="http://msdn.microsoft.com/en-us/library/ms929469.aspx" rel="noreferre...
<p>This did exactly what i needed: </p> <pre><code> Dim screensize As System.Drawing.Rectangle = Screen.PrimaryScreen.Bounds Public gDeviceRes As String = screensize.Height </code></pre>
24,719
<p>I don't want to take the time to learn Obj-C. I've spent 7+ years doing web application programming. Shouldn't there be a way to use the WebView and just write the whole app in javascript, pulling the files right from the resources of the project?</p>
<p>I found the answer after searching around. Here's what I have done:</p> <ol> <li><p>Create a new project in XCode. I think I used the view-based app.</p></li> <li><p>Drag a WebView object onto your interface and resize.</p></li> <li><p>Inside of your WebViewController.m (or similarly named file, depending on the na...
<p>At least 2 others mentioned phonegap, but I thought I'd post this too and mention that Apple has approved the phonegap framework. So, now you won't get your app rejected by Apple just because you're using phonegap. </p> <p><a href="http://blogs.nitobi.com/jesse/2009/11/20/phonegapp-store-approval/" rel="nofollow ...
8,995
<p>I'm wondering why my transaction log would only be 2 MB on my 40 GB database when I have recovery mode set to full and unlimited file growth set on the transaction log. Any ideas?</p> <p>Edit: I'd say there is probably a few hundred MB inserted every day and a lot of updates going on. It's a database that drives a ...
<p>Because you back up the log, and that's what it's supposed to do?</p> <p>Sidenote (given that I can't comment): A full backup does <em>not</em> truncate the log. Only log backups, or TRUNCATE_ONLY commands, truncate the log. </p>
<p>if you are doing regular full backups, those will truncate the transaction log.</p>
20,295
<p>I have made a custom UserControl i Vb.net (windows application).</p> <p>How can I add this dynamically to a form?</p>
<p>A UserControl is essentially just another class. It inherits from Control, so you can do all kinds of things you do with controls, but otherwise it's just a class. Thus, to add the usercontrol dynamically to your form you'd do the following:</p> <ol> <li>Create a new instance of your control. Like <code>Dim X As Ne...
<pre><code> For i As Integer = 1 To 10 Dim tb As New TextBox tb.Top = 26 * i tb.Left = 12 tb.Text = "text box " &amp; i.ToString() tb.Parent = Me Next </code></pre>
48,919
<p>How do I embed a tag within a <a href="http://docs.djangoproject.com/en/dev/ref/templates/builtins/#url" rel="nofollow noreferrer" title="url templatetag">url templatetag</a> in a django template?</p> <p>Django 1.0 , Python 2.5.2</p> <p>In views.py</p> <pre><code>def home_page_view(request): NUP={"HOMEPAGE": ...
<p>Maybe you could try passing the final URL to the template, instead?</p> <p>Something like this:</p> <pre><code>from django.core.urlresolvers import reverse def home_page_view(request): NUP={"HOMEPAGE": reverse('named-url-pattern-string-for-my-home-page-view')} variables = RequestContext(request, {'NUP...
<p>That's seems way too dynamic. You're supposed to do</p> <pre><code>{% url named-url-pattern-string-for-my-home-page-view %} </code></pre> <p>And leave it at that. Dynamically filling in the name of the URL tag is -- frankly -- a little odd. </p> <p>If you want to use any of a large number of different URL tags...
31,798
<p></p> <p>It is supposed to be backwards compatible with HTML4 and XHTML. <a href="http://ejohn.org/blog/html5-doctype/" rel="nofollow noreferrer">John Resig posted about some of the benefits</a>.</p> <p>As long as we don't use any of the new and not supported yet features, would there be any downside to start build...
<p>Well consider this:</p> <p>When serving as text/html, all you need a doctype for is to trigger standards mode. Beyond that, the doctype does nothing as far as browsers are concerned.</p> <p>When serving as text/html, whether you use XHTML markup or HTML markup, it's treated by browsers as HTML.</p> <p>So, really ...
<p>Personally I'd say no. There is no clear benefit to HTML5 and in fact would go as far as to say that the whole thing is botched from the start.</p> <p>Having specialised tags for header, footers and sidebars is a huge mistake - you've got them already in the form of tags (div) and names (classes/id's). Why do we ne...
2,750
<p>Is there any libraries that would allow me to use the same known notation as we use in BeanUtils for extracting POJO parameters, but for easily replacing placeholders in a string?</p> <p>I know it would be possible to roll my own, using BeanUtils itself or other libraries with similar features, but I didn't want to...
<p>Rolling your own using BeanUtils wouldn't take too much wheel reinvention (assuming you want it to be as basic as asked for). This implementation takes a Map for replacement context, where the map key should correspond to the first portion of the variable lookup paths given for replacement.</p> <pre><code>import ja...
<p>Spring Framework should have a feature that does this (see Spring JDBC example below). If you can use groovy (just add the groovy.jar file) you can use Groovy's GString feature to do this quite nicely. </p> <p>Groovy example</p> <pre><code>foxtype = 'quick' foxcolor = ['b', 'r', 'o', 'w', 'n'] println "The $foxt...
17,490
<p>How do I check if an index exists on a table field in MySQL?</p> <p>I've needed to Google this multiple times, so I'm sharing my Q/A.</p>
<p>Use <code>SHOW INDEX</code> like so:</p> <pre><code>SHOW INDEX FROM [tablename] </code></pre> <p>Docs: <a href="https://dev.mysql.com/doc/refman/5.0/en/show-index.html" rel="noreferrer">https://dev.mysql.com/doc/refman/5.0/en/show-index.html</a></p>
<p>You can't run a specific show index query because it will throw an error if an index does not exist. Therefore, you have to grab all indexes into an array and loop through them if you want to avoid any SQL errors.</p> <p>Heres how I do it. I grab all of the indexes from the table (in this case, <code>leads</code>) ...
15,476
<p>When I use `gqap' command to reflow a paragraph in vim, vim seems to try to be smart and adds indentation automatically, e.g.</p> <ul> <li>When a line ends with a ',':</li> </ul> <pre> We protect your rights with two steps: (1) copyright the software, and (2), offer you this license which gives you legal permis...
<p>What filetype do you do this in? And what is the output of ':set'?</p> <p>If you copy your texts to an empty file, it formats it the way you want it. I have smartindent and autoindent enabled, so you could try that. (set si, set ai)</p>
<p>I had the same problem. I looked at my settings like this:</p> <p>:set</p> <p>I didn't have cindent set, but I did have smartindent. So, based on the above:</p> <p>:set nosmartindent</p> <p>Then the unwanted indentation on the last line (just as described above) was fixed. </p> <p>Thanks for the help!</p>
37,717
<p>When given a static set of objects (static in the sense that once loaded it seldom if ever changes) into which repeated concurrent lookups are needed with optimal performance, which is better, a <code>HashMap</code> or an array with a binary search using some custom comparator?</p> <p>Is the answer a function of ob...
<p>For very small collections the difference is going to be negligible. At the low end of your range (500k items) you will start to see a difference if you're doing lots of lookups. A binary search is going to be O(log n), whereas a hash lookup will be O(1), <a href="https://stackoverflow.com/questions/200384/constant...
<p>Of course, hash is fastest for such a big dataset.</p> <p>One way to speed it up even more, since the data seldom changes, is to programmatically generate ad-hoc code to do the first layer of search as a giant switch statement (if your compiler can handle it), and then branch off to search the resulting bucket.</p>...
46,988
<p>In standard ASP.net applications ASP.net offered some protection from XSS attacks with validateRequest throwing detect dangerous input errors if some one tried to. This functionality seems to have been taken out of MVC any idea why?</p>
<p>This is a hard line to cross. Is your web application just a RESTful web resource like it 'should' be? Or is it trying to do more. Next thing you know you have 100 hidden input fields: __VIEWSTATE, __EVENTTARGET, __EVENTARGUMENT, etc, etc.</p> <p>As you know, you can still prevent XSS attacks in MVC. Just <a href="...
<p>I find the ValidateRequest solution as a hack. In my opinion 'warding off XSS' is a Business Rule; therefore let the Model handle the situation.</p> <p>I really like the explanation regarding the desire to better follow REST principles. As to the 100 hidden fields, it reminds me of an ASP solution I provided some y...
42,439
<p>I need to write a function that generates an id that is unique for a given machine running a Windows OS.</p> <p>Currently, I'm using WMI to query various hardware parameters and concatenate them together and hash them to derive the unique id. My question is, what are the suggested parameters I should use? Currentl...
<p>Parse the <a href="http://www.dmtf.org/standards/smbios/" rel="noreferrer">SMBIOS</a> yourself and hash it to an arbitrary length. See the <a href="http://www.dmtf.org/standards/published_documents/DSP0134_2.6.0.pdf" rel="noreferrer">PDF specification</a> for all SMBIOS structures available.</p> <p>To query the SMB...
<p>Look up CPUID for one option. There might be some issues with multi-CPU systems.</p>
12,509
<p>I have a multi-threaded C++ app which does 3D rendering with the OpenSceneGraph library. I'm planning to kick off OSG's render loop as a separate thread using boost::threads, passing a data structure containing shared state in to the thread. I'm trying to avoid anything too heavyweight (like mutexes) for synchroniza...
<p>In C++11 and later, which has standards-defined concurrency, use <code>std::atomic&lt;bool&gt;</code> for this purpose. From <a href="http://en.cppreference.com/w/cpp/atomic/atomic" rel="noreferrer">http://en.cppreference.com/w/cpp/atomic/atomic</a>:</p> <blockquote> <p>If one thread writes to an atomic object wh...
<p>This thread has a little more info and discussion on thread-safety, especially for simple data types:</p> <p><a href="https://stackoverflow.com/questions/164496/how-can-i-create-a-thread-safe-singleton-pattern-in-windows">How can I create a thread-safe singleton pattern in Windows?</a></p>
27,510
<p>How can I find out which Service Pack is installed on my copy of SQL Server?</p>
<p>From TechNet: <a href="https://gallery.technet.microsoft.com/Determining-which-version-af0f16f6" rel="noreferrer">Determining which version and edition of SQL Server Database Engine is running</a></p> <pre><code>-- SQL Server 2000/2005 SELECT SERVERPROPERTY('productversion'), SERVERPROPERTY ('productlevel'), SERVE...
<pre><code>Select @@Version </code></pre> <blockquote> <p>Ex: My machine has the following one installed.</p> <p>Microsoft SQL Server 2008 R2 (RTM) - 10.50.1600.1 (Intel X86) Apr 2 2010 15:53:02 Copyright (c) Microsoft Corporation Enterprise Edition on Windows NT 6.1 (Build 7601: Service Pack 1)</p> </block...
5,171
<p>I have written a script that goes through a bunch of files and snips out a portion of the files for further processing. The script creates a new directory and creates new files for each snip that is taken out. I have to now evaluate each of the files that were created to see if it is what I needed. The script also...
<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,947
<p>This is something that made me doubt for a while so I thought it would be a good idea to post it here to find some insight, it's a relational database modeling problem/doubt</p> <p>I have the following problem:</p> <p>I have "questions" that must be in an specific "state", and all changes of state must be audited....
<p>I think the gist of what you're asking is: Should the state of the question be based on an intermediary table between Questions and State that has a time component (A) or should the table be more static, but with a log-oriented history table on the side (B). </p> <p>(Note: If you wanted to do a pure version of (A),...
<p>Once you draw in all the relationships, they're the same.</p> <p>I don't understand why you have state_id in the question table -- since you have the historical table, having the state in the question table is redundant and can leave you with out-of-sync data.</p> <p>Seems to me that if you want the current state ...
44,812
<p>I want to diaplay message boxes that looks good, with the possibillity to use bold/italic text and text with different colors. The standard MessageBox.Show doesn't provide this functionality.</p> <p>I have been trying to create a message box using the WebBrowser control to display nicely formatted text using HTML-s...
<p>You could create your own Form class that hosts the WebBrowser control (or an RTF control) to display the formatted content. Just give it an interface (API) similar to MessageBox so you can use it much the same way (e.g., checking the user's Yes/No or Ok/Cancel/etc responses).</p> <p>For the sizing, you would likel...
<p>I have just created and posted a product, HTML MessageBox, that solves exactly Mikael's problem. It's a drop-in replacement for the standard Windows API MessageBox call, that allows you to use bold, underline, and italic, and fonts. And it behaves like standard MessageBoxes, auto-sizing to the message, word wrapping...
39,888
<ol> <li>We are looking to use the MVC Framework in our SP Application.</li> <li>This is what we are trying to accomplish... A virtual directory within the SPSite which can host and run MVC. for e.g., /_layouts/MVC/</li> </ol> <p>Any hints on the required configuration changes (if at all this is possible) will be very...
<p>This might be of interest to you <a href="http://www.codeplex.com/SharePointMVC" rel="nofollow noreferrer">http://www.codeplex.com/SharePointMVC</a></p> <p>I published it about 5 minutes ago.</p> <p>It is basically a library to help rendering ASP.MVC inside a SharePoint masterpage.</p> <p>Still early days but you...
<p>I would recommend running your virtual directory in it's own app pool. I'm leveraging MVC on some other Microsoft products and the app pool's Managed Pipeline Mode must = 'Integrated' for MVC. </p>
23,416
<p><a href="https://web.archive.org/web/20210126032647/http://geekswithblogs.net/michelotti/archive/2007/12/17/117791.aspx" rel="nofollow noreferrer">Link</a></p> <p>I'm using ASP.NET with C# and trying to use linq to sql to update a data context as exhibited on the blog linked above. I created the timestamp field in ...
<p>If you have a timestamp column, then to update a record (from a vanilla object): yes, I would expect to have to assign it. Otherwise, you lose the ability to use the timestamp for optimistic concurrency checking.</p> <p>The idea is you take a copy of the timestamp when you get hold of your (disconnected) object, th...
<p>If you have a timestamp column, then to update a record (from a vanilla object): yes, I would expect to have to assign it. Otherwise, you lose the ability to use the timestamp for optimistic concurrency checking.</p> <p>The idea is you take a copy of the timestamp when you get hold of your (disconnected) object, th...
34,469
<p>I have a multi-frame layout. One of the frames contains a form, which I am submitting through XMLHttpRequest. Now when I use document.write() to rewrite the frame with the form, and the new page I am adding contains any javascript then the javascript is not exectuted in IE6?</p> <p>For example:</p> <pre><code>docu...
<p>Workaround is to programmatically add <code>&lt;script&gt;</code> blocks to head DOM element in JavaScript at Callback function or call eval() method. It's only way you can make this work in IE 6.</p>
<p>Another possible alternative is to use JSON, dynamically adding scripts references which will be automatically processed by browser. </p> <p>Cheers.</p>
9,492
<p>I wrote a script to export twitter friends as foaf rdf description. Now I'm looking for a tool to visualize the friend networks. I tried <a href="http://foafscape.berlios.de/" rel="nofollow noreferrer">http://foafscape.berlios.de/</a> but for 300+ Nodes it is really slow and does a bad job on auto formatting.</p> <...
<p>perhaps the <a href="http://prefuse.org/" rel="noreferrer">prefuse</a> visualization toolkit might help you. It's based on Java and has many sample apps including a <a href="http://prefuse.org/gallery/graphview/" rel="noreferrer">graph viewer</a>.</p>
<p>If you're using Java, you could use <a href="http://www.jgraph.com/" rel="nofollow noreferrer">JGraph</a>.</p>
9,979
<p>So they say PLA is biodegradable. But I still don't know how much biodegradable.</p> <p>I live in a flat and we have composting trash can in the courtyard. However if I throw PLA in there and it does not decompose, neighbors are gonna be pissed since many of them are intending to use the soil for their balcony flow...
<p>This question has been asked on just about every forum out there. Here's one example from <a href="https://www.filabot.com/blogs/news/57233604-the-misleading-biodegradability-of-pla" rel="nofollow noreferrer">filabot.com</a> .</p> <blockquote> <p>The reality however, is that this process will take several hundred y...
<p>PLA products will take up to 6 months to degrade in commercial composting facility. In home composting facility, it may take longer time.</p> <p>Source: <a href="http://www.biogreenchoice.com/category_s/1866.htm" rel="nofollow noreferrer">http://www.biogreenchoice.com/category_s/1866.htm</a></p>
524
<p>I have a sort of tree structure that represent a hierarchy of layers in a map, divided by types of layers and categories. Each node can be a different class for different types of layers (but all nodes implement a common interface).</p> <p>I need to convert that class to an ASP.NET TreeView control. Each node in th...
<p>A <a href="http://en.wikipedia.org/wiki/Visitor_pattern" rel="nofollow noreferrer">Visitor</a> perhaps, to walk input tree and build corresponding UI tree?</p>
<p>It sure sounds to me like you want to use Model-View-Controller here. Your tree map structure is probably the Model, the View is the TreeView control - you probably need to add a Controller class of some kind to manage the interaction between the two.</p>
21,375
<p>For a deleted file what's the command to use to view the content of a old revision</p> <pre><code>E:\Downloads\eeli\eel\eel&gt;svn cat eel-scalable-font.h -r 2 svn: warning: 'eel-scalable-font.h' is not under version control </code></pre>
<p>You need to use a repository URL (not working copy), and use the @rev syntax. Something like:</p> <pre><code>svn cat https://myhost/svn/eeli/eel/eel/eel-scalable-font.h@2 </code></pre>
<p>I think what your looking for is: </p> <pre><code>svn cat eel-scalable-font.h@2 </code></pre>
38,584
<p>I would like to implement a post build event that performs the following actions</p> <ol> <li>A relative path copy of the DLL output (1 file, not all the debug jazz)</li> <li>A register the output DLL to GAC</li> </ol> <p>How is this done?</p>
<p>Does that do you want?</p> <pre><code>copy $(TargetPath) $(TargetDir)..\..\someFolder\myoutput.dll regasm $(TargetPath) </code></pre> <p>(Entered into the field for post-build step under project properties)</p>
<p>Ran into a related issue. The answers here helped (thanks!).</p> <p>My scenario was in debugging an MEF-reliant application I needed to have the related DLLs in a particular location. I ran into issue with overwriting the prior build so did need to add a delete to the script.</p> <pre><code>delete $(SolutionDir)...
48,522
<p>We have a website/webservice running on one of our servers. We hit that webservice once a day with a scheduled .bat scipt.</p> <p>Just recently the scheduled task started to fail. The log shows "Invalid URI: The hostname could not be parsed."</p> <p>When we're logged into the server we can reach the website throug...
<p>For the private IP Address your using Wikipedia Reference <a href="http://en.wikipedia.org/wiki/IP_address" rel="nofollow">http://en.wikipedia.org/wiki/IP_address</a> for what are the limits and proper uses.</p> <p>If you have access to the source code for the web service look for fixed IP Address being used along...
<p>Try using the IP Address of the machine instead of localhost.</p> <p>Basically, I'm taking a wild stab that someone ran a lockdown or a service patch was installed that somehow is filtering request resposes to localhost (127.0.0.1).</p>
45,933
<p>While the C# spec does include a pre-processor and basic directives (#define, #if, etc), the language does not have the same flexible pre-processor found in languages such as C/C++. I believe the lack of such a flexible pre-processor was a design decision made by Anders Hejlsberg (although, unfortunately, I can't fi...
<p>Consider taking a look at an aspect-oriented solution like <a href="http://www.postsharp.org/" rel="noreferrer">PostSharp</a>, which injects code after the fact based on custom attributes. It's the opposite of a precompiler but can give you the sort of functionality you're looking for (PropertyChanged notifications ...
<p>If you are ready to ditch C# you might want to check out the <a href="http://boo.codehaus.org/" rel="nofollow noreferrer">Boo</a> language which has incredibly flexible <a href="http://boo.codehaus.org/Part+17+-+Macros" rel="nofollow noreferrer">macro</a> support through <a href="http://en.wikipedia.org/wiki/Abstrac...
5,790
<p>We have a dedicated godaddy server and it seemed to grind to a halt when we had users downloading only 3MB every 2 seconds (this was over about 20 http requests).</p> <p>I want to look into database locking etc. to see if that is a problem - but first I'm curious as to what a dedicated server ought to be able to se...
<p>to help diagnose the problem, host a large file and download it. That will give you the transfer that the server and your web server can cope with. If the transfer rate is poor, then you know its the network, server or webserver. If its acceptable or good, then you know its the means you have of generating those 3MB...
<p>A lot depends on what the 3MB is. Serving up 1.5MBps of static data is way, way, way, within the bounds of even the weakest server.</p>
27,079