I have to transfer some values to be used as commands over the network, and I wish to make it as efficient and robust as possible, i.e. I need opinions on what to use for these commands, #defines or enums?
The range of commands shall not be more than 20 commands(lets say 40 with every defined response to the command), so according to mo...
I am fairly new to C++, having much more C experience.
I am writing a program that will use the string class, and began to wonder about the efficiency of the "length()" method.
I realized though that I didn't have a good answer to this question, and so was wondering if the answer to this and similar questions exist somewhere. While I a...
My application is having memory problems, including copying lots of strings about, using the same strings as keys in lots of hashtables, etc. I'm looking for a base class for my strings that makes this very efficient.
I'm hoping for:
String interning (multiple strings of the same value use the same memory),
copy-on-write (I think this...
I recently wrote a Vector 3 class, and I submitted my normalize() function for reviewal to a friend. He said it was good, but that I should multiply by the reciprocal where possible because "multiplying is cheaper than dividing" in CPU time.
My question simply is, why is that?
...
Unlike std::map and std::hash_map, corresponding versions in Qt do not bother to return a reference. Isn't it quite inefficient, if I build a hash for quite bulky class?
EDIT
especially since there is a separate method value(), which could then return it by value.
...
System.BitArray only implements the non-generic IEnumerable, which returns an Object for the IEnumerator.Current property. Does running a foreach over a BitArray - eg
foreach (bool b in bitArray)
{
// ...
}
box and unbox each and every bit value?
Looking at the bitarray enumerator in reflector, it looks like it does a fresh bitma...
I want a way to allow users to go through my http proxy server (Squid, Privoxy, etc.) without having to type the IP/port in web browser settings. I was hoping I could use a simple web interface.
I'm envisioning this:
User goes to a website on my server (http://proxy.com) and types a URL
into the form.
The user's browser URL ...
There are two ways to zero out an integer/float array:
memset(array, 0, sizeof(int)*arraysize);
or:
for (int i=0; i <arraysize; ++i)
array[i]=0;
obviously, memset is faster for large arraysize. However, at what point is the overhead of memset actually larger than the overhead of the for loop? For example, for an array of size 5...
I need to produce a large HTML table with quarterly counts for several (around 50) different groups (jurisdictions). I have a MySQL table with around 16,000 rows which have 'jurisdiction_id' and 'quarter' fields. Unfortunately my client doesn't want the resulting report to be paginated. How would I construct a good MySQL query from which...
Looking at DDD, we abstract the database into the various models which we operate on and look at it as a repository where our models live. Then we add the Data Layers and the Service/Business layers on top of it. My question is, in doing so, are we creating inefficiencies in data transfer by building fat models?
For example, say we ha...
I would like to start some questions about simplifying different expressions in F#.
Anyone have ideas for better and/or simpler implementation of insertAt (parameters could be reordered, too). Lists or Sequences could be used.
Here is some start implementation:
let insertAt x xs n = Seq.concat [Seq.take n xs; seq [x]; Seq.skip n xs]
...
What runs faster?
Setting a default value and changing it-
$foo = "";
if($bar)
{
$foo = "someValue";
}
Or-
if($bar)
{
$foo = "someValue";
}
else
{
$foo = "";
}
...
I've been furiously googling trying to figure this out, with surprisingly little luck; I would guess this is a common issue.
I have 5 tables: orders, addresses, notes, transactions, line_items, and shipments.
transactions, addresses and notes all have indexed order_id fields - line_items and shipments have indexed transaction_id fields...
Hi,
i am receiving a piece of plain html from an ajax request.
<h1>Title</h1>
<div>
content
</div>
This is the most simple form. Every piece contains a <h1> tag for a title, and a <div> tag containing the content. I have a nicely formatted container in the html page which needs to populate with the returned html snippet.
This is t...
I have a table that defines the possible categories in my website - fields look something like this:
- id
- name
- parentID
The information is stored something like this:
+-----+------+----------+
| id | name | parentID |
+-----+------+----------+
| 1 | pets | 0 |
+-----+------+----------+
| 2 | cats | 1 |
...
I'm using a weak computer that's chokes when I open too many programs (Out of my control).
So I want to have a lighter way to open Visual Studio solution files and csproj files.
I sometimes like to keep projects open for
code reference
easy access to files I care about.
edit my custom msbuild tasks (don't compile thru the I...
I have an Arduino application (well actually a library) that has a number of status flags in it - and originally I simply declared them as ints (well uint8_t so 8 bit unsigned chars in this case). But I could have combined them all into one integer and used bitmask operations to set and test the status.
An example of the former:
if (_s...
I am doing my first database project.
I have had the following query in the column of EMAIL_ADDRESS
...
EMAIL_ADDRESS CHARACTER VARYING(20) NOT NULL,
...
However, John Saunders uses VARYING(256).
This suggests me that I have not necessarily understood the VARYING correctly. I understand it such that the le...
What is the best data structure to store the million/billions of records (assume a record contain a name and integer) in memory(RAM).
Best in terms of - minimum search time(1st priority), and memory efficient (2nd priority)? Is it patricia tree? any other better than this?
The search key is integer (say a 32 bit random integer). And all...
Hello,
Our environment: CentOS 5, which comes with Apache 2.2 and rsyslog 2.0.6
In order to send Apache 2.2 error log we followed instructions found on the here: http://wiki.rsyslog.com/index.php/Working_Apache_and_Rsyslog_configuration
It works, but the included perl script is very inefficient - it takes huge part of the system resou...