Re: [O] table formula help...

2014-12-05 Thread Thomas S. Dye
Aloha Eric,

One approach would normalize the =counts= table= and use a SQL query to
generate the payments table.

#+name: counts
| id | Piece | N| Unit | Translator |
|  1 | foo   | 84   | line | bar|
|  2 | baz   | 6633 | char | foobar |

The query would sum over =N= conditional on =Unit= and group by
=Translator=.  I can't write the query off the top of my head.

hth,
Tom

Eric Abrahamsen  writes:

> I never seem to use the spreadsheet unless it's some horribly
> complicated thing I don't know how to calculate... Can someone lend me a
> hand?
>
> I'm calculating payment rates for contributors (actually translators) to
> a magazine.
>
> I've got two tables: The first is essentially a table of contents,
> listing pieces with their character count (prose), or line count
> (poetry), plus who translated it.
>
> The second is a list of translators, with their total character/line
> count, and how much they're owed.
>
> I'm having a hell of a time getting the column formulas right:
> specifically referencing one table from another. The first table looks
> like this:
>
> #+NAME: counts
> | Piece  |  Chars | Lines | Translator   |
> +++---+--+
> | 凤凰   ||84 | Austin Woerner   |
> | 王血   |   6633 |   | Eric Abrahamsen  |
> | 赵氏孤儿   |  16984 |   | Canaan Morse |
> | 山鬼故家   ||24 | Lucas Klein  |
> | 寂静何其深沉   ||10 | Lucas Klein  |
>
> And the second:
>
> #+NAME: payments
> #+CONSTANTS: prose=0.7 poetry=10
> | Translator   | Total Chars | Total Lines | Payment |
> |--+-+-+-|
> | Austin Woerner   | | | |
> | Eric Abrahamsen  | | | |
> | Canaan Morse | | | |
> | Lucas Klein  | | | |
>
> In this second table, the formula I want for the "Total Chars" column
> is:
>
> "Set each row of $2 in table payments to the sum of all numbers in $2 of
> remote(counts), if $2 is not empty, and if $4 of remote(counts) is equal
> to $1 of table payments."
>
> The formula for "Total Lines" would be exactly the same, but with the
> $2s all switched to $3. I can handle adding up the amounts!
>
> Is it possible to iterate over all the rows in another table like this?
> Is there a better way I could be arranging my tables?
>
> Thanks for any tips!
>
> Eric
>
>
>

-- 
Thomas S. Dye
http://www.tsdye.com



Re: [O] [RFC] Change property drawer syntax

2014-12-05 Thread Puneeth Chaganti
On Sat, Dec 6, 2014 at 5:01 AM, Nicolas Goaziou  wrote:
> Hello,
>
> Puneeth Chaganti  writes:
>
>> It looks the commit 8d8ad983823c63b13fd6b471ce9db8c2f95e3808 broke
>> generation of org sparse trees, when searching with properties that
>> are not all uppercase.
>
> Could you provide an ECM?

I've attached the ECM.

>> The fix seems to be just removing the conversion of key to upcase in
>> `org-entry-properties'. Since the comparison with special properties
>> is being done by a case insensitive check, this should be the only fix
>> required?
>
> There is another check, case-sensitive this time, for duplicate
> properties just below.
>
> Anyway, I think the problem lies in the fact that, somewhere in the
> internals of the function generating the spare tree, there is
> a case-sensitive search.

Yes, that is correct.  I have a few code blocks that work and don't
work, in the ECM, if at all you want to look at them.


sparse-tree-ecm.org
Description: Binary data


[O] table formula help...

2014-12-05 Thread Eric Abrahamsen
I never seem to use the spreadsheet unless it's some horribly
complicated thing I don't know how to calculate... Can someone lend me a
hand?

I'm calculating payment rates for contributors (actually translators) to
a magazine.

I've got two tables: The first is essentially a table of contents,
listing pieces with their character count (prose), or line count
(poetry), plus who translated it.

The second is a list of translators, with their total character/line
count, and how much they're owed.

I'm having a hell of a time getting the column formulas right:
specifically referencing one table from another. The first table looks
like this:

#+NAME: counts
| Piece  |  Chars | Lines | Translator   |
+++---+--+
| 凤凰   ||84 | Austin Woerner   |
| 王血   |   6633 |   | Eric Abrahamsen  |
| 赵氏孤儿   |  16984 |   | Canaan Morse |
| 山鬼故家   ||24 | Lucas Klein  |
| 寂静何其深沉   ||10 | Lucas Klein  |

And the second:

#+NAME: payments
#+CONSTANTS: prose=0.7 poetry=10
| Translator   | Total Chars | Total Lines | Payment |
|--+-+-+-|
| Austin Woerner   | | | |
| Eric Abrahamsen  | | | |
| Canaan Morse | | | |
| Lucas Klein  | | | |

In this second table, the formula I want for the "Total Chars" column
is:

"Set each row of $2 in table payments to the sum of all numbers in $2 of
remote(counts), if $2 is not empty, and if $4 of remote(counts) is equal
to $1 of table payments."

The formula for "Total Lines" would be exactly the same, but with the
$2s all switched to $3. I can handle adding up the amounts!

Is it possible to iterate over all the rows in another table like this?
Is there a better way I could be arranging my tables?

Thanks for any tips!

Eric




[O] How to export strings froom options to JS variables?

2014-12-05 Thread Marcin Borkowski
Hi all,

I have this near the beginning my Org file:

#+ATTR_COOL: How cool is that!

I want it to be exported to something like

var how_cool = 'How cool is that!'

There is a problem, hovever, what happens if some clever kid exploited
it, putting things like apostrophes into the string:

#+ATTR_COOL: It's nice!

which gets exported to