instruction stringlengths 0 30k ⌀ |
|---|
I am doing precisely the same thing and have various issues semi regularly even with this process.
How do you handle the spacing between copying the file from Server A to Server B and restoring the transactional backup on Server B.
Every once in a while the transaction backup is larger than normal and takes a lon... |
If you're going to be adding/removing elements a lot, just use a List. If it's multidimensional, you can always ust a List<List<int>> or something.
On the other hand, lists are less efficient than arrays if what you're mostly doing is *traversing* the list, because arrays are all in one place in your CPU cach... |
If you're going to be adding/removing elements a lot, just use a List. If it's multidimensional, you can always use a List<List<int>> or something.
On the other hand, lists are less efficient than arrays if what you're mostly doing is *traversing* the list, because arrays are all in one place in your CPU cach... |
[Pydev][1] has worked well for me.
[1]: http://pydev.sourceforge.net/ |
If data in both of your CSV files is already sorted and have the same number of records, you could skip the data structure entirely and do in-place analysis.
StreamReader one = new StreamReader("C:\file1.csv");
StreamReader two = new StreamReader("C:\file2.csv");
String lineOne;
String lineTwo;
... |
To prepare or handle a spike (or peak) performance, I would first determine whether you are ready through some simple performance testing with something like [jmeter][1].
It is easy to setup and get started and will give you early metrics whether you will handle an expected peak load.
However given your time cons... |
The problem resides in the loaded swf, it simply does not clean up the audio after itself.<r/>
Try attaching an unload event onto movieclips like this:
MovieClip(event.target.content).loaderInfo.addEventListener(Event.UNLOAD, unloadMovieClipHandler);
private function unloadMovieClipHandler(event:Event) : v... |
There is no standard mapping that I know of. What I've done in the past is translate the ones I know about, and a catch block for System.Runtime.InteropServices.SEHException. All non-translated exceptions will be turned into that exception. As long as you have a debug build of the code that is throwing the exception... |
vmware have [a really good PDF doc][1] on this problem.
Basically, the host will slew the ticks delivered to your guests as it can.
**Don't** run NTP or timed or junk like that. Just install vmware-guestd and let the host slew your ticks. If you still lose ticks, then any other solution will have major drift too.
... |
At the risk of being obvious, I'd say try to avoid branching altogether. The amount of overhead this causes must not be underestimated. Even when you think you can't hold off any longer (release one of system in production, release two being built but also change requests to release one) still try to find another way: ... |
display: block means that the element is displayed as a block, as paragraphs and headers have always been. A block has some whitespace above and below it and tolerates no HTML elements next to it, except when ordered otherwise (by adding a float declaration to another element, for instance). display: inline means that ... |
Css can improve performance, because they are cached from browser, and pages are smaller! |
Production Logging in Flex |
|apache-flex|logging| |
Is there any way to capture the trace statements of your Flex app while not running in debug mode?
Or is there any other way to output logging information when not running a debugger?
Currently I'm trying to fix a bug that only presents itself in very specific deployment scenario, but I could see this being usefu... |
Block uses the full width available, with a new line before and after. Inline uses only the width it needs without forcing new lines. |
yes,
display:block makes the element behave like a block eg: `<p>`
display:inline make and element layout inline.
these can be applied to elements that default to the opposite display type.
Possible Values
* none - no display at all.
* inline - An inline box.
* block - A block box.
*... |
Note that in the above C++ solutions, there was some problems.
One solution was inefficient because it passed an std::string by copy, and because it iterated over all the chars, instead of comparing only half the chars. Then, even when discovering the string was not a palindrome, it continued the loop, waiting its e... |
if you can write a batch file that does not need to be interactive, try running that batch file as a service, to do what needs to be done. |
I've worked on a high-volume system using MySQL and I've tried both MyISAM and InnoDB. I found that the table-level locking in MyISAM caused serious performance problems for our workload which sounds similar to yours. Unfortunately I also found that performance under InnoDB was also worse than I'd hoped. In the end I r... |
That's because fwrite() expects a string as its second argument. Try doing this instead:
fwrite($fpr, chr(0x63));
chr(0x63) returns a string with one character with ASCII value 0x63. (So it'll write the number 0x63 to the file.) |
From Ben Rady at Object Mentor ([Continuous Testing Explained][1]):
- [CT-Eclipse][2] (was Continuous Testing Plugin for Eclipse) – Java/Eclipse
- [Fireworks][4] – Java/IntelliJ
- [Infinitest][5] – Java
[1]: http://blog.objectmentor.com/articles/2007/09/20/continuous-testing-explained
[2]: http... |
There is a list in this Ben Rady article at Object Mentor: [Continuous Testing Explained][1]. Unfortunately the only Eclipse tool appears to be [CT-Eclipse][2] which is not currently maintained either.
There is also [Fireworks][4] for IntelliJ and [Infinitest][5] which is not IDE specific but also has some IntelliJ... |
I've done it both ways you are talking about, My preferred approach now is the persistent ignorant (or PONO -- Plain Ole' .Net Object) method where your domain classes are only worried about being domain classes. They do not know anything about how they are persisted or even if they are persisted. Of course you have... |
One-to-one mapping seems the sanest approach to me. "Universal" mapping is hardly possible because of application-specific exceptions, although there is some obvious mapping for STL exception classes.
Also there is an issue of SEH exceptions from unmanaged code. Depending on your situation it might be necessary to c... |
That shouldn't be too hard to write yourself as long as you only need the headers. Try that:
import sys
def log_headers(app, stream=None):
if stream is None:
stream = sys.stdout
def proxy(environ, start_response):
for key, value in environ.iteritems():
... |
My other option is to write more custom code around the application settings and execute it on formLoad and formClosing. This doesn't use data binding.
Drawbacks:
* More code to write.
* Very fiddly. The order you set the properties on formLoad is confusing. For example, you have to make sure you've set the wind... |
My other option is to write more custom code around the application settings and execute it on formLoad and formClosed. This doesn't use data binding.
Drawbacks:
* More code to write.
* Very fiddly. The order you set the properties on formLoad is confusing. For example, you have to make sure you've set the windo... |
Can you host multiple tenants on a single ASP.NET application instance over SSL? |
|asp.net|iis|ssl|hosting| |
I have an ASP.NET application that will host multiple tenants (Software-as-a-Service style). Each tenant will have their own domain name (www.mydomain.com, www.yourdomain.com) and their own SSL certificate.
**Is there a way to host the application such that all of the tenants are on the same application *instance*?*... |
* http://p2p.wrox.com/topicindex/20339.htm
* http://note19.com/2007/05/27/javascript-guid-generator/ |
There have been a couple attempts at this. The question is: do you want actual GUIDs, or just random numbers that *look* like GUIDs? It's easy enough to generate random numbers. From <http://note19.com/2007/05/27/javascript-guid-generator/>:
function S4() {
return (((1+Math.random())*0x10000)|0).toString... |
You still need to use locks (your code could be interrupted at any time to execute another thread and this can cause data inconsistencies). The problem with GIL is that it prevents Python code from using more cores at the same time (or multiple processors if they are available). |
If the private method is well defined (ie, it has a function that is testable and is not meant to change over time) then yes. I test everything that's testable where it makes sense.
For instance, an encryption library might hide the fact that it performs block encryption with a private method that encrypts only 8 b... |
If the private method is well defined (ie, it has a function that is testable and is not meant to change over time) then yes. I test everything that's testable where it makes sense.
For instance, an encryption library might hide the fact that it performs block encryption with a private method that encrypts only 8 b... |
I must say I also thought that it's the usual issue solved by setReuseAddress(true). However, the error message in that case is usually something along the lines that the JVM can't bind to the port. I've never seen the posted error message before. Googling for it seems to suggest that another process is listening on on... |
Logs are usually one line per entry so that you can grep for what you want. The idea is to have everything in the file, but to use grep in order to read the parts you care about. Grep for everything but load balancer stuff when you read them. |
|windows|installation|permissions|nsis| |
I'm trying to build a Windows installer using Nullsoft Install System that requires installation by an Administrator. The installer makes a "logs" directory. Since regular users can run this application, that directory needs to be writable by regular users. How do I specify that all users should have permission to ha... |
Mod-rewrites on apache: change all URLs |
|mod-rewrite|apache| |
Right now I'm doing something like this:
RewriteRule ^/?logout(/)?$ logout.php
RewriteRule ^/?config(/)?$ config.php
I would much rather have one rules that would do the same thing for each url, so I don't have to keep adding them every time I add a new file.
Also, I like to match things like '/config... |
|mod-rewrite|apache|regex|regular-expression| |
|regex|apache|mod-rewrite|regular-expressions| |
|regex|apache|mod-rewrite| |
There isn't an equivalent syntax in C#. |
Regular expressions in C# for file name validation |
|d| |
Hey does anyone have a good regular expression they'd like to share that can validate a text string to make sure it is a valid Windows filename (aka not have \/:*?"<>| characters).
I'd like to use it like the following:
// Return true if string is invalid
if (Regex.IsMatch(szFileName, "<your regex string... |
|c#|regular-expressions| |
|c#|regex| |
You're defining the class twice, which I'm pretty sure doesn't work.
Try something like this:
First a header CppClass.h file:
// CppClass.h
using namespace std;
class CppClass
{
public:
static void Start();
static void Stop();
static void Join();
privat... |
Can you use Silverlight with AJAX without any UI element? |
|javascript|ajax|silverlight| |
I know you can just use CSS to hide the DIV or Silverlight Plugin, but is there a way to instantiate a Silverlight Component/App using JavaScript that doesn't show any UI element at all?
There is alot of great functionality in Silverlight, like MultiThreading and compiled code, that could be utilized by traditional ... |
Only if the "business" error messages are database error messages in the sense that the database constraints which have been put in place to satisfy basic low-level business requirements at the database level are being violated.
It should not be used for high-level business logic, which should be avoided in the data... |
Refactoring on a large scale needs to be done at the right time in the development timeline. If you do huge amounts of refactoring near release you'll end up hurting yourself because you'll introduce painful merges at a time when changes should be minimized. The more disruptive your refactoring will be the earlier in t... |
Refactoring on a large scale needs to be done at the right time in the development timeline. If you do huge amounts of refactoring near release you'll end up hurting yourself because you'll introduce painful merges at a time when changes should be minimized. The more disruptive your refactoring will be the earlier in t... |
I use the comments
"If you cannot explain your physics to a barmaid, it is not very good physics" and "You do not really understand something unless you can explain it to your grandmother" (Attributed to Rutherford and Einstein)
as mantras when I am talking requirements with customers.
Take the two pronged app... |
You might want to take a look at the Dan Kegel's "[The C10K problem][1]" web page about handling multiple data sources/sinks.
Basically it is best to use minimal threads, which in sockets can be done in most OS's w/ some event system (or asynchronously in Windows using IOCP).
When you run into the case where the ... |
if it happens often enough that you're able to see it in your browser, try intalling the Live http headers Firefox extension or the Tamper Data extension, and watch the response headers as they are seen by the browser. |
If the awk scripts won't go into the main bin directory (prefix/bin), then you need to place them in an appropriate sub-directory - probably of lib but possibly libexec or share (since the awk scripts are probably platform neutral).
Correct: software won't necessarily end up in /usr/local/bin; on my machine, /usr/lo... |
The best description of red-black trees I have seen is the one in Cormen, Leisersen and Rivest's 'Introduction to Algorithms'. I could even understand it enough to partially implement one (insertion only). There are also quite a few applets such as [This One][1] on various web pages that animate the process and allow... |
A number of the collection classes in .Net have built in support for synchronizing and making access from multiple threads safe. For example (in C++/CLR):
<pre><code>
Collections::Queue ^unsafe_queue = gcnew Collections::Queue();
Collections::Queue ^safe_queue = Collections::Queue::Synchronized(unsafe_queue);
</... |
If you want to change the size according to resolution you can do something like this (adjusting the preferred width and resolutions according to your specific needs):
(defun set-frame-size-according-to-resolution ()
(interactive)
(if window-system
(progn
;; use 120 char wide window for l... |
Putting rules into the HTML page gives them greater "specificity," and therefore priority, over external rules. **If several CSS rules conflict, ID wins over class, and inline styles win over ID.**
<pre>
<head>
<style type="text/css">
span.reminder {color: blue;}
span#themostimportant {colo... |
Visual Studio 2008, at least for me, displays the contents of STL containers in the standard mouseover contents box. |
You have to use the ***fmt*** taglib.
First, add the taglib for sitemesh and fmt on the fisrt line of the decorator.
<%@ taglib prefix="decorator" uri="http://www.opensymphony.com/sitemesh/decorator"%>
<%@ taglib prefix="page" uri="http://www.opensymphony.com/sitemesh/page"%>
<%@ taglib prefix="c" u... |
I have used it when I've been sent .dmp files from an NT4.0 server - MSVC won't load these old format files. |
If you want all documents, do a query on *:*
If you want all documents with a certain field (e.g. id) try id:[* TO *]
|
If you want all documents, do a query on *:*
If you want all documents with a certain field (e.g. id) try id:[* TO *]
|
Remove is not a generic method so that existing code using a non-generic collection will still compile and still have the same behavior.
See http://www.ibm.com/developerworks/java/library/j-jtp01255.html for details. |
Remove is not a generic method so that existing code using a non-generic collection will still compile and still have the same behavior.
See http://www.ibm.com/developerworks/java/library/j-jtp01255.html for details.
Edit: A commenter asks why the add method is generic. The new collections specify the type of ... |
Remove is not a generic method so that existing code using a non-generic collection will still compile and still have the same behavior.
See http://www.ibm.com/developerworks/java/library/j-jtp01255.html for details.
Edit: A commenter asks why the add method is generic. [...removed my explanation...] Second c... |
Yes. I think this is particularly intriguing when mixed with [other dynamic languages][1] -- but then, I'm probably biased. :)
**Edit:** But you'd need to use the managed Javascript that's part of the Silverlight Dynamic Languages SDK and not the normal Javascript that's part of the browser.
[1]: http://www.co... |
How to refactor in a branch without losing your mind? |
|refactoring|branch| |
I refactor my and other people's code **all the lot**.
When I work in a branch and not in Trunk, this sometimes results in some extremely painful merges, especially if I don't merge back to Trunk regularly (the code at the branch slowly shifts away from the Trunc, and when people modify Trunk I have to figure out manu... |
I refactor my and other people's code **all the time**.
When I work in a branch and not in Trunk, this sometimes results in some extremely painful merges, especially if I don't merge back to Trunk regularly (the code at the branch slowly shifts away from the Trunc, and when people modify Trunk I have to figure out man... |
How to refactor in a branch without losing my mind? |
I'd love to say that I've cleverly parallelized an algorithm using lock-free data structures in order to get n-fold performance increase on an n-core processor. But I've never had a practical need, especially since most of my professional code has been for single-core systems.
Almost every time I've used more than o... |
I'd love to say that I've cleverly parallelized an algorithm using lock-free data structures in order to get n-fold performance increase on an n-core processor. But I've never had a practical need, especially since most of my professional code has been for single-core systems.
Almost every time I've used more than o... |
See http://msdn.microsoft.com/en-us/library/system.security.cryptography.x509certificates.x509store.aspx
using System.Security.Cryptography.X509Certificates;
...
var store = new X509Store(StoreName.My);
foreach(var cert in store.Certificates)
...
|
I don't know any other resources, but I found the examples in the comments on <a href="http://us.php.net/manual/en/ref.xmlwriter.php">this page</a> quite helpful. |
Since nobody has mentioned this yet, I'd recommend looking at [Git][1] as well. There's even a free source hosting service: [github][2].
[1]: http://git.or.cz/
[2]: http://github.com/ |
I never do this, and I always recommend against it. I don't care about diffs being harder to read. I do care that it takes time to do this in the first place, and it takes additional time whenever the lines have to be realigned. Editing code that has this format style is infuriating, because it often turns into a hu... |
Using a javax.script package on javascript with an external src attribute |
|javascript|javax.script| |
Say I have some javascript that looks like...
<script type="text/javascript" src="http://someplace.net/stuff.ashx"></script>
<script type="text/javascript">
var stuff = null;
stuff = new TheStuff('myStuff');
</script>
... and I want to use the javax.script package in java 1... |
|javascript|javax.script|java| |
Say I have some javascript that looks like...
<script type="text/javascript" src="http://someplace.net/stuff.ashx"></script>
<script type="text/javascript">
var stuff = null;
stuff = new TheStuff('myStuff');
</script>
... and I want to use the javax.script package in java 1... |
Without knowing specifics, I'd lean towards delegates and events to notify of changes.
http://msdn.microsoft.com/en-us/library/17sde2xt(VS.71).aspx
And implementing the Observer or Publish Subscribe pattern
http://en.wikipedia.org/wiki/Observer_pattern
http://msdn.microsoft.com/en-us/library/ms978603.aspx
... |
As you noted, that functionality is supported in plugins, and won't be supported by Rails core. |
Caleb P and JeeBee probably have your fastest solution. Plus you don't have to setup different services or point to files on different machines. You can specify your environment either by using a ${user.name} variable or by specifying the profile in a -D argument for Ant or Maven.
Additionally in this setup, you c... |
[Python][1].
I have used MyGeneration which uses C# to write your code templates. However, I started using Python and I found that I can write code that generates other code **faster** in that language than I would if written in C#. Subsequently, I have used Python to code gen C#, TSQL, and VB.
Generally, code ... |
The way I would do this manually is:
- Use Data - AutoFilter
- Apply a custom filter based on a date range
- Copy the filtered data to the relevant month sheet
- Repeat for every month
Listed below is code to do this process via VBA.
It has the advantage of handling monthly sections of data rathe... |
The first one is certainly clearer, and clarity should certainly be an aim of your code. However, in terms of the first one, I'll direct you [here][1]: Jeff Atwood's take on calling things "SomethingManager" - not recommended.
[1]: http://www.codinghorror.com/blog/archives/000553.html |
Is there an equivalent to the XNA framework for consoles other than XBox360? |
|video-game-consoles|xbox|wii|ps3| |