My question is, is there a way to make this code more efficient or write it in a simple way? javascript by the way.
switch (tempvar1) {
case 1:
currentSlide = 'slide1';
showaslide('ppslide1');
break;
case 2:
currentSlide = 'slide2';
showaslide('ppslide2');
break;
case 3:
currentSlide = 'slide3';
sho...
In one statement I'm trying to group rows of one table by joining to another table. I want to only get grouped rows where their grouped result is not empty.
Ex. Items and Categories
SELECT Category.id
FROM Item, Category
WHERE Category.id = Item.categoryId
GROUP BY Category.id
HAVING COUNT(Item.id) > 0
The above query gives me the re...
I am working on a game that I am going to open to the public to have on their game.
The game stores lots of information (about 300 rows) per website and spends a lot of time updating values within this MySQL database.
Is it better (faster/efficient) to add a new table for every website or to just have 1000's of rows in one table and add...
I need a big, driver-internal memory buffer with several tens of megabytes (non-paged, since accessed at dispatcher level).
Since I think that allocating chunks of non-continuous memory will more likely succeed than allocating one single continuous memory block (especially when memory becomes fragmented) I want to implement that memory b...
Which of these queries are more efficient?
select 1 as newAndClosed
from sysibm.sysdummy1
where exists (
select 1
from items
where new = 1
)
and not exists (
select 1
from status
where open = 1
)
select 1 as newAndClosed
...
are there any main factors in which the programs efficiency depends?
...
Where are some good resources for looking at the pros/cons of different ways of implementing heap allocators? Resources touching on efficiency (fragmentation, throughput, etc) are preferred. I am NOT looking for simple code repositories.
edit:
I'm not really interested in the philosophical grounding of this wiki. As such, I don't reall...
Hi! I'm trying to create a small search for my site. I've tried using full-text index search, but I could never get it to work. Here is what I've come up with:
if(isset($_GET['search'])) {
$search = str_replace('-', ' ', $_GET['search']);
$result = array();
$titles = mysql_query("SELECT title FROM Entries WHERE title LIKE '%$search%'"...
I'm trying to read a 17MB excel file (2003) with PHPExcel1.7.3c, but it crushes already while loading the file, after exceeding the 120 seconds limit I have.
Is there another library that can do it more efficiently? I have no need in styling, I only need it to support UTF8.
Thanks for your help
...
I have a collection of objects, each with an int Frame property. Given an int, I want to find the object in the collection that has the closest Frame.
Here is what I'm doing so far:
public static void Search(int frameNumber)
{
var differences = (from rec in _records
select new { FrameDiff = Math.Abs(rec.Frame...
Currently I am using mysql to log all traffic from all users coming into a website that I manage. The database has grown to almost 11m rows in a month, and queries are getting quite slow. Is there a more efficient way to log user information? All we are storing is their request, useragent, and their ip, and associating it with a certain ...
I have created a page where there are various items on a page and people need to vote on them by clicking "recommend" (like how they have it on levi.store.com). The items are sorted based on the number of "recommends" they receive. The problem I am having is that there are 100 of these items, and when I try to display them it becomes way...
I have an application (C++) that I think would be well served by an STL priority_queue. The documentation says:
Priority_queue is a container adaptor, meaning that it is implemented on top of some underlying container type. By default that underlying type is vector, but a different type may be selected explicitly.
and
Priority...
I have a possibly large block of text to search for instances of [[...]], where the ... can be anything, including other brackets (though they cannot be nested; the first instance of ]] after [[ ends the match).
I can think of two ways to match this text:
Using a non-greedy qualifier: /\[\[.+?\]\]/
Using a lookahead: /\[\[(?:(?!\]\])....
So say for example I'm going through an 'if' block and in this block, I am comparing the value of some number to a constant. Would it be more expensive like this:
if( foo.getOb().getVal() == CONST_0 )
{
....
}
....
if( foo.getOb().getVal() == _CONST_N )
{
....
}
else
....
OR:
int x = foo.getOb().getVal();
if( x == CONS...
I have this method:
public static int what(String str, char start, char end)
{
int count=0;
for(int i=0;i<str.length(); i++) {
if(str.charAt(i) == start)
{
for(int j=i+1;j<str.length(); j++)
{
if(str.charAt(j) == end)
count++;
}
}
...
Im trying to add a file to an existing .zip file using sharpziplib - problem is, the zip file is 1GB in size. When i try to add 1 small file (400k) sharpziplib creates a copy/temp of the orig zip file before adding the new file - this poses a problem when the amount of free disk space is less than 2x the zip file you are trying to updat...
The code I'm writing receives an ArrayList from unmanaged code, and this ArrayList will always contain one or more objects of type Grid_Heading_Blk. I've considered changing this ArrayList to a generic List, but I'm unsure if the conversion operation will be so expensive as to nullify the benefits of working with the generic list. Curren...
Hello, I have a SQL query that I'm currently solving by doing two queries. I am wondering if there is a way to do it in a single query that makes it more efficient.
Consider two tables:
Transaction_Entries table and Transactions, each one defined below:
Transactions
- id
- reference_number (varchar)
Transaction_Entries
- id
- acco...
Right now I am using fread() to read a file, but in other language fread() is inefficient i'v been told. Is this the same in C? If so, how would faster file reading be done?
...