input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
How to operate with multiple assembly versions in private folders using config? <p>I have a scenario where I have multiple versions of the same assembly that I need to store in the application private folders, in a structure like this:</p>
<pre><code>.\My.dll // latest version, say 1.1.3.0
.\v1.1.1\My.dll /... | <p>Without seeing the entire solution, I can only assume you have a typo somewhere. I just tried this for myself and - with the help of <a href="http://msdn.microsoft.com/en-us/library/e74a18c4%28vs.71%29.aspx" rel="nofollow">fuslogvw</a>, I was able to get it working.</p>
<p>I have three versions of the assembly and ... |
Python - How to calculate equal parts of two dictionaries? <p>I have a problem with combining or calculating common/equal part of these two dictionaries. In my dictionaries, values are lists: </p>
<pre><code>d1 = {0:['11','18','25','38'],
1:['11','18','25','38'],
2:['11','18','25','38'],
3:['11','... | <p>Assuming this is Python, you want:</p>
<pre><code>dict((x, set(y) & set(d1.get(x, ()))) for (x, y) in d2.iteritems())
</code></pre>
<p>to generate the resulting dictionary "d3".</p>
<h3>Python 3.0+ version</h3>
<pre><code>>>> d3 = {k: list(set(d1.get(k,[])).intersection(v)) for k, v in d2.items()}
{... |
SharePoint Table of Contents Web Part and export/import <p>After moving a SharePoint MOSS site using stsadm export/import I have found some problems with the Table of Contents Web Part.</p>
<p>If I click the Heading of one of the sections in the Table of Contents web part, for example 'Documents' the page errors as it... | <p>Might be one of the properties on the webpart that has a value from where it was exported from (Site?).</p>
<p><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.publishing.webcontrols.tableofcontentswebpart_properties.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/microsoft.sharepo... |
Unit test constructor that uses My.Settings <p>I have a constructor that looks like this:</p>
<p>Public Sub New()
MyBase.New()
ws.Url = My.Settings.WebServiceURL
End Sub</p>
<p>(ws is private)</p>
<p>Is there any point in unit testing this?</p>
<p>The class did not previously have this constructor.... | <p>Is this the only constructor for the class? If so, then you test it every time you test the class, and a separate test is unnecessary. If you had written a separate test, you would have refactored it into the others after the first success.</p>
|
Splitting html table in ASP.NET <p>I have a html file which has a huge table with 4 columns and multiple rows. I want to display it in an asp 2.0/3.5 page, such that it's first 2 columns appear in one area and other two appear in another area adjacent to it. Some thing like splitting the table in two and displaying. Is... | <p>How do you generate the table? That will determine how you split it.</p>
<p>Also, I don't understand the benefit of just putting the two halves side by side. Did you intend to be able to hide one half?</p>
|
Setting up Visual SVN for real world use <p>I have just setup VisualSVN on my local machine and on our server that hosts our websites. I used the standard default settings when installing the software but I'm a bit confused how to use this with our setup.</p>
<p>I have tested the installation and everything appears to... | <p>I think you're confused about what VisualSVN is:</p>
<blockquote>
<p>VisualSVN Server is a package that contains everything you need to install, configure and manage Subversion server for your team on Windows platform. It includes Subversion, Apache and a management console. </p>
</blockquote>
<p>It's a slick pa... |
Sourcesafe command line options <p>I am having an issue with the Microsoft Visual Sourcesafe command line options that I'm hoping someone has run across and can assist me with. </p>
<p>I have the following line in a DOS batch file.</p>
<pre><code>"c:\Program Files\Microsoft Visual SourceSafe\ss.exe" GET
"$/Devel... | <p><code>-I-Y</code> Answers Yes to all Yes or No questions</p>
<p><a href="http://msdn.microsoft.com/en-us/library/028cya07%28v=vs.80%29.aspx">http://msdn.microsoft.com/en-us/library/028cya07%28v=vs.80%29.aspx</a></p>
|
How do I make a marquee progress bar in WPF? <p>In Winforms I could set the ProgressBarStyle of a progress bar to Marqee, and that would have the progress bar incriment on its own without having to be set, for processes where I don't know how long its going to take, and no good way to report back to the UI.</p>
<p>I w... | <p>I think you simply want to set the <em>IsIndeterminate</em> property of the ProgressBar to <em>true</em>. (See <a href="http://sachabarbs.wordpress.com/2009/12/29/better-wpf-circular-progress-bar/">this</a> article, which also has a nice example of a fancy circular progress indicator.)</p>
|
How scaleable really is a web-services based architecture? <p>Whenever someone talks about a services-based architecture, they often mention scalability, often in the same breath. However, it seems that using services adds more overhead, rather than reducing it, since there is now a protocol, like SOAP or REST, involve... | <p>Scalability and performance are two separate things. Yes, a service based approach does add the overhead of a network protocol, but this is a minimal sacrifice for the benefits of being able to rapidly adopt well-tested services in any application on the domain.</p>
<p>If the overhead of the network is a deal-brea... |
C# Extension Methods Architecture Question <p>I recently asked this question:
<a href="http://stackoverflow.com/questions/638463">http://stackoverflow.com/questions/638463</a></p>
<p>Marc Gravell answer was perfect and it solved my problem. But it gave me something to think about...</p>
<p>If and Extension method mus... | <p>I expect the real answer is simply: there wasn't a good use-case. For instances, the advantage is that it enables a fluent-API over existing types (that don't themselves provide the logic) - i.e.</p>
<pre><code>var foo = data.Where(x=>x.IsActive).OrderBy(x=>x.Price).First();
</code></pre>
<p>which enables LI... |
Subversion Merge Access Rights <p>I need to limit access to merge changes into the trunk to specific individuals. Is there any way to limit merge rights on specific folders in subversion? I don't want to block merging from branch to branch, only into the trunk.</p>
| <p>Can't you make the trunk read-only for those specific people, using Subversion's access control mechanisms?</p>
<p>In your <a href="http://svnbook.red-bean.com/en/1.5/svn.serverconfig.pathbasedauthz.html" rel="nofollow"><code>svnaccess</code></a> file:</p>
<pre><code>[/MyProject/trunk]
me = rw
albert = r
bernard =... |
How can I compare a float to NaN if comparisons to NaN always return false? <p>I have a float value set to NaN (seen in the Watch Window), but I can't figure out how to detect that in code:</p>
<pre><code>if (fValue == float.NaN) // returns false even though fValue is NaN
{
}
</code></pre>
| <p>You want <code>float.IsNaN(...)</code>. Comparisons to <code>NaN</code> always return false, no matter what the value of the float is. It's one of the quirks of floating points.</p>
<p>That means you can do this:</p>
<pre><code>if (f1 != f1) { // This conditional will be true if f1 is NaN.
</code></pre>
<p>In fac... |
SQL query to calculate correct leadtime in table (MS Access) <p>I have the following table: <code>log(productId, status, statusDate, department...)</code>, where productId, status and statusDate is the primary key.
Example:<br><br>
id1 01 01/01/2009<br>
id1 02 02/01/2009<br>
<strong>id1 03 03/01/2009</strong><br>
id1 0... | <p>How about:</p>
<pre><code>SELECT t.ID, t.Status, t.SDateTime,
(SELECT Top 1 SDateTime
FROM t t1 WHERE t1.Status = 1
AND t1.ID=t.ID
AND t1.SDateTime<t.SDateTime
AND t1.SDateTime>=
Nz((SELECT Top 1 SDateTime
FROM t t2
WHERE t2.Status=3
... |
Pointer to member functions - C++ std::list sort <p>How do i pass a pointer to a member function to std::list.sort()? </p>
<p>Is this possible? Thanks</p>
<pre><code>struct Node {
uint32_t ID;
char * Value;
};
class myClass {
private:
uint32_t myValueLength;
public:
... | <p>It is possible. Did you consider using boost::function?</p>
<pre><code>list.sort( boost::bind( &myClass::compare, this, _1, _2 ) );
</code></pre>
<p>Is your 'compare' function will rely on <strong>this</strong> data? If not - you may simpy make 'compare' function to be <strong>static</strong>. And then it will... |
How to zero fill a number inside of an Excel cell <p>How do you zero fill a number to 10 positions inside an excel spreadsheet?</p>
<p>i.e. If cell A1 has 1234 how can cell A2 display 0000001234 (10 postions).</p>
| <p>=TEXT(A1,"0000000000")</p>
|
Writing a Macro to Use the Transpose Function Repeatedly <p>I am trying move rows of values into a column in Excel. The transpose function works well, but will only move one row at a time. I would like to get a macro that will convert 173 rows of data across three columns into one column. Please see example below.
T... | <p>The following will load the data from the CurrentRegion of A1 into an array and paste into one column, beginning in A5.</p>
<p>I'm assuming the data is numerical, contiguous and that this is a one-off, rather than an exercise that might have to be repeated on data sets of differing sizes. If your data is not conti... |
Inline Code on Webform Property <p>Why doesn't this display the date/time when rendered?</p>
<pre><code><asp:Label runat="server" ID="test" Text="<%= DateTime.Now.ToString() %>" ></asp:Label>
</code></pre>
<p>Is there anyway to make this work?</p>
| <p>Asp.net server controls don't play well with the <%=, instead you can do:</p>
<pre><code><span><%= DateTime.Now.ToString() %></span>
</code></pre>
<p>Ps. you could alternatively set the label's text on the code-behind. It might work for your scenario to set it on the PreRenderComplete.</p>
|
Making LaTeX Beamer Black & White <p>Is there a way to make LaTeX Beamer output black & white? I need it for paper printing purposes. I'm using the default color theme, and for contrast reasons I need the title and everything to be black. If there is a black&white color scheme, I could use it, but otherwise I d... | <p>OK, found it after some more search. The answer is:</p>
<pre><code>\setbeamercolor{frametitle}{fg=black}
</code></pre>
|
What are the advantages of delegates? <p>What are the benefits/advantages of using delegates? Can anyone provide any simple examples?</p>
| <p>They're a great way of encapsulating a piece of code. For instance, when you attach an event handler to the button, that handler is a delegate. The button doesn't need to know what it does, just how to call it at the right time.</p>
<p>Another example is LINQ - filtering, projecting etc all require the same kind of... |
Change lookup rule for views <p>I have an application that gets rolled out in multiple countries. There will be a setting in the web.config file, that defines the country.
The country will not be in the URL.</p>
<p>Some of the the views change depending on the country.
My first attempt is to use a folder inside the v... | <pre><code>public class MyViewEngine : WebFormViewEngine
{
private static string[] LocalViewFormats = new[] { "~/Views/ESP/{0}.aspx",
"~/Views/ESP/{0}.ascx" };
public MyViewEngine()
{
ViewLocationFormats = LocalViewFormats.Union(ViewLocationF... |
How much memory can a 32 bit process access on a 64 bit operating system? <p>On Windows, under normal circumstances a 32 bit process can only access 2GB of RAM (or 3GB with a special switch in the boot.ini file). When running a 32 bit process on a 64 bit operating system, how much memory is available? Are there any spe... | <p>2 GB by default. If the application is large address space aware (linked with /LARGEADDRESSAWARE), it gets 4 GB (not 3 GB, see <a href="http://msdn.microsoft.com/en-us/library/aa366778.aspx">http://msdn.microsoft.com/en-us/library/aa366778.aspx</a>)</p>
<p>They're still limited to 2 GB since many application depen... |
Nhibernate one-to-one mapping a class with itself <p>We have a situation where we want to define a relationship where a class (named Module) may or may not be related to a Module object that is a predecessor to it. There can be zero or none predecessors. The class looks like this:</p>
<pre><code>public class Module
... | <p>You could use the <a href="http://www.hibernate.org/hib%5Fdocs/nhibernate/1.2/reference/en/html%5Fsingle/#mapping-declaration-manytoone" rel="nofollow">many-to-one</a> element:</p>
<pre><code><class name="Module">
<Id name="Id">
<generator class="native"/>
</Id>
<many-... |
What's needed for PHP's mcrypt_decrypt()? <p>I have a script that uses mcrypt_decrypt() function, but I get the following error</p>
<blockquote>
<p>Fatal error: Call to undefined function mcrypt_decrypt()</p>
</blockquote>
<p>What modules/libraries do I need to include to use this function? Or is there another re... | <p>sudo apt-get install php5-mcrypt </p>
<p>works on ubuntu. </p>
|
Enumerated Values based on distinct ones XSLT 2.0 <p>I have a long list of values in XML with named identifiers. I need to make separate output files for each of the distinct identifiers grouped together and uniquely named.</p>
<p>So, for example, let's say I have:</p>
<pre><code><List>
<Item group="::thi... | <p><strong>Here is a solution that uses some of the good new features in XSLT 2.0:</strong></p>
<p><strong><em>This transformation</em></strong>:</p>
<pre><code><xsl:stylesheet version="2.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xsl:output ... |
Is it possible to restore a SQL 7 DB to SQL 2008? <p>I have an old SQL 7 DB .bak file I am trying to work with now. I tried to restore the backup in SQL 2008, but it said that it was unable to work with the file. Does anyone know how I could restore this DB?</p>
| <p>You will need to install SQL Server 7, 2000, or 2005 and restore the backup to one of those first.</p>
<ul>
<li>SQL 2000/2005 - Restore the backup, export, and restore to 2008.</li>
<li>SQL 7 - Restore the backup and use the SQL Server 2008 import functionality to import the data.</li>
</ul>
|
Tile scrolling / preloading (Google Maps style) of HTML layers with Ajax <p>I am looking to replicate the panning (not necessarily the zooming) effect of the Google Maps API, but without the images. Essentially, I want to position HTML elements in a large coordinate system and be able to navigate around them, <a href="... | <p>Oh, you will have so much fun doing this yourself, and sure will be no too much time consuming if you use jQuery, here is a brief of what you'll do...</p>
<p>Build you container/containing layout (use overflow:hidden to show only the desired size)</p>
<p>Then capture user actions with the mousedown and mouseup eve... |
Crystal Reports: Subreport on more than one page <p>Hi I have a Crystal reports, report set up and I want to insert a sub report as the first page. I thought I can do this buy placing a subreport in the PageHeader of my other report. It works well but it does not display the rest of my sub report pages; it only displ... | <p>If you put a subreport in the pageheader and the subreport is longer than a page, crystal might blow up!</p>
|
How to add extra newline with 'puts' without sticking newline character into string? <p>If I say</p>
<pre><code>puts "Hello"
</code></pre>
<p>and decide to add an extra newline I need to do this:</p>
<pre><code>puts "Hello\n"
</code></pre>
<p>Having this character in the string is ugly. Is there any way to do this ... | <p>Just make another call to <code>puts</code>:</p>
<pre><code>puts "Hello"
puts
</code></pre>
|
Linq to SQL connections <p>I'm using Linq to SQL for a fairly complicated site, and after go live we've had a number of database timeouts. The first thing I noticed was there are a fairly large number of connections to the database.</p>
<p>Coming from an ADO.net background we used to code it so that any site would onl... | <p>I'm guessing that you are keeping DataContexts around and not calling Dispose on them when done (or leaving them around, at least).</p>
<p>Rather, you should initialize your DataContext, perform your operation, and then dispose of it when done. You shouldn't hold a reference to it between operations.</p>
<p>Prefe... |
Best practices for Active Record Pattern and using static methods for group operations <p>It is true what they say about design patterns that they are simply the embodiment of techniques already in general use. I have been using the Active Record Pattern since 1985.</p>
<p>One of the attributes of this pattern is the ... | <p>Just from working with LINQ, I like the idea of passing in an expression instead of a string. But, perhaps that is just me? I am also not fond of ActiveRecord, as it mixes state and behavior in the same object. Nice packaging, but not a clean separation of model and data access.</p>
<p>I have seen cases where a cus... |
VB/VBA: Fetch HTML string from clipboard (copied via web browser) <p>It seems that when you copy something from a web browser to the clipboard, at least 2 things are stored:</p>
<ol>
<li>Plain text </li>
<li>HTML source code</li>
</ol>
<p>Then it is up to the software that you are pasting into can determine which one... | <p>This time I've read the question properly and realised <em>coonj</em> wants to get the HTML from the clipboard including tags. </p>
<p>I believe this is reasonably difficult. You need to read the clipboard using Windows API calls. And then, parse the resulting CF_HTML string which has some wacky headers added on to... |
How to make a dropdownlist disabled on change event using JQUERY? <pre><code>$(document).ready(function() {
$('#<%=ddlContinents.ClientID %>').change(function() {
var element = $(this);
var totalLength = element.children().length;
if ($(this).disabled == false) { $(this).disabled = true;... | <p>You should use <a href="http://api.jquery.com/prop/" rel="nofollow"><code>.prop()</code></a> for jQuery 1.6+ or <a href="http://api.jquery.com/attr/" rel="nofollow"><code>.attr()</code></a> for earlier versions of jQuery:</p>
<p>> jQuery 1.6:</p>
<pre><code>$(document).ready(function() {
$('#<%=ddlContinents.... |
SQL 2005 instance won't work with DNS <p>Basically I have a sql 2005 standard server with a named instance installed (server/instance1). I also have created a DNS entry (dnsDBServer) that points to the ip address of the sql server. A web application we have can connect using the following methods (ipaddress/instance1... | <p>Most likely your DNS resolution isn't working exactly like you thought it would.</p>
<p>Do a tracert from the machine that is trying to talk to your sql server and see where it's going to.</p>
<p>You should also look at the firewall settings between the requesting machine and the server to see if there is anything... |
Unable to put TERM to .bashrc in Mac <p><a href="http://stevey-home.blogspot.com/" rel="nofollow">Stevey</a> recommends to set the following command to .bashrc</p>
<pre><code>TERM=xterm-256color
</code></pre>
<p>I put the code to the top of my .bashrc and I have now a flashing black green terminal. The font color in ... | <p>Simply put, the Mac's terminal app doesn't support 256 color. See here: <a href="http://news.ycombinator.com/item?id=443769" rel="nofollow">http://news.ycombinator.com/item?id=443769</a></p>
<p>From the same link, it looks like there may be other terminals that do. Good luck!</p>
|
Is there a way to get notified when a child is added/removed from a WPF Panel? <p>I can't find the event that would get fired when a child is added or removed from a WPF panel. Does such an event exist and I am just missing it?</p>
| <p>I couldn't find an event, but you might try the <a href="http://msdn.microsoft.com/en-us/library/system.windows.controls.panel.onvisualchildrenchanged%28VS.85%29.aspx"><code>Panel.OnVisualChildrenChanged</code></a> method.</p>
|
read iphone sms messages? <p>is there a possibility to read received SMS messages ?</p>
| <p>Yes, you can.
The sms messages are stored in a Sqlite db file.</p>
<p>Here's some information on howto read and get those files.</p>
<p><a href="http://menoob.com/2008/12/04/how-to-save-and-read-your-iphone-text-messages-on-your-computer/">read and save sms</a></p>
<p><a href="http://www.tuaw.com/2007/08/22/more-... |
HyperLinkField not showing as link <p>I have the following column in a <code>GridView</code>, and my problem is that it only renders the text "Download", not a URL.</p>
<pre><code><asp:HyperLinkField DataNavigateUrlFields="ArchiveLocation" Text="Download" DataNavigateUrlFormatString="{0}" />
</code></pre>
<p>Wh... | <p>A work around would be to use a template field and encode the colon to its hexadecimal representation, which would be %3A.</p>
<pre><code><asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# Eval("ArchiveLocation","{0}").Replace(":", Server.... |
Is JasperReports the appropriate solution to display reports in a web application? <p>We want to generate Reports either embedded as html pages in a web app or downloadable as a <em>pdf</em>. Hence I came across <em>JasperReports</em> because it thought it would fullfill these requirements. </p>
<p>Currently we assume... | <p><strong>Pagination</strong></p>
<p>It's kind of your service design how your pageing ist implemented!
PDF is an standalone output format for printing issues. It can't read more data from the server (without Web-Services and Reader Extensions). So you can define, that JasperReports should only a subset of your data... |
Image width/height as an attribute or in CSS? <p>What's the "correct" semantic way to specify image height and width? In CSS...</p>
<pre><code>width:15px;
</code></pre>
<p>or inline...</p>
<pre><code><img width="15"
</code></pre>
<p>?</p>
<p>CSS seems like the right place to put visual information. On the oth... | <p>It should be defined inline. If you are using the img tag, that image should have semantic value to the content, which is why the alt attribute is required for validation. </p>
<p>If the image is to be part of the layout or template, you should use a tag other than the img tag and assign the image as a CSS backgrou... |
System.UnauthorizedAccessException in mscorwks.dll causing app pool crashes <p>My app pools keep randomly crashing in IIS 6.0 MS Debug Diag points to kernel32.dll every time.</p>
<p>The entry point is always mscorwks!CreateApplicationContext+bbef and the result is always a System.UnauthorizedAccessException.</p>
<p>S... | <p>The reference to mscorwks.dll was only a symptom of the problem. mscorwks.dll is the dll that contains the common language runtime.</p>
<p>To diagnose the root cause of the problem, I followed the following steps:</p>
<ol>
<li>Use <a href="http://www.microsoft.com/DOWNLOADS/details.aspx?FamilyID=28bd5941-c458-46f1... |
Can server-side viewstates fix one of the biggest problems with ASP.NET? <p>I've read a few SO articles about whether or not ASP.NET MVC is worth the migration from "regular" ASP.NET. One of the biggest reasons for using MVC I've seen quoted was not having to use Viewstates. </p>
<p>However, it is possible to eliminat... | <p>The only issue with viewstate is abusing the use of it. This easily happens as the default is to have it all on. You can't even turn it all off by default on a page, and selectively turn on specific controls (they will add support for this on the 4.0). You will see few code with the viewstate=false on it, and with l... |
How do I upload a file with mod_python? <p>I want to create a simple file upload form and I must be completely incapable. I've read docs and tutorials,but for some reason, I'm not getting the submitted form data. I wrote the smallest amount of code I could to test and it still isn't working. Any ideas what's wrong?</p>... | <p>try putting enctype="multipart/form-data" in your form tag. Your mistake is not really mod_python related.</p>
|
Doubly connected ordered tree mapping using NHibernate <p>We need to map simple class using NHibernate:</p>
<pre><code>public class CatalogItem
{
private IList<CatalogItem> children = new List<CatalogItem>();
public Guid Id { get; set; }
public string Name { get; set; }
public CatalogItem ... | <p>I'm no expert, but <code><key property-ref=...></code> looks strange to me in this usage. You should be able to do <code><key column="ParentID"/></code>, and NHibernate will automatically use the primary key of the associated class -- itself, in this case.</p>
<p>You may also need to set the list to <co... |
How To Check for an Index in Oracle <p>I am writing a schema upgrade script for a product that depends on an Oracle database. In one area, I need to create an index on a table - if that index does not already exist. Is there an easy way to check for the existence of an index that I know the name of in an Oracle scrip... | <p>select count(*) from user_indexes where index_name = 'myIndex'</p>
<p>sqlplus won't support IF..., though, so you'll have to use anonymous PL/SQL blocks, which means EXECUTE IMMEDIATE to do DDL.</p>
<pre><code>DECLARE
i INTEGER;
BEGIN
SELECT COUNT(*) INTO i FROM user_indexes WHERE index_name = 'MYINDEX';
... |
IndexOutOfRangeException on accessing attributes through String array? <p>I have a treeView displayed on a winform.Now when i click on an xmlnode in the treeview its attributes get displayed in the listbox.Now i have divided the whole logic in UI and back end part. Now what i want that my back end class contains the me... | <p>You're going too far in your loop.</p>
<pre><code>for( int i = 0; i <= attCol.Count;i++)
</code></pre>
<p>should be</p>
<pre><code>for( int i = 0; i < attCol.Count;i++)
</code></pre>
|
Functors in Ocaml <p>I am having a bit of a problem with a functor (and it's resultant type). Below, I have a Set functor that uses an Ordered type. I actually used the <code>set.ml</code> that comes with ocaml for some guidance, but I seem to be doing everything <em>ahhem</em> right. I created an Ordered module with i... | <p>You need to change these two lines</p>
<pre><code>module Set (Elt:Ordered) : S =
module OrdInt : Ordered =
</code></pre>
<p>to</p>
<pre><code>module Set (Elt:Ordered) : S with type elt = Elt.t =
module OrdInt : Ordered with type t = int =
</code></pre>
<p>Without these, the modules will not have signatures tha... |
How do I fire an ASP.NET custom validator from JavaScript? <p>I want to code a function in javascript that every time I call it in the webform it fires up an specific validator in that same webform.</p>
| <pre><code><asp:RequiredFieldValidator ID="passwordRequiredFieldValidator" runat="server"
ErrorMessage="* Password Required!"
EnableClientScript="true" CssClass="errorText"
ControlToValidate="passwordTextBox">
</asp:RequiredFieldValidator>
</code></pre>
<p>To fire this validator use:</p>
<p... |
Web Services for Remote Portlets in C# / .NET -- Options? <p>I recently had my mind expanded by a new concept: <a href="http://en.wikipedia.org/wiki/Web%5FServices%5Ffor%5FRemote%5FPortlets" rel="nofollow">Web Services for Remote Portlets</a>, or WSRP. I learned of it during a presentation on a Java-based web portal we... | <p>WSRP is very contrarian. By now the world has seen that tight coupling between the data model and the presentation model is suboptimal. The success of RSS, REST, MVC, and web services in general shows this. Despite the WS in the name, WSRP stands against the core principles of Web services. The WSRP spec ignores t... |
SVN Export with revision history problem <p>I need to provide our clients with a dump of a single sub directory in our SVN repository along with the revision history if possible. I know that you can do a dump but I don't believe you can tell it to isolate a single sub directory in the repo. If I export i'll only get th... | <p>It is possible to filter a dump file to only contain one subdirectory using <a href="http://svnbook.red-bean.com/en/1.5/svn.ref.svndumpfilter.html" rel="nofollow">svndumpfilter</a>. Such a dump file can then be loaded into a new repository and it will work perfectly fine, as if the repo had always been that directo... |
What is the easiest and lightest way to make a client-server in Perl? <p>It will be better if this solution is based on HTTP protocol.</p>
| <p>Checkout <a href="http://search.cpan.org/~gaas/libwww-perl-5.825/lib/HTTP/Daemon.pm" rel="nofollow">HTTP::Daemon</a> in CPAN. It will give you the basics of a server. You can then over-ride methods to handle your HTTP.</p>
<p>Alternatively, try <a href="http://search.cpan.org/~jesse/HTTP-Server-Simple-0.38/lib/HTTP... |
How do I properly format this json object in PHP <p>I need to be able to create a data structure in PHP which creates for instance, an array of car vendors. Each of those array elements contains a child array which holds types of cars for that vendor.</p>
<p>So you'd have something like</p>
<pre><code>$cars['toyota']... | <p>If you have PHP >5.2.0, try <a href="http://www.php.net/json%5Fencode" rel="nofollow"><code>json_encode($cars)</code></a>.</p>
<p>This will make an array in an array, but it won't give you what you have in your javascript sample:</p>
<pre><code>$vendors = array(
'toyota' => array('camry', 'etc.'),
'honda' =... |
Coming out of the habit of writing ifs/elseifs for every possible condition <p>When parsing an xml document for its nodes or attributes, if the document is large, I would have a bunch of ifs and else statements.</p>
<p>Obviously, 100+ ifs does not make up maintainable code in the long run.</p>
<p>Rather than doing th... | <p>If you need to map <code><condition on xml node</code>> to <code><change of state</code>> there's no way to avoid defining that mapping <em>somewhere</em>. It all depends on how many assumptions you can make about the conditions and what you do under those conditions. I think the dictionary idea is a good one.... |
Email integration <p>I was wondering if someone could help me out. In some web application, the app will send out emails, say when a new message has been posted. Then instead of signing into the application to post a reply you can just simply reply to the email and it will automatically update the web app with your r... | <p><strong>Generally:</strong></p>
<p>1) Set up a dedicated email account for the purpose.</p>
<p>2) Have a programm monitor the mailbox (let's say fetchmail, since that's what I do).</p>
<p>3) When an email arrives at the account, fetchmail downloads the email, writes it to disk, and calls script or program you hav... |
Unable to set iPython to use 2.6.1 Python <p>I have installed the newest iPython in Mac. However, it uses the Python verion 2.5.1.</p>
<p>I installed the Python 2.6.1 by MacPython package at <a href="http://www.python.org/download/" rel="nofollow">here</a>. </p>
<p><strong>How can I make my iPython to use Python 2.6.... | <p>A good way to get it to work is <a href="http://www.jamesmurty.com/2009/06/05/ipython-with-python-2_6-osx-leopard/" rel="nofollow">here.</a> I needed to restart my terminal before ipython pointed to python2.6. Note the latest ipython distribution is 0.10, not 0.9.</p>
|
What tools exist for comparing C++ code to coding guidelines? <p>There exist tools for comparing code against a custom specified set of coding guidelines/standards for a variety of languages (rather than pure static analysis for common defects). Examples include <a href="http://msdn.microsoft.com/en-us/library/bb42947... | <p>A tool used by us was CodeWizard from Parasoft. But I think the new version is called "Parasoft C++ Test". From the homepage:</p>
<ul>
<li>Static analysis of code for
compliance with user-selected coding
standards </li>
<li>Graphical RuleWizard
editor for creating custom coding
rules </li>
<li>Static code path si... |
What does "exec sp_reset_connection" mean in Sql Server Profiler? <p>Trying to understand what Sql Profiler means by emitting "sp_reset_connection".</p>
<p>I have the following, "exec sp_reset_connection" line followed by BatchStarting and Completed,</p>
<pre><code>RPC:Completed exec sp_reset_connection
SQL:Bat... | <p>Like the other answers said, <code>sp_reset_connection</code> indicates that connection pool is being reused. Be aware of one particular consequence!</p>
<blockquote>
<p><strong><a href="http://blogs.msdn.com/b/jimmymay/archive/2009/02/02/sp-reset-connection-does-not-reset-transaction-isolation-level-unexpected-b... |
Best way to convert Delphi code to C++? <p>I have an application written in Delphi that compiles in Delphi 2007. I think it was originally written in Delphi 7.</p>
<p>Anyway, I need to convert all the core non-GUI code into C++ because I want to release a Mac version of the software.</p>
<p>What is the best way to do... | <p>Why not just use an OS X Delphi compiler? <a href="http://www.freepascal.org/">Free Pascal</a> claims to support Delphi on OS X (though not being a Pascal coder I haven't tried it).</p>
|
Changing the Log4Net Root Level When App is built as Release <p>I have a project I am working on using log4net, and it works great, but I want to know if i can override the XML configuration for the root "level" attribute for the logging when in debug and release.</p>
<p>Currently my root configuration looks like:</p>... | <p>I do the oposite, in debug mode I use the developer configurations which is better for filtering the relevant messages for me; and in release mode, I lock the level to WARN to prevent a user wants to hack my code (he could use tons of other ways, but this is a 5 seconds trick): </p>
<pre><code>public static vo... |
Reference ASP.NET control by ID in JavaScript? <p>When ASP.NET controls are rendered their ids sometimes change, like if they are in a naming container. <code>Button1</code> may actually have an id of <code>ctl00_ContentMain_Button1</code> when it is rendered, for example.</p>
<p>I know that you can write your JavaScr... | <p>This post by Dave Ward might have what you're looking for:</p>
<p><a href="http://encosia.com/2007/08/08/robust-aspnet-control-referencing-in-javascript/">http://encosia.com/2007/08/08/robust-aspnet-control-referencing-in-javascript/</a></p>
<p>Excerpt from article:</p>
<blockquote>
<p>Indeed there is. The bett... |
Rewrite urls from user submitted HTML <p>I use one WYSIWYG editor in a small cms. It allows users to upload files, images, etc. If I add image named dog.jpg, in source I'll get:</p>
<pre><code><img src="/myweb/userfiles/images/dog.jpg" />
</code></pre>
<p>I can save this to a database and use it later on any pa... | <p>I am unsure the regex version has any of the characteristics you mention in this case.</p>
<p>That said, you can do:</p>
<pre><code> string ReplaceUrlPaths(string html, string partialPath, string fullPath)
{
var pattern = string.Format("((href|src)=\")({0}|{1})", partialPath, fullPath);
var ... |
What are some utilities to search for code throughout many files or folders? <p>What is an utility to find code throughout many files or folders. Something akin to PowerGrep but freeware.</p>
| <p>On Windows, there's a "find" command that is similar to grep.</p>
<p>You could also download cygwin or some other Unix emulator and get grep from that.</p>
<p>On Windows, you can also get a standalone version of grep with "unxutils" pack: <a href="http://unxutils.sourceforge.net/" rel="nofollow">http://unxutils.so... |
Delphi - Problem With Set String and PAnsiChar and Other Strings not Displaying <p>I was getting <a href="http://stackoverflow.com/questions/628965/delphi-accessing-data-from-dynamic-array-that-is-populated-from-an-untyped-poin/629213#629213">advice from Rob Kennedy</a> and one of his suggestions that greatly increased... | <p>Some comments:</p>
<ol>
<li>Your question is very unclear. What exactly do you want to do?</li>
<li>Your question reads terrible, please check your text with a spelling checker. </li>
<li>The question you are referring to is this one: <a href="http://stackoverflow.com/questions/628965/delphi-accessing-data-from-dyn... |
How should I log while using multiprocessing in Python? <p>Right now I have a central module in a framework that spawns multiple processes using the Python 2.6 <a href="http://docs.python.org/library/multiprocessing.html?#module-multiprocessing"><code>multiprocessing</code> module</a>. Because it uses <code>multiproces... | <p>I just now wrote a log handler of my own that just feeds everything to the parent process via a pipe. I've only been testing it for ten minutes but it seems to work pretty well. </p>
<p>(<strong>Note:</strong> This is hardcoded to <code>RotatingFileHandler</code>, which is my own use case.)</p>
<hr>
<h2>Update: ... |
Asp.Net MVC Can't get .html files or .xml files 404 error? <p>How do I return .html files or .xml files that are in folders in the view? I'm using jquery which request a static Html file via ajax and insert the results into a div and it keeps giving a 404 error any idea?</p>
<p>Thanks</p>
| <p>If you need to ignore routing for a given path, use:</p>
<pre><code>routes.IgnoreRoute("path/to/static/content");
</code></pre>
<p>Also, I may be reading your question wrong, but it's a bad idea to put static content in your View folders. Make a folder like "Content" or "public" at the document root.</p>
<p>If y... |
Strange 5 second pause with PHP command line interface (related to mysql/mysqli extension) <p>I'm getting a strange 5 to 7 second pause when executing PHP scripts from the command-line PHP client (PHP 5.2 on Windows).</p>
<p>During this pause the PHP script just appears to 'freeze' for a while before returning to the ... | <p>it's a <a href="http://bugs.mysql.com/bug.php?id=37226">bug in mysql</a>. you can solve it by getting the latest libmysql.dll (5.1.31 or higher. some older versions also work - see second link). make sure that's the libmysql.dll actually used and there are no other libmysql.dlls in your path. see the related <a href... |
Silverlight 2.0 loading issue <p>I have developed a SL2 application for a client (whose computers are under pretty heavy lockdown via group policies). The SL2 application has worked fine for everyone except the client.</p>
<p>The client is using WinXP + IE7 and has the SL2 runtime installed.</p>
<p>On the client's ma... | <p>After months of to-ing and fro-ing the issue has been resolved - although we still don't know the true underlying cause.</p>
<p>The client's IT staff recently updated their transparent proxy server (which also filters content) and the silverlight app started working under IE.</p>
<p>One of the changes made was to ... |
ModelFactory in ASP.NET MVC to solve 'RenderPartial' issue <p>The 'RenderPartial()' method in ASP.NET MVC offeres a very low level of functionality. It does not provide, nor attempt to provide a true 'sub-controller' model *.</p>
<p>I have an increasing number of controls being rendered via 'RenderPartial()'. They fal... | <p>Instead of adding things like <code>MailingListSignup</code> as a property of your <code>ProductModel</code>, encapsulate both at the same level in a class like <code>ProductViewModel</code> that looks like:</p>
<pre><code>public class ProductViewModel() {
public ProductModel productModel;
public MailingLis... |
Problem with iPhone application that plays Sound <p>I've developed an iPhone application that plays Sound. </p>
<p>However, when I play a sound in the simulator, the console shows the lines below (<a href="http://img12.imageshack.us/img12/7097/picture2mtb.png" rel="nofollow">also shown in this screenshot</a>).</p>
<... | <p>How are you loading the file and, how are you adding the file to the application?</p>
<p>If you are including your sound file in the app's bundle, this error can be caused because you are incorrectly loading the resource.</p>
<p>If that is the case, this is the code you want to retrieve the sound file:</p>
<p><co... |
Will a using statement rollback a database transaction if an error occurs? <p>I've got an IDbTransaction in a using statement but I'm unsure if it will be rolled back if an exception is thrown in a using statement. I know that a using statement will enforce the calling of Dispose()...but does anyone know if the same is... | <p>Apparently yes. This is how SqlInternalTransaction's Dispose method (which SqlTransaction's Dispose calls) looks like from <a href="http://www.red-gate.com/products/reflector/">Reflector</a>:</p>
<pre><code>private void Dispose(bool disposing)
{
// ...
if (disposing && (this._innerConnection != null... |
If the path of a file has space in between the uri cannot fetch the file in the path <p>The message box crops up could not find part of the path of the file"file path" when i try to open a file that has space in its file path. I have used LocalPath instead of AbsolutePath and it works fine for me, but its only limited ... | <p>If the file can be fetched depends on your implementation of the software. Try to replace the spaces with %20</p>
<p>What kind of development are we talking about here? JAVA GUI or WebApps? C/C++?</p>
|
TreeView control in C#, select() and focus <p>When i select a node in the treeview it highlights and i show data based on that node below. When i select another control (the treeview loses focus) it is no longer highlighted. How do i keep it highlighted after losing focus? While doing a search i cant tell which node is... | <p>You have to set the HideSelection property to false - so you'll see the selection, altough the TreeView control lost focus</p>
|
Django MOD_PYTHON ERROR <p>I have had django running with mod_python for awhile now but today I get the following error</p>
<pre><code>MOD_PYTHON ERROR
ProcessId: 4551
Interpreter: 'thatch'
ServerName: 'thatch'
DocumentRoot: '/var/www/thatch'
URI: '/'
Location: '/'
Directory: Non... | <p>I can only guess what your problem might be, but here are two standard checks:</p>
<ol>
<li>Import modpython in shell, from a couple different working directories</li>
<li>Change users (if you have any besides root set up) and repeat step 1</li>
</ol>
<p>If #2 looks like more trouble than it's worth, then try <em>... |
Can 3D OpenGL game written in Python look good and run fast? <p>I am planning to write an simple 3d(isometric view) game in Java using jMonkeyEngine - nothing to fancy, I just want to learn something about OpenGL and writing efficient algorithms (random map generating ones). </p>
<p>When I was planning what to do, I s... | <p>If you are worried about 3D performance: Most of the performance-critical parts will be handled by OpenGL (in a C library or even in hardware), so the language you use to drive it should not matter too much.</p>
<p>To really find out if performance is a problem, you'd have to try it. But there is no reason why it c... |
What is a better language-introduction preview than "Hello World"? <p>Many programming languages introduce themselves with a simple "Hello World" program.</p>
<p>As a programmer, I must admit that this does not give very good insight into the strenghts and capabilities of the language.</p>
<p>What kind of problem wou... | <p>I think the "Hello World" program has its uses. It says a lot if you can run that program:</p>
<ul>
<li>You have your IDE/Tools setup correctly</li>
<li>You can write a class and or main method in that language</li>
<li>You can call a function in that language to print</li>
<li>You can edit a file and format it co... |
is there AES source code (VB.NET) that decrypts AS3CRYPTO crypted msgs <p>Is there a simple ASP.NET (.VB) available for AES-encrypting?</p>
<p>here is a link to c# one but its complicate one having pretty much parameters, for example salt.
[<a href="http://www.gutgames.com/post/AES-Encryption-in-C.aspx" rel="nofollow... | <p>AES is built into the framework, as the <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.aes.aspx" rel="nofollow">Aes</a> class in System.Security.Cryptography. There are two concrete implementations, one managed, one using the Windows Crypto Service Provider (faster, but not portable to... |
help with T-SQL on SQL Server 2005 <p>I have a T-SQL that works below:</p>
<pre><code>
SELECT WP_VTDID AS UTIL_VTDID,
(SELECT COUNT(WP_ENGINE) FROM WAYPOINTS WHERE (WP_ENGINE = 1) AND (WP_SPEED > 0) AND WP_VTDID='L083') AS UTIL_RUN,
(SELECT COUNT(WP_ENGINE) FROM WAYPOINTS WHERE (WP_ENGINE = 1) AND (WP_SPEED = 0) AND ... | <p>You want to JOIN your nested SQL statements on the waypoints table.</p>
<p>This is untested but see what I've done here:</p>
<pre><code>SELECT
WAYPOINTS.WP_VTDID AS UTIL_VTDID,
COUNT(UTIL_RUN.WP_ENGINE) AS UTIL_RUN
FROM WAYPOINTS
JOIN WAYPOINTS UTIL_RUN ON
WAYPOINTS.PKEY=UTIL_RUN.PKEY
AND (UTIL_RU... |
LINQ to SQL inserting large object from .NET <p>What is the fastest way to get a list object with a count of 100,000 records into SQL using LINQ to SQL?</p>
| <p>For mass data, the <em>fastest</em> way is to use something like <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlbulkcopy.aspx" rel="nofollow"><code>SqlBulkCopy</code></a> to push the data (via a crafted <code>IDataReader</code>) into a staging table (same layout, but no indexes/etc) - and ... |
WCF: Separate service per Business Entity <p>If for example, you have customers, orders and products. Do you create a separate service for each of these business entities?</p>
<p>It kinda feels logical that you should create a service contract for each of these. However, since you have to explicitly specify the contr... | <p>Services act on business entities, but are not business entities.</p>
<p>So customers, orders and products would be data contracts, not service contracts.</p>
<p>It's the actions you perform on those data contracts that form your service contract, and the actions you expose on an entity may or not be all the thing... |
What's the best way to deprecate a column in a database schema? <p>After reading through many of the questions here about DB schema migration and versions, I've come up with a scheme to safely update DB schema during our update process. The basic idea is that during an update, we export the database to file, drop and ... | <p>Maybe you should refactor to use views over your tables, where the views never include the deprocated columns.</p>
|
WPF lost Databinding <p>I'm new to WPF and its Databinding, but I stumbled upon a strange behaviour I could not resolve for myself.</p>
<p>In a Dialog I've got a Listbox with Users and a TextBox for a username. Both are bound to a UserLogonLogic-which publishes among others a <code>CurrentUser</code> property.</p>
<p... | <p>This is a job for a good view model. Define two properties on your view model:</p>
<ul>
<li><code>SelectedUser : User</code></li>
<li><code>UserEntry : string</code></li>
</ul>
<p>Bind the <code>ListBox</code>'s <code>SelectedItem</code> to the <code>SelectedUser</code> property, and the <code>TextBox</code>'s <co... |
my default.aspx.vb is unable to see another myclass.cs file in same folder ! <p>I am trying to use myclass.cs from aspx.vb but receive error "myclass not declared" when I give command:</p>
<p>Imports myclass</p>
<p>any ideas how to make a reference?</p>
| <ol>
<li><p>Ensure you declared your class <strong>public</strong>.</p></li>
<li><p>Put your C# class into the App_Code folder.</p></li>
</ol>
|
Firefox onkeydown detect pressed key <p>From an input text I need to call a function to capture the onkeydown event and I need to pass a parameter to that event, for example:</p>
<pre><code><input type="text" onkeydown="TextOnKeyDown('myPrefix');" />...
</code></pre>
<p>Then in that function I need to know what... | <p>I wrote this yesterday, works in both FF and IE => </p>
<pre><code>//execute this during initialization
document.onkeydown = function(event) {
var holder;
//IE uses this
if(window.event) {
holder = window.event.keyCode;
}
//FF uses this
else {
holder = event.which;
}
... |
Semi-transparent image border <p>I'd like the image to bleed into the container div.imgborder and i'd like the bleeding to be semitransparent (like an opaque glass effect). Is there a way to achieve this via CSS or maybe setting an image background with some opacity on the div.imgborder? </p>
<pre><code><!DOCTYPE H... | <p>Gecko and WebKit support setting rgba() as a border-color property, so you could potentially set:</p>
<pre><code>border-color: rgba(255,255,255,0.42);
</code></pre>
<p>..and have a border that is semi-transparent.</p>
<p>To accomplish the bleeding, however, you'll probably need to overlay a transparent div on the... |
Retain newlines in HTML but wrap text: possible? <p>I came across an interesting problem today. I have a text email I'm sending from a Web page. I'm displaying a preview and wanted to put the preview in a fixed font retaining the white space since that's the way the plain text email will appear.</p>
<p>Basically I w... | <p>Try</p>
<pre><code>selector {
word-wrap: break-word; /* IE>=5.5 */
white-space: pre; /* IE>=6 */
white-space: -moz-pre-wrap; /* For Fx<=2 */
white-space: pre-wrap; /* Fx>3, Opera>8, Safari>3*/
}
</code></pre>
|
Forcing Installshield to uninstall before an install <p>I have an InstallShield 12 installscript. I want to uninstall the old version before installing the new version. I will keep the name of the package unchanged. How can I do this?</p>
| <p>With an MSI-based project, this would be accomplished by configuring a Major Upgrade for your project. Upgrades don't exist for InstallScript projects, but there are no Windows Installer restrictions to keep you from running multiple installations simultaneously. You should be able to simply run the uninstallation o... |
Can't access entity from within the View <p>I'm passing <code>IList<Post></code> to <code>View(posts)</code>.<br />
<code>Post</code> is a <code>linqToSql</code> generated model class.<br />
<code>Post</code> has an <code>FK</code> relation to the <code>Category</code> table by <code>Id</code>.</p>
<p>When I'm i... | <p>Yes, actually what the error tells you! In other words, keep your DataContext open till you finished working with the data.</p>
<p>Previously I just create a DataContext per page request, and dispose it at the end of the request. Worked relatively well.</p>
|
How to remove projects/ solutions from Recent Projects window in Visual Studio 2005 <p>In the top left corned of the Visual Studio Start Page there is a Recent Projects section that lists as standard 10 last opened Project. I am aware that this number can be changed using <strong>Tools->Options->Environment->Genera</st... | <p>This <a href="http://aspnetcoe.wordpress.com/2007/02/06/how-to-remove-recent-projects-from-visual-studio-start-page/">blog post</a> answers your question quite nicely. I won't duplicate the author's work here.</p>
<h3>Steps to Remove Recent Projects</h3>
<ol>
<li>Close Visual Studio if it is running.</li>
<li>Star... |
I2C ISR and Interrupts <p>Platform - ARM9</p>
<p>I have a third party device connected via I2C to the ARM9. My problem is the I2C read/write is getting in a twist. It appears the IRQ line is asserted but never de-asserted when there is data to read. The read fails as the third-party device NACKs the address packet. So... | <p>An important thing is whether your RTOS/system is ready to support nested exceptions. Unless there is a good reason to do so, things are simpler if you avoid nested exceptions and disable all interrupts when entering an ISR and re-enabling when leaving.</p>
<p>If you want to allow other higher-priority interrupts t... |
url does not decode properly with request[] in C# <p>I have an object like this: </p>
<pre><code>public class adapterContext {
public HttpRequest Request;
}
adapterContext ac = new adapterContext();
ac.Response = context.Response;
</code></pre>
<p>I pass this object to my functions and use ac.Request[""] to get m... | <p>there's a nice function, you should take care of: <a href="http://msdn.microsoft.com/en-us/library/system.web.httputility.urldecode.aspx" rel="nofollow">HttpUtility.UrlDecode(string, Encoding)</a> ...
otherwise you need to adjust the <a href="http://msdn.microsoft.com/en-us/library/hy4kkhe0.aspx" rel="nofollow">glob... |
how can i add another object to an already defined IQueryable object? <p>I have IQueryable Products.
now i want to add new product to this IQueryable object.
so how do i do this?</p>
| <p>I've never tried this, but try products.Union(moreProducts).</p>
|
Making VB.NET debugging like C# <p>I've programmed in C# for the majority of my .NET career - now I'm working on a VB.net project - when debugging it drives me insane the differences of how the debugging works.</p>
<p>two off the top of my head are</p>
<p>1) having to prefix my immediate window queries with ?</p>
<p... | <p>1 is supported by both VB and C#. When you prefix an immediate window query with ?, you are saying "please evaluate an expression". In the abscence of a ?, anything you will type will be evaluated as a statement. This makes a big difference in the following two lines</p>
<pre><code>? a = b
a = b
</code></pre>
<... |
What should I consider when choosing a mocking framework for .Net <p>There are lots of mocking frameworks out there for .Net some of them have been superseded by others that are better in everyway. However that still leaves many mocking frameworks that have different <em>styles</em> of usage.</p>
<p>The time it takes... | <p><em>So what questions should I by asking about the project and myself to help decide on the best mocking framework to use in a given case?</em></p>
<p>The questions you should be asking about the project is: Has the project been developed with the SOLID principles, or not? Is this a project that has loose coupling ... |
LINQ to SQL - Problem with 1-to-1 association <p>In the L2S designer I have dropped a table and a view. I tried adding an association between the 2 on their primary keys. This should be a one-to-one relationship, so I set the cardinality property of the association as such. </p>
<p>But, when coding I can't access the ... | <p>In my experience Linq To SQL requires the Primary/Foreign key relationships established in the DB. Otherwise, you'll have to do a join.</p>
<p>Not sure if this applies to your situation, but it may... </p>
<p><a href="http://stackoverflow.com/questions/619231/linq-to-sql-without-explicit-foreign-key-relationships... |
How to convert string into float in javascript? <p>I am trying to parse two values from a datagrid.<br>
The fields are numeric, and when they have a comma (ex. 554,20), I can't get the numbers after the comma.<br>
I've tried <code>parseInt</code> and <code>parseFloat</code>. How can I do this?</p>
| <p>If they're meant to be separate values, try this:</p>
<pre><code>var values = "554,20".split(",")
var v1 = parseFloat(values[0])
var v2 = parseFloat(values[1])
</code></pre>
<p>If they're meant to be a single value (like in French, where one-half is written 0,5)</p>
<pre><code>var value = parseFloat("554,20".repl... |
Faking browser request in ASP.net C# <p>I'm using the code below to pull one of our 3rd party developed pages in so I can parse it as XML for my random bits of work.</p>
<p>Irritatingly we stil have a browser detection level set on the server that only allows certain browsers on to the site; so the question is how wou... | <p>Browser detection is done based on a header in the request to the server. All you need to do is set that header. However, with HttpWebRequest you don't set that through the headers collection but rather with the .UserAgent property. </p>
<pre><code>...
System.Net.WebRequest objRequest =
System.Net.HttpWebReques... |
How to detect a firewall in Windows? <p>My app needs to make a GET request to a website and I'd like to be able to know if it's being blocked by a firewall, and ask the user to add an exception.</p>
<p>How can I find out that my get request failed because of a firewall, instead of something else?</p>
| <p>If it's a good firewall, you can't. Among other options, a firewall can:</p>
<ul>
<li>reply with one of several different <a href="http://en.wikipedia.org/wiki/Internet%5FControl%5FMessage%5FProtocol">ICMP</a> messages, indicating the destination is not accessible, or</li>
<li>silently discard the request, resulti... |
What language decision in C# annoys you? <p>I was just dealing with strings, and I find myself annoyed that strings can be nullable. So, I have to have </p>
<pre><code>if((teststring??string.Empty)==string.Empty)
</code></pre>
<p>all over the place. Would string? have been so hard for allowing nullability in the rela... | <p>Testing strings for Null or Empty is best done using:</p>
<pre><code>if (string.IsNullOrEmpty(testString))
{
}
</code></pre>
|
Print without Printer selection dialog <p>I want to print my crystal report directly, without printer selection popup.
How can I do this ?</p>
<pre><code>myReportDocument.SetDataSource(saveDataSet);
//Print
crystalReportViewer1.ShowRefreshButton = false;
crystalReportViewer1.ShowCloseButton = false;
crystalReportViewe... | <pre><code>myReportDocument.PrintOptions.PrinterName = "PRINTER_NAME";
myReportDocument.PrintToPrinter(copies, collate, startPage, endPage);
</code></pre>
|
DataTable Copying <p>Hi I have a datatable with 5 columns and I would like to copy only two of those columns to another datatable. What is the best way to do this?</p>
<p>DataTable 1:</p>
<pre><code>col1 col2 col3 col4 col5
1 2 3 4 5
6 7 8 9 10
</code></pre>
<p>DataTable 2:</p>
<pre><code>c... | <p>Would something like this be efficent?</p>
<pre><code> DataTable myTable = new DataTable();
myTable.Columns.Add("Col1");
myTable.Columns.Add("Col2");
myTable.Columns.Add("Col3");
myTable.Columns.Add("Col4");
myTable.Columns.Add("Col5");
myTable.Rows.Add(new obj... |
More examples of Prism (Composite Application Library) Applications? <p>The examples that Microsoft's Patterns and Practices provides are quite helpful:</p>
<ul>
<li>about a half-dozen simpler <strong>QuickStarts</strong> which touch on specific issues</li>
<li>the StockTrader <strong>reference implementation</strong>... | <p>Here (<a href="http://petedoesstuff.net/Blog/?p=79" rel="nofollow">http://petedoesstuff.net/Blog/?p=79</a>) you'll find a bunch of links to the samples of using the Prism. </p>
<p>Particularly, LateNight (<a href="http://code.google.com/p/cwpfsamples/" rel="nofollow">http://code.google.com/p/cwpfsamples/</a>) may b... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.