instruction stringlengths 0 30k ⌀ |
|---|
When writing, know your audience.
If you're logging warning/error messages for your own consumption, then it's fairly easy: what do *you* need to know when something goes wrong?
If you're logging warning/error messages for someone else, then things get tricky. What do they know? What does their mental model of t... |
Note that exponentiation by squaring is not the most optimal method. It is probably the best you can do as a general method that works for all exponent values, but for a specific exponent value there are might be a better method.
For instance, if you want to x^15, the method of exponentiation will give you:
... |
This is a job for ... **[Wikipedia][1]**!
* [Types of Virtualization][2]
* [Platform Virtualization][3]
* [Comparison of Virtual Machines][4]
Now that the obvious stuff is out of the way...
Linux runs fine as a guest on every VM host I've used, so I'm going to assume that you're referring to Linux as the hos... |
This is a job for ... **[Wikipedia][1]**!
* [Types of Virtualization][2]
* [Platform Virtualization][3]
* [Comparison of Virtual Machines][4]
Now that the obvious stuff is out of the way...
Linux runs fine as a guest on every VM host I've used, so I'm going to assume that you're referring to Linux as the hos... |
for example, right now I have a roll-my-own solution that uses data files that include blocks like:
PlayerCharacter Fighter
Hitpoints 25
Strength 10
StartPosition (0, 0, 0)
Art
Model BigBuffGuy
Footprint LargeFootprint
end
InventoryItem Sword
Inv... |
The `<cfdocument>` approach is the sanctioned way to get it done, however it does not offer everything possible in the way of manipulating existing PDF documents. I had a project where I needed to generate coupons based using a pre-designed, print-resolution PDF template. `<cfdocument>` would have let me approximate ... |
You could just want to install ntpd, it works well enough on real servers, should also do the trick on virtual ones. Another possibility is to check if Parallels has a configuration option like "Sync guest clock to host clock". |
What about using <a href="http://en.wikipedia.org/wiki/Network_Time_Protocol">an NTP service</a> to keep it sync'd? |
The vast majority of the devs I've spoken to about ECMAScript et. al. end up admitting that the problem isn't the scripting language, it's the ridiculous HTML DOM that it exposes. Conflating the DOM and the scripting language is a common source of pain and frustration regarding ECMAScript. Also, don't forget, IIS can u... |
No you are way off. Typically there is nothing an application can do that can cause the OS to crash. OS crashes are generally caused by buggy device drivers and hardware failures. |
Another possibility is to integrate a scripting runtime into your program, so that your users can write the business logic in a DSL. [IronPython][1] would be a candidate.
[1]: http://www.codeplex.com/IronPython |
First, it is important to conceptually understand what is required. Once that is understood we can take it from there.
On the server, it should look something similar to:
{
HANDLE hEvent;
hEvent = CreateEvent(null, true, false, TEXT("MyEvent"));
while (1)
{
WaitForS... |
I don't understand what do you mean saying "best way". It would be better to provide simple example of what you want to achieve. Composing dynamic LINQ expression is not hard but tricky.
Here is an example of dynamic linq expression creation:
[How do I compose existing Linq Expressions][1]
[1]: http://sta... |
If it can be viewed, it can be copied.
And if one person can copy it, he can send it to a million other people.
So its meaningless to make it hard to copy, because there's always people *able* to copy it, who will then proceed to send it to everyone who can't.
The only thing DRM does is make it harder for cons... |
Have a look at GNU [gperf][1].
[1]: http://www.gnu.org/software/gperf/ |
Generate docs in automated build |
|build-process|build-automation|documentation| |
Is there any way to generate project docs during automated builds?
I'd like to have a single set of source files (HTML?) with the user manual, and from them generate:
* PDF document
* CHM help
* HTML version of the help
The content would be basically the same in all three formats.
Currently I'm using ms... |
not sure what you mean. If you're using a divert rule, then all you have to do is listen on that ip:port combination in your java app and you're all set. If you want to read the actual destination endpoint information, you'll need to use JNI for that. |
You can use [`chntpw`][1] tool to edit Windows registry offline. Here's an example of [how to use it][2].
The keys you're looking for are these:
HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\ComputerName\ComputerName
HKEY_LOCAL_MACHINE\SYSTEM\Current Control Set\
Services\Tcpip\Parameters\In... |
Tomcat6's implementation of HttpServlerResponse is the Response class. Internally it uses a CoyoteOutputStream wrapped around an OutputBuffer. As the name suggests, this class is a buffer, default size 8k. So I would say at the very least if you are writing less than 8k then you arent going to block. You may need to fl... |
I am a non-english speaker from germany.
In my opinion it does make no sense to translate programming related words from english into another language. At university (although it is located in germany) nearly all lectures were held in english, all good programming books are written in english, most important web sit... |
I think the practice of keeping code to 80 (or 79) columns was originally created to support people editing code on 80-column dumb terminals or on 80-column printouts. Those requirement have mostly gone away now, but there are still valid reasons to keep the 80 column rule:
- To avoid wrapping when copying code in... |
In case you have changes to the files, and cannot delete them, you can use the Subversion 1.5 feature that allows you to 'checkout with obstructions'.
Just delete the .svn directory in this directory, and the directories below, and:
In case the broken directory was the top directory of the working copy:
sv... |
I guess if you don't mind messing with checking columns and such you could return something different based on what happened.
If everything is fine, return the data as normal.
If something isn't fine, return a result with a column named Error that describes what was bad. Check the column names for this column befor... |
Ask for forgiveness, instead of permission.
Get it working in private (which it looks like you have) and then demonstrate its advantages.
One thing that always gets people is using CruiseControl's Tray utility - people love it when they can see, through their system tray, that the build succeeded. (this is assumi... |
Ask for forgiveness, instead of permission.
Get it working in private (which it looks like you have) and then demonstrate its advantages.
One thing that always gets people is using CruiseControl's Tray utility - people love it when they can see, through their system tray, that the build succeeded. (this is assumi... |
Alternatively, you can switch to JRockit which handling permgen differently then sun's jvm. It generally has better performance as well.
http://www.bea.com/jrockit/ |
Nope. No macros for F#. |
I think the question has a flaw. I wouldn't even assume toString() will print a useful piece of data. So, if you begin with that assumption, you know you have to check it prior to calling it and can assess it's 'cost' on a case by case basis. |
I've done this, but it was usually to pass along business "error" messages, essentially a data configuration had to be in place that couldn't be enforced with standard FK constraints for whatever reason.
If they are actually "errors", I don't have much of a problem with it. If it's inserting a record and using RAIS... |
Normally I don't limit the FPS of the game, instead I change all my logic to take the time elapsed from last frame as input.
As far as fixed-rate goes, unless you need a high rate for any reason, you should use something like 25/30. The human eye can't really notice animations at a faster rate, and you will be makin... |
Normally I don't limit the FPS of the game, instead I change all my logic to take the time elapsed from last frame as input.
As far as fixed-rate goes, unless you need a high rate for any reason, you should use something like 25/30. That should be enough rate, and will be making your game a little lighter on CPU usa... |
For these situations I employ techniques on the SQL Server side that not only leverage the database for the sorting, but also use custom paging to ONLY return the specific records needed.
It is a bit of a pain to implemement at first, but the performance is amazing afterwards! |
If you're serving your CSS from static files (or anything that the query string doesn't matter for), try varying that to ensure that the browser makes a fresh request, as it will think that it's pulling a completley different resource, so have for example:
"styles.css?token=1234" in the CSS reference in your markup ... |
**Right answer**: memcached . Fast, clean, supports multiple processes, integrates **very** cleanly with Rails these days. Not even that bad to set up, but it is one more thing to keep running.
**90% Answer**: There are probably multiple Rails processes running around -- one for each Mongrel you have, for example.... |
I solved it by sending the headers
header('Pragma: public');
header('Cache-Control: max-age=0');
I didn't knew that session_start() send headers by it's own.
I found the answer in the comments section of: <a href="http://www.alagad.com/go/blog-entry/error-internet-explorer-cannot-download-filename-f... |
You would probably want to split that large table eventually. You'll probably want to put it on a separate hard disk, before thinking of a second server. Doing it with MySQL is the most convenient option. If it is capable, then go for it.
BUT
Everything depends on how your database is being used, really. Sta... |
In case you have changes to the files, and cannot delete them, you can use the Subversion 1.5 feature that allows you to 'checkout with obstructions'.
Just delete the .svn directory in this directory and:
<del>and the directories below,</del> (you don't need to delete inside directories when using --depth files, ... |
In case you have changes to the files, and cannot delete them, you can use the Subversion 1.5 feature that allows you to 'checkout with obstructions'.
Just delete the .svn directory in this directory and:
(you don't need to delete inside directories when using --depth files, thanks Eric)
In case the broken dir... |
Something that I found relatively hard to find out was how to do the reverse of what you are doing, whereby you need to find out the value of part of the query string.
So for example:
If you wanted to rewrite the Url:
http://www.example.com/signup-**old**-script.**asp**?**aff**=12345
to:
http://www.example.... |
Which Continous Integration library to use? |
|continous-integration|java|agile| |
I've worked with **Cruise Control** as the CI framework in my last project.
Any recommendations on some other tools?
(Not that i found CruiseControl lacking, just wanted to know if someone did some comparisons)
|
Which Continuous Integration library to use? |
|continuous-integration|java|agile| |
|java|agile|continuous-integration|comparison|cruisecontrol| |
The usual method to exit a Python program:
sys.exit()
(to which you can also pass an exit status) or
raise SystemExit
will work fine in a Tkinter program. |
In your application.rc file there is a version block. This block controls the version info displayed in the filesystem.
> VS_VERSION_INFO VERSIONINFO
> FILEVERSION 1,0,0,1
> PRODUCTVERSION 1,0,0,1
You can programmatically update this file. Make sure to open and save the file as binary. We ha... |
There is a helpful [Railscast on Rails 2.1 caching][1]. It is very useful if you plan on using memcached with Rails.
[1]: http://railscasts.com/episodes/115-caching-in-rails-2-1 |
This will be available in Flash Player 10:
Reading and Writing Local Files in Flash Player 10
<http://www.mikechambers.com/blog/2008/08/20/reading-and-writing-local-files-in-flash-player-10/>
Otherwise you need to use Adobe AIR, or bounce it off the server.
mike chambers
mesh@adobe.com |
Where can I find good tutorials on FO (Formating/ed Objects), the stuff one feeds to fop and get PDF's ? |
|apache-fop|fo|xml|pdf|tutorials| |
On a company that I've worked, me and my colleagues, implemented a tailored document distribution system on top of FO.
My task was to get the script to deliver the documents and configure the CUPS print server and the Fax server, so I never had the time to get my hands dirty on FO.
I'm thinking of implementing so... |
Where can I find good tutorials on XSL-FO (Formating/ed Objects), the stuff one feeds to fop and get PDF's ? |
|xml|pdf|tutorials|xsl-fo|apache-fop| |
On a company that I've worked, me and my colleagues, implemented a tailored document distribution system on top of XSL-FO.
My task was to get the script to deliver the documents and configure the CUPS print server and the Fax server, so I never had the time to get my hands dirty on XSL-FO.
I'm thinking of impleme... |
What about [SCTP][1]. It's a standard protocol by the IETF (RFC 2960)
Chunking should help for speed.
[1]: http://en.wikipedia.org/wiki/Stream_Control_Transmission_Protocol |
What about [SCTP][1]. It's a standard protocol by the IETF (RFC 4960)
It has chunking capability which could help for speed.
A [comparison between TCP and SCTP][2] shows that the performances are comparable unless two interfaces can be used.
[1]: http://en.wikipedia.org/wiki/Stream_Control_Transmission_Pr... |
What about [SCTP][1]. It's a standard protocol by the IETF (RFC 4960)
It has chunking capability which could help for speed.
Update: a [comparison between TCP and SCTP][2] shows that the performances are comparable unless two interfaces can be used.
[1]: http://en.wikipedia.org/wiki/Stream_Control_Transmi... |
There isn't much documentation currently available, however the basic system is that GCC translates try/catch blocks to [function calls][1] and then [links in a library with the needed runtime support][2] ([documentation about the tree building code][3] includes the statement "throwing an exception is not directly repr... |
When I do Selenium testing, I wait to see if a certain element is visible (waitForVisible), then I do my action. I usually try to use an element after the one I'm typing in. |
If you are using the Ubuntu default with NetworkManager, try removing the CiscoVPN client and use the NetworkManager vpnc plugin to connect to the Cisco VPN. This should avoid all problems, since NetworkManager then knows about your VPN connection. |
Set up an autobuilder. Once you have it building and running the tests automatically, it won't matter if you convince other people to save their own time :)
If you're using git for version control, here's an autobuilder that automatically finds the exact checkin that started causing the tests to fail: http://github... |
I'm guessing you're running on Slackware so the cpan command is what you want to be using to install any Perl modules. It will pull in all dependencies for you. If you're running it for the first time it will have to do some cofiguration, but newer versions of cpan will ask if you want it to automatically configure it.... |
Enabling the 'multiWindow' feature solved the issue, though I am not clear why.
SeleniumServer(int port, boolean slowResources, boolean multiWindow)
SeleniumServer server = new SeleniumServer(4444, false, true);
Any clarification would be helpful. |
[Disclaimer: I am still trying to fully grok monads. The following is just what I have understood so far. If it’s wrong, hopefully someone knowledgeable will call me on the carpet.]
Arnar [wrote](#71697):
> Monads are simply a way to wrapping things and provide methods to do operations on the wrapped stuff withou... |
I recommend `babel` and `pytz` when working with timezones. Keep your internal datetime objects naive and in UTC and convert to your timezone for formatting only. The reason why you probably want naive objects (objects without timezone information) is that many libraries and database adapters have no idea about timez... |
Just had to put this here
<img src="http://www.implementingscrum.com/images/070806-scrumtoon.jpg">
From [here][1]
[1]: http://www.implementingscrum.com/section/blog/cartoons/ |
They discuss it a little better here: http://www.nabble.com/Multiple-Repositories-in-a-Windows-Server-td15014106.html
Basically you can do:
svnserve -r /path/to/repository
svn://hostname/
or
svnserve -r /path/to/directory/containing/many/repositories
svn://hostname/repositor... |
Generally, services should be designed to not have any visible UI. The entire point of a service is to run in the background, without UI, unattended. (Think SQL Server, IIS, etc.)
In most scenarios, a separate application controls the service's operation, should a GUI be needed. (Continuing the samples I just mentio... |
Its not a great solution, but I've gotten around this before at the page level by adding a querystring to the end of the call to the CSS file:
<link href="/css/global.css?id=3939" type="text/css" rel="stylesheet" />
Then I'd randomize the id value so that it always loads a different value on page load. Then... |
Delegates as parameters in VB.NET |
|vb.net|lambda|delegates|log4net| |
Backstory: I'm using [log4net](http://logging.apache.org/log4net/index.html) to handle all logging for a project I'm working on. One particular method can be called under several different circumstances -- some that warrant the log messages to be errors and others that warrant the log messages to be warnings.
So, a... |
Beware Windows 2000 is not supported on any frameworks above 2.0. So you're application would then only support the following operating systems:
- Microsoft Windows XP
- Microsoft Windows Server 2003
- Windows Vista
- Windows Server 2008
Good Luck! |
This question is tagged both for C and C++, so it has at least two answers, IMHO:
#C
Ahem... Do whatever you want.
I believe the reason given above "If you don't include "stdlib" then you won't get a warning" is not a valid one because one should not rely on this kind of hacks to not forget to include an heade... |
This question is tagged both for C and C++, so it has at least two answers, IMHO:
#C
Ahem... Do whatever you want.
I believe the reason given above "If you don't include "stdlib" then you won't get a warning" is not a valid one because one should not rely on this kind of hacks to not forget to include an heade... |
[CRC-32][1]. There is about a trillion links on google for it.
[1]: http://en.wikipedia.org/wiki/Cyclic_redundancy_check |
Two different sources trying to access a locked area is one problem. Getting all mutexes, monitors and locks to work 100% is not trivial. |
In my opinion
1. Bad drivers
2. Kernel bugs
3. Hardware failure
4. End of resources
A modern operating system will not let a mere application crash it. |
Modal popups - usability |
|usability|modalpopups| |
What are the cases where you'd use a modal popup ?
Does it interrupt the user's flow, if it all of a sudden opens up in his face ?
Would you avoid modal popups in general ? or when should one be careful of using them ? |
What are the cases where you'd use a modal popup ?
Does it interrupt the user's flow, if it all of a sudden opens up in his face ?
Would you avoid modal popups in general ? or when should one be careful of using them ?
**Edit:**
To be a bit more specific, the situation here is this :
I have a menu on the r... |
What are the cases where you'd use a modal popup ?
Does it interrupt the user's flow, if it all of a sudden opens up in his face ?
Would you avoid modal popups in general ? or when should one be careful of using them ?
**Edit:**
To be a bit more specific, the situation here is this :
I have a menu on the r... |
Yes, there is.
From memory:
public static T create<T>(T t)
{
return Activator.CreateInstance<T>();
}
object anon = create(existingAnonymousType); |
One of the [FNV variants][1] should meet your requirements. They're fast, and produce fairly evenly distributed outputs.
[1]: http://isthe.com/chongo/tech/comp/fnv/ |
As mentioned, SQLite is a great single-user database. <a href="http://www.tannertech.net/sqlite3vb/">This page has VB/SQLite examples</a>. Once concerns is that SQLite parses foreign key constraints, but does not enforce them. You can use <a href="http://www.rcs-comp.com/site/index.php/view/Utilities-SQLite_foreign_... |
First: Most of the time you most likely do not care, the difference will be very small. Make sure optimizing this call really makes sense first. Only if your measurements show there is really significant time spent in the call overhead, proceed to optimizing it (shameless plug - Cf. [How to optimize an application to ... |
[Disclaimer: I am still trying to fully grok monads. The following is just what I have understood so far. If it’s wrong, hopefully someone knowledgeable will call me on the carpet.]
Arnar [wrote](#71697):
> Monads are simply a way to wrapping things and provide methods to do operations on the wrapped stuff withou... |
Using the System.IO namespace, you can do something like this
public File[] GetUserFiles(int userId)
{
List<File> files = new List<File>();
DirectoryInfo di = new DirectoryInfo(@"c:\folderyoulookingfor");
foreach(File f in di.GetFiles())
{
if(f.ToString().St... |
Letting several assemblies access the same text file |
|c#|.net|file|file-io|filesystems| |
I've got many assemblies/projects in the same c#/.net solution. A setting needs to be saved by people using the web application gui, and then a console app and some test projects need to access the same file. Where should I put the file and how to access it?
I've tried using "AppDomain.CurrentDomain.BaseDirectory" b... |
Both GET and POST have their place. You should not rely on any of them for security.
GET requests
- are easily cachable
- are easily bookmarkable
- are subject to URI length limitation
- may show parameters in access logs
POST requests
- allows file uploading
- allows large data
- does no... |
80 characters is a ridiculous limit these days. Split your code lines where it makes sense, not according to any arbitrary character limit. |
Assuming that property will never be assigned anything other than 11, then I don't see a reason for assigment in the first place. Just make it a constant then.
Assigment only makes sense when you intend to change the value *unless* the act of assigment itself has other side effects - like volatile writes have memory... |
Never produce to an unknown pathway, in software to? [Toyota principle] |
|principles|process| |