instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I've seen numerous people mentions that you shouldn't use widths and padding or margins on the same element with CSS. Why is that?</p>
| <p>Because some browsers treat the width as the total width of the element including the padding and the margins, and others treat the width as the base width to which the padding and margins are added. As a result your design will look different in different browsers.</p>
<p>For more information, see the <a href="ht... | <p>Are you stating that padding and/or margin values shouldn't co-exist with a DOM element that also has a width value assigned to it? If so, that is only true if you do not want to write CSS that is compatible with both IE as well as browsers which implement web standards (e.g. Firefox). It would be difficult to ach... | 10,137 |
<p>Why does a user needs privileges over his own schema to create packages and triggers?</p>
| <p>Are you asking why users need particular priviliges (i.e. CREATE TABLE, CREATE PROCEDURE, etc) in order to create particular types of objects in their own schema? </p>
<p>If so, the natural answer would be that good security begins with the principle of least privilege-- that is, a user should only have those priv... | <blockquote>
<p>Why does a user needs privileges over
his own schema to create packages and
triggers
They do not.</p>
</blockquote>
<p>Their own schema implies the ownership (or namespace) defined by username.object
All a user needs to create a trigger in their own schema is:
a table in their own schema
the cr... | 17,388 |
<p>I've discovered that any time I do the following:</p>
<pre><code>echo '<a href="http://" title="bla">huzzah</a>';
</code></pre>
<p>I end up with the following being rendered to the browser:</p>
<pre><code><a href="http:///" title="bla">huzzah</a>
</code></pre>
<p>This is particularly anno... | <p>Firefox, especially, shows you the html source the way it's seeing it which is rarely the way you've sent it. Clearly something about your link or it's context is making the browser interpret a trailing slash.</p>
<p>I wonder if it's a side effect of the url encoding. If you rawurldecode it will that help. If th... | <p>Have you looked into your PHP config settings? It might be magic_quotes_gpc deciding to escape things for you (I've been bitten several times by that setting, especially when working with AJAX/JSON traffic). Try making sure it is off and echoing again (you might need to edit your php.ini file, or add <code>php_fla... | 19,110 |
<p>We have an application that installs SQL Server Express from the command line and specifies the service account as the LocalSystem account via the parameter SQLACCOUNT="NT AUTHORITY\SYSTEM".</p>
<p>This doesn't work with different languages because the account name for LocalSystem is different. There's a table list... | <p>You can use .NET's built-in <a href="http://msdn.microsoft.com/en-us/library/system.security.principal.securityidentifier.aspx" rel="noreferrer">System.Security.Principal.SecurityIdentifier</a> class for this purpose: by translating it into an instance of <a href="http://msdn.microsoft.com/en-us/library/system.secur... | <p>This should do something similar to what you posted. I'm not sure how to get specific properties of WMI objects offhand, but this will get you started with the syntax:</p>
<pre><code>ManagementObject m = new ManagementObject("winmgmts:root\cimv2");
m.Get();
MessageBox.Show(m["Win32_SID.SID='S-1-5-18'"].ToString());... | 25,104 |
<p>I need to know how I can search an array for some literal text and have it used as a condition whether to continue.</p>
<p>Here's why:
Each time I execute a function I am pushing the ID of the property it acts upon into an array. I need my function to check if that ID is in the array already and if it is, remove it... | <p>Grep isn't a standard javascript Array method. Are you using a javascript library that has added this method to Array? If so, you may want to look at its implementation. Since you are pushing arrays into the array, it would need to be able to search the elements of each element of the array, instead of the arra... | <pre><code>function arraytest(){
var myArray = new Array();
myArray.push(["test1"]);
myArray.push(["test2"]);
myArray.push(["test3"]);
for(i=0;i<myArray.length;i++){
if(myArray[i]=="test1"){
successFunction("Celebration\!");
}
}
}
</code></pre>
<p>Is an it... | 47,811 |
<p>I see two types of examples in various places. One uses form fields like</p>
<blockquote>
<p>curl -X PUT -d "phone=123.456.7890" "<a href="http://127.0.0.1/services/rest/user/123" rel="nofollow noreferrer">http://127.0.0.1/services/rest/user/123</a>"</p>
</blockquote>
<p>and the other uses an XML content like (s... | <p>It could be something like JSON(P)? (I'm not sure about exact syntax):</p>
<pre><code>$ echo '{user: {id: 123, phone: 123.456.7890}}' |\
> curl -X PUT -d @- 'http://127.0.0.1/services/rest/user/'
</code></pre>
<p>Or</p>
<pre><code>$ echo '{phone: 123.456.7890}' |\
> curl -X PUT -d @- 'http://127.0.0.1/servi... | <p>In the second example URL does not refer to a specific resource, so IMHO it's not RESTful.</p>
<p>If you fix that, the choice comes down to form and XML encoding. </p>
<p>If you need structured and extensible data, then XML might be useful:</p>
<pre><code><phone type="work, mobile"><num>555-555</nu... | 39,944 |
<p>I would like to know if someone triend exporting data from MySQL to an ODF format ?</p>
<p>Any information / documentation would be very much appreciated.</p>
<p>I am going to try to export a MySQL result set to ODF spreadsheet if possible.</p>
| <p>You could try looking at this: <a href="http://www.phpclasses.org/browse/package/4398.html" rel="nofollow noreferrer">http://www.phpclasses.org/browse/package/4398.html</a></p>
<p>However looking at the source code it doesn't look great and has lots of hard coded xml strings</p>
| <p>Another option to create OOo files with PHP is <a href="http://www.tinybutstrong.com/tbsooo.php" rel="nofollow noreferrer">tbsOOo</a>; however, it is mainly a templating engine.</p>
<blockquote>
<p>This class allows to create OpenOffice
documents dynamically by separating
display formatting from logic and
d... | 24,314 |
<p>I'm tired of adding ten link libraries into my project, or requiring eight of them to use my own. I'd like to take existing libraries like libpng.a, libz.a, libjpeg.a, and combine them into one single .a library. Is that possible? How about combining .lib libraries?</p>
| <p>You could extract the object files from each library with</p>
<pre class="lang-none prettyprint-override"><code>ar x <library name>
</code></pre>
<p>and then merge them all into a new library with</p>
<pre class="lang-none prettyprint-override"><code>ar cs <new library name> <list each extracted objec... | <p>Combining several third-party libraries into one could create more problems for you—for instance, if two of those libraries define a common symbol which your program doesn't use. Now you've got to extract all (or all-but-one) of the instances of the common symbol before you combine the libraries.</p>
| 3,414 |
<p>I am trying to find out how much memory my application is consuming from within the program itself. The memory usage I am looking for is the number reported in the "Mem Usage" column on the Processes tab of Windows Task Manager.</p>
| <p>A good starting point would be <a href="http://msdn.microsoft.com/en-us/library/ms683219.aspx" rel="noreferrer">GetProcessMemoryInfo</a>, which reports various memory info about the specified process. You can pass <code>GetCurrentProcess()</code> as the process handle in order to get information about the calling pr... | <p>GetProcessMemoryInfo is the function you are looking for. The docs on MSDN will point you in the right direction. Get the info you want out of the PROCESS_MEMORY_COUNTERS structure you pass in.</p>
<p>You'll need to include psapi.h.</p>
| 35,733 |
<p>I have two overloads of a c++ function and I would like to set a breakpoint on one of them:</p>
<pre><code>0:000> bu myexe!displayerror
Matched: 00000000`ff3c6100 myexe!displayError (int, HRESULT, wchar_t *)
Matched: 00000000`ff3c60d0 myexe!displayError (int, HRESULT)
Ambiguous symbol error at 'myexe!displayerro... | <p>Try:</p>
<pre><code>bu 0xff3c6100
</code></pre>
<p>If I remember right, WinDbg allows setting breakpoints by address too.</p>
| <p>Search your dll for all entry point matching your symbol</p>
<pre><code>x myexe!displayerror
</code></pre>
<p>this will output all symbols matching the search string and their entry points, then set the breakpoint on the address</p>
<pre><code>bp ff3c6100 // for myexe!displayError (int, HRESULT, wchar_t *)
</code... | 19,541 |
<p>I have put together a script which is very much like the flickr photostream feature. Two thumbnails next to each other, and when you click the next or prev links the next (or previous) two images slide in. Cool!</p>
<p>Currently when the page loads it loads the two images. The first time nxt / prv is used then the ... | <p>To preload an image from Javascript, you don't need to do anything that sounds like AJAX or JSON. All you need is this:</p>
<pre><code>var img = new Image();
img.src = "http://example.com/new/image.jpg";
</code></pre>
<p>The browser will quite happily load the image in the background, even though it's not displaye... | <p>In the case where you want to <strong>concurrently</strong> preload a larger number of resources, a little ajax can solve the problem for you. Just make sure the caching headers are such that the browser will use the resources on the next request. In the following example, I load up to four resources concurrently.... | 32,135 |
<p>I'm working on an ASP.NET page, using VB.NET and I have this hierarchy:</p>
<p>Page A <br />
- Web User Control 1 <br />
- Web User Control A <br />
- Web User Control B <br />
- Web User Control C <br /></p>
<p>I need to raise an ... | <p>You can use the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.raisebubbleevent.aspx" rel="nofollow noreferrer">BubbleEvent</a> <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.onbubbleevent.aspx" rel="nofollow noreferrer">concept</a> to do this. A BubbleEvent goes up th... | <p>You can create a public method in <code>Page A</code> which gets called from <code>Web User Control B</code> instead of raising an event up the entire control tree.</p>
<p>This would not be my first choice since this will cause tight coupling between those classes but I hope it solves your problem.</p>
<p>Sample P... | 43,343 |
<p>Is there a keyboard shortcut in Access 2003 that will run a query while in design or sql mode?</p>
| <p>It's not built-in. I would try a macro - AutoKeys? You should be able to make almost any keyboard short you want that way.</p>
| <p>Does Alt Q Alt R (ie menu item selection) not suit?</p>
| 8,083 |
<p>I saw this question on Reddit, and there were no positive solutions presented, and I thought it would be a perfect question to ask here. This was in a thread about interview questions:</p>
<blockquote>
<p>Write a method that takes an int array of size m, and returns (True/False) if the array consists of the numbers ... | <p>Under the assumption numbers less than one are not allowed and there are no duplicates, there is a simple summation identity for this - the sum of numbers from <code>1</code> to <code>m</code> in increments of <code>1</code> is <code>(m * (m + 1)) / 2</code>. You can then sum the array and use this identity.</p>
<p... | <p>It seems like we could check for duplicates by multiplying all the numbers n...n+m together, and then comparing that value to the expected product of a sequence with no duplicates <strong>m!/(n-1)!</strong> (note that this assumes it is impossible for a sequence to pass both the expected sum test <strong>and</strong... | 21,331 |
<p>I have a string that has angle brackets in it like this:</p>
<pre><code><element1>my text here</element1>
</code></pre>
<p>The string literally looks like this when I write it to console or my dataGridView or anywhere else. However, I'm trying to write this as part of an XML document. </p>
<p>Everyt... | <p>If you want to keep it as a string without escaping all the elements, use a CDATA block:</p>
<pre><code><xml><![CDATA[<element1>my text here</element1>]]></xml>
</code></pre>
| <p>Hmm.</p>
<p>So I think I've decided that instead of using the XMLSerializer (which I thought would be the fancy way of doing things) I'm just going to build up strings of all my elements and write them out as a normal text file. That's seeming to work and be straightforward enough. I had a couple other unique/odd... | 45,238 |
<p>Just playing around with the now released Silverlight 2.0. I'm trying to put a simple Calendar in a control. However the project doesn't seem to know what I'm talking about:-</p>
<pre><code><UserControl x:Class="MyFirstSL2.Test"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http... | <p>The calendar control is an SDK control in the assembly System.Windows.Controls namespace -- look at %program files%\Microsoft SDKs\Silverlight\v2.0\Libraries\Client add a namespace to your xaml (after you add a reference):</p>
<pre><code>xmlns:basics="clr-namespace:System.Windows.Controls;assembly=System.Windows.C... | <p>I'm pretty sure there's no calendar control in Silverlight that is analogous to the ASP.Net control or the windows forms control. I'm pretty sure there's not a pre-packaged control like that for WPF, either.</p>
| 26,207 |
<p>What is the best way to do per-user database connections in <code>Rails</code>? </p>
<p>I realize this is a poor Rails design practice, but we're gradually replacing an existing web application that uses one database per user. A complete redesign/rewrite is not feasible.</p>
| <p>Put something like this in your application controller. I'm using the subdomain plus "_clientdb" to pick the name of the database. I have all the databases using the same username and password, so I can grab that from the db config file.</p>
<p>Hope this helps!</p>
<pre><code>class ApplicationController < Actio... | <p>Take a look at <a href="http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M001397" rel="nofollow noreferrer">ActiveRecord::Base.establish_connection</a>. That's how you connect to a different database server. I can't be of much more help since I don't know how you recognize the user or map it to it's databas... | 8,320 |
<p>I'm using <code>Console.WriteLine()</code> from a very simple WPF test application, but when I execute the application from the command line, I'm seeing nothing being written to the console. Does anyone know what might be going on here?</p>
<p>I can reproduce it by creating a WPF application in VS 2008, and simply a... | <p>You can use </p>
<pre><code>Trace.WriteLine("text");
</code></pre>
<p>This will output to the "Output" window in Visual Studio (when debugging).</p>
<p>make sure to have the Diagnostics assembly included:</p>
<pre><code>using System.Diagnostics;
</code></pre>
| <p>Check out this post, was very helpful for myself. Download the code sample:</p>
<p><a href="http://www.codeproject.com/Articles/335909/Embedding-a-Console-in-a-C-Application" rel="nofollow">http://www.codeproject.com/Articles/335909/Embedding-a-Console-in-a-C-Application</a></p>
| 19,414 |
<p>I'm writing a MUD engine and I've just started on the game object model, which needs to be extensible.</p>
<p>I need help mainly because what I've done feels messy, but I can't think of a another solution that works better.</p>
<p>I have a class called <code>MudObject</code>, and another class called <code>Contain... | <p>I think you are overcomplicating. If MudObjects can contain other MudObjects, the single base class you need should be along these lines:</p>
<pre><code>public abstract class MudObject
{
MudObject containedBy; //technically Parent
List<MudObject> Contains; //children
}
</code></pre>
<p>This is s... | <p>Why not make all MudObjects containers? ...or at least, have the ability to contain other objects, in terms of your class code. E.g.</p>
<pre><code>public abstract class MudObject
{
MudObject containedBy;
List<MudObject> contains;
}
</code></pre>
<p>You can then set some sort of flag on the object it... | 27,825 |
<p>This one is a bit tedious in as far as explaining, so here goes. I'm essentially populating a tableView on the iPhone with multiple sections, and potentially multiple rows per section. To my understanding, it's best to have an array of arrays so that you can simply determine how many sections one has by sending a me... | <p>The following code works: (<b>edit:</b> added my initialization code)</p>
<pre><code>NSArray * arrayOfRecords = [NSArray arrayWithObjects:
[NSDictionary dictionaryWithObjectsAndKeys:
@"bob", @"name",
[NSNumber numberWithInt:3], @"location", nil],
[NSDictionary dictionaryWithObjectsAndKeys:
... | <p>In Cocoa, it's best to use model objects rather than primitive collections, especially when using Bindings. The dictionaries should certainly be model object, and you may want to turn your inner arrays into model objects as well. (The outer array should stay an array.)</p>
<p>Cocoa Touch doesn't have Bindings, but ... | 40,050 |
<p>Coming up with good, precise names for classes is notoriously difficult. Done right, it makes code more self-documenting and provides a vocabulary for reasoning about code at a higher level of abstraction. </p>
<p>Classes which implement a particular design pattern might be given a name based on the well known patt... | <p>I'll cite some passages from <a href="https://rads.stackoverflow.com/amzn/click/com/0321413091" rel="noreferrer" rel="nofollow noreferrer">Implementation Patterns</a> by Kent Beck:</p>
<h2>Simple Superclass Name</h2>
<blockquote>
<p>"[...] The names should be short and punchy.
However, to make the names precise... | <p>If your "FooProcessor" really does process foos, then don't be reluctant to give it that name just because you already have a BarProcessor, BazProcessor, etc. When in doubt, obvious is best. The other developers who have to read your code may not be using the same thesaurus you are.</p>
<p>That said, more specifici... | 5,891 |
<p>If a table has a rowversion column in it and you make an update to that row, the value of the rowversion column increases. I know that this is by design and the purpose of rowversion columns, however is there any way to make it such that an update operation will have no effect on rowversion value? </p>
<p>Edit: ... | <p>No. See <a href="http://msdn.microsoft.com/en-us/library/ms182776.aspx" rel="nofollow noreferrer">MSDN</a>. "Every time that a row with a rowversion column is modified or inserted, the incremented database rowversion value is inserted in the rowversion column."</p>
| <p>No, but perhaps you mean to use <a href="http://www.sitepoint.com/forums/showthread.php?t=41676" rel="nofollow noreferrer">auto-increment</a>? Then you have a new unique number when the row is created but it doesn't change when the row is updated.</p>
<p>If you also wanted some kind of change-counter that didn't a... | 24,901 |
<p>I've always been wondering about the actual accuracy of 3D printing devices. When looking for the perfect machine to buy, I looked at the speed, price, filaments supported etc, but also accuracy. I once asked somebody who could give me some advice on what to look at. </p>
<p>One of the things I was told about was t... | <p>There's not a simple answer to this question, or if there is, it's "no". However the situation is a lot more complicated. When printer specs cite accuracy like this, they're usually basing the claim on the nominal size of the smallest movements on each axis by one "microstep" of the stepper motors. There's a great a... | <p>Tom's answer is correct, most printers will operate properly with a layer height <em>resolution</em> of 50 micron, using a 0.4mm nozzle. The resulting surface finish will probably be better than at a coarser layer setting, and at finer layer heights the print quality is likely to deteriorate.</p>
<p>Layer height is... | 1,374 |
<p>As it seems there is no scripting language for Windows mobile devices that gives access to phone (sms, mms, make a call, take photo). I wonder how complex it would be to make a Python library that would enable that (write something in C, compile, and import in PythonCE).</p>
<p>Question: Where shall start to unders... | <p>As the first step, you should try to create executable programs that invoke the functions you want. For example, to send SMS, it appears you need to call MailSwitchToAccount, passing "SMS", and so on - familiarize yourself with the C API on the platform.</p>
<p>To create executables, you need Visual Studio, and the... | <p>just tried establishing an environment to get pythonce modules compiled (<a href="http://pythonce.sourceforge.net/Wikka/SConsBuild" rel="nofollow noreferrer">http://pythonce.sourceforge.net/Wikka/SConsBuild</a>) but seems that I can only use 2003 PPC SDK and it has no recent functions available. Even when I followed... | 31,504 |
<p>I've got just one page that I want to force to be accessed as an HTTPS page (PHP on Apache). How do I do this without making the whole directory require HTTPS? Or, if you submit a form to an HTTPS page from an HTTP page, does it send it by HTTPS instead of HTTP?</p>
<p>Here is my example:</p>
<pre><code>http://www.e... | <p>The way I've done it before is basically like what you wrote, but doesn't have any hardcoded values:</p>
<pre>if($_SERVER["HTTPS"] != "on")
{
header("Location: https://" . $_SERVER["HTTP_HOST"] . $_SERVER["REQUEST_URI"]);
exit();
}</pre>
| <pre><code><?php
// Require https
if ($_SERVER['HTTPS'] != "on") {
$url = "https://". $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
header("Location: $url");
exit;
}
?>
</code></pre>
<p>That easy.</p>
| 11,133 |
<p>When doing a Ajax call to an MVC action currently I have my javascript inside the View, not inside its own JS file.</p>
<p>It is then very easy to do this:</p>
<pre><code>var xhr = $.ajax({
url: '<%= Url.Action("DisplayItem","Home") %>/' + el1.siblings("input:hidden").val(),
data: { ajax: "Y" },
... | <p>This way fully uses MVC Routing so you can fully take advantage of the MVC framework.
Inspired by stusmith's answer.</p>
<p>Here I have an action in <code>ApplicationController</code> for dynamic javascript for this URL :</p>
<pre><code> /application/js
</code></pre>
<p>I'm including static files here because I w... | <p>Here's another way:</p>
<p>In your master page, include an area for inline scripts:</p>
<pre><code><head>
...
<asp:ContentPlaceHolder runat="server" ID="_inlineScripts" />
...
</head>
</code></pre>
<p>Then in the Page_Load, create a utility function:</p>
<pre><code>protected void Page_Loa... | 49,307 |
<p>I was thinking about making something like Linq for Lua, and I have a general idea how Linq works, but was wondering if there was a good article or if someone could explain how C# makes Linq possible</p>
<p>Note: I mean behind the scenes, like how it generates code bindings and all that, not end user syntax.</p>
| <p>It's hard to answer the question because LINQ is so many different things. For instance, sticking to C#, the following things are involved:</p>
<ul>
<li>Query expressions are "pre-processed" into "C# without query expressions" which is then compiled normally. The query expression part of the spec is really short - ... | <p>Matt Warren's blog has all the answers (and a sample IQueryable provider implementation to give you a headstart):</p>
<p><a href="http://blogs.msdn.com/mattwar/" rel="nofollow noreferrer">http://blogs.msdn.com/mattwar/</a></p>
| 43,190 |
<p>What are the differences in implementing interfaces <strong>implicitly</strong> and <strong>explicitly</strong> in C#?</p>
<p>When should you use implicit and when should you use explicit?</p>
<p>Are there any pros and/or cons to one or the other?</p>
<hr>
<p>Microsoft's official guidelines (from first edition <... | <p><strong>Implicit</strong> is when you define your interface via a member on your class. <strong>Explicit</strong> is when you define methods within your class on the interface. I know that sounds confusing but here is what I mean: <code>IList.CopyTo</code> would be implicitly implemented as:</p>
<pre><code>public v... | <p>I've found myself using <strong>explicit</strong> implementations more often recently, for the following <strong>practical</strong> reasons:</p>
<ul>
<li><p>Always using explicit from the starts prevents having any naming collisions, in which explicit implementation would be required anyways</p>
</li>
<li><p>Consume... | 17,318 |
<p>Is it possible to get a URL from an action without knowing ViewContext (e.g., in a controller)? Something like this:</p>
<pre><code>LinkBuilder.BuildUrlFromExpression(ViewContext context, Expression<Action<T>> action)
</code></pre>
<p>...but using Controller.RouteData instead of ViewContext. I seem t... | <p>Here's how I do it in a unit test:</p>
<pre><code> private string RouteValueDictionaryToUrl(RouteValueDictionary rvd)
{
var context = MvcMockHelpers.FakeHttpContext("~/");
// _routes is a RouteCollection
var vpd = _routes.GetVirtualPath(
new RequestContext(context, _
... | <p>Craig, Thanks for the correct answer. It works great, and it also go me thinking. So in my drive to eliminate those refactor-resistent "magic strings" I have developed a variation on your solution:</p>
<pre><code>public static string GetUrlFor<T>(this HttpContextBase c, Expression<Func<T, object>&g... | 47,426 |
<p>I want to offload a block of code in my main process to child process to make it run concurrently. I also want to have the PID of the spawned child process so I can monitor and kill it if necessary.</p>
| <p>You can use the <code>fork</code> kernel method. Here is an example:</p>
<pre><code>#!/usr/bin/env ruby
puts "This is the master process."
child_pid = fork do
puts "This is the child process"
exit
end
puts "The PID of the child process is #{child_pid}"
</code></pre>
<p>The <code>fork</code> method returns th... | <p>If you are happy to use Threads, rather than Processes, then something like this <em>may</em> be a bit more scaleable to more-than-one fork:</p>
<pre><code>def doit(x)
sleep(rand(10))
puts "Done... #{x}"
end
thingstodo = ["a","b","c","d","e","f","g"]
tasklist = []
# Set the threads going
thingstodo.each ... | 39,513 |
<p>I've got the following JavaScript on my web page...</p>
<pre><code>64 var description = new Array();
65 description[0] = "..."
66 description[1] = "..."
...
78 function init() {
79 document.getElementById('somedivid').innerHTML = description[0];
80 }
81
82 window.onload = init();
</code></p... | <p>Shouldn't line 82 read:</p>
<pre><code>window.onload = init;
</code></pre>
<p>When you do "init()" it's a call to a function that returns void. You end up calling that function before the page loads.</p>
| <p>In addition to the onload fixes proposed here, also check to see if there are multiple elements with that ID, I believe IE will return a collection of all elements with that ID, in which case you would need to select the intended item out of the collection before accessing that property or ensure you are using uniqu... | 21,540 |
<p>I have a LARGE piece of glass (36"x26") that I will soon be printing on using my newly build MPCNC machine. It is capable of printing about 34"x34"x10".</p>
<p>Anyway, I have had GREAT success printing on heated glass that is sprayed lightly with hairspray using PLA and being able to EASILY remove my prints after ... | <p>Because you will be printing on unheated glass, you will be using some form of adhesive material. If you use an off-the-shelf glue stick, you will likely find it is water soluble. If the bed is removable, immersing it in warm water for a relaxing soak will provide easier model removal. </p>
<p>I don't have experien... | <p>3M Blue decorators tape works well for me. You can get it in different widths. I find giving it a little sand paper rub before each print helps corners to stay down and improves first layer print. I replace about every 10 prints depending on the importance of the print.</p>
| 374 |
<p>I’m thinking about trying some development for the iPhone, is it possible to install Leopard inside VMWare? I already have a pretty high spec PC with a comfy setup that I’d like to use, or do I need to buy a real Mac?</p>
| <p>It is <a href="http://blogs.vmware.com/vmtn/2008/01/virtual-leopa-1.html" rel="noreferrer">legal</a> to run Mac OS X <strong>Server</strong> in a virtual machine <em>on Apple hardware</em>. All other forms of Mac OS X virtualization are currently forbidden.</p>
| <p>Unfortunately, there's no legal way to run OS X in a virtual machine.</p>
<p>For developing iPhone apps you probably don't need a particularly beefy machine, so maybe look into grabbing a <a href="http://store.apple.com/us/browse/home/shop_mac/family/mac_mini?mco=MTE3MTA" rel="nofollow noreferrer">mac mini</a>? Th... | 4,265 |
<p>In C# I use the <code>#warning</code> and <code>#error</code> directives,</p>
<pre><code>#warning This is dirty code...
#error Fix this before everything explodes!
</code></pre>
<p>This way, the compiler will let me know that I still have work to do. What technique do you use to mark code so you won't forget about... | <p>Mark them with <code>// TODO</code>, <code>// HACK</code> or other comment tokens that will show up in the task pane in Visual Studio.</p>
<p>See <a href="https://msdn.microsoft.com/en-us/library/txtwdysk.aspx" rel="noreferrer">Using the Task List</a>.</p>
| <p>As most programmers seem to do here, I use TODO comments. Additionally, I use Eclipse's task interface <a href="http://www.eclipse.org/mylyn/" rel="nofollow noreferrer">Mylyn</a>. When a task is active, Mylyn remembers all resources I have opened. This way I can track</p>
<ol>
<li>where in a file I have to do somet... | 43,496 |
<p>SSIS 2005/2008 does fuzzy lookups and groupings. Is there a feature that does the same in T-SQL?</p>
| <p>Fuzzy lookup uses a q-gram approach, by breaking strings up into tiny sub-strings and indexing them. You can then then search input by breaking it up into equally sized strings. You can inspect the format of their index and write a CLR function to use the same style of index but you might be talking about a fair c... | <p>On March 5 2009 I will have an article posted on www.sqlservercentral.com with a sample of Jaro-Winkler TSQL </p>
| 30,758 |
<p>We've been creating banners using the getURL linking method (in a blank window). For many people, it works just fine. You click the banner and are taken to our site. For others (me included), clicking the flash object triggers a pop-up warning in FireFox (both 2 and 3, default settings). The weird thing is that it d... | <p>In my experience you need to put your link inside a onRelease handler (or MouseEvent.CLICK in as3) for it to not get blocked. If you set it to onPress or anything else will it will be blocked. This isn't foolproof on some setups it will get blocked anyway, but often that's due to a tougher setting on the blocker or ... | <p>Use this code, with <strong>allowscriptaccess='always'</strong> and <strong>wmode='transparant'</strong> or <strong>'opaque'</strong> in the HTML code on the Flash element.</p>
<pre><code>private function click(event : MouseEvent) : void {
getURL(LoaderInfo(root.loaderInfo).parameters.clic kTag);
}
private fun... | 19,874 |
<p>I added a custom install action to my installer to add one of my installation directories to the System PATH environment variable. After I run the installer, the PATH variable reflects the changes (when I access it through the Control Panel::System applet), but when I start a new command shell, the PATH variable doe... | <p>I think this depends on how you are starting the new Command shell. For example, when you change the PATH environment variable under System properties, the change isn't reflected until you open a new Command prompt. I think when you launch a new "cmd" process (from the Run dialog for example), you get a fresh copy o... | <p>How are you adding the environment variable?</p>
<p>Without using any external tools, you can <a href="http://www.windowsnetworking.com/kbase/WindowsTips/WindowsNT/AdminTips/Miscellaneous/SetEnvManipulateNTEnvironmentalVariables.html" rel="nofollow noreferrer">add it to the registry</a>. Then, your test of opening... | 6,152 |
<p>What are the recommendations for including your compiler, libraries, and other tools in your source control system itself?</p>
<p>In the past, I've run into issues where, although we had all the source code, building an old version of the product was an exercise in scurrying around trying to get the exact correct c... | <p>I think the VM is your best solution. We always used dedicated build machines to get consistency. In the old COM DLL Hell days, there were dependencies on (COMCAT.DLL, anyone) on non-development software installed (Office). Your first two options don't solve anything that has shared COM components. If you don't ... | <p>My organisation has a "read-only" filesystem, where everything is put into releases and versions. Releaselinks (essentially symlinks) point to the version being used by your project. When a new version comes along it is just added to the filesystem and you can swing your symlink to it. There is full audit history of... | 14,350 |
<p>I have been working with PHP for a while now and would like to learn some Windows desktop-based GUI applications. Something similar to C# or Visual Basic would be nice, however I would like to learn a language that is open, similar to PHP. </p>
<p>Please do not suggest anything that requires an expensive compiler ... | <p>I think you'll struggle to find anything very like PHP that is perfectly suited for desktop GUI apps. Languages like PHP show their "script-behind-a-webpage" heritage just in the way that awk & perl are very much suited to general purpose/admin scripts on unix boxes.</p>
<p>There are GUI bindings (tk, gtk,...) ... | <p>PHP-GTK is a real stretch of PHP's intended use. I'd personally stay away. Python along with wxWidgets is an easy way to start creating GUI's. There are form builders (e.g. PythonCard and wxGlade) that can expediate the process if you prefer not to handwrite your forms.</p>
| 42,568 |
<p>I'm using linq to pull back an object (i.e. customer) that might have a collection of other objects(customer.orders). I would be nice if I can pass this list of customers to the ultragrid and a hierarchical view of customers and thier orders displayed on databind. When I try this, I just get customers. Anyone kno... | <p>Figured it out. IList collection works and will create bands for properties of your domain object if it is an <code>IList<T></code>. Just make sure that<code>DisplayLayout.ViewStyle = ViewStyle.MultiBand</code>.</p>
| <p>We work with our own custom datasource for grid, so we first create a structure of bands and then we initialize data OnDemand, handling events
InitializeDataRow
InitializeRowsCollection
CellDataRequested</p>
<p>We use Tags to navigate through the structure.</p>
| 33,414 |
<p>I am using SQL Server 2005. I have a table with a text column and I have many rows in the table where the value of this column is not null, but it is empty. Trying to compare against '' yields this response:</p>
<blockquote>
<p>The data types text and varchar are incompatible in the not equal to operator.</p>
<... | <pre><code>where datalength(mytextfield)=0
</code></pre>
| <p>I would test against <a href="http://msdn.microsoft.com/en-us/library/ms187748.aspx" rel="nofollow noreferrer">SUBSTRING</a>(textColumn, 0, 1)</p>
| 5,345 |
<p>In organisations where you have large numbers of applications, written in a <em>myriad</em> of languages running on <em>innumerable</em> platforms and databases how do folks manage the release of builds and patches, particularly when some of the releases are 3rd party? I know there a whole bunch of "Release Manageme... | <p>I have a similar problem. I have only ever seen a home grown solution to this problem (essentially a commandline program made up unix scripts). </p>
<p>In my investigations, the only package that I have seen so far, which specifically targets the problem is <a href="http://www.incanica.com/tableaux.html" rel="nofo... | <p>You can use <a href="http://www.NDepend.com" rel="nofollow noreferrer">NDepend</a> to know and control exactly what you use from tiers library. I wrote an article about this <a href="http://codebetter.com/blogs/patricksmacchia/archive/2008/10/20/controlling-the-usage-of-libraries.aspx" rel="nofollow noreferrer">Cont... | 38,560 |
<p>I'm trying to get my multithreading understanding locked down. I'm doing my best to teach myself, but some of these issues need clarification. </p>
<p>I've gone through three iterations with a piece of code, experimenting with locking.</p>
<p>In this code, the only thing that needs locking is this.managerThreadPri... | <p>1) Before you even start the other thread, you don't have to worry about shared access to it at all.</p>
<p>2) Yes, you should lock <em>all</em> access to shared mutable data. (If it's immutable, no locking is required.)</p>
<p>3) Don't use GetHashCode() to indicate a thread ID. Use Thread.ManagedThreadId. I know,... | <p>There is no need to lock anything before you have started any threads.</p>
<p>If you are only going to read a variable there's no need for locks either. It's when you mix reads and writes that you need to use mutexes and similar locking, and you need to lock in both the reading and the writing thread.</p>
| 18,768 |
<p>Having just witnessed <a href="http://www.youtube.com/watch?v=PEnfpQa3nrI&feature=related" rel="nofollow noreferrer">Sound Load technology</a> on the Nintendo DS game <a href="http://en.wikipedia.org/wiki/Bangai-O_Spirits" rel="nofollow noreferrer">Bangai-O Spritis</a>. I was curious as to how this technology wo... | <p>Its the same old thing used in ZX Spectrum era. You load programs/games from tape.Only the sound quality and the filters are probably better. </p>
<p>In my opinion something like Bluetooth or WiFi is better. You can also send files that can be put on some storage and then load them. I find these methods much easier... | <p>If you want to pass data as audio through the air there are a few things you need to be aware of though, such as how the speaker and microphone interact for example. It is important that they don't distort or alter the sound too much as what you are sending are in fact the raw bytes.<br>
Some audio software will let... | 14,551 |
<p>Scenario:
A stored procedure receives from code a DateTime with, let's say DateTime.Now value, as a datetime parameter.
The stored procedure needs to store only the date part of the datetime on the row, but preserving all date related arithmetics for, to say, do searches over time intervals and doing reports based... | <p>Business Logic should be handled outside of the proc. The procs jobs should be to save the data passed to it. If the requirment is to only store Date and not time, then the BL/DL should pass in DateTime.Now**.Date** (or the equiv...basically the Date part of your DateTime object).</p>
<p>If you can't control the ... | <p>store the date with time = midnight</p>
<p>EDIT: i was assuming MS SQL Server</p>
| 10,538 |
<p>In my previous job I designed and helped build a run-time(production) <a href="http://www.samsaffron.com/blog/archive/2007/05/11/15.aspx" rel="nofollow noreferrer">Profiler tool</a> that among other cool features was able to give me .Net stack traces for every SQL statement that executed. Think of it as SQL-Server P... | <p>I am not sure if it will do excatly what you need but the best profiling tool i have found for .Net is <a href="http://www.red-gate.com/Products/ants_profiler/index.htm" rel="nofollow noreferrer">ANTS Profiler</a>, If i remember it will show you the SQL and also all the .net calls.</p>
| <p>We have recently starting a tool called <a href="http://www.dynatrace.com/en/" rel="nofollow noreferrer">dynaTrace</a>. There is a workstation verison that you can use on one box and a server/agent version for operating against many boxes.</p>
<p>Basically, you set up the tool against a particular application (or ... | 25,328 |
<p>When connecting to a network share for which the current user (in my case, a network enabled service user) has no rights, name and password have to be provided.</p>
<p>I know how to do this with Win32 functions (the <code>WNet*</code> family from <code>mpr.dll</code>), but would like to do it with .Net (2.0) functi... | <p>You can either change the thread identity, or P/Invoke WNetAddConnection2. I prefer the latter, as I sometimes need to maintain multiple credentials for different locations. I wrap it into an IDisposable and call WNetCancelConnection2 to remove the creds afterwards (avoiding the multiple usernames error):</p>
<pre>... | <p>You should be looking at adding a line like this:</p>
<pre><code><identity impersonate="true" userName="domain\user" password="****" />
</code></pre>
<p>Into your web.config.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms998358.aspx" rel="nofollow noreferrer">More Info... | 37,771 |
<p>I am designing an application that is going to consist of 3-4 services that run as separate processes and are linked by a suitable IPC. The system is going to have a web interface and I want to use whatever webserver is there.</p>
<p>The web interface should be accessed under some URL that allows to have other URLs... | <p>OK, I overlooked this previously. Explaining my question here brought me onto it:</p>
<blockquote>
<p>Instead of creating a new process for every request, FastCGI can use a single persistent process which handles many requests over its lifetime. -- <a href="http://en.wikipedia.org/wiki/FastCGI" rel="noreferrer">W... | <p>Even under moderate loads, CGI is a pretty unscalable beast. FastCGI is an option, but you'll probably also find a mod_XXXX package where XXXX is the name of your language. There's a mod for ruby, perl, and python for instance and probably a fair few others. </p>
| 16,905 |
<p>Questions #1 through #4 on the <a href="http://www.joelonsoftware.com/articles/fog0000000043.html" rel="nofollow noreferrer">Joel Test</a> in my opinion are all about the development tools being used and the support system in place for developers:</p>
<ol>
<li>Do you use source control? </li>
<li>Can you make a bui... | <ol>
<li>source control: <a href="http://subversion.tigris.org/" rel="nofollow noreferrer">Subversion</a> or <a href="http://www.selenic.com/mercurial/wiki/" rel="nofollow noreferrer">Mercurial</a> or <a href="http://git-scm.com/" rel="nofollow noreferrer">Git</a></li>
<li>build automation: <a href="http://nant.sourcef... | <p>A good issue tracker that was relatively inexpensive was <a href="http://axosoft.com/products/ontime.aspx" rel="nofollow noreferrer">axoSoft OnTime</a>. I used it for years before getting MS TFS.</p>
<p><a href="http://nant.sourceforge.net/" rel="nofollow noreferrer">Nant</a> and <a href="http://confluence.public.t... | 3,579 |
<p>I am developing an <a href="https://github.com/Stypox/image-to-gcode" rel="nofollow noreferrer">image to gcode program</a>, that would recognize edges and generate corresponding G-code to be sent to a plotter. I was able to detect edges using the <a href="https://en.wikipedia.org/wiki/Sobel_operator" rel="nofollow n... | <p>Quote of comment of <a href="https://3dprinting.stackexchange.com/questions/11956/converting-an-undirected-graph-to-optimal-g-code-paths#comment21885_11956">R.. GitHub STOP HELPING ICE</a> on question reads: </p>
<blockquote>
<p>Pretty sure it is NP-complete (equivalent to travelling salesman problem), no? – </p... | <p>If you can save your plot as a dxf, you can use Repetrel to generate gcode with our "find nearest neighbor" optimizing. You can download it from <a href="http://hyrel3d.net" rel="nofollow noreferrer">http://hyrel3d.net</a> - the full install instructions start at <a href="http://hyrel3d.net/wiki/index.php/Installati... | 1,579 |
<p>I've found some examples using the Win32 api or simulating the ^+ button combination (<kbd>ctrl</kbd>-<kbd>+</kbd>) <a href="http://www.codeproject.com/KB/list/AutoResize.aspx" rel="nofollow noreferrer">using SendKeys</a>, but at least with the SendKeys method the listview grabs the cursor and sets it to an hourglas... | <p>Looks like a call to <code>myListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent)</code> will do what you want. I would think, just call it after adding an item.</p>
<p>More info <a href="https://msdn.microsoft.com/en-us/library/system.windows.forms.listview.autoresizecolumns(v=vs.110).aspx" rel="n... | <p>loop through all columns and set width to -1 after adding content.</p>
| 8,190 |
<p>I have an <code>ArrayList<String></code> that I'd like to return a copy of. <code>ArrayList</code> has a clone method which has the following signature:</p>
<pre><code>public Object clone()
</code></pre>
<p>After I call this method, how do I cast the returned Object back to <code>ArrayList<String></co... | <p>Why would you want to clone? Creating a new list usually makes more sense.</p>
<pre><code>List<String> strs;
...
List<String> newStrs = new ArrayList<>(strs);
</code></pre>
<p>Job done.</p>
| <pre><code>ArrayList first = new ArrayList ();
ArrayList copy = (ArrayList) first.clone ();
</code></pre>
| 7,857 |
<p>i have a library with some entities that share the same interface. clients and service share this assembly. now i wonder if there is a way to have this Interface-type as Parameter in my service contracts so that i can use the same method for all classes implementing the interface.</p>
<p>the entities themselve are ... | <p>I solved the problem using the ServiceKnownType attribute at the implementations of the OperationContracts.</p>
<p>When telling your classes that implement the interface as ServiceKnownType's, you can use the interface as parameter and therefore are able to use all classes implementing your interface as long as the... | <p>[I just read your answer and realized that you were asking specifically about parameters to service methods. I'll leave my comments here in case they're still helpful.]</p>
<p>What I've done on projects where I know I have WCF on both sides of the wire, is something like:</p>
<p>A library of only the shared interf... | 18,570 |
<p>I'm implementing my app as a drag source. When I call DoDragDrop (Win32 call, not MFC) it enters into a modal loop and I don't get repaint messages in my main window until DoDragDrop returns. Unfortunately if I do a drop in the shell (a file) and the filename is already there the shell asks if I want to replace the ... | <p>Have you tried a timer? I ran into the same problem with <code>DoDragDrop()</code> and other blocking calls like <code>SHFileOperation()</code> and solved it using a call to <code>SetTimer()</code>.</p>
<p>EDIT: If you want more control over <code>DoDragDrop()</code> then a worker thread works well. You can try c... | <p>Seems like the real answer is to implement IAsyncOperation in my data object.</p>
| 33,987 |
<p>When you run <code>git branch -r</code> why the blazes does it list <code>origin/HEAD</code>? For example, there's a remote repo on GitHub, say, with two branches: master and awesome-feature. If I do <code>git clone</code> to grab it and then go into my new directory and list the branches, I see this:</p>
<pre><cod... | <p><strong>@robinst</strong> is correct.</p>
<p>In git, you can select which branch is checked out by default (i.e. when you clone). By default, <code>origin/HEAD</code> will point at that.</p>
<p>On GitHub, <a href="https://github.com/blog/421-pick-your-default-branch" rel="noreferrer">You can change this</a> in the... | <p>My guess is that someone pushed a branch and called it HEAD:</p>
<pre><code>git push origin HEAD
</code></pre>
| 46,154 |
<p>I'm using VMware Workstation 6.0 for simulation of tight clusters of "blades" in a "chassis". Both the host and target OSs are Linux. Each "chassis" uses a vmnet switch as a virtual backplane, to which the virtual blades connect. Other vmnet switches are used to mediate point-to-point connections between mutiple vir... | <p>The first thing you'll gain by switching will be a substantially more powerful platform that's running directly on the bare-metal of your server.</p>
<p>From my experience, moving <em>up</em> the VMware application stack has never been problematic (Server to Workstation to ESX). However, I would verify this by expo... | <p>One thing to note is the considerable expense of the ESX line compared to Workstation. If you're working for a successful company, though, the cost can easily be justified as ESX is (imho) da bomb. Also, FYI, the old free VMware Server options definitely had a whole different interface.</p>
| 13,549 |
<p>So in high school math, and probably college, we are taught how to use trig functions, what they do, and what kinds of problems they solve. But they have always been presented to me as a black box. If you need the Sine or Cosine of something, you hit the sin or cos button on your calculator and you're set. Which is ... | <p>First, you have to do some sort of range reduction. Trig functions are periodic, so you need to reduce arguments down to a standard interval. For starters, you could reduce angles to be between 0 and 360 degrees. But by using a few identities, you realize you could get by with less. If you calculate sines and cos... | <p>If your asking for a more physical explanation of sin, cos, and tan consider how they relate to right-angle triangles. The actual numeric value of cos(lambda) can be found by forming a right-angle triangle with one of the angles being lambda and dividing the length of the triangles side adjacent to lambda by the le... | 44,898 |
<p>We have a Rails project that uses PostgreSQL-specific queries, so it's uncomfortable to use sqlite even in development mode. The problem is, I'd love to track schema changes in database and omit running migrations on request, and I'd also love to track db-data changes with git, so that I wouldn't need to dump the db... | <p>I'm not sure I understand all the nuances of your question - particularly the comments about using SQLite vs PostgreSQL. If it is to be a multi-DBMS system, then testing with multiple systems is good; if it is to be a single-DBMS system, then working with multiple DBMS is making life pointlessly hard.</p>
<p>Also,... | <p>If I understand correctly, you want to be able to track both schema and data changes.</p>
<p>These are, in fact, two very different things - </p>
<ul>
<li><strong>Schema changes</strong> - this is discussed in several other questions (<a href="https://stackoverflow.com/questions/1294758/how-do-you-maintain-revisio... | 47,937 |
<p>By looking at our <code>DB's</code> error log, we found that there was a constant stream of almost successful SQL injection attacks. Some quick coding avoided that, but how could I have setup a monitor for both the DB and Web server (including POST requests) to check for this? By this I mean if there are off the sh... | <p>Funnily enough, Scott Hanselman had a <a href="http://www.hanselman.com/blog/HackedAndIDidntLikeItURLScanIsStepZero.aspx" rel="nofollow noreferrer">post on UrlScan</a> today which is one thing you could do to help monitor and minimize potential threats. It's a pretty interesting read.</p>
| <p>Monitoring web and DB access logs should alert you to things like this, but if you want a more fully featured alert system I would suggest some kind of IDS/IPS. You'll need a spare machine though, and a switch that can do port mirroring.
If you have those then an IDS is a cheap way of monitoring your traffic for ma... | 2,995 |
<p>Does anybody know if there is a feasible way on Windows XP to programmatically create and configure a user account so that after logging in from the console (no terminal services) a specific app is launched and the user is "locked" to that app ?</p>
<p>The user should be prevented from doing anything else with the ... | <p>SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon has two values
UserInit points to the application that is executed upon successful logon. The default app there, userinit.exe processes domain logon scripts (if any) and then launches the specified Shell= application.</p>
<p>By creating or replacing those entrie... | <p>I guess you're building a windows kiosk?</p>
<p>Here's some background in replacing the windows login shell - <a href="http://blogs.msdn.com/embedded/archive/2005/03/30/403999.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/embedded/archive/2005/03/30/403999.aspx</a></p>
<p>The above link talks about using I... | 12,696 |
<p>Are there any best practices (or even standards) to store addresses in a consistent and comprehensive way in a database ?</p>
<p>To be more specific, I believe at this stage that there are two cases for address storage :</p>
<ul>
<li>you just need to associate an address to a person, a building or any item (the mo... | <p>I've been thinking about this myself as well. Here are my loose thoughts so far, and I'm wondering what other people think.</p>
<p>xAL (and its sister that includes personal names, XNAL) is used by both Google and Yahoo's geocoding services, giving it some weight. But since the same address can be described in xAL ... | <p>normalize your database schema and you'll have the perfect structure for correct consistency. and this is why:
<a href="http://weblogs.sqlteam.com/mladenp/archive/2008/09/17/Normalization-for-databases-is-like-Dependency-Injection-for-code.aspx" rel="nofollow noreferrer">http://weblogs.sqlteam.com/mladenp/archive/20... | 15,350 |
<p>If you add a image to your browser's DOM, IE6 will not check its cache to see if it already downloaded the image but will, instead, re-retrieve it from the server. I have not found any combination of HTTP response headers (of the ensuing image request) to convince IE6 that it can cache the image: Cache-control, Ex... | <p>Maybe <a href="http://www.mister-pixel.com/index.php?Content__state=is_that_simple" rel="nofollow noreferrer">this</a> will work? (is the same behaviour like hovering on links with css background image)</p>
| <p>A quick google mentions the "Expires" header, which you've already tried. Digging deeper, it mentions the ETag header:</p>
<p><a href="http://mir.aculo.us/2005/08/28/internet-explorer-and-ajax-image-caching-woes" rel="nofollow noreferrer">http://mir.aculo.us/2005/08/28/internet-explorer-and-ajax-image-caching-woes... | 8,801 |
<p>When you think about it, doesn't the REST paradigm of being resource-oriented boil down to being object-oriented (with constrained functionality, leveraging HTTP as much as possible)?</p>
<p>I'm not necessarily saying it's a bad thing, but rather that if they are <strike>essentially the same</strike> very similar t... | <p>REST is similar to OO in that they both model the world as entities that accept messages (i.e., methods) but beyond that they're different.</p>
<p>Object orientation emphasizes encapsulation of state and <strong>opacity</strong>, using as many different methods necessary to operate on the state. REST is about trans... | <p>Only if your objects are DTOs (<a href="http://en.wikipedia.org/wiki/Data_Transfer_Object" rel="nofollow noreferrer">Data Transfer Objects</a>) - since you can't really have behavior other than persistence.</p>
| 18,444 |
<p>A question to those who have a 3D printer. Have you ever needed a spare throat or a heater block? Do they ever break? </p>
<p>I just bought some spare parts: heaters, thermistors, nozzles... However, I am not sure if buying throats and heater blocks make any sense.</p>
| <h1>Short answer</h1>
<p>Yes</p>
<h1>Long answer</h1>
<h2>Heater bocks</h2>
<p>A heater block is destroyed if one of the following happens</p>
<ul>
<li>Threads stripped</li>
<li>Bent or otherwise deformed</li>
<li>stripped grub screw</li>
</ul>
<p>All of these can happen by handling the block with too much force when s... | <p>Parts don't have to break or bent, they may become unusable by other issues as well!</p>
<p>In addition to <a href="/a/12115">the answer of @Trish</a>, if you clog your hotend, or the hotend/heater block/nozzle gets buried deep into solidified filament (see image below), it might be much easier just to replace the ... | 1,604 |
<p>I'm trying to expose this function to Python using SWIG:</p>
<pre><code>std::vector<int> get_match_stats();
</code></pre>
<p>And I want SWIG to generate wrapping code for Python so I can see it as a list of integers.</p>
<p>Adding this to the .i file:</p>
<pre>
%include "typemaps.i"
%include "std_vector.i"... | <pre><code>%template(IntVector) vector<int>;
</code></pre>
| <p>I don't have much experience with Swig, but are you #including your C++ header file in your .i file? Try one (or both) of</p>
<pre><code>%include "myvector.h"
%{
# include "myvector.h"
%}
</code></pre>
| 34,908 |
<p><strong>I need a pure .Net persistent hashtable/binarytree, functionally similar to berkeley-db Java edition.</strong></p>
<p>Functionally it should opperate in a similar maner to a DHT such memcached and velocity etc but it doesn't have to be distributed. In essence I am looking for a persistent hashtable.</p>
<... | <p>How about this? <a href="http://sourceforge.net/projects/libdb-dotnet" rel="nofollow noreferrer">SourceForge.net: Berkeley DB for .NET</a></p>
| <p>Have you tried using the build in collections in System.Collections.Generic? And using serialization to push that puppy out to an XML document or something of the like.</p>
| 13,381 |
<p>I've declared Javascript arrays in such a way that I could then access them by a key, but it was a long time ago, and I've forgotten how I did it.</p>
<p>Basically, I have two fields I want to store, a unique key, and its value. I know there is a way to do it.. something like:</p>
<pre><code>var jsArray = new {key... | <p>You can do it in different ways:</p>
<pre><code>var a = {'a':0, 'b':1, 'c':2};
var b = new Array();
b['a'] = 0;
b['b'] = 1;
b['c'] = 2;
var c = new Object();
c.a = 0;
c.b = 1;
c.c = 2;
</code></pre>
| <p>Here is a JavaScript class that provides a simple dictionary.</p>
<pre><code>if( typeof( rp ) == "undefined" ) rp = {};
rp.clientState = new function()
{
this.items = new Object();
this.length = 0;
this.set = function( key, value )
{
if ( ! this.keyExists( key ) )
{
thi... | 24,263 |
<blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="https://stackoverflow.com/questions/321113/how-can-i-pre-set-arguments-in-javascript-function-call-partial-function-appli">How can I pre-set arguments in JavaScript function call? (Partial Function Application)</a> </p>
</blockquote>
<p>I need to... | <p>What you are after is called <strong>partial function application</strong>. </p>
<p>Don't be fooled by those that don't understand the subtle difference between that and currying, they <em>are</em> different.</p>
<p>Partial function application can be used to implement, but <em>is not</em> currying. Here is a quot... | <p>The following is equivalent to your second code block:</p>
<pre><code>var f = function () {
//Some logic here...
};
var fr = f;
fr(pars);
</code></pre>
<p>If you want to actually pass a reference to a function to some other function, you can do something like this:</p>
<pre><code>function fiz(x, y, ... | 48,796 |
<p>I'd like all queries like</p>
<pre><code>http://mysite.com/something/otherthing?foo=bar&x=y
</code></pre>
<p>to be rewritten as</p>
<pre><code>http://mysite.com/something/otherthing.php?foo=bar&x=y
</code></pre>
<p>In other words, just make the .php extension optional, universally.</p>
| <p>I would do it this way. Basically, if file doesn't exist, try adding .php to it.</p>
<pre><code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ $1.php [QSA,L]
</code></pre>
| <p>Something like...</p>
<pre><code>RewriteRule /something/(.+)?(.+) /something/$1.php?$2
</code></pre>
<p>would probably work.</p>
| 22,239 |
<p>When I try to compile code on VS 2005 and it fails, the line which causes the error gets underlined blue, and mouse-hovering over it displays the error message. Fine, but you can't see object types or whatever, because Intellisense will show the error message, and not object info.</p>
<p>In this image, I wanted to ... | <p>Select "Build|Clean Solution" - this cleans up intermediate files and other things. More importantly, it also clears the list of error messages, restoring normal behaviour of Intellisense.</p>
| <p>ctrl-space inside the parens</p>
| 11,395 |
<p>How do you get around this Ajax cross site scripting problem on FireFox 3?</p>
| <p>If you're using jQuery it has a callback function to overcome this:</p>
<p><a href="http://docs.jquery.com/Ajax/jQuery.ajax#options" rel="noreferrer">http://docs.jquery.com/Ajax/jQuery.ajax#options</a></p>
<blockquote>
<p>As of jQuery 1.2, you can load JSON
data located on another domain if you
specify a JSO... | <p>Some more details would be nice: which AJAX library are you using, what would you like to achive, how you do it.</p>
<p>For example it can be a cross-domain Ajax request, which is not allowed. In this case use <a href="http://www.json.org/" rel="nofollow noreferrer">JSON</a>.</p>
| 7,432 |
<p>In perfmon in Windows Server 2003, there are counter objects to get per-process processor time and memory working set statistics. The only problem is that in an environment with multiple application pools, there is no way to reliably identify the correct worker process. In perfmon, they are all called "w3wp", and if... | <p>We'd always collect the stats for all the w3wp processes, and we would capture PID. This is one of the counters in the Process group.</p>
<p>There's a script that site in Server 2003's system32 folder called IISApp.vbs, that will list all the processes and their PIDs. You will need to run this to capture the PID's.... | <p>The w3wp instance may not appear, if the worker process is idle for a long time .
The UI interface has to be used for small course of time , so that the worker process (w3wp) can show up in the instances.</p>
| 48,634 |
<p>I am instantiating a local COM server using CoCreateInstance. Sometimes the application providing the server takes a long time to start. When this happens, Windows pops a dialog box like this:</p>
<p><strong>Server Busy</strong></p>
<p>The action cannot be completed because the other program is busy. Choose 'Swi... | <p>If you're using MFC, we used to do stuff like this:</p>
<pre><code>// prevent the damned "Server Busy" dialog.
AfxOleGetMessageFilter()->EnableBusyDialog(0);
AfxOleGetMessageFilter()->EnableNotRespondingDialog(0);
</code></pre>
| <p>Have a look at <code>IMessageFilter</code> and <code>CoRegisterMessageFilter</code>.</p>
| 35,714 |
<p>Take the following two lines of code:</p>
<pre><code>for (int i = 0; i < some_vector.size(); i++)
{
//do stuff
}
</code></pre>
<p>And this:</p>
<pre><code>for (some_iterator = some_vector.begin(); some_iterator != some_vector.end();
some_iterator++)
{
//do stuff
}
</code></pre>
<p>I'm told that th... | <p>The first form is efficient only if vector.size() is a fast operation. This is true for vectors, but not for lists, for example. Also, what are you planning to do within the body of the loop? If you plan on accessing the elements as in</p>
<pre><code>T elem = some_vector[i];
</code></pre>
<p>then you're making ... | <p>Even better than "telling the CPU what to do" (imperative) is "telling the libraries what you want" (functional).</p>
<p>So instead of using loops you should learn the algorithms present in stl.</p>
| 15,936 |
<p>As part of our current database work, we are looking at a dealing with the process of updating databases.</p>
<p>A point which has been brought up recurrently, is that of dealing with system vs. user values; in our project user and system vals are stored together. For example...</p>
<p>We have a list of templates.... | <p>I have never had problems (performance or development - TDD & unit testing included) using GUIDs as the ID for my databases, and I've worked on some pretty big ones. Have a look <a href="http://www.sql-server-performance.com/articles/per/guid_performance_p2.aspx" rel="nofollow noreferrer">here</a>, <a href="http... | <p>Maybe I didn't get it, but couldn't you use GUIDs as Ids and still have user and system data together? Then you can access the system data by the (non-changable) GUIDs.</p>
| 3,109 |
<p>In <b>Prototype</b> I can show a "loading..." image with this code:</p>
<pre><code>var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars,
onLoading: showLoad, onComplete: showResponse} );
function showLoad () {
...
}
</code></pre>
<p>In <b>jQuery</b>, I can load a server page into an element w... | <p>There are a couple of ways. My preferred way is to attach a function to the ajaxStart/Stop events on the element itself.</p>
<pre><code>$('#loadingDiv')
.hide() // Hide it initially
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
})
;
</code></p... | <p>You can always use <a href="http://malsup.com/jquery/block/#overview" rel="nofollow noreferrer">Block UI jQuery plugin</a> which does everything for you, and it even blocks the page of any input while the ajax is loading. In case that the plugin seems to not been working, you can read about the right way to use it <... | 9,397 |
<p>There appear to be several options available to programs that handle large numbers of socket connections (such as web services, p2p systems, etc).</p>
<ol>
<li>Spawn a separate thread to handle I/O for each socket.</li>
<li>Use the <a href="http://linux.die.net/man/2/select" rel="nofollow noreferrer">select</a> sys... | <p>From my experience, you'll have the best perf with #6. </p>
<p>I also recommend you look into libevent to deal with abstracting some of these details away. At the very least, you'll be able to see some of their benchmark <img src="https://monkey.org/~provos/libevent/libevent-benchmark2.jpg" alt="benchmark results... | <p>I use epoll() extensively, and it performs well. I routinely have thousands of sockets active, and test with up to 131,072 sockets. And epoll() can always handle it.</p>
<p>I use multiple threads, each of which poll on a subset of sockets. This complicates the code, but takes full advantage of multi-core CPUs.</... | 17,238 |
<p>Am looking for commercial/free recommended c# winform controls packs</p>
| <p><strong><a href="http://www.devexpress.com/" rel="noreferrer">DevExpress</a></strong> </p>
<p><em>I've tried <a href="http://www.componentone.com/" rel="noreferrer">ComponentOne</a>, DevExpress and <a href="http://www.telerik.com/" rel="noreferrer">Telerik</a></em></p>
| <p>I have used the Telerik controls suite, and they are fairly decent.</p>
| 21,534 |
<p>I want to get user input in one page, store that in a php variable and use it in another php page. I have tried using 'sessions' but it doesn't seem to be working. Is there another safe alternative? This information is likely to be usernames and passwords.</p>
| <p>Try changing your session code as this is the best way to do this.</p>
<p>For example:</p>
<h2>index.php</h2>
<pre><code><?php
session_start();
if (isset($_POST['username'], $_POST['password']) {
$_SESSION['username'] = $_POST['username'];
$_SESSION['password'] = $_POST['password'];
echo '<a hr... | <p>You can try using POST and GET methods for transferring user inputs within PHP scripts.</p>
<p><a href="http://www.php.net/manual/en/reserved.variables.get.php" rel="nofollow noreferrer">PHP GET</a></p>
<p><a href="http://www.php.net/manual/en/reserved.variables.post.php" rel="nofollow noreferrer">PHP POST</a></p>... | 29,770 |
<p>I was of the opinion that virtualization doesnt work in the super class constructor as per the design of OOP. For example, consider the following C# code. </p>
<pre><code>using System;
namespace Problem
{
public class BaseClass
{
public BaseClass()
{
Console.WriteLine("Hello, W... | <p>In native C++, the program works as expected: you get the call to the base class version of the virtual function within the base class constructor. At the time of the constructor call, only the base class and its virtual functions exist, so you get the lowest-level version of the virtual function defined at the time... | <p>I'd suggest using FxCop on your code. I've worked with many folks who dismiss the items raised by this tool as inconsequential, but, if your code contains lots of minor issues (such as yours), then the chances of being bitten by one or more are that much higher.</p>
<p>ReSharper's code analysis will pick up this p... | 39,667 |
<p>What would be a good offline alternative of the online <a href="http://www.lipsum.com/feed/html" rel="noreferrer">Lipsum generator</a>? It's frustrating when I'm not online and need some placeholder text for testing purpose. A CLI utility would be ideal, so that I can tailor the output to fit my needs.</p>
| <p>In Office 2007 apps, you can type in</p>
<pre><code>=lorem(n)
</code></pre>
<p>with <code>n</code> equaling the number of paragraphs of lorem ipsum you would like generated.</p>
| <p>At the bottom of the lorem ipsum generator you will find links to the generator for other usage. My understanding is the following can be used offline:</p>
<ul>
<li><a href="http://ftp.ktug.or.kr/tex-archive/help/Catalogue/entries/lipsum.html" rel="nofollow noreferrer">TeX Package</a></li>
<li><a href="http://www.s... | 12,034 |
<p>I run into similar codes like this all the time in aspx pages:</p>
<pre><code><asp:CheckBox Runat="server" ID="myid" Checked='<%# DataBinder.Eval(Container.DataItem, "column").Equals(1) %>'>
</code></pre>
<p>I was wondering what other objects I have access to inside of that <%# %> tag. How come Data... | <p>Within <%# %> tags you have access to </p>
<ol>
<li>Anything that is visible in your code-behind class (including protected methods and properties).</li>
<li>Anything declared on the aspx page using <@import @>.</li>
<li>Anything passed in as the event arguments when the ItemDataBound event is fired (e.g. Rep... | <p>I believe you have access to anything within scope of the page class, though the results of the expression are converted to a string, so you can't embed conditional expressions the way you can with "<%" expression holes.</p>
<p><a href="http://www.odetocode.com/Articles/278.aspx" rel="nofollow noreferrer">Here</... | 22,438 |
<p>If I do not specify the following in my web.xml file:</p>
<pre><code><session-config>
<session-timeout>10</session-timeout>
</session-config>
</code></pre>
<p>What will be my default session timeout? (I am running Tomcat 6.0)</p>
| <p>If you're using Tomcat, it's 30 minutes. You can read more about it <a href="http://forums.sun.com/thread.jspa?threadID=565341&messageID=2788327" rel="noreferrer">here</a>.</p>
| <p>Session Time out we can specify for that particular context in web.xml file as mentined below entry
60
</p>
<p>Default Session time out is 30 mins</p>
| 17,133 |
<p>Is it possible to tell if the user of a website is using multiple monitors? I need to find the position of a popup but it's quite likely the user will have a multiple monitor setup. Whilst <code>window.screenX</code> etc. will give the position of the browser window it's useless for multiple monitors.</p>
| <p>I didn't find the answer I needed anywhere on StackOverflow, so responding late to the several related threads here. The solution is, first, check for secondary display with <code>window.screen.isExtended</code>. Then <code>await window.getScreenDetails()</code>, which returns an object that includes an array of scr... | <p>I found this as a solution that someone has used... I do not see why you couldn't trust it.</p>
<p>[if the width is greater then (Height/3) * 4 > (Screen.Width) THEN]</p>
<p>[User has dual monitor]</p>
<p>[End If]</p>
| 16,985 |
<p>How can I create rounded corners using CSS?</p>
| <p>Since CSS3 was introduced, the best way to add rounded corners using CSS is by using the <code>border-radius</code> property. You can <a href="http://www.w3.org/TR/css3-background/#the-border-radius" rel="noreferrer">read the spec</a> on the property, or get some <a href="https://developer.mozilla.org/en-US/docs/Web... | <p>Opera does not support border-radius yet (apparently it will be in the release after version 10). In the meantime, you can <a href="http://dev.opera.com/articles/view/new-development-techniques-using-opera-k/" rel="nofollow noreferrer">use CSS to set an SVG background to create a similar effect</a>.</p>
| 2,873 |
<p>I've been tasked with deploying an application built by a third party on an Oracle Application Server, version 10.1.3.0. I've deployed it on Oracle Application Server version 10.1.2.0 without much difficulty. I'm getting the following error:</p>
<pre><code>javax.naming.NamingException: Lookup error: javax.naming.... | <p>Fiddler can do constrained bandwidth and latency simulations.</p>
| <p><a href="http://snad.ncsl.nist.gov/nistnet/" rel="nofollow noreferrer">NIST Net</a> can do some crazy network emulation.</p>
| 32,824 |
<p>How can I resume a dehydrated orchestration ?</p>
<ul>
<li>the orchestration in question should have been retrieving messages from a MSMQ queue</li>
<li>but the userid permission wasn't set on the queue, so the BizTalk box wasn't able to read from the queue</li>
</ul>
<p>Corrected the permissions, but the only opt... | <p>If the orchestration attempted to start and failed on the MSMQ receive, it's essentially hung and has not removed a message from the queue. I'd terminate it. The orchestration should clear and pickup the new messages. Does your orchestration implement a singleton pattern or are you using ordered delivery on the r... | <p>Can you suspend, then resume?</p>
<p>It's been a couple years since I did BizTalk. Quirks like this were annoying. Even worse when it's 250k dehydrated and you need to script to restart them. ugh</p>
<p>I feel for you.</p>
| 44,830 |
<p>I'm interested in how garbage collection works. I've read up on how some work such as mark-and-sweep, stop-and-copy, generational GC, etc... I'd like to experiment with implementing some of these and comparing their behaviors. What's a good way to get started experimenting with my own? Ideally something in C, Java o... | <p>Never played with it myself, but the one that always gets mentioned for use with C/C++ is <a href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/" rel="noreferrer">Hans Boehm's</a>.</p>
| <p>Implement your own JVM. Nothing fancy, just the basics. There are lots and lots of programs/compilers/languages which generate JVM code so you have plenty of material to test with.</p>
| 30,830 |
<p>I'm a c++ programmer and I'm playing around with java after finding JPA which for a few of my current applications is a god send. I haven't touched java since university and I'm having a problem running out of heap space. I'm using the code below as the main part of a not-very-serious test of jdbc/jpa/lucene but I k... | <p>I don't see anything obviously out of place. If you're working with a very large database, you could try increasing your heap size by using the <code>-Xmx n</code> option in your JVM invocation. This is usually not the best solution - only do with this when you know your working set size is actually bigger than th... | <p>How many items are in your result set? If there are enough records, than you will use up all your memory, as there is nothing garbage collected in this case as you are doing an addDocument to the writer, which will hold a reference to all the documents you are creating.</p>
| 26,707 |
<p>In an aspx C#.NET page (I am running framework v3.5), I need to know where the user came from since they cannot view pages without logging in. If I have page <code>A</code> (the page the user wants to view) redirect to page <code>B</code> (the login page), the Request.UrlReferrer object is null. </p>
<p>Backgroun... | <p>If you use the standard Membership provider, and set the Authorization for the directory/page, the code will automatically set a query parameter of ReturnUrl and redirect after a successfull login.<p>If you don't want to use the Membership provider pattern, I would suggest manually doing the query string parameter t... | <p>The problem could be related on how you redirect the user to some other page. Anyways, the referer url is nothing you should take as absolute rule - a client can fake it easily.</p>
| 17,973 |
<p>Basically my problem stems from a desire to have the textbox portion be white, and the drop down to be black. When I set the text to white, the drop down appears as I want it, but the text in the textbox itself is hardly readable. Setting the Foreground to black makes the drop down unreadable.</p>
<p>Is there a goo... | <p>Edit the ControlTemplate, You will see a TextBlock and another PopUp which again has a set of controls. Have a different ForeGround/Background for this TextBox, </p>
| <p>Your best bet is to edit a copy of the template of the ComboBox and set the two of them independently.</p>
| 16,326 |
<p>My C# application includes an embedded web browser, which is made possible by the <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx" rel="nofollow noreferrer">System.Windows.Forms.WebBrowser</a> class. Users are able to navigate to websites using the app, however, when they encou... | <p>Are you looking to actively block popups or handle them in your application? If you're wanting to customize the blocking, then you'll have to implement the <a href="http://msdn.microsoft.com/en-us/library/aa768283(VS.85).aspx" rel="nofollow noreferrer">DWebBrowserEvents2 interface</a>, specifically the <a href="http... | <p>IIRC you can trap the NewWindow2 event on the WebBrowser control and set Cancel = true to prevent the pop-up.</p>
<p>This article may help:</p>
<p><a href="http://www.codeproject.com/KB/cpp/ExtendedWebBrowser.aspx#GoalBlock" rel="nofollow noreferrer">http://www.codeproject.com/KB/cpp/ExtendedWebBrowser.aspx#GoalBl... | 27,059 |
<p>I'm looking for a good way to enumerate all the Video codecs on a Windows XP/Vista machine.</p>
<p>I need present the user with a set of video codecs, including the compressors and decompressors. The output would look something like</p>
<pre>
Available Decoders
DiVX Version 6.0
XVID
Motion JPEG
CompanyX's MPEG-2 ... | <p>This is best handled by DirectShow.</p>
<p>DirectShow is currently a part of the platform SDK.</p>
<pre><code>HRESULT extractFriendlyName( IMoniker* pMk, std::wstring& str )
{
assert( pMk != 0 );
IPropertyBag* pBag = 0;
HRESULT hr = pMk->BindToStorage(0, 0, IID_IPropertyBag, (void **)&pBag );
if... | <p>Another point I forgot.</p>
<p>The Windows Media Foundation is a toolkit for using WMV/WMA. It does not provide all things that DirectShow supports. It is really only a SDK for Windows Media.
There are bindings in WMV/WMA to DirectShow, so that you can use WM* files/streams in DirectShow applications.</p>
| 5,041 |
<p>I have derived a TabControl with the express purpose of enabling double buffering, except nothing is working as expected. Here is the TabControl code:</p>
<pre><code>class DoubleBufferedTabControl : TabControl
{
public DoubleBufferedTabControl() : base()
{
this.DoubleBuffered = true;
this.Se... | <p>If you read the documentation, it says, "This member is not meaningful for this control." If you want the control to be drawn utilizing double-buffering, you'll have to implement it yourself. Besides the fact that if you owner-draw the control, you would have to implement double-buffering yourself anyhow.</p>
| <p>Not sure, but you might try double-buffering the control that contains the tab control. </p>
| 27,615 |
<p>How can i format currency related data in a manner that is culture aware in JavaScript?</p>
| <p>Dojo has a <a href="http://api.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.currency.format" rel="nofollow noreferrer">currency formatter</a> that's locale aware. </p>
<p>If you don't want to include Dojo in your project just for this function, then perhaps you can localize the currency in your back-end?</p>
| <p>there is a Number.localeFormat function but I'm not sure it's what your after</p>
<p><a href="http://msdn.microsoft.com/en-gb/library/bb310813.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-gb/library/bb310813.aspx</a></p>
| 7,468 |
<p>we're developing a web app to cover all aspects of a printing company from finances, to payroll, to job costing. Its important to be able to control who can access what parts of these applications. Don't want a line employee giving himself a raise, etc...</p>
<p>I've heard of the concept of ACL & ACO, but hav... | <p>A brief rundown on ACLs, where they should be used and how they should be structured and implemented for various applications and user levels can be found here:</p>
<p><a href="http://c2.com/cgi/wiki?AccessControlList" rel="nofollow noreferrer">LINK</a></p>
| <p>I've had to implement that type of security a couple of times. Unfortunately I don't know of any really good articles that provide examples. My implementations were mainly piecing together the parts through trial and error.</p>
<p>However, I did come across this link on MSDN:</p>
<p><a href="http://msdn.microsof... | 3,368 |
<p>My homepage (or welcome page) will consist of data from two models (lets call them authors and posts). I am new to rails and not sure what is the best way to accomplish this.</p>
<p>Should I create a new controller called welcome which gathers data from the authors and posts and then display them in the welcome ind... | <p>The question is, is your home page just a landing page or will it be a group of pages? If it's just a landing page, you don't expect your users to hang around there for long except to go elsewhere. If it's a group of pages, or similar to an existing group, you can add an action to the controller it's most like.</p... | <p>Create a new controller named as appropriately as you can. SummaryController? StartController? DailyFrontPageController? You'll have an idea.</p>
<p>Not only that, I'd seriously consider creating a new Model, <em>not</em> ActiveRecord-based, that collects the information from your Author and Post models (or whateve... | 45,504 |
<p>I have a Linq to objects statement</p>
<pre><code> var confirm = from l in lines.Lines
where (l.LineNumber == startline.LineNumber) || (l.LineNumber == endline.LineNumber)
select l;
</code></pre>
<p>The confirm object is returning an 'Object Null or Not A Reference' at at System.Linq.Enumerable.WhereListIterat... | <p>I'm not sure if it's possible to debug from VS, but I find <a href="http://www.linqpad.net/" rel="noreferrer">LINQPad</a> to be quite useful. It'll let you dump the results of each part of the LINQ query.</p>
| <p>While it isn't a way of debugging, I'd suggest using the following:</p>
<pre><code>using (var db = new AppContext())
{
db.Database.Log = s => System.Diagnostics.Debug.WriteLine(s);
// Rest of code
}
</code></pre>
<p>You can then check the output window when debugging to s... | 14,404 |
<p>I need to upsize a split Access database, i.e., one that's currently split between tow mdb files, a front-end and back-end. I see many webpages that in essence say, "run the Upsizing Wizard." My first, very basic question:</p>
<p><em>Should I be running this wizard in my front-end mdb or my back-end mdb?</em></p>
... | <p>I would agree with your first guess: you will want to run the wizard on the back-end mdb.</p>
<p>Once that's in SQL Server, also as you guessed, you'll want to link the front end to work with the SQL Server data. One way to do this is to set up an ODBC data source for your new SQL Server database and select that in... | <p>As a matter of standard paranoia, I would just make a backup copy of the existing files and run the Upsizing Wizard on the front end. If anything undesirable happens, just revert the changes by overwriting with the backup copy.</p>
| 22,295 |
<p>I'm increasingly becoming aware that there must be major differences in the ways that regular expressions will be interpreted by browsers.<br />
As an example, a co-worker had written this regular expression, to validate that a file being uploaded would have a PDF extension:</p>
<pre><code>^(([a-zA-Z]:)|(\\{2}\w+)\... | <p>As far as I know firefox doesn't let you have the full path of an upload. Interpretation of regular expressions seems irrelevant in this case. I have yet to see any difference between modern browsers in regular expression execution.</p>
| <p>I have not noticed a difference between browsers in regards to the pattern syntax. However, I have noticed a difference between C# and Javascript as C#'s implementation allows back references and Javascript's implementation does not.</p>
| 34,526 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.