Hi, i have a question about basic mysql database optimisation.
I have 3 tables, Articles, Tags and Taggings (which is a join table).
Articles Taggings Tags
id id id
name article_id name
tag_id
I am retrieving the articles that exactly match the ...
Is there a method, javascript script or anything that could allow to preload hyperlinks in the page? For instance, I want that when user comes to http://ahostel.lt/ and the page fully loads, the script would start preloading other pages in the navigation (Booking, Map, Facilities, Look around, [...]). So when user clicks on any of those ...
I am tracking clicks over three time periods: the past day, past week and past month.
To do this, I have three tables:
An hourly table, with columns link_id, two other attributes, and hour_1 to hour_24, together with a computed column giving the sum
A weekday table, with columns click_id, two other attributes, and day_1 to day_7, toge...
This is my tables, the AUTO_INCREMENT shows the size of each:
tbl_clientes:
CREATE TABLE `tbl_clientes` (
`int_clientes_id_pk` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
`str_clientes_documento` varchar(255) DEFAULT NULL,
`str_clientes_nome_original` char(255) DEFAULT NULL,
PRIMARY KEY (`int_clientes_id_pk`),
UNIQUE KEY `st...
I have two ways to program the same functionality.
Method 1:
doTheWork(int action)
{
for(int i = 0 i < 1000000000; ++i)
{
doAction(action);
}
}
Method 2:
doTheWork(int action)
{
switch(action)
{
case 1:
for(int i = 0 i < 1000000000; ++i)
{
doAction<1>();
}
...
Why is there a difference in the output produced when the code is compiled using the two compilers gcc and turbo c.
#include <stdio.h>
int main()
{
char *p = "I am a string";
char *q = "I am a string";
if(p==q)
{
printf("Optimized");
}
else{
printf("Change your compiler");
}
return 0...
First off - I haven't had much experience with Java yet, and I'm a beginner when it comes to the Android SDK.
I'm trying to write a music player app, which when started scans the entire SD card for mp3 files.
Currently this is how I'm doing that:
// Recursively add songs in a directory
public void addSongsInDirectory(File dir, String ...
Give the following (straight-forward) code:
public class pr1 {
public static void f1(){
long sx = 0, s;
s = System.currentTimeMillis();
for(long i = 0; i < Integer.MAX_VALUE; ++i){
sx += i;
}
System.out.println("f1(): " + (System.currentTimeMillis() - s));
}
public static...
Hi,
in the quest to make an Ada code run faster, I'm including the pragma optimize time in the code (in the declarative part). On compiling in AdaGIDE using the GNAT Ada libre Core compiler, I get a warning message:
pragma Optimize(Time);
|
>>> warning: insufficient -O value
In the Global settings in the AdaGIDE edit...
For no reason other than fun I implemented a Trie today. At the moment it supports add() and search(), remove() should also be implemented but I think that's fairly straight forward.
It is fully functional, but filling the Trie with data takes a little too much for my taste. I'm using this list as datasource: http://www.isc.ro/lists/twl...
This question is inspired by several back-and-forths I've had recently about techniques that are or are not optimal for python programming. I may know other languages, but I am still learning in python. A wonderfully helpful comment was just recently posted by MikeD on a suboptimal answer of mine here that mentioned the operator module a...
First i was using this request:
Model.object.get(name='somethink', date=somedatavariable)
But then I needed to extend my query and change it to this:
Model.objects.get(name__icontains="somethink", date__range(start_date,end_date))
Suddenly my database takes 5 times longer than with the original query. What's going on here, and how ...
Hello,
I have a thought provoking question, in relation to the use Entity Framework (EF) to persist data. My (intended) application is not a typical LOB scenario where the standard CRUD operations are done on individual records.
Instead, what I would like to use the data stored within my entities, create some Matrices by combining the ...
List<int> list = ...
for(int i = 0; i < list.Count; ++i)
{
...
}
So does the compiler know the list.Count does not have to be called each iteration?
...
Hi,
Im making a mysql table which will be holding my blog posts and some of their information. I want to be able to add comments the the blog posts and have them saved in mysql. My question is weather I should make a table called comments and have all the comments there have the blog post id, so I would only select the corresponding com...
I need the most efficient way (in cpu cycles) to determine if two numbers have the same/different sign. But the catch is if either number is zero I need to be able to distinguish it from numbers with same/different signs (ie. zero is treated as a "third" sign). The following code is similar to what I need, but the return values can be an...
Are there any benefits to omitting the closing body and html tags?
Why is the google.com homepage missing the closing body and html tags?
edit - with regards to bandwidth, it's an extremely small amount, really. Say 10 million hits @ roughly 10 bytes saved ~ 100 mb only... Are there reasons other than bandwidth?
edit 2 - and nope, g...
I'm using a blogger platform for blogging. I've many widgets on my blog which refer to JavaScript files on the different servers, which is affecting loading performance of my blog.
Can I combine those files into one in order to reduce my requests to those servers? Or is there any other way to optimize my JavaScript code?
...
While the question check if input is type of string has been closed two of the answers spiked a micro-optimization question in my mind: which of the below two solutions would perform better?
Reed Copsey provided a solution using Char.IsLetter:
string myString = "RandomStringOfLetters";
bool allLetters = myString.All( c => Char.IsLetter...
I have a problem at hand which can be reduced to something like this :
Assume a bunch of random points in a two-dimension plane X-Y where for each Y, there could be multiple points on X and for each X, there could be multiple points on Y.
Whenever a point (Xi,Yi) is chosen, no other point with X = Xi OR Y = Yi can be chosen. We have ...