input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
What's the best way to implement a SQL script that will grant permissions to a database role on all the user tables in a database? <p>What's the best way to implement a SQL script that will grant select, references, insert, update, and delete permissions to a database role on all the user tables in a database?</p>
<p>... | <p>I'm sure there is an easier way, but you could loop through the sysobjects table in the database and grant permissions to any user table objects that exist. You could then run that multiple times whenever new tables are added.</p>
|
Learning CIL <p>Does anybody know any good resources for learning how to program CIL with in-depth descriptions of commands, etc.? I have looked around but not found anything particularly good.</p>
| <p>The only CIL book on my shelf is <a href="http://rads.stackoverflow.com/amzn/click/1590596463" rel="nofollow">Expert .NET 2.0 IL Assembler</a> by Serge Lidin. In terms of what the individual opcodes do or mean, the Microsoft documentation on System.Reflection.Emit has some pretty good information. And it's always ... |
How can I programmatically determine if my workstation is locked? <p>I'm writing up some productivity/metrics tools for myself to help monitor my focus throughout the day. Recently, I've noticed that I tend to get off track more than usual and feel the need to get up and go for walks/drinks/etc and I'm concerned that I... | <p>I hadn't found this before, but from any application you can hookup a SessionSwitchEventHandler. Obviously your application will need to be running, but so long as it is:</p>
<pre><code> Microsoft.Win32.SystemEvents.SessionSwitch += new Microsoft.Win32.SessionSwitchEventHandler(SystemEvents_SessionSwitch);
... |
How to parse a string into a nullable int <p>I'm wanting to parse a string into a nullable int in C#. ie. I want to get back either the int value of the string or null if it can't be parsed.</p>
<p>I was kind of hoping that this would work</p>
<pre><code>int? val = stringVal as int?;
</code></pre>
<p>But that won't... | <p><code>int.TryParse</code> is probably a tad easier:</p>
<pre><code>public static int? ToNullableInt(this string s)
{
int i;
if (int.TryParse(s, out i)) return i;
return null;
}
</code></pre>
<p><strong>Edit</strong> @Glenn <code>int.TryParse</code> is "built into the framework". It and <code>int.Parse<... |
Problems with disabling IIS shutdown of idle worker process? <p>I ran into an issue with an IIS web app shutting down an idle worker process. The next request would then have to re-initialize the application, leading to delays. I disabled the IIS shutdown of idle worker processes on the application pool to resolve th... | <p>I'm assuming that you're referring to IIS 6.</p>
<p>Instead of disabling shutdown altogether, maybe you can just increase the amount of time it waits before killing the process. The server is essentially conserving resources - if your server can stand the resource allocation for a process that mostly sits around d... |
Is it possible to forward ssh requests that come in over a certain port to another machine? <p>I have a small local network. Only one of the machines is available to the outside world (this is not easily changeable). I'd like to be able to set it up such that ssh requests that don't come in on the standard port go to a... | <p>Another way to go would be to use ssh tunneling (which happens on the client side).</p>
<p>You'd do an ssh command like this:</p>
<pre><code>ssh -L 8022:myinsideserver:22 paul@myoutsideserver
</code></pre>
<p>That connects you to the machine that's accessible from the outside (myoutsideserver) and creates a tunne... |
Friendly URLs for ASP.NET <p>Python frameworks always provide ways to handle URLs that convey the data of the request in an elegant way, like for example <a href="http://somewhere.overtherainbow.com/userid/123424/">http://somewhere.overtherainbow.com/userid/123424/</a></p>
<p>I want you to notice the ending path <stro... | <p>This example uses ASP.NET Routing to implement friendly URLs. </p>
<p>Examples of the mappings that the application handles are: </p>
<p><a href="http://samplesite/userid/1234">http://samplesite/userid/1234</a> - <a href="http://samplesite/users.aspx?userid=1234">http://samplesite/users.aspx?userid=1234</a><br /... |
Source control system for single developer <p>What's the recommended source control system for a very small team (one developer)?<BR><BR>
Price does not matter. Customer would pay :-)<BR>
I'm working on Vista32 with VS 2008 in C++ and later in C# and with WPF. Setting up an extra (physical) server for this seems overki... | <p>I would use Subversion (in fact I use it) [<strong>update</strong>: Jul 2014 -- I use Git -- see end of the answer].
SVN is:</p>
<ul>
<li>free, </li>
<li>good enough (see disadvantages below), </li>
<li>simple, </li>
<li>works fine on Windows (and Linux too), </li>
<li>a lot of people use it so it's easy to get ... |
Suggest some good MVC framework in perl <p>Can you suggest some good MVC framework for perl -- one I am aware of is <a href="http://www.catalystframework.org/" rel="nofollow">catalyst</a></p>
<p>The need is to be able to expose services on the perl infrastructure which can be called by Java/.Net applications seamlessl... | <p>I'll tell you right now that Catalyst has by far the best reputation amongst Perl developers in terms of a rapid application development MVC framework. </p>
<p>In terms of "pure" MVC I'm not sure there are even that many "mature" or at least production-ready alternatives.</p>
<p>If Catalyst doesn't seem right to y... |
Wacom tablet Python interface <p>If possible I want to catch pressure sensitive input from a Wacom tablet in Python. Are there any Python libraries available that can do this?</p>
| <p>You could perhaps take a look at the <a href="http://www.alexmac.cc/tablet-apps/tablet-apps-0.3.1.tar.bz2" rel="nofollow">software</a> described <a href="http://www.alexmac.cc/tablet-apps/" rel="nofollow">here</a>. It is a gnome applet, written in Python.</p>
<p>From the web site:</p>
<p>"The gnome wacom applet is... |
How can I call a .NET DLL from an Inno Setup script? <p>I want to call a function from a .NET DLL (coded in C#) from an Inno Setup script.</p>
<p>I have:</p>
<ol>
<li>marked the <em>Register for COM interop</em> option in the project properties,</li>
<li>changed the <em>ComVisible</em> setting in the <em>AssemblyInfo... | <p>Intenta de esta manera (Try this way):</p>
<pre><code>Var
obj: Variant
va: MyVariableType;
Begin
//Starting
ExtractTemporaryFile('MyDll.dll');
RegisterServer(False, ExpandConstant('{tmp}\MyDll.dll'), False);
obj := CreateOleObject('MyDll.MyClass');
//Using
va := obj.MyFunction();
//Finishing
UnregisterSer... |
How to know whether a window with a given title is already open in Tk? <p>Iâve writen a little python script that just pops up a message box containing the text passed on the command line. I want to pop it up only when the window âresulting from a previous callâ is not open.</p>
<pre><code>from Tkinter import *
... | <p>I believe you want:</p>
<pre><code>if 'normal' != root.state():
tkMessageBox.showinfo("Key you!", " ".join(sys.argv[1:]))
</code></pre>
|
A issue with the jquery dialog when using the themeroller css <p>The <a href="http://dev.jquery.com/view/trunk/ui/demos/functional/#ui.dialog" rel="nofollow">demos</a> for the jquery ui dialog all use the "flora" theme. I wanted a customized theme, so I used the themeroller to generate a css file. When I used it, every... | <p>I think it is because you have the classes different.<br/>
<code><div id="SERVICE03_DLG" class="flora"></code> (flora)<br/>
<code><div id="SERVICE03_DLG" class="ui-dialog"></code> (custom)</p>
<p>Even with the flora theme, you would still use the ui-dialog class to define it as a dialog.</p>
<p>I've d... |
Common Files in Visual Studio Solution <p>Many times I have seen Visual Studio solutions which have multiple projects that share source files. These common source files are usually out in a common directory and in the solution explorer their icon shows up with a link arrow in the bottom left.</p>
<p>However, any time... | <p>Right click on a project, select <strong>Add->Existing Item->Add as link</strong> (press on small arrow on Add button)</p>
|
XML Editor for OS X <p><a href="http://stackoverflow.com/questions/12073/what-is-the-best-xml-editor" rel="nofollow">http://stackoverflow.com/questions/12073/what-is-the-best-xml-editor</a> was a great question regarding XML editors on Windows. What about on OS X?</p>
<p>Oxygen is feature complete, but, it's a Java ap... | <p>If you use TextMate, there are plugins available such as <a href="http://ditchnet.org/xmlmate/" rel="nofollow">http://ditchnet.org/xmlmate/</a></p>
|
C# Force Form Focus <p>So, I did search google and SO prior to asking this question. Basically I have a DLL that has a form compiled into it. The form will be used to display information to the screen. Eventually it will be asynchronous and expose a lot of customization in the dll. For now I just want it to display pro... | <p>I also had trouble activating and bringing a window to the foreground. Here is the code that eventually worked for me. I'm not sure if it will solve your problem.</p>
<p>Basically, call ShowWindow() then SetForegroundWindow().</p>
<pre><code>using System.Diagnostics;
using System.Runtime.InteropServices;
// Sets ... |
How do you move a file in SVN? <p>I'm using TortoiseSVN against the SourceForge SVN repository. I'd like to move a file from one folder to another in order to maintain its revision history. Is this possible? If so, how do you do it?</p>
<p>(My current strategy has been to copy the file into the new folder and check it... | <p>Check out section <b><a href="http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-rename.html#tsvn-dug-rename-move">5.14.2. Moving files and folders</a></b> (or check out "move" in the Index of the help) of the TortoiseSVN help. You do a move via right-dragging. It also mentions that you need to commit from ... |
How do I group in memory lists? <p>I have a list of <code>Foo</code>. Foo has properties <code>Bar</code> and <code>Lum</code>. Some <code>Foo</code>s have identical values for <code>Bar</code>. How can I use lambda/linq to group my <code>Foo</code>s by <code>Bar</code> so I can iterate over each grouping's <code>Lum</... | <pre><code>var q = from x in list
group x by x.Bar into g
select g;
foreach (var group in q)
{
Console.WriteLine("Group " + group.Key);
foreach (var item in group)
{
Console.WriteLine(item.Bar);
}
}
</code></pre>
|
Getting an int representation of a String <p>I am looking for a way to create an int\long representation of an arbitrary alpha-numeric String. Hash codes won't do it, because I can't afford hash collisions i.e. the representation must be unique and repeatable. </p>
<p>The numeric representation will be used to perform... | <p>Unless your string is limited in length, you can't avoid collisions. </p>
<p>There are 4294967296 possible values for an integer (2^32). If you have a string of more than 4 ASCII characters, or more than two unicode characters, then there are more possible string values than possible integer values. You can't have ... |
iPhone app crashing with NSUnknownKeyException setValue:forUndefinedKey: <p>I'm writing my first iPhone app, so I haven't gotten around to figuring out much in the way of debugging.
Essentially my app displays an image and when touched plays a short sound.
When compiling and building the project in XCode, everything bu... | <p>(This isn't really iPhone specific - the same thing will happen in regular Cocoa).</p>
<p>NSUnknownKeyException is a common error when using <a href="https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/KeyValueCoding/Articles/KeyValueCoding.html" rel="nofollow">Key-Value Coding</a> to access a k... |
web site structure/architecture <p>What web site structure(s)/architecture(s) would the community swear by, with a narrowing down in the direction towards more of a small facebook style project?</p>
<p>I understand the question to be rather broad/subjective; but being relatively new to the area of web development, I f... | <p>I guess it depends on the technology you select. For web projects in general I've always employed (Web-)MVC for the past two years or so. The advantage being a clear seperation of frontend and backend in order to create a managable code base.</p>
<p>But that's as vague as a recommendation could be. :)</p>
<p>Aside... |
Center a block of content when you don't know its width in advance <p>After lots of attempts and search I have never found a satisfactory way to do it with CSS2.</p>
<p>A simple way to accomplish it is to wrap it into a handy <code><table></code> as shown in the sample below. Do you know how to do it avoiding ta... | <p>@Jason, yep, <code><center></code> works. Good times. I'll propose the following, though:</p>
<pre><code> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN">
<html>
<head>
<style type="text/css">
body
{
text-align: center;
}... |
Why doesn't Oracle tell you WHICH table or view does not exist? <p>If you've used Oracle, you've probably gotten the helpful message "ORA-00942: Table or view does not exist". Is there a legitimate technical reason the message doesn't include the name of the missing object? </p>
<p>Arguments about this being due to se... | <p>SQL*Plus does tell you the table that doesn't exist. For example:</p>
<pre><code>SQL> select
2 *
3 from
4 user_tables a,
5 non_existent_table b
6 where
7 a.table_name = b.table_name;
non_existent_table b
*
ERROR at line 5:
ORA-00942: table or view does not exist
</code></pre>
... |
Showing a hint for a C# winforms edit control <p>I'm working on a C# winforms application (VS.NET 2008, .NET 3.5 sp 1). I have a search field on a form, and rather than have a label next to the search field I'd like to show some grey text in the background of the search field itself ('Search terms', for example). When ... | <p>You will need to use some P/Inovke interop code to do this. Look for the Win32 API <code>SendMessage</code> function and the <code>EM_SETCUEBANNER</code> message.</p>
|
Reference material for LabVIEW <p>I'm supposed to learn how to use <a href="http://www.ni.com/labview/">LabVIEW</a> for my new job, and I'm wondering if anybody can recommend some good books or reference/tutorial web sites.</p>
<p>I'm a senior developer with lots of Java/C#/C++ experience.</p>
<p>I realize that this ... | <p><strong>It will take some <em>training</em> and some <em>time</em> to learn the style needed to develop maintainable code</strong>.</p>
<p>Coming from Java/C#/C++, you probably have a good idea of good software architecture. Now you just need to learn the peculiarities of LabView and the common pitfalls.</p>
<p>Fo... |
Is there a good Fogbugz client for Mac OS X? <p>And/or: do I need one?</p>
<p>I've recently started using FogBugz for my hobby projects, and I'm very happy with things so far. Having read more about it, especially the evidence-based scheduling, I'd like to start using it for my PhD as well. (Heh; something tells me my... | <p>The official answer is no, there is not a dedicated Mac client, other than Safari :)</p>
<p>There's a <a href="http://support.fogcreek.com/default.asp?W840" rel="nofollow">command line version</a> that runs on Linux, Windows, and Mac.</p>
<p>There are also plans for an iPhone version although I'm not technically s... |
Versioning library like SQLite database library? <p>I like how SQLite library can be included into an application and the application has a full-fledged database to use.</p>
<p>Similarly, is there an open source versioning library that I can include into my application so that I can save versions of files as well as d... | <p>SVN doesn't require any prerequisites on end user machine. You can embed SVN right into you app. To learn more on subversion integration, visit "<a href="http://www.svnforum.org/2017/viewforum.php?f=17&sid=643adb11d5f8edd09544aa435b6f5732" rel="nofollow">Application Integration/Embedding</a>" thread on SVN forum... |
Best way to test a MS Access application? <p>With the code, forms and data inside the same database I am wondering what are the best practices to design a suite of tests for a Microsoft Access application (say for Access 2007).</p>
<p>One of the main issues with testing forms is that only a few controls have a <code>h... | <p>I appreciated knox's and david's answers. My answer will be somewhere between theirs: just make <strong><em>forms that do not need to be debugged</em></strong>!</p>
<p>I think that forms should be exclusively used as what they are basically, meaning graphic interface <strong><em>only</em></strong>, meaning here tha... |
How can I break on exception using ddbg <p>I'm using the d programing language to write a program, and I'm trying to use ddbg to debug it. When there is an exception, I want to have the program break whenever there is an exception thrown so that I can inspect the stack.</p>
<p>Alternatively, is there another debugger... | <p>You want to break when there's any exception thrown or just uncaught exceptions? Because I think the latter is already the default behavior.</p>
<p>You probably know this, but you get the stack trace by typing 'us' (unwind stack) at the prompt. Just trying to eliminate the obvious.</p>
<p>Anyway, I've never had ... |
Is there a way to parse a dependency tree from a build script output? <p>I have an inherited project that uses a build script (not make) to build and link the project with various libraries.</p>
<p>When it performs a build I would like to parse the build output to determine what and where the actual static libraries b... | <p>You might try using the <code>nm</code> tool. Given the right options, it will look at a binary (archive or linked image) and tell you what objects were linked into it.</p>
<p>Actually, here's a one-liner I use at work:</p>
<pre><code>#!/bin/sh
nm -Ag $* | sed 's/^.*\/\(.*\.a\):/\1/' | sort -k 3 | grep -v ' U '
... |
What are the most useful (custom) code snippets for C#? <p>What are the best code snippets for C#? (using visual studio) VB has a lot that are pre-defined, but there are only a handful for C#. Do you have any really useful ones for C#?</p>
<p>Anyone want to post a good custom one you created yourself?</p>
<p><a hre... | <p>There's plenty of code snippets within Visual Studio for basic programming structure but I wouldn't necessarily rate one higher than another. </p>
<p>I would definitely say the best ones are the custom snippets you define yourself to accomplish more specific tasks that you may find yourself using on a regular basis... |
Deciphering C++ template error messages <p>I'm really beginning to understand what people mean when they say that C++'s error messages are pretty terrible in regards to templates. I've seen horrendously long errors for things as simple as a function not matching its prototype.</p>
<p>Are there any tricks to decipheri... | <p>You can try the following tool to make things more sane:</p>
<p><a href="http://www.bdsoft.com/tools/stlfilt.html">http://www.bdsoft.com/tools/stlfilt.html</a></p>
|
Moving ViewState out of the page? <p>We are trying to lighten our page load as much as possible. Since ViewState can sometimes swell up to 100k of the page, I'd love to completely eliminate it.</p>
<p>I'd love to hear some techniques other people have used to move ViewState to a custom provider.</p>
<p>That said, a f... | <p>How do you handle Session State? There is a built-in "store the viewstate in the session state" provider. If you are storing the session state in some fast, out of proc system, that might be the best option for the viewstate.</p>
<p>edit: to do this add the following code to the your Page classes / global page ba... |
Free text search integrated with code coverage <p>Is there any tool which will allow me to perform a free text search over a system's code, but only over the code which was actually executed during a particular invocation?</p>
<p>To give a bit of background, when learning my way around a new system, I frequently find ... | <p>You can generally twist a code coverage tool's arm and get a report that shows the paths that have been executed during a given run. This report should show the code itself, with the first few columns marked up according to the coverage tool's particular notation on whether a given path was executed.</p>
<p>You mi... |
How can I upsert a bunch of ActiveRecord objects and relationships in Rails? <p>I am working with an API that provides bus arrival data. For every request, I get back (among other things) a list of which routes serve the stop in question. For example, if the list includes result for bus route #1, 2, and 5, then I know ... | <p>If I get it right, you (should) have 2 models. A Route model, and a Stop model.</p>
<p>Here's how I would define these models:</p>
<pre><code>class Route < ActiveRecord::Base
has_and_belongs_to_many :stops
belongs_to :stop, :foreign_key => 'destination_id'
end
class Stop < ActiveRecorde::Base
has_a... |
Free JSP plugin for eclipse? <p>I was looking out for a free plugin for developing/debugging JSP pages in eclipse.<br />
Any suggestions? </p>
| <p>The <a href="http://wiki.eclipse.org/Category:Eclipse_Web_Tools_Platform_Project" rel="nofollow">Eclipse Web Tools Platform Project</a> includes a JSP debugger. I have only ever needed to use it with Tomcat so I cannot say how well it works with other servlet containers.</p>
|
Best Ruby on Rails social networking framework <p>I'm planning on creating a social networking + MP3 lecture downloading / browsing / commenting / discovery website using Ruby on Rails. Partially for fun and also as a means to learn some Ruby on Rails. I'm looking for a social networking framework that I can use as a b... | <p>It depends what your priorities are.</p>
<p>If you really want to learn RoR, <strong>do it all from scratch</strong>. Seriously. Roll your own. It's the best way to learn, far better than hacking through someone else's code. If you do that, sometimes you'll be learning Rails, but sometimes you'll just be learning t... |
Cannot handle FaultException <p>i have a wcf service that does an operation. and in this operation there could be a fault. i have stated that there could be a fault in my service contract. </p>
<p>here is the code below;</p>
<pre><code>public void Foo()
{
try
{
DoSomething(); // throws Fau... | <p>Are you consuming the WCF service from Silverlight? If so, a special configuration is needed to make the service return a HTTP 200 code instead of 500 in case of error. The details are here: <a href="http://msdn.microsoft.com/en-us/library/dd470096%28VS.96%29.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/libr... |
Eclipse spelling engine does not exist <p>I'm using Eclipse 3.4 (Ganymede) with CDT 5 on Windows.</p>
<p>When the integrated spell checker doesn't know some word, it proposes (among others) the option to add the word to a user dictionary.</p>
<p>If the user dictionary doesn't exist yet, the spell checker offers then ... | <p>The CDT version of Ganymede apparently shipped improperly configured. After playing around for a while, I have come up with the following steps that fix the problem.</p>
<ol>
<li>Export your Eclipse preferences (File > Export > General > Preferences).</li>
<li>Open the exported file in a text editor.</li>
<li><p>F... |
How to disable Visual Studio macro "tip" balloon? <p>Whenever I use a macro in Visual Studio I get an annoying tip balloon in the system tray and an accompanying "pop" sound. It says:</p>
<blockquote>
<p>Visual Studio .NET macros</p>
<p>To stop the macro from running, double-click the spinning cassette.<br />
... | <p>This will disable the pop up:</p>
<p>For Visual Studio 2008:</p>
<pre>HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0<br>
DWORD DontShowMacrosBalloon=6</pre>
<p>For Visual Studio 2010 (the DWORD won't be there by default, use <code>New | DWORD value</code> to create it):</p>
<pre>HKEY_CURRENT_USER\Software... |
How do I publish a Asp.NET web application using MSBuild? <p>I am trying to publish an Asp.net MVC web application locally using the NAnt and MSBuild. This is what I am using for my NAnt target;</p>
<pre><code><target name="publish-artifacts-to-build">
<msbuild project="my-solution.sln" target="Publish"&g... | <p>The "Publish" target you are trying to invoke is for "OneClick" deployment, not for publishing a website... This is why you are getting the seemingly bizarre message.
You would want to use the AspNetCompiler task, rather than the MSBuild task. See <a href="http://msdn2.microsoft.com/en-us/library/ms164291.aspx">h... |
Something like a callback delegate function in php <p>I would like to implement something similar to a c# delegate method in PHP. A quick word to explain what I'm trying to do overall: I am trying to implement some asynchronous functionality. Basically some resource-intensive calls that get queued, cached, and dispa... | <p>(Apart from the observer pattern) you can also use <a href="http://php.net/manual/function.call-user-func.php" rel="nofollow"><code>call_user_func()</code></a> or <a href="http://nl2.php.net/manual/function.call-user-func-array.php" rel="nofollow"><code>call_user_func_array()</code></a>.</p>
<p>If you pass an <code... |
Winforms c# - Set focus to first child control of TabPage <p>Say I have a <code>Textbox</code> nested within a <code>TabControl</code>. </p>
<p>When the form loads, I would like to focus on that <code>Textbox</code> (by default the focus is set to the <code>TabControl</code>).</p>
<p>Simply calling <code>textbox1.fo... | <p>The following is the solution:</p>
<pre><code>private void frmMainLoad(object sender, EventArgs e)
{
ActiveControl = textBox1;
}
</code></pre>
<p>The better question would however be why... I'm not entirely sure what the answer to that one is.</p>
<p>Edit: I suspect it is something to do with the fact that bo... |
What are the best Visual Studio addins? <p>I currently use Resharper and have for a few years now. I know there are a ton of other useful addins out there but i never seem to have the time to sort through them to see which is worthy of using. So i was hoping some of you would be able to help me do some sorting.</p>
| <p><a href="http://stackoverflow.com/questions/2767/do-you-have-any-recommended-add-onsplugins-for-microsoft-visual-studio" rel="nofollow">Third post</a> under <a href="http://stackoverflow.com/questions/tagged/visualstudio" rel="nofollow">visualstudio</a> tag</p>
|
How do I write a for loop in bash <p>I'm looking for the basic loop like:</p>
<pre><code>for(int i = 0; i < MAX; i++) {
doSomething(i);
}
</code></pre>
<p>but for bash. </p>
| <p>See: <a href="http://tldp.org/HOWTO/Bash-Prog-Intro-HOWTO-7.html">this site</a></p>
<pre><code> for i in $(seq 1 10);
do
echo $i
done
</code></pre>
|
How can I map a list of strings to my entity using NHibernate? <p>I've got two tables in my database: Articles and Tags</p>
<p>The Tags tables consist of ArticleID (foreign key) and a Tag (varchar).</p>
<p>Now I need to map an articles tags into a readonly collection on Article entity, either using IList Tags or Read... | <p>The type of collection to use in your mapping depends on how you want to represent the collection in code. The settings map like so:</p>
<ul>
<li>The <code><list></code> maps directly to an
IList.</li>
<li>The <code><map></code> maps directly to an IDictionary.</li>
<li>The <code><bag></code> maps... |
Deploying a project using LINQ to SQL <p>I am working on a winforms application using LINQ to SQL - and am building the app using a SQL Express instance on my workstation. The final installation of the project will be on a proper SQL Server 2005. </p>
<p>The database has the same name, and all tables are identical bu... | <p>If I understand your problem correctly, you simply change the database's connection string in your app.config / web.config.</p>
<p><strong>Edit</strong>, post clarification: You have the connection strings stored somewhere. They might be in the app.config of your server. Still, you get them from somewhere and that ... |
VS 2005 & 2008 library linking <p>Is it correct to link a static library (.lib) compiled with VS 2005 with a program which is compiled with VS 2008? Both library and my program are written in C++. This program is run on Windows Mobile 6 Professional emulator.</p>
<p>This seems to work, there are no linking errors. How... | <p>VS2005 and VS2008 use different STL implementations. When the VS2005 code returns a vector, the object has memory layout different from what VS2008 expects. That should be the reason for the broken values you see in the returned date.</p>
<p>As a rule of thumb, you should always compile all C++ modules of a project... |
Practical solution to center vertically and horizontally in HTML that works in FF, IE6 and IE7 <p>What can be a practical solution to center vertically and horizontally content in HTML that works in Firefox, IE6 and IE7?</p>
<p>Some details:</p>
<ul>
<li><p>I am looking for solution for the entire page.</p></li>
<li>... | <p>From <a href="http://www.webmonkey.com/codelibrary/Center_a_DIV" rel="nofollow">http://www.webmonkey.com/codelibrary/Center_a_DIV</a></p>
<pre><code>#horizon
{
text-align: center;
position: absolute;
top: 50%;
left: 0px;
width: 100%;
height: 1px;
overflow: visible;
displa... |
Animation Extender Problems <p>I have just started working with the <code>AnimationExtender</code>. I am using it to show a new div with a list gathered from a database when a button is pressed. The problem is the button needs to do a postback to get this list as I don't want to make the call to the database unless i... | <p>The flow you are seeing is something like this:</p>
<ol>
<li>Click on button</li>
<li>AnimationExtender catches action and call clickOn callback</li>
<li>linkPostback starts asynchronous request for page and then returns flow to AnimationExtender</li>
<li>Animation begins</li>
<li>pageRequest returns and calls play... |
How do I export (and then import) a Subversion repository? <p>I'm just about wrapped up on a project where I was using a commercial SVN provider to store the source code. The web host the customer ultimately picked includes a repository as part of the hosting package, so, now that the project is over, I'd like to reloc... | <p>If you want to move the repository and keep history, you'll probably need filesystem access on both hosts. The simplest solution, if your backend is FSFS (the default on recent versions), is to make a filesystem copy of the entire repository folder.</p>
<p>If you have a Berkley DB backend, if you're not sure of wh... |
Apache rewrite based on subdomain <p>Im trying to redirect requests for a wildcard domain to a sub-directory.<br />
ie. <code>something.blah.domain.com</code> --> <code>blah.domain.com/something</code></p>
<p>I dont know how to get the subdomain name to use in the rewrite rule.</p>
<p><strong>Final Solution:</strong>... | <p>You should have a look at the <a href="http://httpd.apache.org/docs/2.2/rewrite/" rel="nofollow" title="URL Rewriting Guide">URL Rewriting Guide</a> from the apache documentation.</p>
<p>The following is untested, but it should to the trick:</p>
<pre><code>RewriteCond %{HTTP_HOST} ^([^.]+)\.blah\.domain\.com$
Rewr... |
How do you set your Cocoa application as the default web browser? <p>How do you set your Cocoa application as the default web browser?</p>
<p>I want to create an application that is launched by default when the user clicks on an HTTP or HTTPS link in other applications (Mail, iChat etc.).</p>
| <p>There are four steps to making an app that can act as the default web browser. The first three steps allow your app to act as a role handler for the relevant URL schemes (HTTP and HTTPS) and the final step makes it the default role handler for those schemes.</p>
<p><strong>1) Add the URL schemes your app can handle... |
64 bit tools like BoundsChecker & Purify <p>For many years I have used two great tools <a href="http://www.compuware.com/products/devpartner/visualc.htm">BoundsChecker</a> & <a href="http://www-01.ibm.com/software/awdtools/purify/win/">Purify</a>, but the developers of these applications have let me down, they no l... | <p>Viva64 (<a href="http://www.viva64.com/viva64-tool/" rel="nofollow">http://www.viva64.com/viva64-tool/</a>) tool provides detection of errors typical of 64-bit Windows applications. Viva64 is a lint-like static analyzer of C/C++ code. Viva64 integrates into Visual Studio 2005/2008 environment and provides user-frien... |
Problems with mouseout event <p>I'm using JavaScript to hide an image and show some text thats hidden under it. But, when the text is shown if you scroll over it, it fires the mouseout event on the container, that then hides the text and shows the image again, and it just goes into a weird loop.</p>
<p>The html looks ... | <p>I'd give the container div:</p>
<pre><code>position: relative;
</code></pre>
<p>and add a third div in the container (should be the last child of the container) with:</p>
<pre><code>position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
</code></pre>
<p>and catch the mouseover and mouseout events on this div ... |
In HTML, what should happen to a selected, disabled option element? <p>In my specific example, I'm dealing with a drop-down, e.g.:</p>
<pre><code><select name="foo" id="bar">
<option disabled="disabled" selected="selected">Select an item:</option>
<option>an item</option>
<... | <p>The HTML specs are a bit vague (ie. completely lacking) with regard to this odd combination. They do say that a form element with the disabled attribute set should not be successful, so it really <em>can't</em> be selected.</p>
<p>The browser may well render it so that it looks selected, but it shouldn't show up in... |
I understand threading in theory but not in practice in .net <p>I have a basic cs-major understanding of multi-threading but have never had to do anything beyond simple timers in an application. Does anyone know of a good resource that will give me a tour how to work with multi-threaded applications, explaining the bas... | <p>This is a great free resource by Joseph Albahari. <a href="http://www.albahari.com/threading/">Threading in C#</a></p>
|
Mediawiki custom tag Stops page parsing <p>I created a few mediawiki custom tags, using the guide found here</p>
<p><a href="http://www.mediawiki.org/wiki/Manual:Tag_extensions" rel="nofollow">http://www.mediawiki.org/wiki/Manual:Tag_extensions</a></p>
<p>I will post my code below, but the problem is after it hits th... | <p>Never used Mediawiki but that sort of problem in my experience is indicative of a php error that occurred but was suppressed either with the @ operator or because php error output to screen is turned off.</p>
<p>I hate to resort to this debugging method but when absolutely and utterly frustrated in php I will just ... |
Is there a way to generalize an Apache ANT target? <p>We have an Apache ANT script to build our application, then check in the resulting JAR file into version control (VSS in this case). However, now we have a change that requires us to build 2 JAR files for this project, then check both into VSS.</p>
<p>The current ... | <p>I would suggest to work with <a href="http://ant.apache.org/manual/Tasks/macrodef.html" rel="nofollow">macros</a> over subant/antcall because the main advantage I found with macros is that you're in complete control over the properties that are passed to the macro (especially if you want to add new properties).</p>
... |
Garbage Collection: Is it necessary to set large objects to null in a Dispose method? <p>Is it necessary to set large objects to <code>null</code> when implementing a <code>Dispose()</code> method?</p>
| <p>If a class has a Dispose method the best practice is to call it. the reason
behind that is that Dispose runs when called, whereas setting the object to
null simply adds a entry to the Finalize queue in GC, and we cannot
determine when GC will run.</p>
<p>There is no performance benefit in implementing the Dispose m... |
Database abstraction layers for (Visual) C++ <p>What options exist for accessing different databases from C++?
Put differently, what alternatives are there to ADO?
What are the pros and cons?</p>
| <ol>
<li><a href="http://msdn.microsoft.com/en-us/library/ms710252.aspx" rel="nofollow">Microsoft ODBC</a>.</li>
<li>The MFC ODBC classes such as <a href="http://msdn.microsoft.com/en-us/library/2dhc1abk.aspx" rel="nofollow">CDatabase</a>.</li>
<li><a href="http://msdn.microsoft.com/en-us/library/ms722784.aspx" rel="no... |
Replace huge Case statement in Classic ASP <p>I have a 200+ case statement in Classic ASP which is getting out of control. It sets 5 variables, based on which case is selected. Address, Phone, Name etc. Just sets the variables and nothing else in each case.</p>
<p>Databases or files are not an option for this applicat... | <p>Getting out of control? I think it's already out of control!</p>
<p>Can you not categorise the cases into 'x' general areas and split down into helper routines?</p>
|
Does "display: marker" work in any current browsers, and if so, how? <p>I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet.</p>
<p>My goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in p... | <p>Apparently marker was introduced as a value in CSS 2 but did not make it to CSS 2.1 because of lacking browser support.
I suppose that didnât help its popularity â¦</p>
<p>Source: <a href="http://de.selfhtml.org/css/eigenschaften/positionierung.htm#display" rel="nofollow">http://de.selfhtml.org/css/eigenschaften... |
Floats messing up in Safari browsers <p>I have a site I made really fast that uses floats to display different sections of content. The floated content and the content that has an additional margin both appear fine in FF/IE, but on safari one of the divs is completely hidden. I've tried switching to <code>padding</code... | <p>Have you tried floating the #right_content div to the right?</p>
<pre class="lang-css prettyprint-override"><code>#right_content{
float: right;
margin-top: 20px;
width: 400px;
}
</code></pre>
|
Why the option to use attributes in new ATL projects was removed from Visual Studio 2008? <p>This is the text from MSDN comment: "According to the book ATL Internals (2ed) the use of attributes is deprecated and should not be used in new ATL projects."</p>
<p>But WHY?!! </p>
| <p>In ATL these attributes were a compiler trick. They were not a core part of the platform like attributes in C#. They were also more confusing to debug than macros's and the method of dumping generated attribute code was a hassle.</p>
<p>I suspect another issue is likely to have been C++ compiler compatibility and s... |
Override ScriptControl or BaseValidator for an async ASP.NET validator control? <p>I'm planning to develop an ASP.NET server control to provide asynchronous username availability validation for new user registrations. The control will allow a developer to point it at a "username" TextBox and it will provide an indicat... | <p>You should be able to do both if you implement the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.iscriptcontrol.aspx" rel="nofollow">IScriptControl</a> interface while also deriving from BaseValidator:</p>
<pre><code>public class YourControl : IScriptControl, BaseValidator
</code></pre>
<p>To impl... |
CSS - Placement of a div in the lower left-hand corner <p>I wish I were a CSS smarty .... </p>
<p>How can you place a div container in the lower left-hand corner of the web page; taking into account the users scroll-position?</p>
| <p>The attributes...</p>
<pre><code>position: fixed;
left: 0;
bottom: 0;
</code></pre>
<p>...should do the job in every browser except IE. If supporting IE users is important for your site, you need to add some ugly Javascript.</p>
|
How to iterate a jagged array? <p>This has been driving me crazy for a few days. Why doesn't the following work?</p>
<blockquote>
<pre><code> Dim arr(3, 3) As Integer
For y As Integer = 0 To arr.GetLength(0) - 1
For x As Integer = 0 To arr.GetLength(y) - 1
arr(y, x) = y + x
Next
... | <p>Because there is no '2' or '3' dimension. Should be .GetLength(1) instead of .GetLength(y)</p>
<p>Also: in VB.Net array declarations work a little differently. The subscript you specify in the declaration is the last index, not the number of items created like with C# or C++. But the array is still 0-indexed l... |
Can I prevent user pasting Javascript into Design Mode IFrame? <p>I'm building a webapp that contains an IFrame in design mode so my user's can "tart" their content up and paste in content to be displayed on their page. Like the WYSIWYG editor on most blog engines or forums.</p>
<p>I'm trying to think of all potentia... | <blockquote>
<p>...I'm worried about the possibility of someone being able to paste some script in and run it there and then, without even sending it back to the server for processing. </p>
<p>Am I worrying over nothing?</p>
</blockquote>
<p>Firefox has a plug-in called Greasemonkey that allows users to arbitr... |
How to convince a project sponsor that all functions in your code should have unit tests <p>Non technical people in most cases do not see any value in writing unit tests. They just want to have basic code completed and do not spend money and time on such things like unit tests. Later, every day they just to ask to fix ... | <p>The best way is to not get so technical with "non techical" people. Just build it into the delivery time without going into details. </p>
<p>On the flipside, it sounds like the project deadlines were not realistic to actually build it.</p>
|
Average User Download Speeds <p>Any ideas what the average user's download speed is? I'm working on a site that streams video and am trying to figure out what an average download speed as to determine quality.</p>
<p>I know i might be comparing apples with oranges but I'm just looking for something to get a basis for ... | <p><a href="http://speedtest.net/global.php">Speedtest.net</a> has a lot of stats broken down by country, region, city and ISP. Not sure about accuracy, since it's only based on the people using their "bandwidth measurement" service.</p>
|
Best way to detect a release build from a debug build? .net <p>So I have about 10 short css files that I use with mvc app.
There are like
error.css
login.css
etc...
Just some really short css files that make updating and editing easy (At least for me). What I want is something that will optimize the if else branch and ... | <p>Specifically, like this in C#:</p>
<pre><code>#if (DEBUG)
Debug Stuff
#endif
</code></pre>
<p>C# has the following preprocessor directives:</p>
<pre><code>#if
#else
#elif // Else If
#endif
#define
#undef // Undefine
#warning // Causes the preprocessor to fire warning
#error // Causes the preprocessor to fire... |
What is the simplest way to find the difference between 2 times in python? <p>I have 2 time values which have the type <code>datetime.time</code>. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type <code>datetime.datetime</code> but not for <code>dat... | <p>Also a little silly, but you could try picking an arbitrary day and embedding each time in it, using <code>datetime.datetime.combine</code>, then subtracting:</p>
<pre><code>>>> import datetime
>>> t1 = datetime.time(2,3,4)
>>> t2 = datetime.time(18,20,59)
>>> dummydate = datetim... |
What are some good usability guidelines an average developer should follow? <p>I'm not a usability specialist, and I really don't care to be one.</p>
<p>I just want a small set of rules of thumb that I can follow while coding my User Interfaces so that my product has decent usability.</p>
<p>At first I thought that t... | <p><img src="http://i.stack.imgur.com/G5Xcl.png" alt="simplicity"/></p>
<p>Source: <a href="http://stuffthathappens.com/blog/wp-content/uploads/2008/03/simplicity.png" rel="nofollow">http://stuffthathappens.com/blog/wp-content/uploads/2008/03/simplicity.png</a></p>
|
Get MIME type of a local file in PHP5 without a PECL extension? <p><code>mime_content_type()</code> is deprecated.</p>
<p>How can I find the <code>MIME type of a local file</code> using <code>PHP5</code> but without using this deprecated method or the <code>PECL fileinfo extension?</code></p>
<p>Edit: That's what I w... | <p>If you can't use the fileinfo extension, and you don't want to use mime_content_type, your options are limited.</p>
<p>Most likely you'll need to do a lookup based on the file extension. mime_content_type did something a bit more intelligent and actually looked for special data in the file to determine the mime ty... |
How many real world developers are involved with the Demoscene? <p>I grew up learning to code based on what I've experienced with the <a href="http://en.wikipedia.org/wiki/Demoscene">demoscene</a>. It seems to be a pretty sparse subculture in the US. How many developers watch or participate in the scene?</p>
<p>Teas... | <p>I think nowadays developers are kind of "dropping out of the demo scene". In the good old days demos were all about "what could you technically squeeze out of the machine". You needed to be a good developer/coder/hacker to achieve the best. Today the development seems to be more like basic technical stuff. Most effe... |
Why does clicking a child window not always bring the application to the foreground? <p>When an application is behind another applications and
I click on my application's taskbar icon, I expect the entire application to
come to the top of the z-order, even if an app-modal, WS_POPUP dialog box is
open.</p>
<p>However, ... | <p>I know this is very old now, but I just stumbled across it, and I know the answer.</p>
<p>In the applications you've seen (and written) where bringing the dialog box to the foreground did <strong>not</strong> bring the main window up along with it, the developer has simply neglected to specify the owner of the dial... |
How do I stop Visual Studio from automatically inserting asterisk during a block comment? <p>I'm tearing my hair out with this one. If I start a block comment <code>/*</code> in VS.NET 2005+ then carriage return, Visual Studio insists that I have another asterisk <code>*</code>. I know there's an option to turn this of... | <p><a href="http://forums.msdn.microsoft.com/en-US/csharpide/thread/a41e3652-efe2-4f81-ad3e-94994974fcb2/">This post</a> addresses your question. The gist of it is:</p>
<pre><code>Text Editor > C# > Advanced > Generate XML documentation comments for ///
</code></pre>
|
Best way to deal with RoutingError in Rails 2.1.x? <p>I'm playing with the routing.rb code in Rails 2.1, and trying to to get it to the point where I can do something useful with the RoutingError exception that is thrown when it can't find the appropriate path.</p>
<p>This is a somewhat tricky problem, because there a... | <p>Nooooo!!! Don't implement method_missing on your controller! And please try to avoid action_missing as well.</p>
<p>The frequently touted pattern is to add a route:</p>
<pre><code>map.connect '*', :controller => 'error', :action => 'not_found'
</code></pre>
<p>Where you can show an appropriate error.</p>
<... |
Find all drive letters in Java <p>For a project I'm working on. I need to look for an executable on the filesystem. For UNIX derivatives, I assume the user has the file in the mighty $PATH variable, but there is no such thing on Windows.</p>
<p>I can safely assume the file is at most 2 levels deep into the filesystem,... | <p><a href="http://docs.oracle.com/javase/7/docs/api/java/io/File.html#listRoots()">http://docs.oracle.com/javase/7/docs/api/java/io/File.html#listRoots()</a></p>
<pre><code>File[] roots = File.listRoots();
for(int i = 0; i < roots.length ; i++)
System.out.println("Root["+i+"]:" + roots[i]);
</code></pre>
<p>g... |
When can DataInputStream.skipBytes(n) not skip n bytes? <p>The <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/io/DataInput.html#skipBytes%28int%29" rel="nofollow">Sun Documentation for DataInput.skipBytes</a> states that it "makes an attempt to skip over n bytes of data from the input stream, discarding the skip... | <p>1) There might not be that much data available to read (the other end of the pipe might not have sent that much data yet), and the implementing class might be non-blocking (i.e. it will just return what it can, rather than waiting for enough data to fulfil the request).</p>
<p>I don't know if any implementations ac... |
Where did all the java applets go? <p>When java was young, people were excited about writing applets. They were cool and popular, for a little while. Now, I never see them anymore. Instead we have flash, javascript, and a plethora of other web app-building technologies.</p>
<p>Why don't sites use java applets anymo... | <p>I think Java applets were overshadowed by Flash and ActionScript (pun unintended), being much easier to use for what Java Applets were being used at the time (animations + stateful applications). </p>
<p>Flash's success in this respect in turn owes to its much smaller file sizes, as well as benefiting from the Sun ... |
How to get the base 10 logarithm of a Fixnum in Ruby? <p>I want to get the base 10 logarithm of a Fixnum using Ruby, but found that n.log or n.log10 are not defined. Math::log is defined but uses a different base than 10.</p>
<p>What is the easiest way to get the base 10 logarithm of a Fixnum?</p>
| <p>There is </p>
<pre><code>Math::log10 (n)
</code></pre>
<p>And there is also a property of logarithms that logx(y) = log(y)/log(x) </p>
|
How do I reset a sequence in Oracle? <p>In <a href="http://en.wikipedia.org/wiki/PostgreSQL">PostgreSQL</a>, I can do something like this:</p>
<pre><code>ALTER SEQUENCE serial RESTART WITH 0;
</code></pre>
<p>Is there an Oracle equivalent?</p>
| <p>Here is a good procedure for resetting any sequence to 0 from Oracle guru <a href="http://asktom.oracle.com">Tom Kyte</a>. Great discussion on the pros and cons in the links below too.</p>
<pre><code>tkyte@TKYTE901.US.ORACLE.COM>
create or replace
procedure reset_seq( p_seq_name in varchar2 )
is
l_val numb... |
Bad Smells When Reviewing Code Affects Approach? <p>G'day,</p>
<p>I was thinking about a comment from <a href="http://stackoverflow.com/users/1175/kristopher-johnson" rel="nofollow">Kristopher Johnson</a> about my answer to this <a href="http://stackoverflow.com/questions/50612/software-development-quality" rel="nofol... | <p>Developed "gut feeling" is what distinguish beginners from professionals. After you gain some experience "gut feeling" becomes one of the main contributors to final decision. It doesn't matter whether you're reviewing somebody's code or creating system architecture, gut feeling guides you. However pragmatic develope... |
How to get an absolute file path in Python <p>Given a path such as <code>"mydir/myfile.txt"</code>, how do I find the absolute filepath relative to the current working directory in Python? E.g. on Windows, I might end up with:</p>
<pre><code>"C:/example/cwd/mydir/myfile.txt"
</code></pre>
| <pre><code>>>> import os
>>> os.path.abspath("mydir/myfile.txt")
</code></pre>
|
How do you treat legacy code (and data)? <p>I am currently in the process of restructuring my local Subversion repository by adding some new projects and merging legacy code and data from a couple of older repositories into it. </p>
<p>When I have done this in the past I have usually put the legacy code in a dedicated... | <p>All code becomes 'legacy' one day, why seperate it at all? Source control is by project/branch or project/platform/branch and that type of hierarchy. Who cares how long in the tooth it is?</p>
|
Determine how much memory a class uses? <p>I am trying to find a way to determine at run-time how much memory a given class is using in .NET. Using Marshal.SizeOf() is out, as it only works on value types. Is there a way to check exactly how much memory a class uses?</p>
| <p>I've only recently started looking into this type of thing, but i have found that memory profilers can give quite detailed information regarding instances of objects within your application.</p>
<p>Here are a couple that are worth trying:</p>
<ul>
<li><a href="http://www.red-gate.com/Products/ants_profiler/index.h... |
Metamodelling tools <p>What tools are available for metamodelling? </p>
<p>Especially for developing diagram editors, at the moment trying out <a href="http://www.eclipse.org/modeling/gmf/" rel="nofollow">Eclipse GMF</a></p>
<p>Wondering what other options are out there?
Any comparison available?</p>
| <p>Your question is simply too broad for a single answer - due to many aspects.</p>
<p>First, meta-modelling is not a set term, but rather a very fuzzy thing, including modelling models of models and reaching out to terms like MDA.</p>
<p>Second, there are numerous options to developing diagram editors - going the Ec... |
Graph (Chart) Algorithm <p>Does anyone have a decent algorithm for calculating axis minima and maxima? </p>
<p>When creating a chart for a given set of data items, I'd like to be able to give the algorithm: </p>
<ul>
<li>the maximum (y) value in the set </li>
<li>the minimum (y) value in the set </li>
<li>the number ... | <p>OK, here's what I came up with for one of our applications. Note that it doesn't deal with the "optional value" scenario you mention, since our optional value is always 0, but it shouldn't be hard for you to modify.</p>
<p>Data is continually added to the series so we just keep the range of y values up to date by i... |
Vista BEX error <p>Recently I got IE7 crashed on Vista on jar loading (presumably) with the following error:</p>
<pre><code>Problem signature:
Problem Event Name: BEX
Application Name: iexplore.exe
Application Version: 7.0.6001.18000
Application Timestamp: 47918f11
Fault Module Name... | <p>BEX=Buffer overflow exception. See <a href="http://technet.microsoft.com/en-us/library/cc738483.aspx" rel="nofollow">http://technet.microsoft.com/en-us/library/cc738483.aspx</a> for details. However, c000000d is STATUS_INVALID_PARAMETER; the technet article talks primarily about status c0000005 or c0000409 (access v... |
Property default values using Properties.Settings.Default <p>I am using .Net 2 and the normal way to store my settings. I store my custom object serialized to xml. I am trying to retrieve the default value of the property (but without reseting other properties). I use:</p>
<pre><code>ValuationInput valuationInput = (V... | <p>At some point, something, somewhere is going to have to use Xml Deserialization, whether it is you or a wrapper inside the settings class. You could always abstract it away in a method to remove the "ugly" code from your business logic.</p>
<pre><code>public static T FromXml<T>(string xml)
{
XmlSerializer... |
How to force my ASP.net 2.0 app to recompile <p>I have a ASP.net 2.0 app and I have made some changes the the source file ( cs files ). I uploaded the changes with the belief that it would auto-recompile. I also have the compiled dll in MY_APP/bin. I checked it and noticed that it did not recompile. Please understand I... | <p>my #1 way to do this, add white space to the top of the web config file, after the xml declaration tag.</p>
<p>It forces the node to re-cache and recompile. We even have a page deep in the admin called Flush.aspx that does it for us.</p>
|
How do I allow assembly (unit testing one) to access internal properties of another assembly? <p>I would like my Core assembly to not expose a certain class and I would still like to be able to test it. How can I do that ?</p>
| <p><a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute(VS.80).aspx">InternalsVisibleTo</a> attribute to the rescue!</p>
<p>Just add: </p>
<pre><code>[assembly:InternalsVisibleToAttribute("UnitTestAssemblyName")]
</code></pre>
<p>to your Core classes AssemblyI... |
How do I build a loop in JavaScript? <p>How can I build a loop in JavaScript?</p>
| <p><strong>For loops</strong></p>
<pre><code>for (i = startValue; i <= endValue; i++) {
// Before the loop: i is set to startValue
// After each iteration of the loop: i++ is executed
// The loop continues as long as i <= endValue is true
}
</code></pre>
<p><strong>For...in loops</strong></p>
<pre>... |
What are the (technical) pros and cons of Flash vs AJAX/JS? <p>We provide a web application with a frontend completely developed in Adobe Flash. When we chose Flash 6 years ago, we did so for its large number of features for user interaction, like dragging stuff, opening and closing menus, tree navigation elements, pop... | <p>In addition to what others have said, Flash is constrained in the "rectangle" and cannot be added to a normal html page in an un-obtrusive manner.</p>
<p>@Gulzar I think when more browsers will support the video tag like mozilla 3.1 does we'll see even more adoption of ajax/js over flash.</p>
|
VB6 Runtime Type Retrival <p>How can you obtain the Type (the name as a string is sufficient) of an Object in VB6 at runtime?</p>
<p>i.e. something like:</p>
<pre><code>If Typeof(foobar) = "CommandButton" Then ...
</code></pre>
<p><strong>/EDIT:</strong> to clarify, I need to check on Dynamically Typed objects. An e... | <p>I think what you are looking for is TypeName rather than TypeOf.</p>
<pre><code>If TypeName(foobar) = "CommandButton" Then
DoSomething
End If
</code></pre>
<p>Edit: What do you mean Dynamic Objects? Do you mean objects created with
CreateObject(""), cause that should still work.</p>
<p>Edit: </p>
<pre><code>... |
Templates of Technical and Functional Specs <p>So basically I am looking for good templates for writing both technical and functional specs on a project or work request.</p>
<p>What do you use? How deep do you get while writing the specs? Any additional general tips you could provide would be appreciated.</p>
<p>My c... | <p>On general tips;</p>
<p>We are implementing a process of </p>
<p>1) Business Requirements Statement (BRS)</p>
<p>2) Functional Specification</p>
<p>3) Technical specification</p>
<p>The BRS covers what the business problems are, and what the requirements are around solutions, testing, security, reliability and ... |
How can you determine what version(s) of .NET are running on a system? <p>What are the different ways (programmatically and otherwise) to determine what versions of .NET are running on a system?</p>
| <p>Directly from the source:</p>
<p><em><a href="http://support.microsoft.com/kb/318785" rel="nofollow">How to determine which versions and service pack levels of the Microsoft .NET Framework are installed</a></em></p>
|
Patterns for the overlap of two objects <p>I'm sure this has already been asked and answered so I apologize in advance for that but I'm not figuring out the correct keywords to search for. Searching for "Pattern" hits way too many Q & A's to be useful.</p>
<p>I'm working on a regression testing app. I'm displayi... | <p>Table driven designs can be effective.
Steve Maguire had few nice examples in <em>Writing</em> <em>Solid</em> <em>Code</em> .</p>
<p>They are also a great way to capture tests, see <a href="http://fit.c2.com/" rel="nofollow">fit</a> .</p>
<p>In your case something like:</p>
<pre><code>Field1ReadonlyRules = {
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.