Hey guys, I know this is a rather trivial question, but what is the best way handle this situation? I have several cases and I am just using simple if, if elses. I remember using a look up table at one point and I drew one out on paper, but I am not sure how to implement it in Java. Any tips would be appreciated, even if the answer is th...
My database schema looks like this:
Table t1:
id
valA
valB
Table t2:
id
valA
valB
What I want to do, is, for a given set of rows in one of these tables, find rows in both tables that have the same valA or valB (comparing valA with valA and valB with valB, not valA with valB). Then, I want to look for rows with...
Given a string (assume only English characters) S of length n, we can count the number of palindromic substrings with the following algorithm:
for i = 0 to |S| do
p1 = number of palindromes centered in i (odd length)
p2 = number of palindromes centered in i and i+1 (even length)
add p1 + p2 to total number of palindromic su...
I need some quick advice.
I would like to simulate a cellular automata (from A Simple, Efficient Method
for Realistic Animation of Clouds) on the GPU. However, I am limited to OpenGL ES 2.0 shaders (in WebGL) which does not support any bitwise operations.
Since every cell in this cellular automata represents a boolean value, storing 1 ...
I'm a rookie hobbyist and I nest for loops when I write python, like so:
dict = {
key1: {subkey/value1: value2}
...
keyn: {subkeyn/valuen: valuen+1}
}
for key in dict:
for subkey/value in key:
do it to it
I'm aware of a "next" keyword that would accomplish the same goal in one line (I asked a question abo...
See this previous question for some background. I'm trying to renumber a corrupted MPTT tree using SQL. The script is working fine logically, it is just much too slow.
I repeatedly need to execute these two queries:
UPDATE `tree`
SET `rght` = `rght` + 2
WHERE `rght` > currentLeft;
UPDATE `tree`
SET `lft` = `lft` + 2
WHERE `lft...
I recently read somewhere that one of ways of tuning sql query is - If it has too many joins then do one join with fewer tables and cache the results in a temporary table. Then do the rest of the query joining on that table.
My question - How it will improve the performance, as you are joining same numbers of tables. (Only not together)...
this is my code
void fixInstellingenTabel(object source, ElapsedEventArgs e)
{
NASDataContext _db = new NASDataContext();
List<Instellingen> newOnes = new List<Instellingen>();
List<InstellingGegeven> li = _db.InstellingGegevens.ToList();
foreach (InstellingGegeven i in li) {
if (_db.Instellingens.Count(q => q....
I was wondering if, whenever I have a situation in which I have to hide some UI element temporarily, it is sufficient to hide it (many frameworks give this option) or I should delete the object in memory and recreate it later when needed again (with the same parameters).
What are the pros and cons of each solution? I was thinking that m...
Hi, I am trying to implement the codebook foreground detection algorithm outlined here in the book Learning OpenCV.
The algorithm only describes a codebook based approach for each pixel of the picture. So I took the simplest approach that came to mind - to have a array of codebooks, one for each pixel, much like the matrix structure und...
I made a Google App Engine application as a class project in my university. Now I need to optimize it to use it commercially.
Nowadays, the code is very slow. It has only few Models with many properties in each.
Before rewriting the Models code, I need to know if my application will be faster if I increase the number of Models, i.e. inc...
I never really put too much time on optimizing website. Sure i put script at the botton, make sprite, get the crap out the HTML and CSS at the end of the contract, event tweek some javascript.
Yesterday, i getting a WordPress site ready to be launch, and delete all the unused plug-in, and getting the one i keep working and up-to-date an...
From a performance point of view is it the same doing this:
select * from MYTABLEONE MT1
join MYVIEW MV on MT1.ID = MV.ID
(
where the view is
create view MYVIEW as
select MT2.*, MT3.*
from MYTABLETWO MT2
join MYTABLETHREE MT3 on MT2.OtherID = MT3.OtherID
)
Or is it better to do this:
select MT1.*, MT2.*, MT3.*
from MYTABLEONE MT1...
I have a select query like this
select count(distinct id)*100/totalcount as freq, count (distinct id) from
<few joins, conditions, gorup by here> .....
Will this result in 2 calculations of count under MySql 5.0? I can calculate the frequency in my appliation as well if this is a problem. I am aware of the solutions presented in htt...
Note: I noticed some errors in my posted example - editing to fix it
The official C# compiler does some interesting things if you don't enable optimization.
For example, a simple if statement:
int x;
// ... //
if (x == 10)
// do something
becomes something like the following if optimized:
ldloc.0
ldc.i4.s 10
ceq
bne.un.s do_not_...
I am looking for a firefox/firebug plugin (or any OFFLINE tool is OK) to display the ratio of real text/markup.
There are online tools, like http://www.seochat.com/seo-tools/code-to-text-ratio/ and this Firefox plugin: https://addons.mozilla.org/en-US/firefox/addon/150366/ (this is online too).
...
I have about 7 query-string parameters in my URL :
http://www.examplesitname.com/EN/en/tshirt-jeans.aspx?productid=324175730&documentid=295110&producttitle=Pyjama+Tshirt&categoryid=55479572&source=TreeStructureNavigation&numberpage=1&pos=TG_n_n
If I break it down following are the query string parameters :
produ...
I have the following code
(function($){
$.fn.kb = function(evt, map, fn, options)
{
var _this = this;
var modifiers = [17, 18, 19];
function precise(a, b)
{
return b.Size - a.Size;
}
if (!this.data("Combos"))
this.data("Combos", []);
var combos = ...
I'm trying to determine the best general approach for querying against joined two tables that have a lot of data, where each table has a column in the where clause. Imagine a simple schema w/ two tables:
posts
id (int)
blog_id (int)
published_date (datetime)
title (varchar)
body (text)
posts_tags
post_id (int)
tag_id (int)
Wi...
I have a very simple XML:
<Rows>
<Row>
<id>1</id>
<name>foo</name>
<more>xyz</more>
</Row>
<Row>
<id>2</id>
<name>bar</name>
<more>abc</more>
</Row>
</Rows>
and need to do lots of querying on the ID, speed being really key.
Would it be more efficient loading the XML into a datatable and creating a PK o...