instruction stringlengths 0 30k ⌀ |
|---|
|c#|asp.net|database|linq|linq-to-sql|asp| |
What is best practice for FTP from a SQL Server stored procedure? |
|sql-server|ftp| |
Personally, I would use a [List][1]<Employee> for creating the list on the backend, and then use [IList][2]<Employee> when you return. When you use interfaces, it gives you the flexability to change the implementation without having to alter who's using your code. If you wanted to stick with an ArrayList, that'd b... |
The easiest way to unit test an object with database access is using transaction scopes.
For example:
[Test]
[ExpectedException(typeof(NotFoundException))]
public void DeleteAttendee() {
using(TransactionScope scope = new TransactionScope()) {
Attendee anAttendee = Attendee.Get(3);
... |
I apply common sense - this sort of thing is just one of the zillion trade-offs that engineering entails, and has few special characteristics that I can see.
But to be more specific, the overwhelming majority of people doing weird unreadable things in the name of performance are doing them prematurely and without me... |
The best way to do something like this would be to return, as you say, a List, preferably using generics, so it would be List`<Employee`>.
Returning a List rather than an ArrayList means that if later you decide to use, say, a LinkedList, you don't have to change any of the code other than where you create the objec... |
NHibernate and Oracle connect through Windows Authenication |
|windows|oracle-database|nhibernate| |
How do I use Windows Authentication to connect to an Oracle database?
Currently I just use an Oracle Username and password however a requirement is to give the user on install the option of selecting Windows Authentication since we offer the same as SQL. |
I like the CxxTest as well for the same reasons. It's a header file only so no linking required. You aren't stuck with Perl as there is a Python runner as well. I will be reviewing the google library soon. The Boost stuff pulls in too much other baggage. |
Just trying to avoid large framework downloads to the client for one very small thing, perhaps I am being daft.
I had looked at jQuery but also ExtJS, the documentation and UI 'look' seem far superior and professional in ExtJS ... are there particular reasons for you guys recommending jQuery? |
My solution just for kicks (this was a fun exercise), no cursors, no iterations, but i do have a helper field
-- Setup test table
DECLARE @names TABLE (
id INT IDENTITY(1,1),
name NVARCHAR(25) NOT NULL,
... |
Note that map is going to modify your source array as well. So you could either do:
map {s/ //g} @outdata;
and skip the @filtered variable altogether, or if you need to retain the originals,
@filtered = @outdata;
map {s/ //g} @filtered;
Although, in that case, it might be more readabl... |
Entity Objects can facilitate cacheing on the application layer. Good luck caching a datareader.
|
There's an alternative approach to this:
#include <iostream>
#include <fstream>
#include <iterator>
using namespace std;
int main()
{
ifstream iFile("input.txt"); // input.txt has integers, one per line
copy(istream_iterator<int>(iFile), istream_iterat... |
There's an alternative approach to this:
#include <iterator>
#include <algorithm>
// ...
copy(istream_iterator<int>(iFile), istream_iterator<int>(),
ostream_iterator<int>(cerr, "\n")); |
Well, AFAIK, all .NET versions (except version 1.x) compile to the same bytecode. In case of C#, all new features are simply syntactic sugar, which get transformed into C# 2.0 constructs when compiling.
The key point where things could go wrong is when you use C# 3.0 or 3.5 specific DLLs. They don't work well with the... |
Found this MSDN tutorial: [Creating Add-ins Using Visual C++](http://msdn.microsoft.com/en-us/library/aa699351%28VS.60%29.aspx). Thanks Matt. |
This is not possible, as you say, from a security stand point. The only way you could simulate it, is by creating a modeless dialog window.
There are many third-party javascript-plugins that you could use to fake this effect so you do not have to write all that code. |
COTS Workshop Registration System |
|cots| |
Does anyone have any experience with any COTS systems for managing workshops and the associated registrations, courses, communications, etc.?
We have a home-built Perl system that is about 8 years old and is currently embedded as an iframe in a SharePoint portal site (externally facing). Needless to say, it isn't in... |
You can't unfortunately. The only way is to simulate this with a window.open call. |
Not possible. You can however use a third party javascript library that emulates a popup window, and it will probably look better as well and be less intrusive. |
Don't use the confirm() dialog then... easy to use a custom dialog from prototype/scriptaculous, YUI, jQuery ... there's plenty out there. |
The first thing to came to mind is [Quercus][1] (from the makers of the Resin servlet engine), as Jordi mentioned. It is a Java implementation of the PHP runtime and purportedly allows you to access Java objects directly from your PHP (part of me says "yay, at last").
On the other hand, while I have been itching to ... |
Also, you could use autoconf and distribute your application in source form only. :) |
git-stash vs. git-branch |
|git| |
In a previous Git question, Daniel Benamy was talking about a workflow in Git:
> I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I started my crap work.
He wanted to restore his working state to a previou... |
In a [previous Git question](http://stackoverflow.com/questions/21848/switch-branch-names-in-git), Daniel Benamy was talking about a workflow in Git:
> I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I start... |
In a [previous Git question](http://stackoverflow.com/questions/21848/switch-branch-names-in-git), Daniel Benamy was talking about a workflow in Git:
> I was working on master and committed some stuff and then decided I wanted to put that work on hold. I backed up a few commits and then branched from before I start... |
The simple approach is to use an 8x8 integer array. Use 0 for empty squares and assign values for the pieces:
1 white pawns
2 white knights
3 white bishops
4 white rooks
5 white queens
6 white king
Black pieces use negative values
-1 black pawn
-2 black knight
e... |
How do I retrieve data sent to the web server in ASP.NET? |
|asp.net| |
What are the ways to retrieve data submitted to the web server from a form in the client HTML in ASP.NET? |
You should always go for readability first. The shape of a system will typically evolve as you develop it, and the real performance bottlenecks will be unexpected. Only when you have the system running and can see real evidence - as provided by a profiler or other such tool - will the best way to optimise be revealed.
... |
An interface is a contract between the implementation and the user of the implementation.
By using an interface, you allow the implementation to change as much as it wants as long as it maintains the contract for the users.
It also allows multiple implementations to use the same interface so that users can reuse ... |
In VB.NET
For POST requests:
value = Request.Form("formElementID")
For GET requests:
value = Request.QueryString("formElementID")
|
You don't say what language you're talking about, but in something .NETish, then it's no more work to return an IList than a List<T> or even an ArrayList, though the mere mention of that obsolete class makes me think you're not talking about .NET. |
@ Jason
You may as well return IList<> because an array actually implements this interface. |
> Programs must be written for people to read, and only incidentally for
> machines to execute. <br> — Abelson & Sussman, SICP
Well written programs are probably easier to <a href="http://en.wikipedia.org/wiki/Optimization_%28computer_science%29#When_to_optimize">profile and hence improve performance</... |
"Premature optimization is the root of all evil." - Donald Knuth |
at times when optimization is necessary, i'd rather sacrifice compactness and keep the performance enhancement. perl obviously has some deep waters to plumb in search of the conciseness/performance ratio, but as cute as it is to write one-liners, the person who comes along to maintain your code (who in my experience, ... |
Is there a Way to use Linq to Oralce |
|linq|oracle-database| |
I can connect with the DataContext to the Oracle database however I get errors in running the query against the oracle database. I looked at the SQL generated and it is for MSSQL and not Oracle PSQL.
Does anybody know of a decent easy to use wrapper to use LINQ against an Oracle Database? |
Is there a Way to use Linq to Oracle |
|oracle-database|linq| |
Just to extend the previous answer... If, for whatever reason, the assignments need to be part of the conditional, you'd want to write it thusly:
$condition ? ($a=2) : ($a=3);
This would be useful if you're assigning to different variables based on the condition.
$condition ? ($a=2) : ($b=3);
And if... |
I use generic lists for almost all scenarios. The only time that I would consider using a derived collection anymore is if I add collection specific members. However, the advent of LINQ has lessened the need for even that. |
First of all, I am not completely sure I follow, you might need to provide some additional details to help us understand what is happening and what the problem is. I guess I am not sure I understand exactly what you're trying to accomplish and what the problem is.
Second, you shouldn't need to set the dialog's paren... |
@nlucaroni: hg transplant doesn't seem to be supported by the version of HG I am using: version 1.0.1+20080525
I was able to combine my two repositories in this way:
1) Use "hg clone first_repository" to clone one of the repositories.
2) Use "hg pull -f other_repository" to pull the code in from the other reposito... |
I was able to combine my two repositories in this way:
1) Use "hg clone first_repository" to clone one of the repositories.
2) Use "hg pull -f other_repository" to pull the code in from the other repository.
The -f (force) flag on the pull is the key -- it says to ingore the fact that the two repositories aren't f... |
NxBRE is one option.
http://sourceforge.net/projects/nxbre/#item3rd-5
|
Static methods are not instance methods. There's no instance context, therefore to implement it from the interface makes little sense. |
I'll answer your question with an example. Suppose we had a Math class with a static method add. You would call this method like so:
Math.add(2, 3);
If Math were an interface instead of a class, it could not have any defined functions. As such, saying something like Math.add(2, 3) makes no sense.
|
I would suggest if you are going for a PHP and MySQL install to instead use [WAMP][1]. It works great and is easy to add extensions and modify everything. I use it for work and love it.
[1]: http://www.wampserver.com/en/ "WAMP" |
The reason why you can't have a static method in an interface lies in the way Java resolves static references. Java will not bother looking for an instance of a class when attempting to execute a static method. This is because static methods are not instance dependent and hence can be executed straight from the class f... |
I'm trying to write a custom WPF ValidationRule to enforce that a certain property is unique within the context of a given collection. For example: I am editing a collection of custom objects bound to a ListView and I need to ensure that the Name property of each object in the collection is unique. Does anyone know how... |
If you application uses the JEE stack and you are using [Hibernate][1] you can use the [Compass Framework][2] maintain a searchable index of your database. The Compass Framework uses [Lucene][3] under the hood.
The only catch is that you cannot replicate your search index. So you need to use a clustered database to ... |
This is specific to a C# project, but I ignore these files/directories:
- *.csproj.user
- /obj/*
- /bin/*
- *.ncb
- *.suo
I have no problems running the code in the depot on other machines after I ignore all of these files. The easiest way to find out what you need to keep is to make a copy of the f... |
I use a CSS class instead:
<input type="text" id="BeginDate" class="calendar" />
<input type="text" id="EndDate" class="calendar" />
Then, in your document.ready function:
$('.calendar').datepicker();
Using it that way for multiple calendar fields works for me. |
[.NET 3.5 SP1 tries to use the action="" attribute][1] (.NET 3.5 RTM did not). So, when you deploy, your code is attempting to set the HtmlForm.Action property and failing, as the System.Web.dll on the deploy target is RTM and does not have a setter on the property.
[1]: http://john-sheehan.com/blog/index.php/le... |
[Frank Krueger][1] writes:
> Gaius: A Null Pointer exception gets thrown for you automatically by the runtime, there is no benefit to testing that stuff in the function prologue.
I have two responses to this:
1. Null was just an example. For square(x), I'd want to test that the square root of the result is (... |
I know this is not possible for alert(), so I guess it is not possible for confirm either. Reason is security: it is not allowed for you to change it so you wouldn't present yourself as some system process or something. |
Dynamic robots.txt |
|seo| |
Let's say I have a web site for hosting community generated content that targets a very specific set of users. Now, let's say in the interest of fostering a better community I have an off-topic area where community members can post or talk about anything they want, regardless of the site's main theme.
Now, I _want_... |
<http://www.elandsys.com/resources/sendmail/smarthost.html>
> Sendmail Smarthost
>
> A smarthost is a host through which
> outgoing mail is relayed. Some ISPs
> block outgoing SMTP traffic (port 25)
> and require their users to send out
> all mail through the ISP's mail
> server. Sendmail can be configured t... |
I would highly recommend reading the book [PHP In Action][1]. It takes you through abstracting your database connections, templating systems and all the other basics of a web application. If every PHP developer read this book then the language would have a much better reputation.
It also has chapters on refactoring,... |
jQuery: Can you select by CSS rule, not class? |
|jquery|selector|javascript| |
A .container can contain many .components, and .components themselves can contain .containers (which in turn can contain .components etc. etc.)
Given code like this:
$(".container .component").each(function()
{
$(".container", this).css('border', '1px solid #f00');
});
What do I need... |
|javascript|jquery|css-selectors| |
< META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW">
This will work for all well-behaving search engines, just add it to the head. |
I side-stepped this problem completely by building my Qt app statically on MacOSX. That might not be practical for you though. |
Simlarly to @James Marshall's suggestion - in ASP.NET you could use an HttpHandler to redirect calls to robots.txt to a script which generated the content. |
Matthew has the correct approach here. In my opinion, it is very unusual for an application to reset a sequence's current value after every use. Much more conventional to set the increment size to whatever you need upfront.
Also, this way is much more performant. Selecting nextval from a sequence is a highly opti... |
This looks like an issue with name resolution, try creating a public synonym on the table:
CREATE PUBLIC SYNONYM *MyTempTable* for *MyTempTable*;
Also, what exactly do you mean by **wrong result**, incorrect data, error message? |
This looks like an issue with name resolution, try creating a public synonym on the table:
CREATE PUBLIC SYNONYM *MyTempTable* for *MyTempTable*;
Also, what exactly do you mean by **wrong result**, incorrect data, error message?
----------
Edit: What is the name of the schema that the required table bel... |
An array would probably be fine. If you wanted more convenient means of "traversing" the board, you could easily build methods to abstract away the details of the data structure implementation. |
[Fiddler][1] is a(nother) web proxy that can be used to degrade your connection.
[1]: http://www.fiddler2.com/fiddler2/ |
As far as I have heared Google Chrome will have multithreaded javascript, so it is a "current implementations" problem. |
I don't know of a way to embed powerpoint slides directly into html. However, there are a number of solutions online for converting a PPT file into a SWF, which can be embedded into HTML just like any other flash movie.
[Googling for 'ppt to swf'][1] seems to give a lot of hits. Some are free, others aren't. Some... |
I don't think (at least can't find a way to make) [Chris' answer][1] work in this case because ***do_div()*** actually changes the dividend in-place. Getting the absolute value implies a temporary variable whose value will change the way I require but can't be passed out of my ***__divdi3()*** override.
I don't see... |
> While each generated GUID is not
> guaranteed to be unique, the total
> number of unique keys (2^128 or
> 3.4×10^38) is so large that the probability of the same number being
> generated twice is very small. For
> example, consider the observable
> universe, which contains about 5×1022
> stars; every star coul... |
> While each generated GUID is not
> guaranteed to be unique, the total
> number of unique keys (2^128 or
> 3.4×10^38) is so large that the probability of the same number being
> generated twice is very small. For
> example, consider the observable
> universe, which contains about 5×10^22
> stars; every star cou... |
It is better to use a look-up table for obtaining the distance between two cities.
This makes sense because
* The Formula to calculate the distance ais quite computationally intensive..
* Distance between cities is unlikely to change.
So unless you needs are very specific (like terrain mapping from a satellite... |
OU is an Organizational Unit (sort of like a Subfolder in Explorer), not a Group, Hence group1, 2 and 3 are not actually groups.
You are looking for the DN Attribute, also called "distinguishedName". You can simply use DOMAIN\DN once you have that. |
OU is an Organizational Unit (sort of like a Subfolder in Explorer), not a Group, Hence group1, 2 and 3 are not actually groups.
You are looking for the DN Attribute, also called "distinguishedName". You can simply use DOMAIN\DN once you have that.
Edit: For groups, the CN (Common Name) could also work.
The f... |
This is a knapsack problem [(wikipedia to the rescue!)][1] The weights are the days in transit, and the profit should be $5000 - cost of leg. Eliminate all negative costs and go from there!
MSN
[1]: http://en.wikipedia.org/wiki/List_of_knapsack_problems |
One option is to use a single subversion repository and check-in changes that effect both library and project at the same time. That way you know that whatever revision of the project you are on requires the same revision of the library. |
Actually, since the size of material is fixed, but the requests are not, it's a bin packing problem.
Again, [wikipedia to the rescue!][1]
(Something I might have to look into for work too, so yay!)
MSN
[1]: http://en.wikipedia.org/wiki/Bin_packing |
Use the [nant task][1], so you get one single build file.
[1]: http://nant.sourceforge.net/release/0.85-rc1/help/tasks/nant.html |
The GAC can also be used by assemblies that require elevated permissions to perform privileged operations on behalf of less trusted code (e.g. a partial trust ASP.NET application).
For example, say you have a partial trust ASP.NET application which needs to perform a task that would require elevated privileges, i.e.... |
If you are on Microsoft plattform you could use the Indexing service. This integrates very easliy with IIS websites.
It has all the basic features like full text search, ranking, exlcude and include certain files types and you can add your own meta information as well via meta tags in the html pages.
Do a google... |
.Net - Detecting the Appearance Setting (Classic or XP?) |
|vb.net|windows-xp|display.properties|appearance| |