INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: 1 2 3 4 [5]   Go Down

Author Topic: Wiki Updates  (Read 74659 times)

Arindelle

  • Citizen of the Universe
  • *****
  • Posts: 2772
Re: Wiki Updates
« Reply #200 on: January 19, 2016, 04:10:47 am »

Hey apparently people noticed that swap, unswap and groupcount are not on the "expression" page ... anyway could one of you guys put them in - I'd ask for permission, but what I write confuses people more than helps most of the time

thanks
Steve

re http://yabb.jriver.com/interact/index.php?topic=102683.msg712367#msg712367
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #201 on: January 19, 2016, 08:10:45 am »

Happy to. However, since you asked, can you PM me some good explanation overview links from the forum for each of those?

I know Swap() and Unswap() pretty well, but I'd like to refer to something from Matt explaining specifics when writing docs.  And I don't know the deal with GroupCount() at all.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #202 on: January 20, 2016, 02:21:31 pm »

Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Wiki Updates
« Reply #203 on: January 20, 2016, 04:02:43 pm »

Each of your examples of swap() and unswap() seem backwards.  Meaning you're using unswap() where you should be using swap().  Unless I don't understand it.  I didn't think that this was correct:

unswap(Paul Simon)

Thank you for updating the docs.  :)  I'm just trying to help improve the quality.

Brian.
Logged

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3019
Re: Wiki Updates
« Reply #204 on: January 20, 2016, 04:31:54 pm »

Couple of problems, I think.

The swap() example uses an unswap example.

In the unswap description, it says swap()  In the unswap example it has a swap example.

Should be swap(Paul Simon) and unswap (Simon, Paul)

The Sammy Davis example ignores the Jr. in the result. Is that correct?
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #205 on: January 20, 2016, 05:07:07 pm »

I'll check. That page is a nightmare to edit because it was originally written to be machine generated by some script MrC cooked up, and is full of crazy tables with all kinds of HTML markup. I might have did mess something up.

The Jr. part surprised me, but that is right. I tested it. If you do:
Swap(Sammy Davis Jr.)

It removes the Jr suffix, and outputs: Davis, Sammy
MrC's original RegEx() did not. It would have outputted: Davis, Sammy Jr.

I don't really know which is "right".
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #206 on: January 20, 2016, 05:11:01 pm »

Ok. I fixed it, and I added a note to the Sammy Davis Jr. example that makes it more clear what it does:
Quote
Handles most common name suffixes by removing them, and results in Davis, Sammy.

One thing I wasn't sure with this, because I don't use it heavily, is do these now work for semicolon delimited lists? They didn't originally, but I think perhaps that was added...
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #207 on: January 20, 2016, 05:26:40 pm »

That page is a nightmare to edit because it was originally written to be machine generated by some script MrC cooked up, and is full of crazy tables with all kinds of HTML markup.

One of these days I want to break that monolithic page up into sub-pages for each of the major functional groupings, more like the COM Automation pages:
http://wiki.jriver.com/index.php/Media_Center_Automation

MrC liked his monolithic pages. I think because he didn't edit the wiki directly often, and used some crazy Perl scripts to allow him to edit them in a desktop application (probably BBEdit, knowing him). He also loved tables, which I hate dealing with in wiki markup. In any case, with some of "his" old pages, it has made editing them (post his departure)... Difficult.

But that's a major, and obnoxious, project. And, frankly, there is much more important stuff to be done (and, you know, I have much more fun things to do with my life). The Expression Language itself doesn't change that much (they don't give us new toys too often), so it isn't high on the priority list.

If anyone is a wiki editing wizard, though, and wants to take a crack at it...  ;D ;D ;D
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Wiki Updates
« Reply #208 on: January 20, 2016, 05:43:09 pm »

The Jr. part surprised me, but that is right. I tested it. If you do:
Swap(Sammy Davis Jr.)

It removes the Jr suffix, and outputs: Davis, Sammy

That's incorrect.  Your example in the docs has:  swap(Sammy Davis, Jr.)

That comma is being interpreted as an argument I believe and it's being dropped entirely.  You can put anything after the comma (foobar, baz) and it drops it.  If you write it without the comma:  Swap(Sammy Davis Jr.)

Then it works correctly and outputs:  Davis, Sammy Jr.

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #209 on: January 20, 2016, 06:03:56 pm »

Oops. That explains it. I'll fix it.

Of course, about 1/2 of mine like that do have a comma. That's why I tested with that. I copypasted from MC. So, to use swap() right with those, you need to clean them of commas first.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #210 on: January 20, 2016, 06:26:09 pm »

Okay. I fixed it, but I found a bug.

The Unswap() command is useless as it is, for the same reason. You can't actually even do the simple example I provided in the documentation:
Unswap(Simon, Paul) results in Simon

To make it work, you have to escape the comma with a / and do Unswap(Simon/, Paul). But that's ridiculous because the command has no additional parameters, and it is designed to work with commas.

They should fix both of them. I'll mention it to Matt in a different thread.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Wiki Updates
« Reply #211 on: January 20, 2016, 07:16:40 pm »

What you've reported is true.  But I think it's a consequence of how MC interprets typed characters versus the values stored in fields.  To whit:

unswap(swap(Paul Simon))

Produces:  Paul Simon

Further, I just tested storing a swapped value in the Comments field.  Then I made an expression column with unswap([comment]) .  The expression column correctly unswapped the swapped value.  So I think it's working as intended.

Finally, you asked about semi-colon separated values:  Yes, it swaps each member individually.  I tried it on [Director] for my movie collection and it swapped them all, including ones that had more than one director in the field.

Thanks again for your work on the docs.

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #212 on: January 20, 2016, 07:23:34 pm »

Further, I just tested storing a swapped value in the Comments field.  Then I made an expression column with unswap([comment]) .  The expression column correctly unswapped the swapped value.  So I think it's working as intended.

Ok, I wondered about that, but hadn't had a chance to test it yet (I was going to before I whined to Matt).

It treats input from a field value as a single argument (as though it is quoted on the command line), but there's no way to type that in manually (that I know of). It only works when you feed it with a field value (or, probably, the output of another expression).

That's fine, really. I can't imagine anyone in their right mind would use it with manually entered text. I just didn't know the expression engine did that. It isn't like I hardcode strings often, obviously!  ;) ;D

Finally, you asked about semi-colon separated values:  Yes, it swaps each member individually.  I tried it on [Director] for my movie collection and it swapped them all, including ones that had more than one director in the field.

I thought he'd fixed it, but it was in a different thread than the original Swap() and Unswap() one, and I didn't find it in a quick search. I was lazy and figured someone would answer.

Yes. Laziness pays off again!

I'll update the examples, and add in the stuff about lists. I might even add something further up in the page about arguments and commas.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

dtc

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 3019
Re: Wiki Updates
« Reply #213 on: January 20, 2016, 08:29:05 pm »

glynor - Thanks for you efforts. It is good to have this functionality covered in the Wiki. There will always be some unusually cases with this function, but we now have the basic functionality covered. Thanks.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41957
  • Shoes gone again!
Re: Wiki Updates
« Reply #214 on: January 21, 2016, 07:07:50 am »

To make it work, you have to escape the comma with a / and do Unswap(Simon/, Paul). But that's ridiculous because the command has no additional parameters, and it is designed to work with commas.

They should fix both of them. I'll mention it to Matt in a different thread.

It doesn't seem that crazy that commas need to be escaped.

I suppose we could make a special parsing mode that doesn't escape commas that are used just inside a few functions, but it sounds complicated and kind of gross!
Logged
Matt Ashland, JRiver Media Center

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #215 on: January 21, 2016, 07:14:59 am »

It doesn't seem that crazy that commas need to be escaped.

I suppose we could make a special parsing mode that doesn't escape commas that are used just inside a few functions, but it sounds complicated and kind of gross!

According to Brian's test (I haven't tested yet myself), it's unnecessary. If you feed it with the output of a field (or, I assume, the output of another expression) then it works.

That's how people will use it in the real world. It just messed up my samples because I was typing them in manually. I'll test and confirm, but I think it is fine. I'll put something in the documentation to explain the samples.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Wiki Updates
« Reply #216 on: January 21, 2016, 08:01:07 am »

Another test reveals that unswap() doesn't seem to like the swapped version of Jr. suffixes.  For example:

unswap(swap(Sammy Davis Jr.))

That produces:  Sammy Jr. Davis

I don't think that's the intended behavior.

Brian.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41957
  • Shoes gone again!
Re: Wiki Updates
« Reply #217 on: January 21, 2016, 08:53:54 am »

Another test reveals that unswap() doesn't seem to like the swapped version of Jr. suffixes.  For example:

unswap(swap(Sammy Davis Jr.))

That produces:  Sammy Jr. Davis

I don't think that's the intended behavior.

Brian.

Boy you're making my life complicated!

Next build:
Changed: The Unswap expression function understands Jr., Sr., etc. and does the unswapping special when those are present.
Logged
Matt Ashland, JRiver Media Center

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8009
Re: Wiki Updates
« Reply #218 on: January 21, 2016, 08:59:33 am »

Boy you're making my life complicated!

Sorry about that :( .  When I get into testing mode sometimes I can't stop.  What's funny is, I really have no intention of every using this feature!  Thanks for working to make it perfect.  :)

Brian.
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #219 on: January 21, 2016, 09:10:09 am »

What's funny is, I really have no intention of every using this feature!

See, on my hand, I do have every intention of using it (well, Swap() anyway), and I just haven't gotten there yet. I really want to set up a [Director (Reversed)] and [Actors (Reversed)] expression field to use for display in panes and theater view categories, but...

Laziness wins in bad ways too.  ::)
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #220 on: January 21, 2016, 09:13:13 am »

Matt, if you see this, can you comment about the "rules" for how expressions feed into other expressions?

Can I write something to this effect (worded better) in on the wiki page about expression arguments:

The output of an expression function (which includes field values) is always treated as a single input parameter when nested in another expression function. So that commas don't need to be escaped when they are contained in the output of an expression to be used as input on another expression function.

Such that:
if [Artist] = Simon, Paul
Unswap([Artist]) results in "Paul Simon"
and Unswap(Field(Artist)) also results in "Paul Simon"

Where using a string literal functions differently:
Unswap(Simon, Paul) results in "Simon" unless you escape the comma.

Is this right? Are there any cases where the expansion does not work that way?
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41957
  • Shoes gone again!
Re: Wiki Updates
« Reply #221 on: January 21, 2016, 09:17:05 am »

Matt, if you see this, can you comment about the "rules" for how expressions feed into other expressions?

Can I write something to this effect (worded better) in on the wiki page about expression arguments:

The output of an expression function (which includes field values) is always treated as a single argument when nested in another expression function. So that commas don't need to be escaped when they are contained in the output of an expression to be used as input on another expression function.

Is this right? Are there any cases where the expansion does not work that way?

That's exactly right.  It's treated as "one unit" when it comes out of another function or argument, so escapement isn't necessary.
Logged
Matt Ashland, JRiver Media Center

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #222 on: January 21, 2016, 09:18:19 am »

Great. With that in mind, if you really love us, it would be pretty cool to have an expression function like this:
literal() which just does "this" (effectively the same as commenting the whole block).

Not really necessary since you can block escape text, but it would look less ugly in expressions and be a bit more readable.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41957
  • Shoes gone again!
Re: Wiki Updates
« Reply #223 on: January 21, 2016, 09:39:45 am »

Great. With that in mind, if you really love us, it would be pretty cool to have an expression function like this:
literal() which just does "this" (effectively the same as commenting the whole block).

Not really necessary since you can block escape text, but it would look less ugly in expressions and be a bit more readable.

I don't really understand, but I'm happy to try and help!

Next build:
NEW: Added the expression function Literal(...) that just outputs the text that's in parenthesis (useful for making a readable block of code).
Logged
Matt Ashland, JRiver Media Center

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #224 on: January 21, 2016, 09:53:59 am »

Well, to make sure it is useful, the literal() function would need the "special case" discussed above (automatically block escaping the text, essentially).
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #225 on: January 21, 2016, 03:11:31 pm »

That's exactly right.  It's treated as "one unit" when it comes out of another function or argument, so escapement isn't necessary.

I fixed the documentation on this:
http://wiki.jriver.com/index.php/Expression_Language#Function_Arguments

I think I might actually break up the page. This thing is super unweildy to edit. The TOC and Anchors keep breaking and all sorts of other obnoxious side effects.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #226 on: January 24, 2016, 12:32:33 am »

I issued a major smackdown on the entire Expression Language page today:
http://wiki.jriver.com/index.php/Expression_Language

I broke out each of the Function "Types" (the groupings MrC made way back in the day) into their own pages, and those contain the actual documentation blocks for the different functions. But to ensure you can still Command/Control-F search the main page directly for functions by name, I included a nice index section that links directly to each function's documentation.

You can jump directly to the Functions section with this link:
http://wiki.jriver.com/index.php/Expression_Functions

And to the index:
http://wiki.jriver.com/index.php/Expression_Language#Function_Index

This keeps the Expression Language page itself much more manageable. Breaking up pages is always a balancing act between making the user click once more to access the information, and keeping the page readable and navigable. For this page, I think it was long-since past time.

More, I created a system of templates for creating each function-specific documentation block. This morphs the nearly-impenetrable blocks of HTML and wikitext tables into something much simpler to manage and modify, if needed. The set of templates includes:
* {{function description box}}
* {{argument table}}
* {{argument table row}}
* {{argument optional}}

When used, it turns the source of, for example, SaveAdd(), from MrC's version:
Code: [Select]
====SaveAdd(…): Adds to a global variable====

{| style="width: 100%; border-spacing: 0; border: 0px solid black;" align="top" cellpadding="3" cellspacing="0"
|- id="SaveAdd" valign="top"
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 2px 1px 0 2px; border-right: 1px solid #bbb;" width="100" | Description
| style="background: #f9f9f9; color: #111; border-style: solid; border-width: 2px 2px 0 0" width="1200" | <span style="font-family: monospace,monospace; font-size:1em; color:#0f3f8d; font-size:110%"><b>saveadd(</b><i>variable</i><b>, </b><i>value</i><b>, </b><i>mode</i><b>)</b></span>
The [[#SaveAdd|SaveAdd()]] function adds <i>value</i> to a global <i>variable</i> either numerically or as a list item.
The <i>mode</i> argument indicates how <i>variable</i> is modified.

Available <i>mode</i> values:

<div style="margin-left: 20pt;"><table style="border-spacing:0px; border-collapse:collapse; background: #f9f9f9">
<tr><td style="text-align:left; padding-right:20pt"><b>0</b></td><td>Add numeric <i>value</i> (integer or decimal) to <i>variable</i></td></tr>
<tr><td style="text-align:left; padding-right:20pt"><b>1</b></td><td>Append string <i>value</i> as a list item to <i>variable</i></td></tr>
<tr><td style="text-align:left; padding-right:20pt"><b>2</b></td><td>Prepend string <i>value</i> as a list item to <i>variable</i></td></tr>
</table></div>

Argument <i>mode</i> is optional (defaults to 0).

|- valign="top"
! scope="row" style="background: #ecedf3; color: #111; border-style: solid; border-width: 0px 1px 2px 2px; border-top: 1px solid #bbb; border-right: 1px solid #bbb;" | Examples
|style="background: #f9f9f9; color: #111; border-style: solid; border-width: 0px 2px 2px 0; border-top: 1px solid #bbb;" | <span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>saveadd(v, 1)</nowiki></b></span>
<p style="margin-left:20pt;">Numerically increments the global <i>variable</i> <span style="font-family: monospace,monospace; font-size:1em;">v</span> by <span style="font-family: monospace,monospace; font-size:1em;">1</span>.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>saveadd(v, math(2 - 6))</nowiki></b></span>
<p style="margin-left:20pt;">Numerically increments the global <i>variable</i> <span style="font-family: monospace,monospace; font-size:1em;">v</span> by the outcome of the [[#Math|Math()]], which is <span style="font-family: monospace,monospace; font-size:1em;">-4</span>.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>load(foo, v)saveadd(v, bar, 1)load(v)</nowiki></b></span>
<p style="margin-left:20pt;">Loads <i>value</i> <span style="font-family: monospace,monospace; font-size:1em;">foo</span> into <i>variable</i> <span style="font-family: monospace,monospace; font-size:1em;">v</span>, then appends the <i>value</i> <span style="font-family: monospace,monospace; font-size:1em;">bar</span> as a list item, and the final <span style="font-family: monospace,monospace; font-size:1em;">load(v)</span> expression outputs the
result of <span style="font-family: monospace,monospace; font-size:1em;">foo; bar</span>.</p>
<span style="font-family: monospace,monospace; font-size:1em;"><b><nowiki>load(That, v)saveadd(v, This, 2)load(v)</nowiki></b></span>
<p style="margin-left:20pt;">Similar to the previous example, but using the prepend <i>mode</i>, resulting in the output <span style="font-family: monospace,monospace; font-size:1em;">This; That</span>.</p>
|}
<div style="text-align:right;">([[#top|Back to top)]]</div>

Into:
Code: [Select]
=== <span id="SaveAdd">SaveAdd(&hellip;)</span> ===
: Adds to a global variable.

{{function description box
| name=saveadd
| arguments=variable, value, mode
| description=
The [[#SaveAdd|SaveAdd()]] function adds <i>value</i> to a global <i>variable</i> either numerically or as a list item.
The <i>mode</i> argument indicates how <i>variable</i> is modified.

{{argument table
| name=mode
| contents=
{{argument table row|0|Add numeric <i>value</i> (integer or decimal) to <i>variable</i>}}
{{argument table row|1|Append string <i>value</i> as a list item to <i>variable</i>}}
{{argument table row|2|Prepend string <i>value</i> as a list item to <i>variable</i>}}
}}
{{argument optional|mode|0}}
| examples=
'''{{monospace|saveadd(v, 1)}}'''
: Numerically increments the global <i>variable</i> {{monospace|v}} by {{monospace|1}}.
'''{{monospace|saveadd(v, math(2 - 6))}}'''
: Numerically increments the global <i>variable</i> {{monospace|v}} by the outcome of the [[#Math|Math()]], which is {{monospace|-4}}.
'''{{monospace|load(foo, v)saveadd(v, bar, 1)load(v)}}'''
: Loads <i>value</i> {{monospace|foo}} into <i>variable</i> {{monospace|v}}, then appends the <i>value</i> {{monospace|bar}} as a list item, and the final {{monospace|load(v)}} expression outputs the result of {{monospace|foo; bar}}.
'''{{monospace|load(That, v)saveadd(v, This, 2)load(v)}}'''
: Similar to the previous example, but using the prepend <i>mode</i>, resulting in the output {{monospace|This; That}}.
}}

Not all of the new subpages are converted from MrC's old style to the new system, however. I only got through Conditional Functions as far as fully converting them. But the copied-and-tweaked versions that are there now are basically just as functional as they were.

For any new content, or tweaking existing content, of course, I'll convert them over. Perhaps  I'll continue going through them by hand as well (which was actually good on the two sections I did, because I found some typos and other glitches), but we'll see.

Still didn't actually add GroupCount() which was what started all of this. But I'll get there.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

Arindelle

  • Citizen of the Universe
  • *****
  • Posts: 2772
Re: Wiki Updates
« Reply #227 on: January 24, 2016, 05:59:56 am »

I issued a major smackdown on the entire Expression Language page today:
http://wiki.jriver.com/index.php/Expression_Language

I broke out each of the Function "Types" (the groupings MrC made way back in the day) into their own pages, and those contain the actual documentation blocks for the different functions. But to ensure you can still Command/Control-F search the main page directly for functions by name, I included a nice index section that links directly to each function's documentation.

You can jump directly to the Functions section with this link:
http://wiki.jriver.com/index.php/Expression_Functions

And to the index:
http://wiki.jriver.com/index.php/Expression_Language#Function_Index



better get some good steaks on order, Jim  ;D

while your at it, Glynor ... could you change the page layout and graphical elements too ... looks a bit "90s" to me, maybe a facelift to the logo too

Moderator

Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #228 on: January 25, 2016, 05:12:18 pm »

Did a little more today. Got the function documentations "fixed" through Test and Comparison Functions now.

I also made redirects for all of the functions so that you can access them directly using URLs in this form:
http://wiki.jriver.com/index.php/Compare()
http://wiki.jriver.com/index.php/ConvertDate()

And so on and so forth. They all work, if they're in there now.

This lets me put them all in a category, which generates a by-name index of them:
http://wiki.jriver.com/index.php/Category:Expression_Functions

That's pretty cool.

But, I discovered something while doing it. Redirects to page sections don't work right on some browsers on the version of mediawiki that we're using. Specifically, on Mobile Safari on iOS (though possibly others, I saw some reference to the same issue on Opera and desktop Safari), it redirects to the top of the proper page, but not to the section.

I think this is something that has been fixed in more recent versions of mediawiki. I found a few threads about Wikipedia from back in 2007-2009 referencing this issue, but nothing since then. And, they do now work on Wikipedia, even if you turn off the mobile "theme", but they're on a much more modern version than us, and have all sorts of extensions installed.

I know redirecting to sections like that is done by Javascript after the page-redirection loads.  So, it could be our common.js. I don't know though, as I couldn't find a bunch of instructions on how to fix it, just "it works now", which makes me think it was a mediawiki bug (or something they worked around). Not sure, but that seems dangerous to go spelunking after.

Still, though, they're useful (and on mobile safari it still gets you "close"), and you can use them in posts and whatnot and other places on the Wiki. Handy side-effect of re-working them.
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

ferday

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 1732
Re: Wiki Updates
« Reply #229 on: January 25, 2016, 07:34:02 pm »

I don't really understand, but I'm happy to try and help!

Next build:
NEW: Added the expression function Literal(...) that just outputs the text that's in parenthesis (useful for making a readable block of code).

Actually, that's pretty cool.  Thanks Matt, I think I can find some use for this

@glynor, thanks for the efforts.  Looks great
Logged

ssands

  • Galactic Citizen
  • ****
  • Posts: 457
Re: Wiki Updates
« Reply #230 on: January 25, 2016, 10:25:44 pm »

@glynor,
Thanks for your time and efforts, it is appreciated!
Logged

glynor

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 19608
Re: Wiki Updates
« Reply #231 on: January 25, 2016, 11:57:04 pm »

Okay, so I took a crack at:
http://wiki.jriver.com/index.php/Grouping_Functions

But... Phew! There is a paucity of information on these functions, and I haven't used them myself at all to build anything, so I don't have any experience. Back in the beginning (when it actually got added to the builds) Matt said:
I'll start a thread sometime in the next few days to explain this better and give some examples.  I think it opens up a lot of neat possibilities.

I don't believe that ever happened, kind sir. Or if it did, I couldn't find it anywhere. Right now, my documentation is pretty terrible (effectively just links to two threads, and old ones). I kinda fudged the rest based on some of your background information, but it isn't stupendous. I'm not even positive that those two are all there are of the grouping functions. You'd mentioned them as part of a "class" and I saw a few oblique suggestions that there might be others, though they seemed inexact and "futurey"...

Also, you'd mentioned this:
This might be a nice extension of the new class of Group...(...) functions.

What's better:

GroupSummary(Disc #, max)
or
GroupMax(Disc #)

I don't know, but I don't think anything was ever done here. For the record, I think GroupSummary(field, mode) is definitely the way to go. Mode 0 can be Automatic, just like the current function, and then 1 through whatever would be...

Functions to ask explicitly for mode, mean, min, max, etc. would be a nice addition.

So... I don't know what to do here. At least it is something for now, though!
Logged
"Some cultures are defined by their relationship to cheese."

Visit me on the Interweb Thingie: http://glynor.com/

Arindelle

  • Citizen of the Universe
  • *****
  • Posts: 2772
Re: Wiki Updates
« Reply #232 on: January 26, 2016, 06:27:11 am »

if you guys want a working example to cut and paste for the Literal(...) function

this works nice (and it also removes the dreaded time stamp for my audio files which mucks things up for me ;) )

After reimporting the local media, the new field's data could be used for stats and views instead of the actual date imported field. Also, it's a way to save stats if you have to re import media files or write back file tags to the library.

Code: [Select]
=Literal([Date Imported])Now this works great. The result I get is something like this
19/08/2013 22:32

and when adding the expression to remove the time from the output using RemoveRight(...)

Code: [Select]
=removeright(literal([Date Imported]),6)
Removes the trailing old value [ 22:32] from the original string, resulting in 19/08/2013. Because no new string is specified, the default empty value is used as a replacement, effectively stripping the old value.
Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 41957
  • Shoes gone again!
Re: Wiki Updates
« Reply #233 on: January 26, 2016, 11:03:15 am »

This thread is kind of long and scary.

But the function:
GroupSummary(...)

Was added.  From the comment:
"Get a summary for the current group of files.

Field: the name of the field to summarize
Example: GroupSummary(Rating)"

And it does summarize groupings when used in a pane, etc.
Logged
Matt Ashland, JRiver Media Center
Pages: 1 2 3 4 [5]   Go Up