Roy Tang

Programmer, engineer, scientist, critic, gamer, dreamer, and kid-at-heart.

Blog Notes Photos Links Archives About

Notes: Microblog-like status updates. You can subscribe to an RSS feed of this list.

Nov 2017

  • So applicable in our country as well. Failure of justice system leads to mob justice

    Quoted ddayen's tweet:
    1/ The reason there’s a concern about disproportionate responses in the last month of sexual misconduct revelations is that we’ve utterly abandoned the rule of law in America.
    Posted by under notes at
    Also on: twitter / 0
  • If someone responds to allegations of HR violations with “we have a horrible drug problem” or “you don’t understand our situation”, that implies a belief that there is a situation that justifies violating the rights of its citizens.

    Posted by under notes at
    Also on: twitter / 0
  • If someone responds to allegations of HR violations with “that’s an insult to our sovereignty”, that implies a belief that a state has a sovereign right to violate the rights of its citizens.

    Posted by under notes at
    Also on: twitter facebook / 1
  • JUSTICE LEAGUE Spoiler-Free Review:

    • Movie was OKAY. Started out fine, build-up was good, kind of surprised with what happened in the middle, then a disappointing conclusion
    • Movie was SHORT. IMDB says 120 minutes but my watch told me it was < 2h. Probably could have spent more time putting the team together or setting up the characters or such
    • the movie does pander a lot to comic/DC fans; Batman/Superman themes play in the background when they first appear; References to some other DC characters during the exposition, etc
    • Ugh Steppenwolf so boring and terrible
    • I think Ezra Miller and Gal Gadot were the best here out of the lead roles.
    • A number of fight scenes reminded me of Injustice
    • the best part of this movie was the Black Panther trailer that I somehow hadn’t seen or heard of yet
    • for some reason the other comic book movie that came to mind was X-Men Apocalupse
    • Gary Oldman should play JJJ in the next Spider-Man so that he and JK Simmons will have effectively role-swapped
    • one mid credits scene for fun and one end credits scene as a portent of things that may come later
    • Imax was okay. There was one scene where I instinctively moved my head to avoid an incoming projectile
    • Magugustuhan ba ni Mama: It’s very much a fantasy action movie so probably not.
    • we still get Batman with guns and Superman who threatens to kill
    • no title drop and no Superfriends reference = LAME
  • When you pull an all-nighter you sometimes overshoot the “if i lay my head down ill fall asleep instantly” phase and land in some weird “what if can never sleep again” phase also your tweets become 1% more insane for every 53 minutes you stay up past your normal bedtime

    Posted by under notes at
    Also on: twitter twitter / 0
  • A hypothesis made with no scientific basis whatsoever: I feel like pro-admin fanatics are more likely to believe insane conspiracy theories (like flat earth stuff, fake moon landing, jet fuel melts steel beams etc) than non-fanatics

    Posted by under notes at
    Also on: twitter / 0
  • @switchfollows meron ka bang Monastery Mentor? I only have 2 and I kinda wanna build that 2nd deck

    Quoted JeffHoogland's tweet:
    Some interesting #modern decks in the results of the last #MTGO PTQ #mtg
    @switchfollows meron ka bang Monastery Mentor? I only have 2 and I kinda wanna build that 2nd deck
Quoted JeffHoogland's tweet:   Some interesting #modern decks in the results of the last #MTGO PTQ #mtg
    @switchfollows meron ka bang Monastery Mentor? I only have 2 and I kinda wanna build that 2nd deck
Quoted JeffHoogland's tweet:   Some interesting #modern decks in the results of the last #MTGO PTQ #mtg
    @switchfollows meron ka bang Monastery Mentor? I only have 2 and I kinda wanna build that 2nd deck
Quoted JeffHoogland's tweet:   Some interesting #modern decks in the results of the last #MTGO PTQ #mtg
    Posted by under notes at #modern #mtgo #mtg
    Also on: twitter / 0
  • I’ve been testing migrating one of our systems to Marklogic 9 and using the Optics API.

    One of our functions involves grouping claims by member_id, member_name and getting the sums and counts, so I did something like this:

    var results = op.fromView('test', 'claims')
      .groupBy(['member_id', 'member_name'], [
             op.count('num_claims', 'claim_no'),
             op.sum('total_amount', 'claim_amount')
             ])
      .orderBy(op.desc('total_amount'))
      .limit(200)
      .result()
      .toArray();
    

    Above works fine. The results are of the form

    [
      { 
        member_id: 1, 
        member_name: 'Bob', 
        num_claims: 10, 
        total_amount: 500
      }, 
      ...
    ]
    

    However, we also have a field “company”, where each claim is filed under a different company. Basically the relevant view columns are claim_no, member_id, member_name, company, claim_amount

    I would like to be able to show a column that list the different companies for which the member_id/member_name has filed claims, and how many claims for each company.

    i.e. I want my results to be something like:

    [
      { 
        member_id: 1, 
        member_name: 'Bob', 
        num_claims: 10, 
        total_amount: 500,
        companies: [
          {
            company: 'Ajax Co',
            num_claims: 8
          },
          {
            company: 'Side Gig',
            num_claims: 2
          }
        ]
      }, 
      ...
    ]
    

    I tried something like this:

    results = results.map((member, index, array) => {
      var companies = op.fromView('test', 'claims')
        .where(op.eq(op.col('member_id'), member.member_id))
        .groupBy('company', [
          op.count('num_claims', 'claim_no')      
        ])
        .result()
        .toArray();
      member.companies = companies;
      return member;
    });
    

    And the output seems correct, but it also executes quite slowly - almost a minute (total number of claim documents is around 120k)

    In our previous ML8 implementation, we were pre-generating summary documents for each member - so retrieval was reasonably fast with the downside that whenever we got a bunch of new data, all of the summary documents had to be re-generated. I was hoping that ML9’s optic API would make it easier to do the retrieval/grouping/aggregates on the fly so we wouldn’t have to do that.

    In theory, I could just add company to the groupBy fields, then merge the rows in the result query as needed. But the problem with that approach is that I can’t guarantee I’ll get the top 200 by total amount (as was my original query)

    So, the question is: Is there a better way of doing this with a reasonable execution time? Or should I just stick to pre-generating the summary documents?

  • I have a Marklogic 9 project that I’m configuring with Roxy. I’ve been following these examples: https://github.com/marklogic-community/roxy/wiki/Adding-Custom-Build-Steps

    Basically, I have a server-side JS function that I want to call after deploy content. I have something like this:

    then you would define your new method

      def deploy_content
        # you can optionally call the original
        original_deploy_content
    
        # do your stuff here
        execute_query(%Q{
          xquery version "1.0-ml";
          xdmp:javascript-eval('var process = require("/ingestion/process.sjs"); process.postDeployContent();')
        },
        :db_name => @properties["ml.app-name"] + "-content")
    
      end
    

    The xquery being called here evaluates fine when executed via query console. But when I call ml local deploy content, I get the following error:

    ERROR: 500 "Internal Server Error"
    ERROR: <html xmlns="http://www.w3.org/1999/xhtml">
      <head>
        <title>500 Internal Server Error</title>
        <meta name="robots" content="noindex,nofollow"/>
        <link rel="stylesheet" href="/error.css"/>
      </head>
      <body>
        <span class="error">
          <h1>500 Internal Server Error</h1>
          <dl>
            <dt>XDMP-MODNOTFOUND: var process = require("/ingestion/process.sjs"); process.postDeployContent(); -- Module /ingestion/process.sjs not found</dt>
            <dd></dd>
            <dt>in [anonymous], at 1:14 [javascript]</dt>
            <dd></dd>
            <dt>at 3:6,
    in xdmp:eval("var process = require(&amp;quot;/ingestion/process.sjs&amp;quot;); proce...") [javascript]</dt>
            <dd></dd>
            <dt>in /eval, at 3:6 [1.0-ml]</dt>
            <dd></dd>
          </dl>
        </span>
      </body>
    </html>
    

    Why is the module not found when running via xquery from app_specific.rb?

    Or… is there a better way to call a JS module function from here. Sorry, I’m not too familiar with the xquery side, so I just called a JS function instead.

  • Repost from IpeLustre:

    WAS told BBM has hired Russian & Indonesian trolls; they’re cheaper. Unfortunately, their Tagalog is crooked. Test them by talking in Tagalog. Incidentally, Pinoy trolls have quit. Kapag kausap ninyo ang mga bagong trolls, laliman ninyo ang Tagalog para mabuking. They’re here.

    Posted by under notes at
    Also on: twitter / 0
  • Our president’s rate is probably way lower since he doesnt tweet. Still, sana someone does that analysis haha

    Quoted CNN's tweet:
    President Trump says something that isn’t true 5.5 times a day. Every day. | Analysis by @CillizzaCNN http://cnn.it/2AFkOUr
    Our president’s rate is probably way lower since he doesnt tweet. Still, sana someone does that analysis haha
Quoted CNN's tweet:   President Trump says something that isn’t true 5.5 times a day. Every day. | Analysis by @CillizzaCNN http://cnn.it/2AFkOUr
    Posted by under notes at
    Also on: twitter / 0
  • This is perfectly legal in non-Silver border land! And why isn’t it mythic?!? #MTGUN3

    Quoted misterorange's tweet:
    OMG they did it. We’re all done here, let’s pack it up. #MTGUn3
    This is perfectly legal in non-Silver border land! And why isn’t it mythic?!? #MTGUN3
Quoted misterorange's tweet:   OMG they did it. We’re all done here, let’s pack it up. #MTGUn3
    Posted by under notes at #MTGUN3 #mtgun3
    Also on: twitter / 0
  • Repost from mrc199x:

    The idea behind non-official channels, like Sass, RJ, Bruce, and other D D S bloggers, is ensure there will be attack dogs for issues that official channels can’t tackle head on. This strategy achieves a common goal with the benefit of deniability.

    Posted by under notes at
    Also on: twitter / 0
  • Repost from mcnees:

    Astrophysicist and science communicator Carl Sagan was born #OTD in 1934. Here is what he feared we might become, from “The Demon Haunted World.”

    Astrophysicist and science communicator Carl Sagan was born #OTD in 1934. Here is what he feared we might become, from “The Demon Haunted World.”
    Posted by under notes at #OTD
    Also on: twitter / 0
  • Repost from kimmaicutler:

    There should be a term for this. Maybe “algorithmic radicalization.”

    https://www.nytimes.com/2017/11/12/technology/social-media-disinformation.htmlhttps://www.nytimes.com/2017/11/12/technology/social-media-disinformation.html https://www.buzzfeed.com/vijaypandurangan/how-can-we-kill-fake-news

    There should be a term for this. Maybe “algorithmic radicalization.”
https://www.nytimes.com/2017/11/12/technology/social-media-disinformation.htmlhttps://www.nytimes.com/2017/11/12/technology/social-media-disinformation.html https://www.buzzfeed.com/vijaypandurangan/how-can-we-kill-fake-news
    There should be a term for this. Maybe “algorithmic radicalization.”
https://www.nytimes.com/2017/11/12/technology/social-media-disinformation.htmlhttps://www.nytimes.com/2017/11/12/technology/social-media-disinformation.html https://www.buzzfeed.com/vijaypandurangan/how-can-we-kill-fake-news
    There should be a term for this. Maybe “algorithmic radicalization.”
https://www.nytimes.com/2017/11/12/technology/social-media-disinformation.htmlhttps://www.nytimes.com/2017/11/12/technology/social-media-disinformation.html https://www.buzzfeed.com/vijaypandurangan/how-can-we-kill-fake-news
    There should be a term for this. Maybe “algorithmic radicalization.”
https://www.nytimes.com/2017/11/12/technology/social-media-disinformation.htmlhttps://www.nytimes.com/2017/11/12/technology/social-media-disinformation.html https://www.buzzfeed.com/vijaypandurangan/how-can-we-kill-fake-news
    Posted by under notes at
    Also on: twitter / 0
  • Thread

    Quoted tonyocruz's tweet:

    The weakest link in the broad anti-Duterte opposition are the Yellows (not all, just the diehard and rabid ones).

    They think their votes are more important than others.

    They think Duterte’s sins absolve PNoy’s record of ineptitude, cruelty, corruption and puppetry.

    Posted by under notes at
    Also on: twitter / 0
  • Repost from HoldenShearer:

    Seeing some folks I follow circulating a point that’s worth drawing a bit of attention to. One of the oldest canards in low-denominator comedy is that women are inscrutable and men can’t understand them. There’s a reason for this and it ain’t funny.

    Posted by under notes at
    Also on: twitter / 0