instruction stringlengths 0 30k ⌀ |
|---|
In addition to Ishmaeel's answer, the method `OpenMappedMachineConfiguration()` will always return a `Configuration` file. So to check to see if it loaded you should check the `HasFile` property where true means it came from a file. |
In addition to Ishmaeel's answer, the method `OpenMappedMachineConfiguration()` will always return a `Configuration` object. So to check to see if it loaded you should check the `HasFile` property where true means it came from a file.
Edit: typo |
Hrm. I don't know about yahoo, but there is another mapping website that provides an API for India.
http://biz.mapmyindia.com/APIs.html |
> This work fine except, if I don't make any changes to that file, it doesn't get committed.
If the file never changes, why would you need it to commmit every single time? |
> This work fine except, if I don't make any changes to that file, it doesn't get committed.
If the file never changes, why would you need it to commmit every single time?
[EDIT]
@Sean = I understand what he's trying to do, but if the file is never getting updated via a hook or some other process and therefore n... |
Is there any negative reasons to use an N-Tier solution? |
|.net|n-tier-architecture|architecture| |
I'm pretty new to my company (2 weeks) and we're starting a new platform for our system using .NET 3.5 Team Foundation from DotNetNuke. Our "architect" is suggesting we use one class project. Of course, I chime back with a "3-tier" architecture (Business, Data, Web class projects).
Is there any disadvantages to usi... |
Are there any negative reasons to use an N-Tier solution? |
|architecture|n-tier-architecture| |
I use #Region to hide ugly and useless automatically generated code, which really belongs in the automatically generated part of the partial class. But, when working with old projects or upgraded projects, you don't always have that luxury.
As for other types of folding, I fold Functions all the time. If you name th... |
Ok check this out, I have reproduced what you are seeing:
import urllib, os
link = "http://python.org"
print "opening url:", link
site = urllib.urlopen(link)
meta = site.info()
print "Content-Length:", meta.getheaders("Content-Length")[0]
f = open("out.txt", "r")
print "F... |
What is the most efficient way to sort an Html Select's Options by value, while preserving the currently selected item? |
|javascript|jquery|arrays|sorting|html-select| |
I have jQuery but I'm not sure if it has any built-in sorting helpers. I could make a 2d array of each item's `text`, `value`, and `selected` properties, but I don't think that javascript's built in `Array.sort()` would work correctly. |
What exactly do you mean by "make a call"? Do you just need to call someone to transfer them or make your own custom, interactive automated call?
If you just need to make a simple call to transfer someone, there are services like [VoiceStar][1] that can do this. If you need to make a custom automated call, I wou... |
Well, in IE6 it seems to sort on the nested array's [0] item:
function sortSelect(selectToSort) {
var arrOptions = [];
for (var i = 0; i < selectToSort.options.length; i++) {
arrOptions[i] = [];
arrOptions[i][0] = selectToSort.options[i].value;
arrOptio... |
I use WebORB for .NET to do Flex remoting and then use DLINQ on the server. One tricky thing about using LINQ with WebORB is that WebORB uses Reflection to automatically retrieve all the relationships of the object(s) you return to Flex. This causes severe time penalties as LINQ uses lazy loading to load relationships.... |
Transactions best practices |
|database|transactions|architecture| |
|c#|.net|xml|xslt|stream| |
Here's a quick question I've been banging my head against today.
I'm trying to convert a .Net dataset into an XML stream, transform it with an xsl file in memory, then output the result to a new XML file.
Here's the current solution:
string transformXML = @"pathToXslDocument";
XmlDo... |
You're correct that this is an old problem, and it has two canonical solutions:
* Use unique identifiers as the primary key. Note that if you're concerned about readability you can roll your own unique identifier instead of using a GUID. A unique identifier will use information about the date and the machine to gene... |
The web.config is cached. But even if it wasn't, don't forget that ado.net maintains a connection pool - its not opening a new connection every time you make a call to the db. |
From what I can recall the contents of the .config file are held in memory anyway... I'll get back to you. |
Think of a database as a great big object - after each call to it, it ought to be in a logically consistent state.
Databases expose themselves via tables, and keeping tables and rows consistent can be done with triggers. Another way to keep them consistent is to disallow direct access to the tables, and only allowi... |
Think of a database as a great big object - after each call to it, it ought to be in a logically consistent state.
Databases expose themselves via tables, and keeping tables and rows consistent can be done with triggers. Another way to keep them consistent is to disallow direct access to the tables, and only allowi... |
How much do you rely on database transactions?
Do you prefer small or large transaction scopes ?
Do you prefer client side transaction handling (e.g. TransactionScope in .NET) over server
side transactions or vice-versa?
What about nested transaction?
Do you have some tips&tricks related to tran... |
How much do you rely on database transactions?
Do you prefer small or large transaction scopes ?
Do you prefer client side transaction handling (e.g. TransactionScope in .NET) over server
side transactions or vice-versa?
What about nested transaction?
Do you have some tips&tricks related to tran... |
How much do you rely on database transactions?
Do you prefer small or large transaction scopes ?
Do you prefer client side transaction handling (e.g. TransactionScope in .NET) over server
side transactions or vice-versa?
What about nested transaction?
Do you have some tips&tricks related to tran... |
|database|architecture|transactions| |
How much do you rely on database transactions?
Do you prefer small or large transaction scopes ?
Do you prefer client side transaction handling (e.g. TransactionScope in .NET) over server
side transactions or vice-versa?
What about nested transactions?
Do you have some tips&tricks related to tra... |
How much do you rely on database transactions?
Do you prefer small or large transaction scopes ?
Do you prefer client side transaction handling (e.g. TransactionScope in .NET) over server
side transactions or vice-versa?
What about nested transactions?
Do you have some tips&tricks related to tra... |
is this SQL Server? Couldn't you write a TSQL stored procedure that loops through and unions the results together?
I am also interested if there is a SQL-only way of doing this though. From the bits I remember from my geographic databases class, there should be. |
Short answer - I do have my development and production servers check out the appropriate directories directly from SVN.
For your example:
Develop on the IDE as you would normally, then, when you're ready to test, check in to your local repository. Your development webserver can then have that directory checked o... |
Java ConnectionPool connection not closing, stuck in 'sleep' |
|java|database|tomcat| |
I have a webapp that uses JNDI lookups to get a connection to the database.
The connection works fine and returns the query no problems. The issue us that the connection does not close properly and is stuck in the 'sleep' mode (according to mysql administrator). This means that they become unusable nad then I run ou... |
I've solved it in the past using Javascript and XMLHttp. It can get a bit hacky depending on the circumstances. In particular, you have to watch out for the inner page failing and how it affects/downgrades the outer one (hopefully you can keep it downgrading elegantly).
Search for XMLHttp (or check [this great tutor... |
This is the disassembled code from Reflector for Path.Combine method. Check IsPathRooted function.
public static string Combine(string path1, string path2)
{
if ((path1 == null) || (path2 == null))
{
throw new ArgumentNullException((path1 == null) ? "path1" : "path2");
... |
This is the disassembled code from Reflector for Path.Combine method. Check IsPathRooted function. If second path is rooted (starts with a DirectorySeparatorChar), return second path as it is.
public static string Combine(string path1, string path2)
{
if ((path1 == null) || (path2 == null))
... |
From what I can recall the contents of the .config file are held in memory anyway... I'll get back to you.
Edit: What [HE][1] said
[1]: http://stackoverflow.com/questions/41050/where-do-you-store-your-connectionstring-should-it-be-cached#41055 |
I've used [JDEE](http://jdee.sourceforge.net/) on several projects. It handles Code Completion. I've never used it for debugging or browsing docs, but it's a big step up from a basic text editor. |
@Portman By default PK == Clustered Index, creating a primary key constraint will automatically create a clustered index, you need to specify non clustered if you don't want it clustered. |
Make sure to utilize guid.comb - takes care of the indexing stuff. If you are dealing with performance issues after that then you will be, in short order, an expert on scaling.
Another reason to use GUIDs is to enable database refactoring. Say you decide to apply polymorphism or inheritance or whatever to your Cus... |
Here's an exceedingly lazy way to do it:
#!/usr/bin/ruby
require 'rubygems'
require 'fox16'
include Fox
theApp = FXApp.new
theMainWindow = FXMainWindow.new(theApp, "Hello")
theButton = FXButton.new(theMainWindow, "Hello, World!")
theButton.tipText = "Push Me!"... |
I'm not sure but it seems that you didn't reset position in stream before passing it to XmlReader. Try to seek at the beginning of your stream before trying to read from it. Also it may be necessary to close\flush stream after you wrote some data to it. |
I'm not sure but it seems that you didn't reset position in stream before passing it to XmlReader. Try to seek at the beginning of your stream before trying to read from it. Also it may be necessary to close\flush stream after you wrote some data to it.
**EDIT**:
Just tried following code and works perfectly:
... |
what are you using for development? VS 2008 supposedly has better JS debugging, haven't tried it yet.
For Ajax you can use the Sys.Debug obj |
You may want to look into using [schemas][1] with PostgreSQL. I've done this in past projects to allow different groups of people or developers to have their own data. Then you can use your scripts to create multiple copies of your database for just such situations.
[1]: http://www.postgresql.org/docs/8.2/st... |
If you use [Firefox][1], you can use the [FireBug][2] plugin. It has great [javascript debugging support][3].
[1]: http://www.mozilla.com/en-US/firefox/
[2]: https://addons.mozilla.org/en-US/firefox/addon/1843
[3]: http://getfirebug.com/js.html |
Are you designing specifically _for_ Chrome, or do you want to make sure your pages work well with Chrome?
Assuming it's the latter, then just use the same design considerations you'd do for any browser. If applicable, keep in mind that many phones and video game consoles have web browsers now.
Chrome uses a new ... |
Depends, what technology stack are you using to implement?
If you are using the .net framework and asp.net 2.0 or above, its trivial. If you are using older versions of the framework, you'd need to write some javascript.
In your OnLoad handler (generally page_load if you are using the stock page template suppl... |
Using plain vanilla html and javascript
<input type='text' id='txtMyInputBox' />
<script language='javascript' type='text/javascript'>
function SetFocus()
{
// safety check, make sure its a post 1999 browser
if (!document.getElementById)
{
return... |
Using @ for variable names that are keywords.
var @object = new object();
var @string = "";
var @if = IpsoFacto(); |
You can use a VS macro to parse the XML file and then call nunit.exe with the /fixture command line argument to specify which classes to run or generate a selection save file and run nunit using that. |
No recommendations as such, but,
You might want to broaden your search to Eclipse plugins such as [http://eclipse-erd.sourceforge.net/][1].
Apart from that there are various ERD tools you have to pay for like [Data Architect][2].
[1]: http://eclipse-erd.sourceforge.net/
[2]: http://www.thekompany.com/pr... |
@Nick Yeah, the thing with attached behaviours is that by definition they're not in the same object as the elements whose events you're handling.
I think the answer lies within using WeakReference somehow, but I've not seen any simple code samples to explain it to me. :) |
I use m_ for member variables, but I'm increasingly becoming tempted to just using lowerCamelCase like I do for method parameters and local variables. Public stuff is in UpperCamelCase.
This seems to be more or less accepted convention across the .NET community. |
I use m_ for member variables, but I'm increasingly becoming tempted to just using lowerCamelCase like I do for method parameters and local variables. Public stuff is in UpperCamelCase.
This seems to be more or less accepted convention across the .NET community.
EDIT: Oh man, getting downvoted for opinions? :-( |
Disabling a ListView in c#, but still showing the current selection |
|c#|listview|.net| |
I have a ListView control, and I'm trying to figure out the easiest/best way to disallow changing the selected row(s), without *hiding* the selected row(s).
I know there's a HideSelection property, but that only works when the ListView is still enabled (but not focused). I need the selection to be viewable even when... |
|c#|listview|.net|windowsforms| |
|c#|.net|winforms|listview| |
As others have said, it is possible. However, if both the service and client use an object that has the exact same domain behavior on both sides, you probably didn't need a service in the first place. |
How would you go about evaluating a programmer? |
|evaluation| |
A few weeks ago, I was assigned to evaluate all our programmers. I'm very uncomfortable with this since I was the one who taught everyone the shop's programming language (they all got out of college not knowing the language and as luck would have it, I'm very proficient with it.). On the evaluation, I was very biased o... |
Where I work some folks like to use the [FileSync Plugin](http://andrei.gmxhome.de/filesync/index.html) for Eclipse for this purpose, though I have seen some oddities with that plugin where files in the target directory occasionally go missing. The whole structure is:
- Ant task to create target directory at desired... |
Doing this requires understanding how HTTP redirects work. When you use `Response.Redirect()`, you send a response (to the browser that made the request) with [HTTP Status Code 302](http://en.wikipedia.org/wiki/HTTP_302), which tells the browser where to go next. By definition, the browser will make that via a `GET` ... |
First of all, it doesn't matter as much splitting out tables unless you also move some of the tables to a separate physical volume.
Secondly, it's not necessarily the table with the largest physical size that you want to move. You may have a much smaller table that gets more activity, while your big table remains... |
How do you add an image in XSLT? |
|xslt| |
I have a simple XML document that contains image information. I need to transform it to HTML -- simple, right? However, when I use the XSL below, it blows up with the error **"Cannot write an attribute node when no element start tag is open."** I can't see where the open tag is -- any ideas?
XML:
<pre>
<root&g... |
I think the behaviour here is correct, because %d is not a valid component of a URL (% is the escape, but expects two hex characters to follow it).
You can't just URL encode the URL as given to you, because that would encode the /s and ?s as well, which you don't want.
So, the question is, what's the correct beha... |
Doing this requires understanding how HTTP redirects work. When you use `Response.Redirect()`, you send a response (to the browser that made the request) with [HTTP Status Code 302](http://en.wikipedia.org/wiki/HTTP_302), which tells the browser where to go next. By definition, the browser will make that via a `GET` ... |
How to find all database references |
|database|db2| |
In trying to figure out [this problem][1] (which is still unsolved and I still have no clue what is going on), I am wondering if maybe an external reference to the table in question is causing the problem. For example, a trigger or view or some other such thing.
Is there an easy way to find all references to a give... |
I'm not sure but it seems that you didn't reset position in stream before passing it to XmlReader. Try to seek at the beginning of your stream before trying to read from it. Also it may be necessary to close\flush stream after you wrote some data to it.
**EDIT**:
Just tried following code and worked perfectly:
... |
I'm not sure but it seems that you didn't reset position in stream before passing it to XmlReader. Try to seek at the beginning of your stream before trying to read from it. Also it may be necessary to close\flush stream after you wrote some data to it.
**EDIT**:
Just tried following code and it worked perfectly:... |
# Whitespace
<pre>
   	.
 .
 	.
		.
  	.
   	.
			 .
 .
	 	 .
	  .
   	.
 .
  .
 			 .
		  			 .
 .
	... |
.NET Mass Downloader with VS.NET 2005? |
|.net|debugging| |
After downloading all .NET framework symbols and sources using [NetMassDownloader][1], is it possible to setup the VS.NET 2005 for debugging into .NET 2.0 source files?
[1]: http://www.codeplex.com/NetMassDownloader |
> Take a look at *static_cast* and *reinterpret_cast*
In C++ Programming Language, 3rd ed, Bjarne Stroustrup describes it on page 130. There's a whole section on this in Chapter 6.
You can recast your Parent class to Child class. This requires you to know when each one is which. In the book, Dr. Stroustrup talks ... |
Can I simply decorate an existing instance? |
|python|oop| |
below I have a very simple example of what I'm trying to do. I want to be able to use HTMLDecorator with any other class.
import cgi
class ClassX(object):
pass # ... with own __repr__
class ClassY(object):
pass # ... with own __repr__
inst_x=ClassX()
inst_y=ClassY()
... |
Here's the final code that I ended up using, the flag (`changeOnce`) worked great, thanks @[Jason][1].
$(function () {
var $one = $("#one");
var $two = $("#two");
var selectOptions = [];
$("select").each(function (index) {
selectOptions[index] = [];
... |
Never mind -- I'm an idiot. I just needed <b>
<xsl:value-of select="/root/Image/node()"/></b>
|
Shouldn't that be:
<xsl:value-of select="/root/Image/img/@src"/>
? It looks like you are trying to copy the entire Image/img node to the attribute @src |
To focus on the specific question ("benefits of Classic vs .Net"), there are only two things Classic does that .Net won't:
1) Includes. They just don't work in ASP.Net. Of course, ASP.Net provides much better ways of accomplishing the same thing, but it's still a bit of a loss and can make migrating an old site t... |
To focus on the specific question ("benefits of Classic vs .Net"), there are only two things I can think of Classic does that .Net won't:
1) Includes. They just don't work in ASP.Net. Of course, ASP.Net provides much better ways of accomplishing the same thing, but it's still a bit of a loss and can make migratin... |
It's not a completely general solution, but if all your events are of the form
void Foo(object o, T args) , where T derives from EventArgs, then you can use delegate contravariance to get away with it. Like this (where the signature of KeyDown is not the same as that of Click) :
public Form1()
{
... |
Unfortunately it does. It also asks you to authorise any application you've built. (at least once.)
I don't know any way around it. |
In order to add attributes, XSL wants
<pre>
<xsl:element name="img">
(attributes)
</xsl:element>
</pre>
instead of just
<pre>
<img>
(attributes)
</img>
</pre>
Although, yes, if you're just copying the element as-is, you don't need any of that. |
If you replace your ISNULL and NVL nonsense with COALESCE, it'll work in T-SQL and PL/SQL! |
We use something similar where I work. Looping through every Tables, Views, Stored Procedures of the system.
CREATE PROCEDURE dbo.SP_GrantFullAccess
@username varchar(300)
AS
DECLARE @on varchar(300)
DECLARE @count int
SET @count = 0
PRINT 'Granting access to user ' ... |