instruction stringlengths 0 30k ⌀ |
|---|
Cookies are only readable by the domain that created them, so if the cookie was created at metric.foo.com, it will have to be deleted under the same domain as it was created. This includes sub-domains.
If you are required to delete a cookie from metric.foo.com, but are currently running a page at www.foo.com, you w... |
For a hobbiest, the simplest answer is that you shouldn't worry about your game's art. You can get by fine with only programmer's art.
After you've created a working gameplay prototype, only then should you look for artists.
For an independent developer, you would need cash to hire artists. There's no getting aro... |
[Boost Serialization][1] provides some pretty useful stuff for working with serializing C++ types, but how well it will match the interface you desire I don't know. It supports both intrusive and non-intrusive designs, so is pretty flexible.
[1]: http://www.boost.org/doc/libs/1_36_0/libs/serialization/doc/index.... |
As for any class that contains a virtual function, a vtable is used. Obviously, invoking a method through a dispatching mechanism like a vtable is slower than a direct call, but in most cases you can live with that. |
I found functions that resemble python's `functools.partial` more useful in JavaScript:
function partial(fn) {
return partialWithScope.apply(this,
Array.prototype.concat.apply([fn, this],
Array.prototype.slice.call(arguments, 1)));
}
function partialWithScope(fn, scope)... |
To make sure that a product is or a cd or a dvd I would add a type column and make it part of the primary key. In the derived column you add a check constraint for the type. In the example I set cd to 1 and you could make dvd = 2 and so on for each derived table.
CREATE TABLE IF NOT EXISTS `product` (
`prod... |
Svn ignore versioned on update |
|svn| |
I have this setup where in my development copy i can commit changes on a certain file to the repository. Then in my production copy, which does checkouts only, i would normally edit this file because this contains references which are environment independent. Is there any way i can ignore this file on the subsequent ch... |
|oracle-database|natural-join| |
Does anyone know why in Oracle 11g when you do a Count(1) with more than one natural join it does a cartesian join and throws the count way off?
Such as
SELECT Count(1) FROM record NATURAL join address NATURAL join person WHERE status=1
AND code = 1 AND state = 'TN'
This pulls back like 3 million row... |
Does anyone know why in Oracle 11g when you do a Count(1) with more than one natural join it does a cartesian join and throws the count way off?
Such as
SELECT Count(1) FROM record NATURAL join address NATURAL join person WHERE status=1
AND code = 1 AND state = 'TN'
This pulls back like 3 million row... |
Respectfully, the answer is to take a few days to learn the basics of OpenGL, and there are much better places for that on the net than here. |
It seems that the data/controls on the page are changed when the postback occurs. What happens if you turn off the event validation in the page directive.
<%@ Page ... EnableEventValidation = "false" /> |
[SqlServerCentral][1] - great source of articles, scripts, advice
Unfortunately to access the articles you need to register (it is free though)
I guess they should learn from StackOverflow about the easy accessibility
[1]: http://www.sqlservercentral.com/ |
XSLT is declarative as opposed to stateful.
Although XSLT is based on functional programming ideas, it is not a full functional programming language, it lacks the ability to treat functions as a first class data type. It has elements like lazy evaluation to reduce unneeded evaluation and also the absence of explic... |
using JTables with netbeans 6.1 aka Matisse |
|jtable|netbeans| |
**Before you answer: Yes I have read the jtable tutorial over at Sun**. No, it did not help me. Yes, I am a dolt. **Please don't answer with a reference to that document**. What I am specifically interested in is how to dynamically add rows and columns to my Jtable via the Netbeans IDE. I already have an object that co... |
|java|swing|netbeans| |
What is the best way to store app specific configuration in rails? |
|ruby-on-rails|configuration| |
I need to store app specific configuration in rails. But it has to be:
- reachable in any file (model, view, helpers and controllers
- environment specified (or not), that means each environment can overwrite the configs specified in environment.rb
I've tried to use environment.rb and put something like
... |
Software protections aren't worth the money -- if your software is in demand it <b>will</b> be defeated, no matter what.
That said, hardware protections can work well. An example way it can work well is this: Find a (fairly) simple but necessary component of your software and implement it in Verilog/VHDL. Generat... |
DateTime.DaysInMonth
try this one |
Well, it depends on the culture you're using, but let's assume you can use Thread.CurrentThread.CurrentCulture, then the code to get the week of today would be:
Culture cultire = Thread.CurrentThread.CurrentCulture;
Calendar cal = culture.Calendar;
Int32 week = cal.GetWeekOfYear(DateTime.Today,
culture.DateT... |
Check [Calendar.GetWeekOfYear][1]. It should do the trick.
There is a problem with it, it does not follow the 4 day rule by ISO 8601, but otherwise it is neat.
[1]: http://msdn.microsoft.com/en-us/library/system.globalization.calendar.getweekofyear(VS.80).aspx |
We migrate to a new SBS 2005 Domain last month. We take the opotunity to create virtual machines for the following servers
- Buid Machine
- Svn Repository Machine
- Bug Traking Machine (FogBugz)
- Testing Databases
|
The problem seems to be in Windows I/O scheduling policy. According to what I found [here][1] there are many ways for an O.S. to schedule disk requests. While Linux and others can choose between different policies, before Vista Windows was locked in a single policy: a FIFO queue, where all requests where splitted in 64... |
you can get the days of a month by using DateTime.DaysInMonth(int WhichYear,int WhichMonth);
|
100% SQL Express, more easy to install and maintain than Oracle.
|
Spaces are allowed in URL's, so you can just use "/about us" in a link (although that will be encoded to "/about%20us". But be honest, this will always be personal preference, so there is no real answer to be given here.
I would go with the convention that dashes can appear in words, so spaces should be converted to... |
Can you put the export file you're creating and the Oracle tablespaces on different disks? You I/O throughput may be the constraining factor...? |
You can find here the [YAWS urlencode and urldecode routines][1]
They are fairly straightforward, although comments indicate the encode is not 100% complete for all punctuation characters.
[1]: http://erlyaws.svn.sourceforge.net/viewvc/erlyaws/trunk/yaws/src/yaws_api.erl?revision=1277&view=markup |
Since iostreams have become a standard you should use them knowing that your code will work for sure with newer versions of compiler. I guess nowadays most of the compilers know very well about iostreams and there shouldn't be any problem using them.
But if you want to stick with *printf functions there can be no pr... |
Another rule of thumb (similar to what others have said) is "test anything that could possibly break". To me that excludes auto-generated getter and setters, but includes hand-written ones that contain some logic. |
I have had great use of the book [Practical Perforce][1]. Though you might not be working with Perforce I think that chapter 7 (How Software Evolves) and chapter 8 (Basic Codeline Management) might be very useful. You might be able to skim them on [Google Books][2].
Perforce also has many great articles on the subje... |
I have had great use of the book [Practical Perforce][1]. Though you might not be working with Perforce I think that chapter 7 (How Software Evolves) and chapter 8 (Basic Codeline Management) might be very useful. You might be able to skim them on [Google Books][2].
Perforce also has many great articles on the subje... |
The paper ["streamed lines: branching patterns for parallel software development" ][1] is an excellent discussion on branching patterns such as the "main line" pattern you mention - it lists the options in the form of patterns together with discussion of anti-patterns. One of the authors is Robert Orenstein of Perforce... |
In C#, a base class' constructor runs _before_ the derived class' constructor, so any instance fields that a derived class might use in the possibly-overridden virtual member are not initialized yet.
Do note that this is just a **warning** to make you pay attention and make sure it's all-right. There are actual use... |
How to correctly add a <select> to a page with jquery and let the change event work? |
|jquery|html-select| |
I've currently got multiple select's on a page that are added dynamically with ajax calls using jquery.
The problem I've had is I could not get the change event to work on the added select unless I use the onchange inside the tag e.g.
<select id="Size" size="1" onchange="onChange(this);">
This works, but ... |
If you are developing it in swing, you should just be able to instantiate the top Frame to create a new window. |
Look into the QueryPerformanceCounter methods if this is for Windows. |
You can generate a script to create the sequences with the start values you need (based on their existing values)....
SELECT 'CREATE SEQUENCE '||sequence_name||' START WITH '||last_number||';'
FROM ALL_SEQUENCES
WHERE OWNER = your_schema
(If I understand the question correctly)
|
If you want to get real funky with it, you could use a build script to get the current version from SVN, then [compile][1] your PHP code, then on a successful build, automatically push the changes to your server.
This will help in debugging and may make your code run faster. Also, getting into the build habit has re... |
Check out [Outlet ORM][1]. It is simpler than Propel and Doctrine and it works similar to Hibernate, only with more of a PHP feel to it.
[1]: http://www.outlet-orm.org |
I use const were I can. const for parameters means that they should not change thier value. This especially valueble when passing by reference. const for funcion declairs that the function should not change the classes members. |
The benefits of source control reveal themselves as the complexity of the project and number of developers increase. If you are working directly on a remote server, and are only making quick patches most of the time, source control might not be worth the effort to you.
Preferably, you should be working from a local ... |
!enumerable.Any()
Will attempt to grab the first element only.
To expand on how/why this works, any determines if any of the components of an IEnumerable match a given function, if none is given, then any component will succeed, meaning the function will return true if an element exists in the enumerable. |
How to check if an OLEDB driver is installed on the system? |
|delphi|oledb|ado| |
How can I make sure that a certain OLEDB driver is installed when I start my application? I use ADO from Delphi and would like to display a descriptive error message if the driver is missing. The error that's returned from ADO isn't always that user-friendly.
There are probably a nice little function that returns al... |
[How Selenium Works][1]
[1]: http://selenium.openqa.org/about/how.html
Even has some pretty images. :) |
Writing tests for existing code may reveal bugs in your code. These tests will force you to look at the existing code so you can see what test you need to write in order to get it to pass and you may see some code that could possibly be written better, or is now useless.
Another tip is to write a test when you encou... |
BTW I prefer using utility methods form Google Collections lib form class Objects that helps me to keep my code clean. Very often equals and hashcode methods are made from IDE's template so their are not clean to read. |
I would suggest renaming the file in the repository from config.php to config.php.sample. This is the file that you would edit to change the default options. For deployment, either to your development environment or to the production server, you would copy config.php.sample to config.php and edit it without worrying ab... |
You might like to look at [boost serialization][1]. Not having used it I can't say whether to recommend it or not. Boost libraries are typically high quality.
[1]: http://www.boost.org/doc/libs/1_36_0/libs/serialization/doc/index.html |
There is also strptime which expects exactly one format:
$a = strptime('22-09-2008', '%d-%m-%Y');
$timestamp = mktime(0, 0, 0, $a['tm_month'], $a['tm_day'], $a['tm_year']); |
Extending ControlCollection in vb.net |
|vb.net|inheritance|overriding| |
I want to extend the basic controlcollection in vb.net so i can just add images and text to a self-made control, and then automaticly convert them to pictureboxes and lables.
So I made a class that inherits form ControlCollection, overriding the add method, and add the functionality.
But when i run the example, i... |
Yes, but nothing noteworthy to my knowledge. The performance hit is because of 'indirection' you have in each method call.
However, it really depends on the compiler you're using since some compilers are not able to inline the method calls within the classes inheriting from the abstract base class.
If you want ... |
|design-patterns|processes|process-management|principles| |
I was listening to a podcast. Where they talked about principles Toyota was using.
" - Never do anything until you are ready to use it."
I think this tell us to look in other places, to learn what other practices have known for years.
Ok, here is the podcast. I think it is interesting
http://itc.convers... |
For GUI controls, I suffix the variable name with the control name:
* firstNameTextBox
* lastNameTextBox
* submitButton
This makes the relationship obvious between for example _firstName and firstNameTextBox.Text, and no one has to remember what the hungarian notation equivalent is. I would always choose clarit... |
JavaScript string concatenation |
|javascript|string|concatenation| |
On my team, we usually do string concatentation like this:
var url = // some dynamically generated URL
var sb = new StringBuffer();
sb.append("<a href='").append(url).append("'>click here</a>");
Obviously the following is much more readable:
var url = // some dynamically generated URL
va... |
Always use Get, except perhaps when actually loading something (eg, loading a file into memory). |
I do projects from 2 weeks to 1 year. Generally my estimates are quite good, *a posteriori*. At the beginning of the project, though, I generally get bashed because my estimates are considered too large.
This is because I consider a lot of things that people forget:
- Time for bug fixing
- Time for deployments... |
How do you maintain your program vocabulary? |
|language-agnostic|organizing|discipline|vocabulary| |
In a not-so-small program, when you have not-so-few entities, in order to maintain code readability, common terms, and otherwise improve mutual understanding between team members, one have to define and maintain **program vocabulary**.
How do you (or your company) deal with this task, what discipline do you have, wh... |
When I read LoadXXX, I'm already thinking that the data comes from some storage media. Since the web service is up in the cloud, GetXXX feels more natural. |
Yes it's true but you shouldn't care. Go with the one that's easier to read. If you have to benchmark your app, then focus on the bottlenecks.
I would guess that string concatenation isn't going to be your bottleneck. |
Software protections aren't worth the money -- if your software is in demand it <b>will</b> be defeated, no matter what.
That said, hardware protections can work well. An example way it can work well is this: Find a (fairly) simple but necessary component of your software and implement it in Verilog/VHDL. Generat... |
I would Google the ROI on Linux vs Windows for a commercial server, I have no option generally on this, but I have seen that long term they level out, in the grand scheme of things the initial cost of the Windows license is actually minimal and insignificant.
Choose the best technology to solve the end users problem... |
You should consider the workload the servers might get.
The most important factor might be the number of simultaneously connected clients at peak times. Try to determine it and tune your settings in a way where:
- there are enough processing threads in both Apache and Tomcat that they don't need to spawn new thre... |
Is XSLT a functional programming language? |
|xslt|functional-programming| |
$ usrp_rx_cfile.py --help
See the -8 option which gets you 8-bit I & Q and allows a minimum
decimation factor of 4.
|
As already mentioned in some of the other answers, you shouldn't need to do this. If a file isn't supposed to be served up by the web server, you shouldn't leave it within the web folder. Includes should be placed in a directory outside the web root.
Apart from that, the proper way to tell the user that a page doesn... |
MalformedInputException while using Shrinksafe with IBM JRE |
|ibm|java|dojo|aix| |
While trying to use Shrinksafe custom_rhino.jar to build Dojo I get MalformedInputException. The problem occurs when build reaches custom widgets/templates which contain french letters stored in UTF-8.
Switching to Sun's JRE is not acceptable solution as this build must run on IBM AIX. It is possible that a solutio... |
|dojo|aix|ibm|java| |
While trying to use Shrinksafe custom_rhino.jar to build Dojo I get MalformedInputException. The problem occurs when build reaches custom widgets/templates which contain french letters stored in UTF-8. The AIX machine has LANG=en\_US which should be correct, judging by other documented problems regarding MalformedInput... |
The usual reason to do it is that you enjoy writing buffer overflows in your string handling. Counted strings are so superior to terminated strings it's hard to see why the C designers ever used terminated strings. It was a bad decision then; it's a bad decision now.
|
Re-ordering entries in a model using drag-and-drop |
|javascript|python|django| |
Say I have a blogging app in Django. How can i re-order the posts using a draggable table in the default admin?
It would be best if i didn't have to add any extra fields to the model, but if i really have to i can.
|
Are there any an OS X equivalent to `hcitool`? |
|macos|bluetooth| |
(Assuming you're writing in C# here)
When an object written in C# is constructed, what happens is that the initializers run in order from the most derived class to the base class, and then constructors run in order from the base class to the most derived class ([see Eric Lippert's blog for details as to why this is]... |
Also, you may consider using different verbs to reuse the same routes for different actions. For example, a GET request to "Products/Edit/45" would display the product editor, whereas a POST to the same url would update the product. You can use the AcceptVerb attribute to accomplish this:
[AcceptVerb("GET")]
... |
Also I recomend using [TraceTool][1] utility, it comes with JavaScript support and is very handy for JS monitoring.
[1]: http://tracetool.sourceforge.net/ |
I wondering why you had chosen Subversion? If your project is not using any vc, may be you should consider to use Mercurial or Git either.
Their stronger point is that they don't need a central repository, that means that your programmers can checkout your project, go to their home, work (without having to have a co... |
Problem in writing to single file in Web service in .NET |