In Python, which data structure is more efficient/speedy? Assuming that order is not important to me and I would be checking for duplicates anyway, is a Python set slower than a Python list?
Hi folks,
I am using Gmail sender function defined here to send a mail to the predefined mail id. But my problem is that i want to embed more text into the body of my mail... The Gmail sender is only accepting one sting to be embedded into the body of the mail. Can anyone tell me how to embed more strings into the body of the mail... If Gmail sender is not efficient method to send a mail then please suggest me an alternative with an example....
Hi all,
I'm dealing with a large amount (30,000) files of about 10MB in size. Some of them (I estimate 2%) are actually duplicated, and I need to keep only a copy for every duplicated pair (or triplet).
Would you suggest me an efficient way to do that? I'm working on unix.
Thank you :-)
What is the best we can do with run length encoding.
http://en.wikipedia.org/wiki/Run-length_encoding Page suggests the time complexity is O(m*n) where m is the number of time the number repeats ..
Is the a more efficient algorithm to do RLE ??
I am developing 2D game for iphone in Objectice-C.In this project I need to use stack, I can do it using STL(Standard template library) stacks or NSMutableArray, since this stack is widely used in the game which one is more efficient?
@interface CarElement : NSObject
{
std::stack<myElement*> *mBats;
}
or
@interface CarElement : NSObject
{
NSMutableArray *mBats;
}
Thanks,
Is it possible to detect all the hotkeys registered by the OS as well as software applications currently running? Any native or managed approach on the Windows platform? I know that the RegisterHotKey function returns false if the hotkey is already registered, but what I am looking for is an approach, method, etc. that will give me a list of registered hotkeys. Looping all possible combinations with RegisterHotKey does not sound like a good idea. Anything more efficient?
Say you have a tuple and want to generate a new tuple by applying a metafunction on each type of the first one. What' the most efficient C++ metafuntion to accomplish to this task? Is it also possible to use C++0x variadic template to provide a better implementation?
I have several thousand objects with string property in the format of "yyyy-MM-ddTHH:mm:ssZ". I want to sort these objects ordered by time.
Is there any useful packages or scripts for this ?
(currently I'm just comparing individual numeric values and it seems it's not very efficient and neat)
Yes, There's More Than One Way To Do It™, but what is the most canonical, most efficient, and most concise methods to read an entire file into a string? (The latter two are perhaps at odds.)
Given a URL to an image (and not the image itself), what's the most efficient of getting it's dimensions? I would like to change the height and width attributes in the image tag (<img>) if it is greater than 200x200. However, if it's smaller than that, then I'd like to keep the size as it is. (I'm using ASP.NET/C#)
As part of a query result, a column with names is returned. I want to apply a function so that the order of first and last name is flipped in my $db results. What is the most efficient way to accomplish this?
While editing, building up, or cherry picking from SQL statements I can find myself interacting with one of four popular database tools. I have been resorting to single line commenting for DB2 and Informix. I have created macros in vim to make this slightly more efficient but I was wondering if I am working too hard.
In looking up how to display these I have seen:
Comma Separated
Bulleted List
just skills
skills with description
Table
It does not seem that these approaches can be space efficient without presenting a wall of text or aesthetically pleasing without taking up too make space. I was wondering if there are any approaches that reach a happy medium.
Create a 4K buffer for storing 4 independent FIFO (first-in/first-out) queues of single byte character data. The organization of the FIFO should be as efficient as possible for storing the 4 queues to support dynamic (not fixed) queue size, insuring that no queue will overflow any other queue and given that it is unknown which queues may have the least # of elements and which queues may have the most # of elements.
I need to get list of files on some drive with paths that matches specific pattern, for example FA\d\d\d\d.xml where \d is digit (0,1,2..9). So files can have names like FA5423.xml.
What is the most efficient name to do this?
I jave a 2D array like this, just like a matrix:
{{1, 2, 4, 5, 3, 6},
{8, 3, 4, 4, 5, 2},
{8, 3, 4, 2, 6, 2},
//code skips... ...
}
I want to get all the "4" position, instead of searching the array one by way, and return the position, how can I search it faster / more efficient? thz in advance.
Hi,
I need to find an inner text of an element inside an XmlDocument and return it's Xpath.
for example, searching for "ThisText" inside :
<xml>
<xml2>ThisText</xml2>
</xml>
should return the Xpath of xml2
what's the most efficient way of doing this in c#?
I have a list of user's security identifiers and I need to get a list of userPrincipalName's... is there any way that I can get it without loading up the users DirectoryEntry and pulling in the userPrincipalName property?
I need the most efficient method possible because this is done a lot
My application has two node types: a parent node which can hold recursive child nodes. Think of it like the post-comment system in SO, but comments can be recursive:
parent_1
child_11
child_12
child_121
child_3
parent_2
child_21
child_211
child_2111
Important to note that the parent nodes have different attributes and behavior than the child nodes.
What is the correct (and presumably most efficient) way of modeling this relationship in Django?
My organisiation uses Sharepoint for its 'intranet'. I have been given the task of creating a site for my department. One of the things I need on there is a procedure guide, which is basically a 150 page document, whereby each page is a separate procedure. Is there an efficient way within sharepoint that these procedures can be stored and searchable somehow, rather than dumping a 150 page document on there?
To apply a CSS to an existing html page I need to add a link that links to the css file, I am asked to include a link in the webpage that I am building that would link to the same html page but with a different css file, I am thinking I need to create a different css file, then create another .html page by copy the exact content from the first page and only change the link of the css file, but it doesn't seem so efficient and I am assuming there should be a standard method to do this.
thanks
Most people with a degree in CS will certainly know what Big O stands for.
It helps us to measure how (in)efficient an algorithm really is and if you know in what category the problem you are trying to solve lays in you can figure out if it is still possible to squeeze out that little extra performance.*
But I'm curious, how do you calculate or approximate the complexity of your algorithms?
*: but as they say, don't overdo it, premature optimization is the root of all evil, and optimization without a justified cause should deserve that name as well.
Python's itertools module provides a lots of goodies with respect to processing an iterable/iterator by use of generators. For example,
permutations(range(3)) --> 012 021 102 120 201 210
combinations('ABCD', 2) --> AB AC AD BC BD CD
[list(g) for k, g in groupby('AAAABBBCCD')] --> AAAA BBB CC D
What are the equivalent in Ruby?
By equivalent, I mean fast and memoryefficient (Python's itertools module is written in C).
Is there support for sliding expiration in the GAE MemcacheService? I can do a crude implementation where following every get() I do a put(). This will effectively reset the expiration time but this obviously is not an efficient solution.
Any pointers on how I can implement this more efficiently?
Thanks,
Keyur
So I have a database that is setup sort of like this (simplified, and in terms of the tables, all are InnoDBs):
Users: contains based user authentication information (uid, username, encrypted password, et cetera)
Contacts: contains two rows per relationship that exists between users as
(uid1, uid2), (uid2, uid1) to allow for a good 1:1 relationship
(must be mutual) between users
Messages: has messages that consist of a blob, owner-id, message-id (auto_increment)
So my question is, what's the best MySQL query to get all messages that belong to all the contacts of a specific user? Is there an efficient way to do this?