I've come across a query that is taking "too long". The query has 50+ left joins between 10 or so tables. To give a brief overview of the database model, the tables joined are tables that store data for a particular data type (ex: date_fields, integer_fields, text_fields, etc.) and each has a column for the value, a "datafield" id, and a...
Hi all,
I have been working with a fast multipole code in Fortran. It is a black box to me, and I have been having some strangeness when compiling it on my mac.
I am using version 11.1 of the compiler, I've got a MacBook Pro running a 2.5 GHz Intel Core 2 Duo on Snow Leopard.
The code runs fine when I set the optimization flag to -O...
I would like to write a context_processor, something like this:
settings.py:
MEDIA_URLS = ('cname2.example.com/media', 'cname3.example.com/media',)
TEMPLATE_CONTEXT_PROCESSORS = (
"util.context_processors.media",
)
util/context_processors.py
from random import choice
from django.conf import settings
def media(request):
"""
...
I have simple metohds to export DataTable to xls using string. Number of columns is 5 - 30, and number or rows might be from 1 to 1000. Sometimes there is problem with performance, and I please for advice what can I change in my code. I'm using .net 4.0
public string FormatCell(string columnName, object value)
{
StringB...
While reading a post on StackOverflow (http://stackoverflow.com/questions/1502081/im-trying-to-optimize-this-c-code-using-4-way-loop-unrolling), which is now marked as closed, I came across an answer (comment, in fact) that said the following: "The two inner loops could possibly get a speed boost by using UInt64 and bit shifting"
Here i...
sir, I have a data with m rows and n columns. how to generate an objective function for this data so that it calculates the values of two thresholds automatically instead of user specifying the thresholds.
...
I'm writing a loop in C, and I am just wondering on how to optimize it a bit. It's not crucial here as I'm just practicing, but for further knowledge, I'd like to know:
In a loop, for example the following snippet:
int i = 0;
while (i < 10) {
printf("%d\n", i);
i++;
}
Does the processor check both (i < 10) and (i == 10) for e...
I have a table PAYMENTS in MySql database:
CREATE TABLE `PAYMENTS` (
`ID` BIGINT(20) NOT NULL AUTO_INCREMENT,
`USER_ID` BIGINT(20) NOT NULL,
`CATEGORY_ID` BIGINT(20) NOT NULL,
`AMOUNT` DOUBLE NULL DEFAULT NULL,
PRIMARY KEY (`ID`),
INDEX `PAYMENT_INDEX1` (`USER_ID`),
INDEX `PAYMENT_INDEX2` (`CATEGORY_ID`),
...
I am designing a function (Java method) which will be executed 40-80 times per second on a mobile device.
I want to avoid producing a ton of dead variables which get collected by GC, as the function runs (possibly throughout the life of the app).
In C I might use volatile for example, to prevent the memory allocation of my variables ...
Hello guys.
I need fast transmit data from my wcf service to client.
As SO helps, it means good binary serializer\derializer and data through List
But I've got only XML text of DataTable serialized on service. It's big overhead.
Ok I should move to binary encoding of List. I haven't any DTO, just xml of DataTable.
Could you help me wit...
Is it faster to do a single database query that finds all the results you need for a page, then do several loops through it with if/else statements to extract what you want to show in each section, or to do several database queries selecting the exact data you require and then just loop through each one separately?
For instance:
@compl...
Possible Duplicate:
manage uploaded files in database or file system?
Hi!
I'm currently developing a website I just want to know of it is more optimal to store images in a table(MySQL) or to store the reference to an image in the table ? In the latter, the image is stored in a directory in a server instead of SQL-database
M...
Suppose we have a connected and undirected graph: G=(V,E).
Definition of connected-set: a group of points belonging to V of G forms a valid connected-set iff every point in this group is within T-1 edges away from any other point in the same group, T is the number of points in the group.
Pls note that a connected set is just a connec...
Consider following function:
void func(const char & input){
//do something
}
Apparently it makes sense for the parameter to be constant value not
reference to constant regarding size of the char type, Now may a compiler optimize that to constant
value so that it'll be the same as following ?
void func(const char input){
//do someth...
I have this query:
SELECT weekno,
dt,
SUM(CARRYOVER) AS CARRYOVER,
daycode,
COALESCE('N','N') AS FLAG,
DATE_FORMAT(STR_TO_DATE(CONCAT(YEAR(dt), weekno, ' Sunday'),
'%X%V %W')
,
'%c/%d/%Y'
) AS ENDOFTHEW...
In C++0x we can now do :
void dosomething( std::vector<Thing>& things )
{
for( Thing& thing : things )
{
dofoo( thing );
wiizzz( thing );
tadaa( thing );
}
}
I know that the addition and use of lambda is syntactic sugar but it provide interesting optimization opportunities.
What about the for loop...
I attempted to create a sort-of file generator which spits out hardcoded messages to a file with slight alterations to some of the strings based on user input. Since I'm utilizaing polymorphism, I have multiple files and interfaces.
I'm finding myself passing a file parameters more times than one and is starting to rethink the way I've...
Below is a sample query of what I am trying to do and it gets the job done but I feel like the sub queries are not the best way to go here. Any pointers?
SELECT DISTINCT
u.UserID,
(SELECT COUNT(LoginID) FROM Logins WHERE Success = 1 AND UserID = u.UserID) AS Successful,
(SELECT COUNT(LoginID) FROM Logins WHERE Success = ...
Hi all, is there a way to force mysql to cache a particular query, for say 5 minutes, so executing that query will always return the same result even if the underlying db changes ?
i'm running a dating site and i have a page that shows "newest matches" and it's hitting the db too much.
thanks in advance.
...
I working on a combinatorial optimization problem that I suspect is NP-hard, and a genetic algorithm has been working well with our dataset. We're a research group and plan to publish our results in our field (not in math or CS), and I'd like to explore the NP-hard question before sending the manuscript out for review.
There are two ...