Is there an easy way to "de-instrument" an instantiated class coming from sqlalchemy's ORM, i.e., turn it into a regular object?
I.e., suppose I have a Worker class that's mapped to a worker table:
class Worker(object):
def earnings(self):
return self.wage*self.hours
mapper(Worker,workers)
where workers is a refle...
I am writing a simple OCR solution for a finite set of characters. That is, I know the exact way all 26 letters in the alphabet will look like. I am using C# and am able to easily determine if a given pixel should be treated as black or white.
I am generating a matrix of black/white pixels for every single character. So for example, the...
Hello,
I am still having trouble with my mysql server. It seems that since i optimize it, the tables were growing and now sometimes is very slow again. I have no idea of how to optimize more.
mySQL server has 48GB of RAM and mysqld is using about 8, most of the tables are innoDB.
Site has about 2000 users online. I also run explain on...
We have a C# mobile application with SQLite database.
We are having a larger inventory database, such as 30k or 100k items. The database file is 12MB on a flash memory card.
Running a simpler SELECT query with limit takes 10-15 seconds.
select id,invitem,invid,cost from inventory
where itemtype = 1 and
(invitem like '%5204d%' o...
Can a static function in C be potentially faster because the compiler's optimizer sees all the call sites and therefore optimizes the epilog and prolog of the called function?
...
I'm using an ODS(ObjectDataSource) backed-up with a Linq-To-SQL class to populate Gridview on my page.
Considering the performance - I've disabled the Viewstate of the Gridview and enabled caching in the ODS.
Apart from this, I've also optimized the Search method in the Linq-to-SQL class to use the .skip & .take methods to fetch only a...
I am faced with the choice where to store some reference data (essentially drop down values) for my application. This data will not change (or if it does, I am fine with needing to restart the application), and will be frequently accessed as part of an AJAX autocomplete widget (so there may be several queries against this data by one us...
Hello,
$res (array)-> (count 50 (!) )
Example:
(
[1] => Array
(
[artistname] => Lady GaGa
[songname] => Love Games
[duration] => 3:31
[url] => 7e91a5ca16ae
[server] => 3
)
[2] => Array
(
[artistname] => DJ Layla
[songnam...
I'm learning SQL at the moment and I've read that joins and subqueries can potentially be performance destroyers. I (somewhat) know the theory about algorithmic complexity in procedural programming languages and try to be mindful of that when programming, but I don't know how expensive different SQL queries can be. I'm deciding whether I...
I have a serious project with big JS file with many functions, and now I have some questions about it.
Of course, I will stick together all my js files and gzip it, but I have a question about functions initialisations. Now I have many, many simple functions, without any classes. I heard that it is better to separate my code into many ...
I have a database containing orders and each order has an associated location. Currentl, when a user is logged in ,I am using Bing Maps API to geocode each order location and then compute driving distance to the logged in user. Based on these distances, the user via a dropdownbox can then specify the maximal distances with the results di...
Right now I'm running a PHP script on my LAMP (CentOS/Apache/MySQL/PHP) stack that generates dynamic images using GD. I'm caching them on the hard drive for 5 minutes. If a cached version exists, I pull that instead of generating a new one. This saves CPU time, but since Apache is still running the PHP file it generates a new Apache proc...
Here is the situation. I have one table that contains records based on records in many different tables (t1 below). t2 is one of the tables that has information pulled from it into t1.
t1
table_oid --which table id is a FK to
id --fk to other table
store_num --field
t2
t2_id
Here is what I need to find: I need the ...
I have, outside of my control, an XmlDocument which has a structure like the following:
<parent1>
...minor amount of data...
</parent1>
I have another XmlDocument, also outside of my control, which has the following structure:
<parent2>
..very large amount of data...
</parent2>
I need an XmlDocument in the format:
<parent1>
...min...
Read the edit below for more information.
I have some code below that I use to split a generic list of Object when the item is of a certain type.
public static IEnumerable<object>[] Split(this IEnumerable<object> tokens, TokenType type) {
List<List<object>> t = new List<List<object>>();
int currentT = 0;
...
There is quite often situation when you need to execute INSERT, UPDATE or DELETE statement based on some condition. And my question is whether the affect on the performance of the query add IF EXISTS before the command.
Example
IF EXISTS(SELECT 1 FROM Contacs WHERE [Type] = 1)
UPDATE Contacs SET [Deleted] = 1 WHERE [Type] = 1
Wha...
I have a column TypeCode varchar(20) that has values like '1', '2', '3', 'FOO', 'BAR'. I need to find the maximum integer which is less than the value of parameter. Something like this:
select max(TypeCode) TypeCode
from table1 a
left join table2 b on b.table1id = a.id
and b.TypeCode not in ('FOO', 'BAR')
where b.Typ...
It is "well-known" that the BFGS optimization algorithm is superlinearly convergent for strictly convex problems, but is there any analysis for problems that are non-strictly convex. For example, suppose that f(x) is convex for some scalar x. Then, suppose we optimize over g(x1,x2)=f(x1+x2). Will this still always be superlinearly con...
I assume that public or private static targets must have reduced memory usage, due to the fact that there is only one copy of the static target in memory.
It seems like because a method is static that might make the method a potential point for further optimization by the CLR compiler beyond what is possible with a non-static function. ...
I would like to know the best practices concerning the usage of a drop-down menu in my website along with search engine optimization. Currently, the content of the menu uses almost 50% of the HTML code, but doesn't describe at all the real content of the page.
Should I move my menu at the end of the HTML code and replace it visually at ...