instruction stringlengths 0 30k ⌀ |
|---|
Make sure you compact and repair the database regularly, especially if the database application experiences frequent record updates, deletions and insertions. Not only will this keep the size of the database file down to the minimum - which will help speed up database operations and network communications - it perform... |
Yes, all objects in the `Dictionary` will be released after a call to `RemoveAll()`. From a performance (as in speed) standpoint I would say those lines setting the variables to `Nothing` are unnecessary, because the code has to first look them up based on the key names whereas `RemoveAll()` will enumerate and release... |
Usually you get a ConcurrentModificationException if you're trying to remove an element from a list whilst it's being iterated through.
The easiest way to test this is:
List<Blah> list = new ArrayList<Blah>();
for (Blah blah : list) {
list.remove(blah); // will throw the exception
}
I'm... |
RemoveAll will remove all the associations from the Dictionary: both the keys and values.
It would be a reference leak for the Dictionary to keep a reference to the values in the Dictionary. |
Publishing vs Copying |
|asp.net|visual-studio| |
What is the difference between publishing a website with visual studio and just copying the files over to the server? Is the only difference that the publish files are pre-compiled? |
A site that implements OpenID authentication in a good way would allow you to switch your ID to another URL or to specify a secondary ID in cases when your primary provider happens to be down.
Currently, most sites still don't have this option, and yes -- if our OpenID providers would delete our accounts one day, we... |
Mapping a collection of enums with NHibernate |
|.net|nhibernate|collections|enums| |
Mapping a collection of enums with NHibernate
Specifically, using Attributes for the mappings.
Currently I have this working mapping the collection as type Int32 and NH seems to take care of it, but it's not exactly ideal.
The error I receive is "Unable to determine type" when trying to map the collection as o... |
This might not count as a "development book" but I have to throw it in anyway: Hackers by Stephen Levy. I found that it spoke to the emotional side of programming. |
Walter Zorn has a [JavaScript library][1] for arbitrary vector graphics. It looks decent.
[1]: http://walterzorn.com/jsgraphics/jsgraphics_e.htm |
The reason not to use IClonable is **not** because it doesn't have a generic interface. [The reason not to use it is because it's vague][1]. It doesn't make clear whether you're getting a shallow or a deep copy; that's up to the implementer.
Yes, `MemberwiseClone` makes a shallow copy, but the opposite of `Memberw... |
Is anyone using the ASP.NET MVC Framework on live sites? |
|asp.net-mvc|web-applications| |
Is it ready for that?
I've been playing with it for a short amount of time and it seems quite reasonable. Is anyone using it for live sites?
any issues to be aware of? |
|asp.net-mvc|web-applications|ironic| |
|asp.net-mvc|web-applications| |
Frequent check ins. Team members should be checking in their changes and re-syncing their sandboxes **at least** once per day. With more frequent check ins merge conflicts will occur less often and be easier to manage when they do occur. |
Yes. You'd use the `urllib2` module, and encode using the `multipart/form-data` content type. Here is some sample code to get you started -- it's a bit more than just file uploading, but you should be able to read through it and see how it works:
user_agent = "image uploader"
default_message = "Image $curre... |
there's a couple of ways. My preferred way is to attach a function to the ajaxStart/Stop events on the element itself.
$('#loadingDiv')
.hide() // hide it initially
.ajaxStart(function() {
$(this).show();
})
.ajaxStop(function() {
$(this).hide();
... |
Your mail server's IP may have been black listed. This is common on shared servers.
[http://www.mxtoolbox.com/blacklists.aspx][1]
[1]: http://www.mxtoolbox.com/blacklists.aspx |
First, check [dnsbl.info][1] to see if your mailserver's IP is blocked by any of the blacklists. If they are, contact the blacklist administrator to investigate removing the block.
[1]: http://www.dnsbl.info/advanced.asp |
Is inline code in your aspx pages a good practice? |
|asp.net|coding-style| |
If I use the following code I lose the ability to right click on variables in the code behind and refactor (rename in this case) them
<a href='<%# "/Admin/Content/EditResource.aspx?ResourceId=" + Eval("Id").ToString() %>'>Edit</a>
I see this practice everywhere but it seems weird to me as I no longer am able ... |
How can I make a shortcut start in a different directory when running it as an administrator on Windows Vista? |
|windows-vista|uac|windows|shortcut| |
I have a shortcut on my desktop which opens a command prompt with many arguments that I need. I set the 'start in' field to d:\ and it works as expected (the prompt starts in d:\). When I choose Advanced -> run as administrator and then open the shortcut, it starts in C:\Windows\System32, even though I have not chang... |
to quote Joe Celko,
>"like a size 26 thong, just because you can
does not mean you should!"
I'm sure there are plenty of applications where you can get away with it, but its' not the best idea. You can't always count on your application to properly manage your database, and frankly managing the database shoul... |
Try [GForge][1], it's a SourceForge fork and has most of its features.
[1]: http://gforge.org/ |
Firstly, relative positioning does what you've described: it reserves space in the original location but displays the DIV offset by some amount.
If you float the DIVs then they will stack left-to-right, but this can cause problems.
A three-column layout using CSS is quite hard. Have a look at [http://www.glish.co... |
I think this is what you're looking for
sampler2D baseMap;
struct PS_INPUT
{
float2 Texcoord : TEXCOORD0;
};
float4 ps_main( PS_INPUT Input ) : COLOR0
{
float4 color = tex2D( baseMap, Input.Texcoord );
return float4(1.0f, 1.0f, 1.0f, co... |
"I'm trying to drive in a nail. Should I use the heel of my shoe or a glass bottle?"
Both Stored Procedures and ORMs are difficult and annoying to use for a developer (though not necessarily for a DBA or architect, respectively), because they incur a start-up cost and higher maintenance cost that doesn't guarantee a... |
"I'm trying to drive in a nail. Should I use the heel of my shoe or a glass bottle?"
Both Stored Procedures and ORMs are difficult and annoying to use for a developer (though not necessarily for a DBA or architect, respectively), because they incur a start-up cost and higher maintenance cost that doesn't guarantee a... |
I learned vi from the excellent O'Reilly book ["Learning the vi editor"][1].
[1]: http://www.amazon.com/Learning-Editor-6th-Arnold-Robbins/dp/1565924266/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1221587482&sr=8-1 |
When you use <%# MyProperty %> declaration you need to databind it, but when using <%= MyProperty %> you don't (which is similar to just writing Response.Write(MyProperty). |
A while ago I found a VB bas module that used DMO and VSS objects to get an entire db scripted off and into VSS. I turned it into a VB Script and posted it [here][1]. You could easily take out the VSS calls and use the DMO stuff to generate all the scripts, and then call SVN from the same batch file that calls the VBS... |
You mentioned two alternatives already: **Silverlight** and **Flash**. It's safe to assume that ~95% people have Flash Player installed; Silverlight has also seen quite good adoption in this short amount of time.
But jumping on the eye-candy bandwagon isn't necessarily going to make your site better. There will be ... |
First, your interface needs ComVisible(true) in order to be seen by the calling script (this is probably causing the error).
Second, add a .NETreference in your project to "Microsoft.mshtml". This will import the COM interfaces for various IE-related things (windows, HTML documents, etc.)
Then, you need to add... |
It seems you can load models inside models, although you probably should solve this another way. See [CodeIgniter forums][1] for a discussion.
class SomeModel extends Model
{
function doSomething($foo)
{
$CI =& get_instance();
$CI->load->model('SomeOtherModel','NiceName',true... |
Office 2007 allows for this. I have found [PDFCreator](http://sourceforge.net/projects/pdfcreator/) to be good, the VBA is included in sample files, and have heard that [CutePDF](http://www.cutepdf.com/) is also good. PDFCreator and CutePDF are free.
To work without Office, you would need viewers, as far as I know:
... |
The short answer for this is no!
You can not link in a dll during compilation.
I don't know if there is some subtle way to do this, but you would probably have to distribute the dlls along with your cms.
The best way to do this is to make some kind of re-distributable. |
<H2> [TallPDF.NET comes with hefty pricetag][1]</H2>
TallPDF.NET allows you to serve dynamic PDF from any .NET application including ASP.NET pages and web services.
<H2> [PDFEdit is FREE][2]</H2>
Free (and open source) editor for manipulating PDF documents. GUI version + commandline interface.
Scripting is use... |
I finally found the answer. You can call the LoginWindows PSI service an set the credentials to NetworkCredentials using the appropriate user, password and domain tokens. Then you can call any PSI method, as long as the credentials are explicit. Otherwise, using DefaultCredentials you'll get an Unauthorized Access erro... |
Craig Shoemaker has made an excellent show on asp.net caching:
http://polymorphicpodcast.com/shows/webperformance/ |
Personally, I *would* have the synthetic/surrogate key column in many-to-many tables for the following reasons:
- If you've used numeric synthetic keys in your entity tables then having the same on the relationship tables maintains consistency in design and naming convention.
- It may be the case in the future ... |
Im my experience I had to manage both situations: images stored in database and images on the file system with path stored in db.
The first solution, images in database, is somewhat "cleaner" as your data access layer will have to deal only with database objects; but this is good only when you have to deal with low ... |
I would like to extract the date a jpg file was created. Java has the lastModified method for the File object, but appears to provide no support for extracting the created date from the file. I believe the information is stored within the file as the date I see when I hover the mouse pointer over the file in Win XP i... |
As others have pointed out there is not a non-blocking pthread_join available in the standard pthread libraries.
However, given your stated problem (trying to guarantee that all of your threads have exited on program shutdown) such a function is not needed. You can simply do this:
int killed_threads = 0;
... |
I probably spend about 1% of my time in Reflector. It's a really nifty tool, but because we write so much of our code in house it hasn't been a great need to decompile any dlls. |
On Windows, I've always used <a href="http://search.cpan.org/~karasik/Win32-GuiTest-1.54/lib/Win32/GuiTest.pm">Win32::GuiTest</a>. |
Two questions I think that need to be answered before you come up with a "perfect" solution..
- The first, is whether TLogLogger is thread-safe. Can the same TLogLogger be called from multiple threads *without* calls to "syncronize"? Even if so, the following may still apply
- Are class variables thread-in-scop... |
Two questions I think that need to be answered before you come up with a "perfect" solution..
- The first, is whether TLogLogger is thread-safe. Can the same TLogLogger be called from multiple threads *without* calls to "syncronize"? Even if so, the following may still apply
- Are class variables thread-in-scop... |
I have heard this argument too - from people who forgot to put an index on their foreign keys and then complained that certain operations were slow (because constraint checking could take advantage of any index). So to sum up: There is no good reason not to use foreign keys. All modern databases support cascaded delete... |
PHP/mySQL - regular recalcuation of benchmark values as new users submit their data |
|php|mysql|stored-procedures|cron| |
I am confronted with a new kind of problem which I haven't encountered yet in my very young programming "career" and would like to know your opinion about how to tackle it best.
**The situation**
A research application (php/mysql) gathers stress related health data from users. User gets a an analyses after filling ... |
I am confronted with a new kind of problem which I haven't encountered yet in my very young programming "career" and would like to know your opinion about how to tackle it best.
**The situation**
A research application (php/mysql) gathers stress related health data from users. User gets a an analyses after filling ... |
Apply the style `margin: 0 0.5em` to both headers - adjust 0.5 to suit (maybe 0.25 or 0.75 is better; also the first 0 is top/bottom margin, adjust as relevant).
Note: Since you want a character space, you want `em` not `px` as suggested earlier.
<br/>
Complete example code...
<!DOCTYPE html>
<html... |
Wrapping accesses to the collection in a synchronized block is the correct way to do this. Standard programming practice dictates the use of some sort of locking mechanism (semaphore, mutex, etc) when dealing with state that is shared across multiple threads.
Depending on your use case however you can usually make s... |
If $arrayofStringsNotInterestedIn is an [array] you should use -notcontains:
Get-Content $FileName | foreach-object { `
if ($arrayofStringsNotInterestedIn -notcontains $_) { $) }
or better (IMO)
Get-Content $FileName | where { $arrayofStringsNotInterestedIn -notcontains $_}
|
My answer would be 'pick one and learn how to use it'. They're both decent shells; bash probably has more bells and whistles, but they both have the basic features you'll want. bash is more universally available these days. If you're using Linux all the time, just stick with it.
If you're programming, trying to stic... |
ConcurrentModificationException is best-effort because what you're asking is a hard problem. There's no good way to do this reliably without sacrificing performance besides proving that your access patterns do not concurrently modify the list.
Synchronization would likely prevent concurrent modifications, and it m... |
There is one: [mod_ruby][1], but it hasn't been maintained in about 2 years.
[1]: http://www.modruby.net/en/ |
Begning J2EE |
|jakarta-ee| |
I know something about Java but completely new to Enterprise Java. I'm trying my hand with NetBeans 6.1 and GlassFish Application Server.
Please guide me to some resources which tell me actually what java enterprise applications are, how they are different from normal java classes etc. Also which is best application ... |
|jakarta-ee| |
Beginning J2EE |
|jakarta-ee| |
Many, perhaps most, applications built for .NET 1.1 will run on later versions of the framework.
But there were some breaking changes, so the only way to be sure if your app build for .NET 1.1 will run on .NET 2.0 or later is to test it.
Microsoft documented the known breaking changes between .NET 1.1 and .NET 2.... |
Im my experience I had to manage both situations: images stored in database and images on the file system with path stored in db.
The first solution, images in database, is somewhat "cleaner" as your data access layer will have to deal only with database objects; but this is good only when you have to deal with low ... |
Yep, [aku][1] is right. In reality if you want certain types & methods to only be accessible to one application, you're better off compiling it all into one exe & marking those types all internal. You can then obfuscate the code to avoid the issue with reflection (see [here][2])
[1]: #39132
[2]: http://stac... |
You could try checking for the type of the data before casting and actually avoid throwing errors.
You could use functions like:<PRE>
ISNUM - to check if the data is of a numeric type
ISDATE - to check if it can be cast to DATETIME</PRE> |
You could try checking for the data type before casting and actually avoid throwing errors.
You could use functions like:<PRE>
ISNUM - to check if the data is of a numeric type
ISDATE - to check if it can be cast to DATETIME</PRE> |
Best thing to do would be to abstract over your renderer as much as possible, to make porting to the other technology as painless as possible. |
Not necessarily, although best practices for source control advise that you do not include generated files, for obvious reasons.
Is there another way for you to publish your generated files elsewhere for download, instead of relying on your version control to be your download server? |
I had a very similar problem in an editor I wrote recently. In the end, I used the TreeNode's BackColor property to determine the selection state of the node. I then wrote a handler for the SelectionChanged event that checked the state of the Shift/Control keys to determine if the selected node was being added to/remov... |
Well... after testing [DepFinder presented above][1], it turns out it is great for a quick detection of simple dependencies, but it does not scale well with the number of classes...
So the REAL ACTUAL ANSWER is:
**[CDA - Class Dependency Analyzer][2]**
It is fast, up-to-date, easy to use and provides with graphi... |
Well... after testing [DepFinder presented above][1], it turns out it is great for a quick detection of simple dependencies, but it does not scale well with the number of classes...
So the REAL ACTUAL ANSWER is:
**[CDA - Class Dependency Analyzer][2]**
It is fast, up-to-date, easy to use and provides with graphi... |
In general, I think from a best practices standpoint, you should not expose the structure of your business objects as data contracts, but rather define "data contract-specific" classes and convert Business to Contract. It may require extra work, but from a separation of concerns and protection from change standpoint t... |
How do I find the definition of a system-named constraint in Oracle? |
|oracle-database| |
All I know about the constraint is it's name (`SYS_C003415`), but I want to see it's definition. |
I typically don't expose my business/data entities across the wire since I like to adhere to the single responsibility principle (srp). To explain, the data entities were created to map to the underlying relational (db) model. So the only reason they should "change", is because of a change to the relational model, th... |
Google "Entity framework" and "vote of no confidence" and see what you get. |
[IOError][1] = target file cannot be found (or for some other reason cannot be read). Check your file's path.
Edit: I just realized this may not be your problem, you're just trying to catch the IO error? If so, you can do this:
<pre>var sound:Sound = new Sound();
sound.addeEventListener( IOErrorEvent.IO_ERROR, i... |
[IOError][1] = target file cannot be found (or for some other reason cannot be read). Check your file's path.
Edit: I just realized this may not be your problem, you're just trying to catch the IO error? If so, you can do this:
<pre>var sound:Sound = new Sound();
sound.addEventListener(IOErrorEvent.IO_ERROR, ioE... |
The argument I have heard is that the front-end should have these business rules. Foreign keys "add unnecessary overhead" when you shouldn't be allowing any insertions that break your constraints in the first place. Do I agree with this? No, but that is what I ahve always heard.
**EDIT:** My guess is he was referrin... |
The argument I have heard is that the front-end should have these business rules. Foreign keys "add unnecessary overhead" when you shouldn't be allowing any insertions that break your constraints in the first place. Do I agree with this? No, but that is what I have always heard.
**EDIT:** My guess is he was referrin... |
How much time do you spend in Reflector? (.NET) |
|.net|reflector|curiosity|voodoo| |
As a consultant I get to toy around with many different products and APIs as the customer demands we use X and Y. I think it is great fun and I learn a lot from it.
What will make a great developer over time is, in my opinion, the will to understand and learn new things. Therefore, I will always try to understand wh... |
A solution could be to use LINQ as in the following example:
int[] test = { 1, 2, 1, 3, 3, 4, 5 };
var res = (from t in test select t).Distinct<int>();
foreach (var i in res)
{
Console.WriteLine(i);
}
That would print the expected:
1
2
3
4
5
|
I like redmine for this: <http://www.redmine.org>. The only thing it's missing from your criteria is voting, but there might even be a plugin for this.
Trac is also popular (<http://trac.edgewall.org>) but it lacks suport for aggregation of data across projects. |
They don't convert directly, but it allows for interoperability between .NET and J2EE.
http://www.mainsoft.com/products/index.aspx |
http://msdn.microsoft.com/en-au/magazine/cc301356.aspx
This is a good article about Context Bound Objects. It contains some so advanced stuff, but if you are not lazy and really want to understand this kind of things it will be really helpful.
At the end you will be able to write something like:
[CallTracingAttr... |
I think you did the right thing. In my experience, XSLT developers are among the very hardest to hire, because it's a language that never caught on either with Web developers nor with casual programmers.
So you end up having to pay the "advanced programmer who knows a language outside the mainstream" premium, but fo... |