As was foretold, we've added advertisements to the forums! If you have questions, or if you encounter any bugs, please visit this thread: https://forums.penny-arcade.com/discussion/240191/forum-advertisement-faq-and-reports-thread/
Options

[Programming] Mirror, mirror, on the wall, show the git diff for them all

19293959798100

Posts

  • Options
    mightyjongyomightyjongyo Sour Crrm East Bay, CaliforniaRegistered User regular
    My coworkers do!

    ....Unfortunately I do not.

  • Options
    TofystedethTofystedeth Registered User regular
    It is recommended that the first record in the file should contain the following header:
    • Header stuff
    • This header line is required.
    :rotate:

    steam_sig.png
  • Options
    Jimmy KingJimmy King Registered User regular
    It is recommended that the first record in the file should contain the following header:
    • Header stuff
    • This header line is required.
    :rotate:

    Sadly, not the first time I've come across this. The OMA DRM spec has the same thing, in fact it just said "optional" at one place, then "required" later. The system I worked on did not implement it and it worked fine on thousands of phones (seriously, the big carriers would make us test and provide proof of the system working with every phone they had sold for the last 5+ years, it was insane). Then, one day, one weird phone on some small Canadian carrier had actually implemented it as required and it took like a week to figure out wtf was going on.

  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Optional, unless you want it to work

  • Options
    TofystedethTofystedeth Registered User regular
    That whole document had some really annoying formatting. There were lots of bullet lists that had a single bullet, or things like the above one, where it was a bullet list with one or two bullets that made sense as things to include or descriptors of the data, and then a bullet or two that really should have been in the heading.

    steam_sig.png
  • Options
    InfidelInfidel Heretic Registered User regular
    Hey, I too would recommend you have it if it was required!

    OrokosPA.png
  • Options
    TraceTrace GNU Terry Pratchett; GNU Gus; GNU Carrie Fisher; GNU Adam We Registered User regular
    edited May 2016
    Howdy folks.

    NARS2.0 is days from release.

    Unlike NARS1.7 where several of the control functions for the system were inactive due to testing purposes 2.0 is coming out fully packaged with NAL-9 implemented to its fullest extent since the new decision making methods were implemented.

    There is also going to be a dev break afterwards as we focus on pushing the new system to its limits and work on planning out our future development plans.

    199tljw1r4wv4png.png

    Trace on
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    edited May 2016
    Hmm. Can a .gitignore glob really not take braces, like "*.min.{js,css}"? One would think that rather handy to have.

    Echo on
  • Options
    bowenbowen How you doin'? Registered User regular
    Echo wrote: »
    Hmm. Can a .gitignore glob really not take braces, like "*.min.{js,css}"? One would think that rather handy to have.

    no, I don't think so.

    Not that *.min.js and *.min.css are onerous to type.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    Having a really weird issue that I hope you guys can help me with.

    I have a Django view that accepts a GET request.

    URL is:
    /api/v3/product/search
    

    The code:
        if request.GET.get('year', None):
            product_cases = product_cases.filter(case_year=request.GET.get('year'))
    

    So if the user searches for the year "2016" the URL looks like:
    /api/v3/product/search?year=2016
    

    In Django I print out the year value:
    print(str(request.GET.get('year')))  # 2016
    

    But I get an Exception:
    ValueError at /api/v3/product/search
    year is out of range

    Django model:
    class Product(models.Model):
        case_year = models.TextField(null=True)
    

    It's a text field... So I'm not sure why I'm getting "out of range". The other filters work just fine, it's just year that blows up. What gives?

  • Options
    KakodaimonosKakodaimonos Code fondler Helping the 1% get richerRegistered User regular
    Asynchronous memory streams and compute streams is the tits in CUDA

  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    urahonky wrote: »
    Having a really weird issue that I hope you guys can help me with.

    I have a Django view that accepts a GET request.

    URL is:
    /api/v3/product/search
    

    The code:
        if request.GET.get('year', None):
            product_cases = product_cases.filter(case_year=request.GET.get('year'))
    

    So if the user searches for the year "2016" the URL looks like:
    /api/v3/product/search?year=2016
    

    In Django I print out the year value:
    print(str(request.GET.get('year')))  # 2016
    

    But I get an Exception:
    ValueError at /api/v3/product/search
    year is out of range

    Django model:
    class Product(models.Model):
        case_year = models.TextField(null=True)
    

    It's a text field... So I'm not sure why I'm getting "out of range". The other filters work just fine, it's just year that blows up. What gives?

    Damn it I'm going to have to post on StackOverflow aren't I?

  • Options
    bowenbowen How you doin'? Registered User regular
    Is GET.get the right thing to use?

    I see lots of "request.META.get(...)" when I google it

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    edited May 2016
    I figured it out. I'm pulling in data from a Pervasive DB which populates into a Postgres DB. For some reason some of the values they are sending me for some of the dates was "0002-11-01 BC", which, in Django, was an invalid year.

    urahonky on
  • Options
    bowenbowen How you doin'? Registered User regular
    Why is that even a valid date in Postgres?

    I think it would be okay to turn off date validation for shit that low and make people use text fields.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    bowen wrote: »
    Why is that even a valid date in Postgres?

    I think it would be okay to turn off date validation for shit that low and make people use text fields.

    Wish I knew.

  • Options
    hsuhsu Registered User regular
    Is there any way to make github display more comment lines/words when displaying the recent commits?

    When I used gerrit, you could see the first few lines of a commit comment, and when viewed in a widescreen monitor, it was easily enough to determine what happened with that commit. This made it easy to search through recent commits, to figure out who's recent push just caused a regression bug.

    Under github, I have to manually click on the "..." link to display more of the commit comment, one by one, in order to figure out the same info, which painfully slows down the process. Particularly since nearly all bugs are prefixed by a tracking number, so nothing in the first few words are ever relevant to the actual changes made.

    iTNdmYl.png
  • Options
    crimsoncoyotecrimsoncoyote Registered User regular
    Have you tried "git log"?

    I honestly haven't touched github in a long time and generally do most of my stuff from a terminal so I'm not familiar with any GUI tools.


    Speaking of git... not sure I posted this in March, but we've finally made the official switch to git and I cannot be happier with it.
    good riddance, cvs

  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    edited May 2016
    OK, so I wanna do a thing in python, and I've wasted entirely too much fucking time trying to figure out, but I'm now annoyed. So I come to ask you, Programming Thread, to show me how I can do the thing that's bothering me.

    We're messing with Flask for some things at work. We're automating some bits of config/setup. Part of config/setup is generating a "secret key", which is basically just a random string. So I could do any myriad of things to generate this value. However, the quickstart guide suggests the following:
    The problem with random is that it’s hard to judge what is truly random. And a secret key should be as random as possible. Your operating system has ways to generate pretty random stuff based on a cryptographic random generator which can be used to get such a key:
    >>> import os
    >>> os.urandom(24)
    '\xfd{H\xe5<\x95\xf9\xe3\x96.5\xd1\x01O<!\xd5\xa2\xa0\x9fR"\xa1\xa8'
    
    Just take that thing and copy/paste it into your code and you’re done.

    Ok, I'll just copy and pa... waaaaaait a minute. I'm scripting, not copying and pasting.

    But, not really thinking anything of it, I just stored the urandom output to a variable and wrote it to file like so:
    >>> sk = os.urandom(24)
    >>> f = open('config.py', 'w')
    >>> f.write(sk)
    >>> f.close()
    

    GREAT! Now, what's my file look like?
    $ cat config.py
    ????|?GkЖ&?ۦ=???Ʋ
    

    Well, hmm. I kind of see what we've done there, but that's not what I want. I literally want to write the escaped string to file as it appears when you ... output (?*) it. I want my file to look like this:
    SECRET_KEY = '\x04h\xa2\xf8\x8d"\xc0\x9b\xf0j\x0bj\xdbH\xea\xb02\xd1\xa48\xbd\xef?\xb1'
    

    What am I missing here? It's gotta be some text encoding/decoding thing that I'm just not sure how to express to Python, ja?

    * This, for some reason, has me grinding my teeth:
    >>> sk = os.urandom(24)
    >>> sk
    '\x04h\xa2\xf8\x8d"\xc0\x9b\xf0j\x0bj\xdbH\xea\xb02\xd1\xa48\xbd\xef?\xb1'
    >>> print sk
    h???"???j
             j?H?2Ѥ8????
    

    Also, yes, I totally could just use like "sk.encode('base64')" or "sk.encode('hex')" (or any variety of "select X random characters from this set") and write that to file, but as I said this silly, little thing has wasted a surprising amount of my time and now I'm compelled to figure out what. the. fuck. I'm not getting.

    iTunesIsEvil on
  • Options
    EndEnd Registered User regular
    edited May 2016
    I guess you want repr(sk)

    normally I'm not too hot on using repr for anything but debugging/logging stuff, but in this case it's literally (get it??) what you want

    End on
    I wish that someway, somehow, that I could save every one of us
    zaleiria-by-lexxy-sig.jpg
  • Options
    iTunesIsEviliTunesIsEvil Cornfield? Cornfield.Registered User regular
    repr() definitely gets me a heck of a lot closer. Thank you @End!

  • Options
    urahonkyurahonky Resident FF7R hater Registered User regular
    >>> sk = os.urandom(24)
    >>> sk
    b'\xee\x9b\xa2(\x92Z\t\x03\xfc\xe0S\x80)\xd45\xda\x8c\x93\xc7\x9a:\xbeF\xfb'
    >>> print(sk)
    b'\xee\x9b\xa2(\x92Z\t\x03\xfc\xe0S\x80)\xd45\xda\x8c\x93\xc7\x9a:\xbeF\xfb'
    >>> print(str(sk))
    b'\xee\x9b\xa2(\x92Z\t\x03\xfc\xe0S\x80)\xd45\xda\x8c\x93\xc7\x9a:\xbeF\xfb'
    

    Must be a weird 2.x thing for Python. Try casting it to a string when you print?

  • Options
    hsuhsu Registered User regular
    Have you tried "git log"?

    I honestly haven't touched github in a long time and generally do most of my stuff from a terminal so I'm not familiar with any GUI tools.
    I use git log all the time, but it's annoying as hell, compared to gerrit's web interface. Once you get used to a good GUI web interface, you'll only drop into the command line when you are forced to do so. Being able to quickly scan the last 100 commit comments, then drill down into a side by side diff by just clicking on a comment, that will speed up your workflow by a factor of 10 compared to command line tools doing the same thing.

    iTNdmYl.png
  • Options
    InfidelInfidel Heretic Registered User regular
    Speaking of, what's a good tool for generating visual diffs like you get on github/bitbucket, but without the repo?

    I want to take an arbitrary git diff and share it for review externally, without giving anyone access to the repo online.

    OrokosPA.png
  • Options
    zeenyzeeny Registered User regular
    edited May 2016
    hsu wrote: »
    Have you tried "git log"?

    I honestly haven't touched github in a long time and generally do most of my stuff from a terminal so I'm not familiar with any GUI tools.
    I use git log all the time, but it's annoying as hell, compared to gerrit's web interface. Once you get used to a good GUI web interface, you'll only drop into the command line when you are forced to do so. Being able to quickly scan the last 100 commit comments, then drill down into a side by side diff by just clicking on a comment, that will speed up your workflow by a factor of 10 compared to command line tools doing the same thing.

    I feel significantly slower using github/gitlab diffs instead of cli. I haven't used gerrit for reviews and maybe its interface is better, but personally I feel more productive with glol / glgp .

    Infid: What are you looking for? Do you mean specifically side by side visual diffs? Diff has a side-by-side option(-y), but I am not sure how this will pipe to a file.....

    Edit: Also, unless I have a strong suspicion of where a bug was introduced, I prefer bisect to the usual log hunt.

    zeeny on
  • Options
    MahnmutMahnmut Registered User regular
    BeyondCompare can produce a side-by-side diff in several formats, including HTML.

    Steam/LoL: Jericho89
  • Options
    hsuhsu Registered User regular
    edited May 2016
    Github's web interface is way worse than gerrit's web interface.

    In gerrit, you can see the entire file side by side, with line differences highlighted, pre-scrolled to the first difference, with colored markers on the vertical scrollbar to track diffs not currently visible. It even highlights character by character differences, if only a few characters differ in the line.

    The diff for github is just the linux diff command split side by side instead of top by bottom, so you only see 3 lines of above / below context for each change, skipping all other context, with no easy way to see a full file side by side, to get a clear picture of context.

    From the gerrit wiki page, here's an example of how gerrit's diff works. Note that this is just 1 or 2 links away from gerrit's commit log list page. Note the built in commit comments by owner as mouse over text. The "skipped" lines can be filled in by clicking on it.
    user-review-ui-side-by-side-diff-screen.png

    hsu on
    iTNdmYl.png
  • Options
    InfidelInfidel Heretic Registered User regular
    That's the kind of thing I want to generate, yes. A side by side diff that is meant to be consumed by a human rather than a machine.

    Can Gerrit do that without hosting the repo? I'd prefer a tool that doesn't require a "server" although I could go through all that if I had to.

    The end result is I want a package of HTML files that represents the whole changeset from one tag to another, that I can throw over the fence in an email zip. It's for a regulatory body review and so I want to keep all the commit level noise out of things. "Version A to version B, here is every change in detail so that you can sift it for backdoors." They don't care about the functional / logical breakdown of changes as much.

    OrokosPA.png
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Gerrit requires access to the repo, and is meant for interactive single change reviews really

    You get that by uploading a standard patch onto a base revision

    You could upload the diff output from head to the old version to get something like what you want

  • Options
    InfidelInfidel Heretic Registered User regular
    Phyphor wrote: »
    Gerrit requires access to the repo, and is meant for interactive single change reviews really

    You get that by uploading a standard patch onto a base revision

    You could upload the diff output from head to the old version to get something like what you want

    Access to the repo isn't a problem so long as it can generate an access-less diff to export out.

    What would be best to get started with that? I can definitely make a patch but I'd like to have the full contents in the diff.

    OrokosPA.png
  • Options
    PhyphorPhyphor Building Planet Busters Tasting FruitRegistered User regular
    Gerrit works by pushing a normal patch to a special refs/for/branch-name thing that the gerrit server understands. So you'd set up a branch on your origin at the base, create a local branch tracking that branch, cherry-pick in the diff between the head and the base and then push that to gerrit, which will create the patch on its server. The non-changed portions will still be available for context if people want it because it knows the base revision

    At least this is the way I've always seen gerrit used, I don't know if it operates any other ways

  • Options
    EchoEcho ski-bap ba-dapModerator mod
    Debugging someone else's React stuff.

    jQuery date picker works on one page. On another page it won't let you enter date manually. Uses the same component.

    Somebody shoot me.

  • Options
    SaerisSaeris Borb Enthusiast flapflapflapflapRegistered User regular
    Does the other page have a keyup/keydown/keypress/input handler bound that's calling `event.preventDefault()`?

    borb_sig.png
  • Options
    EchoEcho ski-bap ba-dapModerator mod
    Saeris wrote: »
    Does the other page have a keyup/keydown/keypress/input handler bound that's calling `event.preventDefault()`?

    It shouldn't, but I haven't looked everywhere yet.

    What happens is that I can't enter anything at all manually, and the datepicker instead instantly tells me the date is invalid. So something gets picked up.

  • Options
    IcyLiquidIcyLiquid Two Steaks Montreal, QuebecAdministrator, Vanilla Staff vanilla
    So, I have been building something. So far it has taken about 3 months all told, doing a little bit every few weekends or so. Much of the time has been spent either waiting for parts to be delivered, or sitting in the bath trying to think in 3 dimensions and plan the hardware.

    I present: Smart Mirror, IcyLiquid Edition
    kj3fltvyduhr.jpg
    alwb3fmq0pao.jpg

    The software consists of a web app built with ReactJS (https://facebook.github.io/react/), connected to a websocket server written in PHP using Ratchet (https://socketo.me). There is another socket client running code that catches events from a hardware motion sensor, so the mirror can gracefully "sleep" when no one is looking at it.

    The server has various "data sources" configured so it can poll regularly for updated weather, news, calendar events, traffic conditions, etc, and push those updates asynchronously to the UI via the websocket connection. I've built it so that multiple clients are supported, with the goal of expanding the number and type of connected devices in my house.

    Overall pretty happy with it, I'm going to hang it from the ceiling using some cement anchors/hooks and 2 steel cables.

    Heavily inspired (both in terms of concept, and the current iteration of the UI) by this Medium post https://medium.com/@maxbraun/my-bathroom-mirror-is-smarter-than-yours-94b21c6671ba#.9u7tc4s9d

  • Options
    LD50LD50 Registered User regular
    That is really cool.

  • Options
    bowenbowen How you doin'? Registered User regular
    you should make it touch screen and implement a whole UI for it

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    IcyLiquidIcyLiquid Two Steaks Montreal, QuebecAdministrator, Vanilla Staff vanilla
    That's planned for a smaller, dedicated wall mounted device.

    The mirror is intentionally non interactive because of finger smudges. I've thought about putting a gesture sensor on there, but I think I like it being purely an output device.

  • Options
    bowenbowen How you doin'? Registered User regular
    I wonder if that material they use for track pads is transparent in some form? That'd make a great "touch screen" feel.

    not a doctor, not a lawyer, examples I use may not be fully researched so don't take out of context plz, don't @ me
  • Options
    LD50LD50 Registered User regular
    I'm disappointed in how few of you used the Shiny reaction for Icy's post.

This discussion has been closed.