instruction stringlengths 0 30k ⌀ |
|---|
Best way to detect a retail build from a debug build? .net |
|.net|debugging|retail| |
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 not incorporate it within the final bits. I want to do something like this
if(Debug.Mode){
<link rel="stylesheet" type="text/css" href="error.css" />
<link rel="stylesheet" type="text/css" href="login.css" />
<link rel="stylesheet" type="text/css" href="menu.css" />
<link rel="stylesheet" type="text/css" href="page.css" />
} else {
<link rel="stylesheet" type="text/css" href="site.css" />
}
I'll have a msbuild task that will combine all the css files, minimize them and all that good stuff. I just need to know if there is a way to remove the if else branch in the final bits.
|
Best way to detect a release build from a debug build? .net |
|.net|debugging|release| |
The additional layer of abstraction will cause it to be slower than a pure call to a sproc. Just by the fact that you have additional allocations on the managed heap, and additional pushes and pops off the callstack, the truth of the matter is that it is more efficient to call a sproc over having an ORM build the query, regardless how good the ORM is.
How slow, if its even measurable, is debatable. This is also helped by the fact that most ORM's have a caching mechanism to avoid doing the query at all.
|
Browsers should auto-fill OpenID login boxes so that you don't have to remember your ID. |
Web frameworks should come with it as the default, unless you take lots of extra time to configure a simple username/password combination. |
Check out [the wikipedia page on locality sensitive hashing][1]. There's also [a good page hosted by a research on MIT][2].
In general, there are several flavors available: hashes for strings (such as [simhash][3]), sets or 0/1 features (such as [min-wise hashes][4]), and for real vectors.
The main trick for numerical hashes is basically [dimension reduction][5], so far. For strings, the idea is to come up with a representation that's robust in the face of minor edits.
I'm also doing a little research in this field, although I guess stackoverflow might not be the right place for nascent work.
[1]: http://en.wikipedia.org/wiki/Locality_sensitive_hashing
[2]: http://www.mit.edu/~andoni/LSH/
[3]: http://scholar.google.com/scholar?hl=en&lr=&cluster=2077823906332929131
[4]: http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.43.9451
[5]: http://en.wikipedia.org/wiki/Dimension_reduction |
Thanks for the answers everyone!
As it turns out, the comment ahead of the file seemed to work, but when I delved into the DBUnit source, it is because validation is turned off.
I did try a simple document load via:
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document = builder.parse(new File("/path/to/file"));
and this fails with an exception because the XML Declaration is not the first thing (as others indicated would be the case).
So, while DBUnit would work, I prefer to have valid XML, so I moved the comment to the end (since DBUnit generates the XML Declaration, it is not an option to place the comment below it, even though I would prefer that... at least not without modifying the XML after the fact, which would be more work than it is worth). |
I posted this response originally here:
<http://stackoverflow.com/questions/8440/visual-studio-optimizations#8473>
You can find many other helpful hints on that page.
If you are using Visual Studio 2008, you can compile using the /MP flag to build a single project in parallel. I have read that this is also an undocumented feature in Visual Studio 2005, but have never tried myself.
You can build multiple projects in parallel by using the /M<maxprojects> flag, but this is usually already set to the number of available cores on the machine, though this only applies to VC++ I believe.
|
Take a look at [waf](http://code.google.com/p/waf/).
I think you can consider it as a complete replacement for make and autotools. It is based on python. One thing I like about waf is that the waf script itself is ~100kb standalone that you place in your project root directory. This is in contrast to make or rake and friends, where the build system must be installed first. You do have to have python >=2.3 installed though.
~$ ./waf configure && ./waf && ./waf install
Waf's equivalent to Makefiles is the wscript file. It is a python script waf reads, and it defines at least 3 functions: `set_options()`, `configure(conf)` and `build(bld)`. You can guess what each of them does.
To jumpstart, I recommend looking in the demos/cpp/* files in the source distribution. Also take a look at the doc/[waf.pdf](http://code.google.com/p/waf/source/browse/trunk/doc/old/waf.pdf) file; it's a 12-page document that will quickly get you up and running.
[1]: http://waf.googlecode.com/svn/wiki/images/waf-screenshot.png "waf screenshot" |
In theory, only multipart/ and message/ can parent other types (per RFC2046). |
You can also use the <code>target</code> pseudo-class in CSS:
<html>
<head>
<style type="text/css">
div#test:target {
background-color: yellow;
}
</style>
</head>
<body>
<p><b><a href="#test">Link</a></b></p>
<div id="test">
Target
</div>
</body>
</html>
Unfortunately the target pseudo class isn't supported by IE or Opera, so if you're looking for a universal solution here this might not be sufficient. |
Casting between multi- and single-dimentional arrays |
|c++|arrays| |
This came up from [this answer to a previous question of mine](http://stackoverflow.com/questions/55093/how-to-deal-with-arrays-declared-on-the-stack-in-c#55183).
Is it guaranteed for the compiler to treat array[4][4] the same as array[16]? For instance, would either of the below calls to <code>api_func()</code> be safe?
void api_func(const double matrix[4][4]);
// ...
{
typedef double Matrix[4][4];
double* array1 = new double[16];
double array2[16];
// ...
api_func(reinterpret_cast<Matrix&>(array1));
api_func(reinterpret_cast<Matrix&>(array2));
}
|
Perhaps take some common functions and make some libraries, that way the same sources are not being compiled over and over again for multiple projects.
If you are worried about different versions of DLLs getting mixed up, use static libraries.
|
The way we work it is: There must be a good reason to refactor the code, otherwise why?
If the reason is to allow another feature to use the same code, associate the changes with the other feature's request.
If it's to make something faster, create a feature request for faster 'xyz' and associate the changes with that - then the customers see you're improving the product.
If it's to design out a bug, log the bug.
It's worth noting that in my environment, the policy cannot be enforced. But clever managers can get reports of changes and if they don't have a bug\request reference in the commit text it's followed up. |
You have to explicitly cast the string types to the same in order to concatenate them, In your case you may solve the issue by simply addig an 'N' in front of 'SomeText' (N'SomeText'). If that doesn't work, try Cast('SomeText' as nvarchar(8)).
|
Yes, just as one can over-normalize a database design.
This seems to be one of those purist vs. pragmatic debates that will never end. <:S |
What should be considered when building a Recommendation Engine? |
|algorithm|recommendation-engine| |
I've read the book [Programming Collective Intelligence][1] and found it fascinating. I'd recently heard about a challenge amazon had posted to the world to come up with a better recommendation engine for their system.
The winner apparently produced the best algorithm by limiting the amount of information to that was being fed to it.
As a first rule of thumb I guess... "**More information is not necessarily better when it comes to fuzzy algorithms."**
I know's it's subjective, but ultimately it's a measurable thing (clicks in response to recommendations).
Since most of us are dealing with the web these days and search can be considered a form of recommendation... I suspect I'm not the only one who'd appreciate other peoples ideas on this.
In a nutshell, **"What is the best way to build a recommendation ?"**
[1]: http://oreilly.com/catalog/9780596529321/ "Programming Collective Intelligence" |
I've read the book [Programming Collective Intelligence][1] and found it fascinating. I'd recently heard about a challenge amazon had posted to the world to come up with a better recommendation engine for their system.
The winner apparently produced the best algorithm by limiting the amount of information that was being fed to it.
As a first rule of thumb I guess... "**More information is not necessarily better when it comes to fuzzy algorithms."**
I know's it's subjective, but ultimately it's a measurable thing (clicks in response to recommendations).
Since most of us are dealing with the web these days and search can be considered a form of recommendation... I suspect I'm not the only one who'd appreciate other peoples ideas on this.
In a nutshell, **"What is the best way to build a recommendation ?"**
[1]: http://oreilly.com/catalog/9780596529321/ "Programming Collective Intelligence" |
If you're in Server Explorer, you can make them visible this way:
* Create a connection to the server you want.
* Right-click the server and choose Change View > Object Type.
* You should now see System Tables and User Tables. You should see sysjobs there, and you can easily drag it onto a .dbml surface. |
|c|enums|typedef| |
One key feature in a functional language is the concept of first-class functions. The idea is that you can pass functions as parameters to other functions and return them as values.
Functional programming involves writing code that does not change state. The primary reason for doing so is so that successive calls to a function will yield the same result. You can write functional code in any language that supports first-class functions, but there are some languages, like Haskell, which do not allow you to change state. In fact, you're not supposed to make any side effects (like printing out text) at all - which sounds like it could be completely useless.
Haskell instead employs a different approach to IO: monads. These are objects that contain the desired IO operation to be executed by your interpreter's toplevel. At any other level they are simply objects in the system.
What advantages does functional programming provide? Functional programming allows coding with fewer potentials for bugs because each component is completely isolated. Also, using recursion and first-class functions allows for simple proofs of correctness which typically mirror the structure of the code. |
Generating Icon Files |
|icons|favicons| |
I'm looking for an online solution for generating .ICO files. I'd like the ICO files to have the ability to have transparency as well.
What software or web site do you use to create them? |
I'm looking for an online solution for generating .ICO files. I'd like the ICO files to have the ability to have transparency as well.
What software or web site do you use to create them?
[Update]
To clarify, I have an existing image in PNG format, 32 x 32 pixels. I want to generate the icon from this existing file, not create a brand new one online. Sorry for the confusion. |
|icons|favicon| |
Reading text files using .NET |
|.net|text-files| |
I need to read from a variety of different text files. I've considered parsing the files line by line (slow) and reading the file using the ODBC text driver (fast) but does anyone have any other (better) suggestions?
I'm using .NET/C#. Ideally any suggestions would need to be easily configurable and (less important) would let me include Excel files in the future. |
I need to read from a variety of different text files (I've some delimited files and some fixed width files). I've considered parsing the files line by line (slow using the File.ReadLine type methods) and reading the file using the ODBC text driver (faster) but does anyone have any other (better) suggestions? I'm using .NET/C#. |
|.net|text-files|fileio| |
|.net|file-io|text-files| |
Font rendering for web pages |
|font| |
Allow user to set up an SSH tunnel, but nothing else |
|ssh|unix| |
I'd like to allow a user to set up an SSH tunnel to a particular machine on a particular port (say, 5000), but I don't want to restrict this user as much as possible. (Authentication will be with public/private keypair).
I know I need to edit the relevant ~/.ssh/authorized_keys file, but I'm not sure exactly what content to put in there.
Lorin |
|unix|ssh| |
I'd like to allow a user to set up an SSH tunnel to a particular machine on a particular port (say, 5000), but I don't want to restrict this user as much as possible. (Authentication will be with public/private keypair).
I know I need to edit the relevant ~/.ssh/authorized_keys file, but I'm not sure exactly what content to put in there (other than the public key).
Lorin |
How do I calculate CRC32 of a string |
|.net|crc32| |
How do I calculate the CRC32 (Cyclic Redundancy Checksum) of a string in .NET? |
This guy seems to have your answer.
http://damieng.com/blog/2006/08/08/Calculating_CRC32_in_C_and_NET |
The accepted practice if to use the *IllegalArgumentException( String message )* to declare a parameter to be invalid and give as much detail as possible... So to say that a parameters was found to be null while exception non-null, you would do something like this:
if( variable == null )
throw new IllegalArgumentException("The object 'variable' cannot be null");
You have virtually no reason to implicitly use the "NullPointerException". The NullPointerException is an exception thrown by the Java Virtual Machine when you try to execute code on null reference (Like *toString()*). |
The solution to the changed question is basically the same.
You will have to run select query with the regex where clause.
Somthing like
Select *
FROM SOMETABLE
WHERE SOMEFIELD REGEXP '"(\d+),(\d+)"'
Foreach of these rows, you want to do the following regex substitution s/"(\d+),(\d+)"/$1$2/ and then update the field with the new value.
Please Joseph Pecoraro seriously and have a backup before doing mass changes to any files or databases. Because whenever you do regex, you can seriously mess up data if there are cases that you have missed. |
I love the way SubSonic does the one column only thing.
Either
DataBaseTable.GetList(DataBaseTable.Columns.ColumnYouWant)
, or:
Query q = DataBaseTable.CreateQuery()
.WHERE(DataBaseTable.Columns.ColumnToFilterOn,value);
q.SelectList = DataBaseTable.Columns.ColumnYouWant;
q.Load();
But Linq is still king when it comes to lazy loading. |
When should I use Compiled LINQ vs Normal LINQ |
|.net|linq| |
I just read up on a performance of LINQ, and there is a HUGE amount to be gained by using Compiled LINQ.
Now, why won't I always use compiled LINQ? |
Use distributed compilation. Xoreax [IncrediBuild][1] can cut compilation time down to few minutes.
[1]: http://www.xoreax.com |
Use distributed compilation. Xoreax [IncrediBuild][1] can cut compilation time down to few minutes.
I've used it on a huge C\C++ solution which usually takes 5-6 hours to compile. IncrediBuild helped to reduce this time to 15 minutes.
[1]: http://www.xoreax.com |
How exactly do you configure httpOnly Cookies in ASP Classic? |
|security|httponly|aspclassic| |
I'm looking to implement httpOnly in my legacy ASP classic sites.
Anyone knows how to do it? |
|security|asp-classic|httponly| |
I would be worried about padding being added for things like Matrix[5][5] to make each row word aligned, but that could be simply my own superstition. |
If this is C or C++, and you're not using precompiled headers, you should be. |
If this is a web app, setting batch build to true can help depending on the scenario.
<compilation defaultLanguage="c#" debug="true" batch="true" >
You can find an overview here: [http://weblogs.asp.net/bradleyb/archive/2005/12/06/432441.aspx][1]
[1]: http://weblogs.asp.net/bradleyb/archive/2005/12/06/432441.aspx |
When you use JOINs instead of multiple queries, you allow the database to apply its optimizations. You also are potentially retrieving rows that you don't need (if you were to replace an INNER join with multiple selects), which increases the network traffic between your app server and database server. Even if they're on the same box, this matters. |
Here's what I came up with:
Wrap it in an EXEC(), like so:
if @version <> @expects
begin
...snip...
end
else
begin
exec('CREATE PROC MyProc AS SELECT ''Victory!''');
end
Works like a charm! |
I was curious about this so I wrote the following test program and compiled it with g++ version 4.1.2.
include <iostream>
#include <string>
using namespace std;
class test
{
public:
test(const char *name)
: _name(name)
{
cout << _name << " created" << endl;
}
~test()
{
cout << _name << " destroyed" << endl;
}
string _name;
};
test t("global variable");
void f()
{
static test t("static variable");
test t2("Local variable");
cout << "Function executed" << endl;
}
int main()
{
test t("local to main");
cout << "Program start" << endl;
f();
cout << "Program end" << endl;
return 0;
}
The results were not what I expected. The constructor for the static object was not called until the first time the function was called. Here is the output:
global variable created
local to main created
Program start
static variable created
Local variable created
Function executed
Local variable destroyed
Program end
local to main destroyed
static variable destroyed
global variable destroyed
|
Adobe says you can set **allowScriptAccess**=never and **allowNetworking**=none and the swf should have no access to anything outside of itself. Although allowNetworking is only in Flash Player 9, so users with earlier versions of Flash would still be susceptible to some exploits.
[Creating more secure SWF web applications : Security Controls Within the HTML Code][1]
[How to restrict SWF content from HTML][2]
[1]: http://www.adobe.com/devnet/flashplayer/articles/secure_swf_apps_04.html
[2]: http://blogs.adobe.com/stateofsecurity/2007/07/how_to_restrict_swf_content_fr_1.html |
ISPs should provide openIds to all their customers that mimic their e-mail addresses. Perhaps openID needs to support automatic translation of foo@example.com into http://openid.example.com/foo so that ISPs can easily set this up on a separate server. |
You can .. but the results *may* be unpredictable.
Even though there is enough information in the format to tell the client to ignore the extra data it is likely not a case the programmer tested for.
A paranoid program might look at the size, notice the discrepancy and decide it won't process your file because clearly it doesn't fully understand it. This is particularly likely when reading data from the web when random bytes in a file could be considered a security risk. |
Personally, I like Test::Most, its basically Test::More with some added cool features. |
Uh, there seems to be a lot of "it's better this way" sort of justification going on.
I think people could benefit from reading "Showstopper"; the book about the development of Windows NT.
The whole reason the services run as DLL's in one process on Windows NT was that they were too slow as separate processes.
If you got down an dirty you'd find that the library loading strategy is the problem.
On unices ( in general) the Shared libraries (DLL's) code segments are actually shared.
Windows NT loads a copy of the DLL per process, becauase it manipulates the library code segment ( and executable code segment) after loading. ( tells it where is your data ? )
This results in code segments in libraries that are not reusable.
So, the NT process create is actually pretty expensive. And on the down side, it makes DLL's no appreciable saving in memory, but a chance for inter-app dependency problems.
Sometimes it pays in engineering to step back and say, "now, if we were going to design this to really suck, what would it look like"
I worked with an embedded system that was quite temperamental once upon a time, and one day looked at it and realized it was a cavity magnetron, with the electronics in the microwave cavity. We made it much more stable (and less like a microwave) after that. |
Application Testing |
|tdd| |
Is the real benefit in TDD the actual testing of the application, or the benefits that writing a testable application brings to the table? I ask becuase I feel too often the converstation revolves so much around testing, and not the total benefits package. |
|tdd| |
Also, you need to make sure that the SQL Server Service is running as a user that has network access - and permissions to the share where the backup file lives. 'Local System' won't have permissions to access the network. |
1. [Microsoft StyleCop][1] provides code style checking for C#, we use it all the time and love it (free)
2. [Axialis IconWorkshop][2] has a Visual Studio add-in which is now free for VS2008 users.
3. [Resharper][3] Yes another vote, because I can't upvote everyone who suggests it :)
4. [Workspace Whiz][4] for C++, I used to live by Workspace Whiz but haven't used it in VS2008 as I hadn't realised there was an update. Will have to give it a try again.
[1]: http://code.msdn.microsoft.com/sourceanalysis
[2]: http://www.axialis.com/download/iwlite.html
[3]: http://www.jetbrains.com/resharper/
[4]: http://workspacewhiz.com/ |
Property default values using Properties.Settings.Default |
|c#|.net|settings| |
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:
ValuationInput valuationInput = (ValuationInput) Settings.Default.Properties["ValuationInput"].DefaultValue;
But it seems to return a string instead of ValuationInput and it throws an exception.
I made a quick hack, which works fine:
string valuationInputStr = (string)
Settings.Default.Properties["ValuationInput"].DefaultValue;
XmlSerializer xmlSerializer = new XmlSerializer(typeof(ValuationInput));
ValuationInput valuationInput = (ValuationInput) xmlSerializer.Deserialize(new StringReader(valuationInputStr));
But this is really ugly - when I use all the tool to define a strongly typed setting, I don't want to serialize the default value myself, I would like to read it the same way as I read the current value: ValuationInput valuationInput = Settings.Default.ValuationInput; |
Mail Message Link Handling |
|macos|applescript| |
I've written an Applescript which when supplied with a Windows network link, will convert it to the correct smb:// equivelent for the server in our office, mount the network drive, and open the requested folder in Finder.
I have this built in an application which just takes a pasted network path. Ideally I need this to trigger on clicking a link in a Mail.app email message... so that it can check if the link is in the correct format, and if so run the script: attempt to mount the drive and load the folder in Finder.
How would I go about doing this? |
When can DataInputStream.skipBytes(n) not skip n bytes? |
|java| |
The [Sun Documentation for DataInput.skipBytes][1] states that it "makes an attempt to skip over n bytes of data from the input stream, discarding the skipped bytes. However, it may skip over some smaller number of bytes, possibly zero. This may result from any of a number of conditions; reaching end of file before n bytes have been skipped is only one possibility."
1. Other than reaching end of file, why might skipBytes() not skip the right number of bytes? (The DataInputStream I am using will either be wrapping a FileInputStream or a PipedInputStream.)
2. If I definitely want to skip n bytes and throw an EOFException if this causes me to go to the end of the file, should I use readFully() and ignore the resulting byte array? Or is there a better way?
[1]: http://java.sun.com/j2se/1.4.2/docs/api/java/io/DataInput.html#skipBytes(int) |
I'd personally plump for returning the resource rather than faffing with a redirect, although I suspect that's only because my subcoscious is telling me redirects are slower.
However, if you were to decide to use a redirect I'd think a 302 or 307 might be more appropiate than a 303, although the [w3.org][1] has details of the different redirect codes you could use.
[1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html |
There are two parts to this. You need to [register a new file type][1] and then [create a desktop entry for your application][2]. The desktop entry associates your application with your new mime type.
I thought that both Gnome and KDE (maybe only 4+?) used the [freedesktop shared mime info spec][3], but I may well be wrong.
[1]: http://www.freedesktop.org/wiki/Specifications/AddingMIMETutor
[2]: http://standards.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html
[3]: http://www.freedesktop.org/wiki/Specifications/shared-mime-info-spec |
There is no Object Model for the InfoPath designer.
I believe the closest that you can get is the exposed API for the Visual Studio hosting that InfoPath supports; but I don't believe that this will give you the programatic control of the designer that you'd like.
[http://msdn.microsoft.com/en-us/library/aa813327.aspx#office2007infopathVSTO_InfoPathDesignerAPIIntegratingInfoPath2007VisualStudio][1]
Sorry Kevin.
[1]: http://msdn.microsoft.com/en-us/library/aa813327.aspx#office2007infopathVSTO_InfoPathDesignerAPIIntegratingInfoPath2007VisualStudio "Overview of the InfoPath Designer API for Integrating InfoPath 2007 into Visual Studio 2005" |
How can I get notification when a mirrored SQL Server database has failed over |
|sql-server| |
We have a couple of mirrored SQL Server databases.
My first problem - the key problem - is to get a notification when the db fails over. I don't *need* to know because, erm, its mirrored and so it (almost) all carries on working automagically but it would useful to be advised and I'm currently getting failovers when I don't think I should be so it want to know when they occur (without too much digging) to see if I can determine why.
I have services running that I could fairly easily use to monitor this - so the alternative question would be "How do I programmatically determine which is the principal and which is the mirror" - preferably in a more intelligent fashion than just attempting to connect each in turn (which would mostly work but...).
Thanks, Murph |
We have a couple of mirrored SQL Server databases.
My first problem - the key problem - is to get a notification when the db fails over. I don't *need* to know because, erm, its mirrored and so it (almost) all carries on working automagically but it would useful to be advised and I'm currently getting failovers when I don't think I should be so it want to know when they occur (without too much digging) to see if I can determine why.
I have services running that I could fairly easily use to monitor this - so the alternative question would be "How do I programmatically determine which is the principal and which is the mirror" - preferably in a more intelligent fashion than just attempting to connect each in turn (which would mostly work but...).
Thanks, Murph
Addendum:
One of the answers queries why I don't need to know when it fails over - the answer is that we're developing using ADO.NET and that has automatic failover support, all you have to do is add `Failover Partner=MIRRORSERVER` (where MIRRORSERVER is the name of your mirror server instance) to your connection string and your code will fail over transparently - you may get some errors depending on what connections are active but in our case very few. |
It might depend on what you do with the data after you fetch it from the DB. If you use each of the four results independently, then it would be more logical and clear to have four separate SELECT statements. On the other hand, if you use all the data together, like to create a unified row in a table or something, then I would go with the single SELECT and JOINs.
I've done a bit of PHP/MySQL work, and I find that even for queries on huge tables with tons of JOINs, the database is pretty good at optimizing - if you have smart indexes. So if you are serious about performance, start reading up on [query optimization and indexing][1].
[1]: http://www.informit.com/articles/article.aspx?p=377652 |
@Kyralessa,
I think it is impossible to implement this without dynamic linq. You can create extension method AddCondition for predicates that accepts parameter of type Control plus lambda expression and returns combined expression. To see example of how it can be implemented see my answer on this question:
[How do I compose existing Linq Expressions][1]
[1]: http://stackoverflow.com/questions/53597/how-do-i-compose-existing-linq-expressions |
@Kyralessa,
You can create extension method AddCondition for predicates that accepts parameter of type Control plus lambda expression and returns combined expression. Then you can combine conditions using fluent interface and reuse your predicates. To see example of how it can be implemented see my answer on this question:
[How do I compose existing Linq Expressions][1]
[1]: http://stackoverflow.com/questions/53597/how-do-i-compose-existing-linq-expressions |
It could be easier if you are having a central session store for all your applications. You can then set the session to null in one place.
|
Well under Oracle you'd want to take advantage of the query caching, and if you have a lot of small queries you are doing in your sequential processing, it would suck if the last query pushed the first one out of the cache...just in time for you to loop around and run that first query again (with different parameter values obviously) on the next pass.
We were building an XML output file using Java stored procedures and definitely found the round trip times for each individual query were eating us alive. We found it was much faster to get all the data in as few queries as possible, then plug those values into the XML DOM as needed.
The only downside is that the Java code was a bit less elegant, as the data fetch was now remote from its usage. But we had to generate a large complex XML file in as close to zero time as possible, so we had to optimize for speed. |