如何在Eclipse的侧栏中更改突出显示的颜色?(How to change highlighted occurrences color in Eclipse's sidebar?)
当您在Eclipse中启用“标记出现”时,将光标置于任何类型/变量/方法/ etc上将会突出显示文本编辑器中的所有出现,并在右标尺中放置一个微弱的条,以显示其他出现的位置文件。
有谁知道偏好中哪里可以改变什么颜色用来突出显示在侧尺中的其他事件? 我现在的显示器/ Windows Aero主题的颜色对我来说太淡了。
我尝试进入首选项>常规>外观>颜色和字体更改“颜色标签 - 匹配高亮”的颜色,但这似乎不适用。
这里是我正在谈论的截图:
When you have "Mark occurrences" enabled in Eclipse, placing the cursor on any type/variable/method/etc will highlight all occurrences in the text editor and place a faint bar in the right ruler to show you the location of other occurrences in the file.
Does anyone know where in the Preferences you can change what color is used to highlight the other occurrences in the side ruler? The color is way too faint for me with my current monitor/Windows Aero theme.
I tried to go into Preferences > General > Appearance > Color and Fonts change the color for "Color labels - match highlight" but this didn't seem to apply.
Here is a screenshot with what I am talking about:
原文:https://stackoverflow.com/questions/2231191
最满意答案
使用更大的数据集, 窗口函数是执行这些类型查询的最有效方式 - 表将仅扫描一次,而不是每个日期一次,就像自连接一样。 它也看起来很简单。 :) PostgreSQL 8.4及以上版本支持窗口功能。
这是它的样子:
SELECT created_at, sum(count(email)) OVER (ORDER BY created_at) FROM subscriptions GROUP BY created_at;
这里
OVER
创建窗口;ORDER BY created_at
意味着它必须总结在created_at
顺序中的计数。
编辑:如果要在一天内删除重复的电子邮件,可以使用
sum(count(distinct email))
。 不幸的是,这不会删除跨越不同日期的重复项。如果要删除所有重复项,我认为最简单的方法是使用子查询和
DISTINCT ON
。 这将把电子邮件归咎于他们的最早日期(因为我按照升序排列按create_at,它会选择最早的日期):SELECT created_at, sum(count(email)) OVER (ORDER BY created_at) FROM ( SELECT DISTINCT ON (email) created_at, email FROM subscriptions ORDER BY email, created_at ) AS subq GROUP BY created_at;
如果您在
(email, created_at)
上创建索引,则此查询也不应太慢。
(如果要测试,这是我如何创建样本数据集)
create table subscriptions as select date '2000-04-04' + (i/10000)::int as created_at, 'foofoobar@foobar.com' || (i%700000)::text as email from generate_series(1,1000000) i; create index on subscriptions (email, created_at);
With larger datasets, window functions are the most efficient way to perform these kinds of queries -- the table will be scanned only once, instead of once for each date, like a self-join would do. It also looks a lot simpler. :) PostgreSQL 8.4 and up have support for window functions.
This is what it looks like:
SELECT created_at, sum(count(email)) OVER (ORDER BY created_at) FROM subscriptions GROUP BY created_at;
Here
OVER
creates the window;ORDER BY created_at
means that it has to sum up the counts increated_at
order.
Edit: If you want to remove duplicate emails within a single day, you can use
sum(count(distinct email))
. Unfortunately this won't remove duplicates that cross different dates.If you want to remove all duplicates, I think the easiest is to use a subquery and
DISTINCT ON
. This will attribute emails to their earliest date (because I'm sorting by created_at in ascending order, it'll choose the earliest one):SELECT created_at, sum(count(email)) OVER (ORDER BY created_at) FROM ( SELECT DISTINCT ON (email) created_at, email FROM subscriptions ORDER BY email, created_at ) AS subq GROUP BY created_at;
If you create an index on
(email, created_at)
, this query shouldn't be too slow either.
(If you want to test, this is how I created the sample dataset)
create table subscriptions as select date '2000-04-04' + (i/10000)::int as created_at, 'foofoobar@foobar.com' || (i%700000)::text as email from generate_series(1,1000000) i; create index on subscriptions (email, created_at);
相关问答
更多-
我只能想到一个递归查询: with recursive tmp (avg_id, num1, num2, sum_m, sum_num1, last_id) as ( select avg_id, num1, num2, num1 * num2, num1, avg_id from running_averages where avg_id = 1 union all select r.avg_id, r.num1, case when r.num1 < 0 then ...
-
使用更大的数据集, 窗口函数是执行这些类型查询的最有效方式 - 表将仅扫描一次,而不是每个日期一次,就像自连接一样。 它也看起来很简单。 :) PostgreSQL 8.4及以上版本支持窗口功能。 这是它的样子: SELECT created_at, sum(count(email)) OVER (ORDER BY created_at) FROM subscriptions GROUP BY created_at; 这里OVER创建窗口; ORDER BY created_at意味着它必须总结在crea ...
-
我在SQL Server测试了一个解决方案,但我发现PostgreSQL支持SQL Server中的所有好东西(CTE,Window函数等),所以这应该是一个好的开始。 您的数据结构对于直接窗口功能设备非常不友好,因此CTE以更容易处理的方式获取它: ID, Date, League, Team, Goals 这允许获得先前的信息,因为团队存在于单个列中。 此外,首先CTE计算团队在特定比赛中的结果。 第二个CTE实际上使用LAG窗口函数获取有关上一个匹配的信息。 ;with PivCTE AS ( ...
-
MyFilteredCumulativeMeasure = COUNTROWS( FILTER( GENERATE( ALL( 'MyTable'[name] ) ,CALCULATETABLE( SAMPLE( 1 ,SUMMARIZE( 'MyTable' ...
-
累积通胀计算(Cumulative inflation calculation)[2023-03-29]
在基地R中完成并不难: cumprod(1 + inflation) [1] 1.027000 1.053702 1.076883 1.097344 1.305840 1.331956 [7] 1.358596 1.385767 1.413483 1.441752 正如你可能从名字中猜到的cumprod , cumprod是累积产品。 测试平等。 all.equal(cumprod(1+inflation), cumulative_inflation) [1] TRUE It's not too h ... -
SQL累积计数(SQL Cumulative Count)[2023-06-24]
以下是一个使用CTE而不是游标来完成的方法: WITH Base AS ( SELECT ROW_NUMBER() OVER (ORDER BY [Count] DESC) RowNum, [Dept], [Count] FROM SR ) SELECT SR.Dept, SR.Count, SUM(SR2.[Count]) Total FROM Base SR INNER JOIN Base SR2 ON SR2.RowNum <= SR.RowNum GROUP ... -
在数据渲染部分,小部件中,我们将javascript函数定义为值字段。 我们将添加函数来直接计算累积,但是我们可以使用: var ri = context.rowIndex; // current row Index var cumVal = 0; var isNotNull = false; // we've to add an ic3Add that supports nulls/empty for ( var row = 0 ; row <= ri; row++ ) { // all fo ...
-
节点:计算“累计”总数(Node: compute “cumulative” total)[2023-07-21]
这是使用reduce的解决方案。 (当涉及在循环中累积值时,reduce通常是个好主意。) _.each(obj, function(subArr){ _.reduce(subArr, function(total, currentObj) { return currentObj.basis = (total += currentObj.num); }, 0); }); 我确信有更聪明的解决方案,但是对于子阵列我不认为你可以在不使用forEach的情况下逃脱,至少不会让事情变得不必要复杂 ... -
SELECT nmindar, count(indx) FILTER(WHERE indx='Allotted') Allotted, count(indx) FILTER(WHERE indx='Vacant') Vacant, count(indx) FILTER(WHERE indx='Amenities') Amenities FROM plotboundary where indzone='Belagavi Zone' group by nmindar UN ...
-
与django orm和postgresql的累积(运行)总和(Cumulative (running) sum with django orm and postgresql)[2022-02-02]
根据Dima Kudosh的回答并基于https://stackoverflow.com/a/5700744/2240489我必须执行以下操作:我在sql中删除了对PARTITION BY的引用,并替换为ORDER BY导致。 AModel.objects.annotate( cumsum=Func( Sum('a_number'), template='%(expressions)s OVER (ORDER BY %(order_by)s)', ...