efficiency

Efficiently updating a QTableView at high speed

I'm using a QTableView with a subclass of QItemDelegate to control the look and feel of the tableview's cells. Each cell displays the name and status of a of an externally connected device, and as many as 100 devices may be connected at once. The name and type of each device is essentially static, updating very rarely (perhaps once an ...

The best way to implement a remote desktop viewer

Hey all, I am an experienced vb.net programmer and have completed many projects, however I want to be able to view the desktop in almost-realtime from a computer on my lan (its part of my business) As this is a business situation teamviewer is not free, but id rather like to make my own server and client anyway - will be fun! :) I nee...

What is more efficient with C code?

What is more efficient with the C code I am working with, moving my code into an existing C program or have an h file #included so it calls the separate .c file? When this is compiled into an .exe how does this work with having it incorporated into the original code vs having an h file and separate .c file? I am not sure how many lines...

How inefficient is String concatenation in Javascript?

Such as var myName = 'Bob'; myName += ' is a good name'; For long operations of this, it there a better way to do it? Maybe with a StringBuffer type of structure? Thanks! :) ...

mapping encoded keys to shorter identifiers in appengine

I want to send unique references to the client so that they client can refer back to specific objects. The encoded keys appengine provides are sometimes 50 bytes long, and I probably only need two or three bytes (I could hope to need four or five, but that won't be for a while!). Sending the larger keys is actually prohibitively expens...

64-bit integer implementation for 8-bit microcontroller

I'm working on OKI 431 microcontroller. This is 8-bit microcontroller. We don't like to have any floating point operation to be performed in our project so we've eliminated all floating point operations and converted them into integer operations in some way. But we cannot eliminate one floating point operation because optimizing the calc...

How can I efficiently count ranges that cover a given range in Perl?

I have a database of some 30k ranges, each is given as a pair of start and end points: [12,80],[34,60],[34,9000],[76,743],... I would like to write a Perl subroutine that a range (not from the database), and returns the number of ranges in the database which fully 'include' the given range. For example, if we had only those 4 ranges ...

Sort order of result for "Find All References" in Visual Studio

I'm currently using Visual Studio 2010, but I don't think this is a version specific issue (think it was the exact same way in 2008 as well). When I want to find out where in my solution some variable/function/whatever is used, I right-click it and select "Find All References". This gives me a long list in the Find Symbol Results view o...

Fast algorithm for finding prime numbers?

First of all - I checked a lot in this forum and I haven't found something fast enough. I try to make a function that returns me the prime numbers in a specified range. For example I did this function (in C#) using the sieve of Eratosthenes. I tried also Atkin's sieve but the Eratosthenes one runs faster (in my implementation): public s...

Does GWT serialize java.lang.Longs efficiently?

I'm sending object IDs back and forth from client to server through the GWT RPC mechanism. The ids are coming out of the datastore as Longs (8 bytes). I think all of my ids will only need 4 bytes, but something random could happen that gives me a 5-byte (or whatever) value. Is GWT going to be smart about packing these values in some v...

How to force workflow runtime to use more CPU power?

Hello I've quite unordinary problem because I think that in my case workflow runtime doesn't use enough CPU power. Scenario is as follow: I send a lot of messages to queues. I use EnqueueItem method from WorkflowRuntime class. I create new instance of workflow with CreateWorkflow method of WorkflowRuntime class. I wait until new workfl...

Which CSS Selector style is more efficient?

Inspired by http://stackoverflow.com/questions/3814966/help-understanding-jquery-attribute-equals-selector the question is: Which of these is more efficient? $('#FOO element.BAR[attr=BAZ]') or $('#FOO element[attr=BAZ].BAR') And yes, we could omit the initial #FOO selector, but that question was asking about that in particular, so...

What do you wish you'd known leaving College as a CS Major?

List 5 things you wish you'd known/done/emphasized differently now that you're in the workforce (in the context of your college software development). Thanks from KY for your wisdom. ...

How to reduce duplication in code - If statements vs separate class

Let's say you have a website that lets you build an account with up to three different account owners. Each entry page for the owner is a separate aspx page. The first person has very different business rules than the second and third owners. The first will have more fields as well and different ones will be required for them but not f...

object array efficiency in Matlab

Hi. For my work I have to set up a project in Matlab, which is not my language of choice and I have some questions regarding efficiency. I am currently dealing with a collection of points with several properties. Rather than putting all of these in separate arrays of equal length I would much prefer to make a single array of Point objec...

AJAX Polling Frequency - To long poll or not to long poll?

I'm building a component of a web page that needs relatively constant database polling. I can see two different approaches for this, and I'm wondering if one of them is better than the others, or if I'm missing a third option. 1) Send off an AJAX request every 1 or 2 seconds to check for updates. Each request returns immediately whether...

Efficiently detect sign-changes in python

I want to do exactly what this guy did: Python - count sign changes However I need to optimize it to run super fast. In brief I want to take a time series and tell every time it crosses crosses zero (changes sign). I want to record the time in between zero crossings. Since this is real data (32 bit float) I doubt I'll every have a numb...

how to sample distributions, given n, distribution name, and parameters in a dataframe?

I have a dataframe: priors <- data.frame(dist = c('lnorm', 'beta', 'gamma'), a = c(0.5, 1, 10), b = c(0.4, 25, 4), n = c(100, 100, 100) ) and I would like to take n samples from the distribution with parameters a and b. I have written this fu...

Fastest way to sort in Python

What is the fastest way to sort an array of whole integers bigger than 0 and less than 100000 in Python? But not using the built in functions like sort. Im looking at the possibility to combine 2 sport functions depending on input size. ...

Is this MySQL query a JOIN, a regular query or both?

I need to get data from 3 different tables. I know the basics about JOINs but when it comes to more complicated queries like getting data from 3 or more tables using JOIN I get a little confused and I just start playing with the queries writing what make sense to me, like the next one: SELECT movies.imdbID, movies.title, movies.year...