I have a list of strings similar to this list:
tags = ('apples', 'apricots', 'oranges', 'pears', 'peaches')
How should I go about grouping this list by the first character in each string using itertools.groupby()? How should I supply the 'key' argument required by itertools.groupby()?
$arr = array('superman','gossipgirl',...);
$text = 'arbitary stuff here...';
What I want to do is find the first/last occurencing index of each word in $arr within $text,how to do it efficiently in PHP?
Is it possible to wrap code in a special function that only executes the first time the plugin is activated?
I have some database code I need to run on plugin activation, but the code need not run again after that.
If I had an array like:
$array['foo'] = 400;
$array['bar'] = 'xyz';
And I wanted to get the first item out of that array without knowing the key for it, how would I do that? Is there a function for this?
I'm looking for the code in the linux kernel (2.4.x) that initializes the first process, pid=0.
Many searches provided many clues, but I still cannot find it.
Any pointers, anyone?
I have an array of NSDictionaries. How can I pull out the first element in the dictionary?
NSArray *messages = [[results objectForKey:@"messages"] valueForKey:@"message"];
for (NSDictionary *message in messages)
{
STObject *mySTObject = [[STObject alloc] init];
stID = mySTObject.stID;
}
Suppose I have a block of memory as such:
void *block = malloc(sizeof(void *) + size);
How do I set the first two bytes to a pointer or NULL while still being able to access the rest of the block of memory? For this reason, I do not want to simply assign 'block' to another pointer or NULL.
I am looking for a way to show my own input view (a UITableView) to enter certain keywords in a UITextView faster than typing them, and also be able to type into this text view the normal way. My solution has a button that causes the keyboard to disappear, revealing the table view underneath it.
Problem is I can't figure out how to make the keyboard go away without resigning first responder, and losing the cursor. Has anyone accomplished this before?
Thanks for any help.
I am trying to identify the point in time where code completion (autocomplete/intellisense/whatever) was first introduced in IDEs and would appreciate any pointers.
By code completion here I mean a feature within the editor that offers methods or suggestions based on the code that was already typed, and I am interested in programming language related completions (not word processor style completion).
I have my web server set up as a remote git repo, so I can type "git push staging" and my last commit goes live on the server. I used this tutorial to set this up.
A lot of the time, I'm testing a new feature, and I want to test several iterations of it on the staging server, before it's ready to quality as a commit. Is there a way to push my working directory to the server without having to commit it first?
I have two tables.
Users table and Users Meta Table
I am looking for a way to get all the information out of both tables with one query. But without repeating the information from Users table.
This is all information relating to the users id number as well. So for example user_id = 1.
Is there a way to query the database and collect all the information I from both tables without repeating the information from the first?
I've tried to install this
http://www.thinktecture.com/resourcearchive/tools-and-software/wscf
it seems I have to download the vs2005 version first and then update with a file for vs2008.
But the addin failed to install as for me.
Did someone achieve to do so with VS 2008 ?
Hi all.
Can anybody help me?
How can I read only first row from an Excel file with OleDbDataAdapter?
I know how I can read all data from any spread sheet:
var dataAdapter = new OleDbDataAdapter("SELECT * FROM [" + sheetName + "$]", oledbConnection);
But I don't know how can I do this for one row.
Simplified table structure (the tables can't be merged at this time):
TableA:
dts_received (datetime)
dts_completed (datetime)
task_a (varchar)
TableB:
dts_started (datetime)
task_b (varchar)
What I would like to do is determine how long a task took to complete.
The join parameter would be something like
ON task_a = task_b AND dts_completed < dts_started
The issue is that there may be multiple date-times that occur after the dts_completed.
How do I create a join that only returns the first tableB-datetime that occurs after the tableA-datetime?
Zend Framework 2/Doctrine 2 seems like my server side framework of choice but i wonder if its advisable or worth it to start with Zend Framework 1.x first, since 2 is not out yet, or learn other things like say C#, Design Patterns etc
I have to write a drop down query for countries.
But USA should always be first.
The rest of the countries are in alphabetical order
I tried the following query
SELECT
countries_id
,countries_name
FROM get_countries
WHERE
countries_id = 138
UNION
SELECT
countries_id
,countries_name
FROM get_countries
WHERE
countries_id != 138
ORDER BY 2 ASC
How do i remove the first element from a list in scheme
say it looks something like
'((apple bob car) (cat dig) (e)))
how would i just get rid of "apple" and leave the rest alone?
Hi guys,
Can I install a second SQL Server instance on the same location as the first instance? Can that cause some problem?
By the way, I'm using SQL Server 2005.
Great thanks.
I can't search for a particular string, since they're all very similar, but I'd like something simple to chop out the first 4 lines in a file.
They're all variable length too. I've had a a think about perl, and it all seems harder than I thought, but I'd like to do it in Perl, AWK or a shell command if possible.
Does anybody have a simple way of doing this?
Hello all. I am a newbie to PHP and I've gotten my first project, but I don't have any designer with me. How can I manage the project without a designer? Please help.....
In Java/C++, for example, do you casually say that 'a' is the first character of "abc", or the zeroth?
Do people say both and it's always going to be ambiguous, or is there an actual convention?
Hi, I first learned C++ then moved to C (I know kind of backwards) and then I found a thing called iTunes U and began watching programming classes to extend my knowledge and noticed that Stanford and MIT both did not teach C or C++ as an introduction to computer programming. Then I began to wonder why they didn't begin teaching C/C++ because I thought C/C++ was more efficient than Java (which Stanford taught) and Python (which MIT taught). Or maybe there is no particular reason?