Club PA 2.0 has arrived! If you'd like to access some extra PA content and help support the forums, check it out at patreon.com/ClubPA
The image size limit has been raised to 1mb! Anything larger than that should be linked to. This is a HARD limit, please do not abuse it.
Our new Indie Games subforum is now open for business in G&T. Go and check it out, you might land a code for a free game. If you're developing an indie game and want to post about it, follow these directions. If you don't, he'll break your legs! Hahaha! Seriously though.
Our rules have been updated and given their own forum. Go and look at them! They are nice, and there may be new ones that you didn't know about! Hooray for rules! Hooray for The System! Hooray for Conforming!

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

19293959798100

Posts

  • bowenbowen How you doin'? Registered User regular
    oh yeah I thought you didn't want to use len either. Hm!

    Ladies.
    iTunesIsEvil
  • Jimmy KingJimmy King Registered User regular
    Drank tequila, played video games, wrote code.
    Infidel wrote: »
    Also, React stuff:

    We did our first app with Flux. I later did our admin portal / BI using Redux.

    Oh my god, just do yourselves a favour and skip Flux. Redux is all the good stuff with none of the crap, and has a great ecosystem now with router/tools.

    I mean, you get a nice debug frame for all your actions and state changes, with history and replay and persistence for reloads, all with one line of code to tie it in.

    https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en

    So good.
    I've been busy as fuck, so late to the game here, but this is what all of our front end guys have been saying for awhile now. We hired (and kept for awhile, but recently lost) a top notch React guy. While dealing with all of the crap for flux to make it easier he looked at his code on one of our projects and said "Oh, I've recreated Redux. Let's just use that." and that is what our react stuff has been using with great success since then.

    Infidelecco the dolphin
  • ShivahnShivahn Unaware of her barrel shifter privilege Eastern coastal temptressRegistered User regular
    edited May 2016
    bowen wrote: »
    oh yeah I thought you didn't want to use len either. Hm!

    Yeah, I misspoke - I said I knew that len(message) would give the right number for ASCII messages because in my head I was running it on the actual message (the normal utf-8 string), not the byte array whose size matters. It didn't occur to me to just check the length of the byte array, rather than asking the size.

    Shivahn on
    bowen
  • InfidelInfidel Heretic Registered User regular
    Jimmy King wrote: »
    Drank tequila, played video games, wrote code.
    Infidel wrote: »
    Also, React stuff:

    We did our first app with Flux. I later did our admin portal / BI using Redux.

    Oh my god, just do yourselves a favour and skip Flux. Redux is all the good stuff with none of the crap, and has a great ecosystem now with router/tools.

    I mean, you get a nice debug frame for all your actions and state changes, with history and replay and persistence for reloads, all with one line of code to tie it in.

    https://chrome.google.com/webstore/detail/redux-devtools/lmhkpmbekcpmknklioeibfkpmmfibljd?hl=en

    So good.
    I've been busy as fuck, so late to the game here, but this is what all of our front end guys have been saying for awhile now. We hired (and kept for awhile, but recently lost) a top notch React guy. While dealing with all of the crap for flux to make it easier he looked at his code on one of our projects and said "Oh, I've recreated Redux. Let's just use that." and that is what our react stuff has been using with great success since then.

    Yeah, this is exactly what I did.

    Was sitting with my devs and going over things and pointed them at Redux and went "so, you know that shit we did this past week? Yeah, I just made us reinvent redux. :rotate:"

    OrokosPA.png
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • NogsNogs Crap, crap, mega crap. Registered User regular
    Ya Redux is awesome.

    Though MobX is also legit and takes a pretty different approach. Worth looking into, if only for educational reasons.

    rotate.jpg
    PARKER, YOU'RE FIRED! <-- My comic book podcast! Satan look here!
    Infidel
  • zeenyzeeny Registered User regular
    You can start using redux++ today guys! https://github.com/Day8/re-frame ... (which also happens to pre-date redux)

  • KakodaimonosKakodaimonos Registered User regular
    So....

    Who here knows anything about CUDA asynchronous streams?

  • bowenbowen How you doin'? Registered User regular
    So....

    Who here knows anything about CUDA asynchronous streams?

    I think @ethea knows a bit

    Ladies.
  • mightyjongyomightyjongyo Registered User regular
    My coworkers do!

    ....Unfortunately I do not.

  • TofystedethTofystedeth veni, veneri, vamoosi 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
    Carpy
  • 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.

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

    Magic Box
    Academician Prokhor "Phyphor" Zakharov, Chief Scientist of China, Provost of the University of Planet - SE++ Megagame
  • TofystedethTofystedeth veni, veneri, vamoosi 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
  • InfidelInfidel Heretic Registered User regular
    Hey, I too would recommend you have it if it was required!

    OrokosPA.png
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
    jjae2123
  • 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
  • EchoEcho Moderator 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
    Echo wrote: »
    Let they who have not posted about their balls in the wrong thread cast the first stone.
  • 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.

    Ladies.
  • urahonkyurahonky 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?

  • KakodaimonosKakodaimonos Registered User regular
    Asynchronous memory streams and compute streams is the tits in CUDA

    Ethea
  • urahonkyurahonky 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?

  • 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

    Ladies.
  • urahonkyurahonky 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
  • 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.

    Ladies.
  • urahonkyurahonky 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.

  • 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
  • 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

    ecco the dolphinEcho
  • iTunesIsEviliTunesIsEvil 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
  • 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.jpgsteam~tinythumb.png
  • iTunesIsEviliTunesIsEvil Registered User regular
    repr() definitely gets me a heck of a lot closer. Thank you @End!

  • urahonkyurahonky 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?

  • 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
  • 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
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • 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
  • MahnmutMahnmut Registered User regular
    BeyondCompare can produce a side-by-side diff in several formats, including HTML.

    Steam/LoL: Jericho89
  • 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
  • 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
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • 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

    Magic Box
    Academician Prokhor "Phyphor" Zakharov, Chief Scientist of China, Provost of the University of Planet - SE++ Megagame
  • 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
    Play D&D 4e? :: Check out Orokos and upload your Character Builder sheet! :: Orokos Dice Roller
    The PhalLounge :: Chat board for Critical Failures IRC! :: #CriticalFailures and #mafia on irc.slashnet.org
  • 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

    Magic Box
    Academician Prokhor "Phyphor" Zakharov, Chief Scientist of China, Provost of the University of Planet - SE++ Megagame
  • EchoEcho Moderator 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.

    Echo wrote: »
    Let they who have not posted about their balls in the wrong thread cast the first stone.
This discussion has been closed.