Suppose a postgresql table items like this. (keywords column is of type text[])  name   account_id      keywords ------------------------------ foo1   1               ['k1', 'k2'] foo2   1               ['k1', 'k3'] foo3   2               ['k4', 'k1'] foo4   2               ['k1', 'k6']   Each row in items is relate to a Account (the table is virtually splitted by account_id). We want make queries like: "items for account 1 with keyword k1". This query requires a composite GIN index on account_id and keywords column.  Actually, we need an inverted index, with rows like this: (the key for each row should be composite)  (account_id, keyword) --&gt; [item1, item2, ...]  What's the right way to create this index in postgresql?
Having trouble indexing and executing a query in O (log n) time.  The query includes an INNER JOIN, an ORDER BY, and an equality operation. If I understand the laws of databases correctly, a query can be indexed and executed in O (log n) time (or thereabouts) if a non-equality operator is not used on more than one column. In this case, I believe the INNER JOIN does count as an equality operator and the non-equality operator would be the ORDER BY portion of the query. This table has upwards of 10,000,000 rows and needs to handle several reads and writes per second.  Using PostgreSQL. This is what the table looks like. As you can see, the column 'Names' is a list property and it is the column that the INNER JOIN goes against:  Age Names                       Date 34  ['carla', 'john', 'sam']    3/13/2011 26  ['json', 'cindy', 'joel']   3/13/2011 72  ['beth', 'amber', 'susie']  3/13/2011 14  ['john', 'jim', 'debie']    3/13/2011   This is the query that we are trying to do:  SELECT * FROM the_table WHERE Age==26 AND Names=='john' ORDER BY Date   My background is from using App Engine's Big Table, so I've used equality operators here to indicate that 'john' should be one of the names in the Names column. This would be an acceptable query in GAE's big table, it would execute in O (log N) time as all Big Table queries are reqyured to do. I am assuming there is a way to do this in PostgreSQL as well since PostgreSQL accepts list data types as columns.  Is this possible to do in PostgreSQL?  If so, how should the index be set up (we can't figure out how to set up an index that takes into account the three properties)?
I have noticed that guest quarters on the Enterprise D have fruit bowls on their tables.  A prominent instance is the fruit bowl in Berlinghoff Rasmussen's quarters in "".  The first thing that Rasmussen does when Data takes him to his guest quarters is take a piece of fruit and shove it in his pocket.  Who replicates fruit for these fruit bowls before guests arrive?  More generally, who removes unused fruit and tidies quarters after guests leave?  Is there a ship hospitality staff, perhaps including Guinan's wait staff in Ten Forward? A lot of people will probably gloss over this fact, but it looks like C-3PO meets BB-8 for the first time in this scene 0:20:                                But how does C-3PO know BB-8's name? Is there a time where C-3PO meets BB-8 before this and knows his name? How to delete an element from an array in C# How to turn off chrome's annoying auto-fill? Is it possible/sensible to add a suspension fork to an old mountain bike? I have a ~1993 Giant mountain bike.  It's not great, but I am a very new and casual rider.    The bike has a solid fork and it makes for the predictable rough trail ride.  The trails are generally fairly modest (I live in North Texas, a 100' change in altitude makes our ears pop here) and the surface is generally dirt (very few rocky areas).  So, I am thinking that it would be very nice to have a suspension bike.  And seeing that a modest fork can be purchased for a modest price, I am wondering if it makes sense to add a fork to this bike.   asked about going the other direction, and there were some cautionary words about changing steering geometry.  So, on balance, is this something that I would be best off to avoid?  I suspect that if I have to replace a bunch of steering parts, the cost will quickly approach that of a new low end bike. I'm completely new and lost in Ubuntu 12.04, I'm having trouble navigating to my Sublime folder which I know is in my /opt folder. Yet I've tried to no avail to navigate into it via Terminal window. The directory is colored in blue, no idea what this means...but I am able to access the folder using the GUI explorer...?  k@k-Ubuntu:~$ cd /opt k@k-Ubuntu:/opt$ ls Sublime Text 2 k@k-Ubuntu:/opt$ cd Sublime Text 2 bash: cd: Sublime: No such file or directory k@k-Ubuntu:/opt$ cd /Sublime Text 2 bash: cd: /Sublime: No such file or directory Displaying two XML listings side by side. I have two XML outputs from a program that I would like to include in a LaTeX document. I would like them to appear side-by-side each in its own box. So that a reader can compare the two outputs while reading the document. Can't seem to find a way to do this, without making images for each output and adding both as images/graphics. Could there be a better option? Updating a chart dynamically in Numbers Background: I've been having some sleep issues so I have started tracking my sleep habits along with some other data but so far, they are just entries in Evernote and as such it is not possible to see any patterns. Obviously I need a spreadsheet app with charting capabilities (doh!). I've been using a great iPhone app called  for data collection for sleep times and then enter those into Evernote.  I have the iWork set so I have been looking at Numbers and going through some tutorials but I still can't tell if it will do what I want. Given that my data set will increase daily, I'd like to be able to "page through" a chart/data set, so it shows say the last 30 data entries. With all the tutorials I have seen, the charts are of fixed size and adding more data to a linked table just causes the chart to cram more stuff in.  Can Numbers do this sort of "paging" of data? I would like to have this sort of "on the fly" charting rather than having to explicitly build a chart each time I want to visualize the data.   (sorry the question is rather garbled: I don't know really anything about using a spreadsheet type app) What is a good book to learn number theory? What would be a good book to learn basic number theory? If possible a book which also has a collection of practice problems? Thanks. Where did the "play on realms" option go? My Minecraft app now only has the option of "play" and there is no "play on realms" to be found!  I downloaded - and paid for - the multiplayer app, but there doesn't seem to be a way to get to any realms on that app either. How can I obfuscate (protect) JavaScript? I want to make a JavaScript application that's not open source, and thus I wish to learn how to can obfuscate my JS code? Is this possible? I have been denied a visa several times in a row. How does one deal with such serial refusals? Is there a way to determine which features / variables of the dataset are the most important / dominant within a k-means cluster solution? Can I use my iPhone as a "remote" for my iPad? Watts P.M.P.O. and audio equipment power I am a beginner in electrical engineering, and to begin learning I decided to look into audio amplifiers. I have seen that the power of audio amplifiers is often described in the units of watts, watts RMS, and watts PMPO. So far, the only one of those units that I think I understand is watts. For instance, I just recently made . If I think: &quot;What is the power of my amplifier supposed to be?&quot;, then my thought process goes like this:  The transistors I used are the TIP120, which have a maximum rated power of 65W. Then, I decide that 60W is a safer maximum which would be reached if my amplifier runs 19V through one of my 6Ω speakers. Therefore, the power of my amplifier is 2x60W.  Then, I look at the datasheets of audio amplifier ICs, like the TPA3116 that says: &quot;50W into a 4Ω load at 21V&quot;, which makes me conclude that in that setting it'll output 14V maximum into the speaker, which I think makes sense. But then, I look at the datasheet of the TDA7294, and they talk about &quot;RMS Power&quot; and &quot;RMS Music Power&quot;, units which I couldn't find clear information about. Then, I look at home audio systems, like a Panasonic Stereo System I have which has &quot;9500 Watts P.M.P.O.&quot; written on the front. 9500W? That sounds stupidly high to me, but then I look again and it has 300W written on the back of it. If I'm correct, maybe a 1kW home stereo system could make sense, but a 2kW or greater one would not exist. So... Are my conclusions about  and the TPA3116 correct? Are my conclusions about audio equipment power correct? Are WattsPMPO, WattsRMS and RMSmusicpower, real useful units? Cross-platform space remaining on volume using python I need a way to determine the space remaining on a disk volume using python on linux, Windows and OS X. I'm currently parsing the output of the various system calls (df, dir) to accomplish this - is there a better way? Date & time format in Krusader - is it changeable at all? Using Ubuntu 16.04. I like Krusader, but can't figure out how it is possible to change date/time format for the Modified column. I truied to change system regional settings, but Krusader ignores them (while, e.g., Midnight Commander uses system settings). Switching application language (in Help menu) also does not affect the date/time format. I like the 24-hour format, not PM/AM, and I may prefer even to hide time, and leave only date. Is that possible in Krusader?  The other post is of no help, as there is no even such file in mys systems as ~/.kde/env/setlocale.sh How to truncate a file in C? how to Query parent to child I have process in salesforce in such a way opportunity we can relate this opportunity to this lookup field parent_opportunity__c . Which relates opportunity to other parent opportunity.  I want to write a query parent to child :  select id,(select id from opportunity where parent_opportunity__c!=null) from opportunity where parent_opportunity__c=null   I have worked with different scenarios i cant able to crack it  select id,name,(select id,name from parent_opportunity__r) from opportunity this is showing error and   select id,name,(select id,name from opportunity) from parent_opportunity__c this is also error "did shoot" vs "shot"