Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
I'm using the command line curl

PHP code:
    public function get($get_resource, $get_filter = "limit=250")
    {
        // Set curl call details
        $get_curl = 'curl -v --request GET -H "Content-Type: application/json" -H "X-Auth-Client: my-auth-client-name" -H "X-Auth-Token: my-token" "https://api.mystore/v2/orders.json"';

        // Execute the curl call and decode the response
        $get_result = exec($get_curl);
        $get_result = json_decode($get_result);

        // Return the result data
        return $get_result;
    }

Adbot
ADBOT LOVES YOU

nielsm
Jun 1, 2009



Grump posted:

I'm using the command line curl

Okay yes that's a weird thing to do. Does anyone actually recommend ever doing that, if you aren't on the command line already?

Try using the API instead.
PHP code:
public function get($get_resource, $get_filter = "limit=250")
{
  $curl = curl_init("https://api.mystore/v2/orders.json");
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
    "Content-Type: application/json",
    "X-Auth-Client: my-auth-client-name",
    "X-Auth-Token: my-token"
  ));
  $json = curl_exec($curl);
  return json_decode($json);
}
Untested.

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
okay cool. Looks like this was the problem:

"Error:SSL certificate problem: self signed certificate in certificate chain"

I went ahead and added, which fixed it:

PHP code:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
Is there any way I can configure my local server to not do an SSL check at all?

Volguus
Mar 3, 2009

Grump posted:

okay cool. Looks like this was the problem:

"Error:SSL certificate problem: self signed certificate in certificate chain"

I went ahead and added, which fixed it:

PHP code:
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
Is there any way I can configure my local server to not do an SSL check at all?

Didn't you already do that by setting the SSL verify to 0?

teen phone cutie
Jun 18, 2012

last year i rewrote something awful from scratch because i hate myself
yeah I did, but I'd rather not write an extra line of code for every request I have to make. This isn't a production project, but rather me just learning.

Anyway, I just figured it out. Thanks!

Hughmoris
Apr 21, 2007
Let's go to the abyss!
I'm new to VCS and github but when viewing files on github, is there any way for it to display the "pretty" version?

For example: https://github.com/jonathanstowe/WebService-Soundcloud/blob/master/lib/WebService/Soundcloud.pm

It has all of the pod markups but its just displaying everything in raw text.

KernelSlanders
May 27, 2013

Rogue operating systems on occasion spread lies and rumors about me.

Hughmoris posted:

I'm new to VCS and github but when viewing files on github, is there any way for it to display the "pretty" version?

For example: https://github.com/jonathanstowe/WebService-Soundcloud/blob/master/lib/WebService/Soundcloud.pm

It has all of the pod markups but its just displaying everything in raw text.

That file is already syntax highlighted, which is what I would consider "pretty." By "pretty" do you mean formatted? Like the output of your PM file? Github supports that for markdown but I don't think it does for PM.

Hughmoris
Apr 21, 2007
Let's go to the abyss!

KernelSlanders posted:

That file is already syntax highlighted, which is what I would consider "pretty." By "pretty" do you mean formatted? Like the output of your PM file? Github supports that for markdown but I don't think it does for PM.

Ahh. Yes, formatted is the word I was looking for and it makes sense now that Github wouldn't format a .pm file.

ufarn
May 30, 2009
Does Bash have docstrings like Python or an `END` command like AviSynth after which you can write whatever, or what's the idiomatic way to escape a bunch of text in your files?

Nude
Nov 16, 2014

I have no idea what I'm doing.
Sadly the accepted way I think is just a series of hashtags per line:
code:
# An example
# Of a multiline
# Comment
You could use:
code:
: <<'DONTUSE'
Another way 
but I 
don't recommend it.
DONTUSE
You can replace DONTUSE with anything, END, COMMENT, etc. But I'm pretty sure most people consider this a hack, and recommend to stick with hashtags. I've only seen "production" bash for homebrew/github scripts tho, so this is just speaking from that experience. Perhaps there is a more official why that I missed.

nielsm
Jun 1, 2009



ufarn posted:

Does Bash have docstrings like Python or an `END` command like AviSynth after which you can write whatever, or what's the idiomatic way to escape a bunch of text in your files?

I think you may be confusing the Python multiline string syntax (that uses triple quotes) with the separate Python syntax of docstrings, which are a bare string as the first statement of a function. It just happens that multiline strings are very often used for docstrings too.

Anyway, Nude in the post above already shows off the HEREDOC syntax:
Bash code:
cat > somefile.txt <<'DOCEND'
This text is pasted verbatim into the file,
since that's what the redirection does.
DOCEND
You can use whatever for the ending symbol, DOCEND in this example. It just needs to be a string that doesn't occur in the quoted data.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I've been thinking about improving software quality and came across QuickCheck, aka, property-based testing. It seems like a neat idea. Hypothesis is a python (and java?) implementation.

Just looking for any thoughts about it...downsides, upsides, anything you want to say about it.

redleader
Aug 18, 2005

Engage according to operational parameters

Thermopyle posted:

I've been thinking about improving software quality and came across QuickCheck, aka, property-based testing. It seems like a neat idea. Hypothesis is a python (and java?) implementation.

Just looking for any thoughts about it...downsides, upsides, anything you want to say about it.

I've never had a chance to use property-based myself, but fellow forums user MononcQc has a neat blog post on it, and is writing a book on the subject (in Erlang, but a lot of the theory should apply to other languages).

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

redleader posted:

I've never had a chance to use property-based myself, but fellow forums user MononcQc has a neat blog post on it, and is writing a book on the subject (in Erlang, but a lot of the theory should apply to other languages).

That's interesting.

This part:

quote:

The initial state of the system, as a data structure
The list of commands that can be run against an interface
The preconditions for these commands to be valid (what operation orders are possible or not)
The state transitions that these commands could enact (the add_user(...) function should mean that my model now contains the user if it didn't exist)
The postconditions for each command according to the current state (the function should return {ok, UserId} if the user didn't exist)

Made me think of Redux...

raminasi
Jan 25, 2005

a last drink with no ice
We use it at work, in addition to other tests. The biggest challenge for me has been figuring out how to get people to move from “that’s neat” to “that’s neat, I’m gonna spend some time to learn how to do it myself.” And obviously, coming up with properties to test can be tricky.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Thermopyle posted:

I've been thinking about improving software quality and came across QuickCheck, aka, property-based testing. It seems like a neat idea. Hypothesis is a python (and java?) implementation.

Just looking for any thoughts about it...downsides, upsides, anything you want to say about it.

That sounds a lot like what Microsoft's Pex was/is, but I'm not confident it's the same.

Sad Panda
Sep 22, 2004

I'm a Sad Panda.
I do matched betting (UK based, perfectly legal). One part of this has casino offers where you get to play a silly amount of either slots or blackjack. Blackjack has a higher EV, but has the tedium of playing thousands of hands of blackjack. Considering how to play a hand is just following the well-established optimal blackjack strategy it seems like something that should be very easy to make a bot for.

Is this something that could be done with a coding language like Autohotkey? My assumption is the biggest challenge will be OCR on the image to determine what cards the player and dealer both have. Past that, it's just a matter of clicking in a certain area to double/hit/stand/split.

I've just started to learn Python (almost finished Learn Python 3 the Hard Way) but I guess this is way past my level.

baquerd
Jul 2, 2007

by FactsAreUseless

Sad Panda posted:

I do matched betting (UK based, perfectly legal). One part of this has casino offers where you get to play a silly amount of either slots or blackjack. Blackjack has a higher EV, but has the tedium of playing thousands of hands of blackjack. Considering how to play a hand is just following the well-established optimal blackjack strategy it seems like something that should be very easy to make a bot for.

Is this something that could be done with a coding language like Autohotkey? My assumption is the biggest challenge will be OCR on the image to determine what cards the player and dealer both have. Past that, it's just a matter of clicking in a certain area to double/hit/stand/split.

Making a bot to gamble for you is likely illegal. Besides, the EV has to go to the house over thousands of hands...?

That said, OCR may or may not be the way to go, you could also intercept the process memory in some manner to read the variables directly.

Dr. Stab
Sep 12, 2010
👨🏻‍⚕️🩺🔪🙀😱🙀
I'd assume online blackjack would reshuffle after every hand and eliminate the edge from counting cards.

JawnV6
Jul 4, 2004

So hot ...
It's not counting cards. The +EV is coming from the casino offers, not grinding out the games. AHK has all the functionality you would need to automate this. You know exactly where the cards show up, you can match images against those positions, then feed in the clicks. Wholly doable.

That said, you're not the first person to figure out this angle. It would not surprise me if trying to automate it would be illegal, against the terms of service, or otherwise not safe to execute long-term. Online poker games used to take extreme measures to prevent this sort of thing, intentionally obscuring their input to text-drawing syscalls and making pattern-matching difficult. Even if you're clever enough to deal with making the bot "look" like a person (randomize click location, randomize delays between clicks, go off-chart once an hour, etc.) there's still the threat of an administrator opening a private chat and seeing you continue to 'play' while ignoring them.

TooMuchAbstraction
Oct 14, 2012

I spent four years making
Waves of Steel
Hell yes I'm going to turn my avatar into an ad for it.
Fun Shoe
There's also the issue of, how much is your time worth? Is there something actually productive you could be working on instead of writing a bot to make marginal amounts of money gambling?

downout
Jul 6, 2009

JawnV6 posted:

...That said, you're not the first person to figure out this angle. ...

This is the main point. It's doable, but only from a "is this possible?" point of view. It might be illegal, so the answer is "yes, but probably not worth it".

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

If you find beer money a useful motivation to learning programming, there's the tried-and-true path of making a video-game bot. Definitely not illegal (though definitely bannable.)

Seaside Loafer
Feb 7, 2012

Waiting for a train, I needed a shit. You won't bee-lieve what happened next

Dont see why it would be illegal. Blackjack has solid rules that are common knowledge on what you must do for maximum win chance. Its always hit on less than 17 or something like that. Just taking the hassle out of doing it yourself.

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

NihilCredo posted:

If you find beer money a useful motivation to learning programming, there's the tried-and-true path of making a video-game bot. Definitely not illegal (though definitely bannable.)

i wouldn’t say definitely

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

Seaside Loafer posted:

Dont see why it would be illegal. Blackjack has solid rules that are common knowledge on what you must do for maximum win chance. Its always hit on less than 17 or something like that. Just taking the hassle out of doing it yourself.

You don't see why the site would want to ban people from botting?

Why do you think they give people those sweetheart deals in the first place?

Seaside Loafer
Feb 7, 2012

Waiting for a train, I needed a shit. You won't bee-lieve what happened next

Jabor posted:

You don't see why the site would want to ban people from botting?

Why do you think they give people those sweetheart deals in the first place?
Might be against the sites terms and conditions but illegal is just silly. Everyone knows the blackjack rules.

Volguus
Mar 3, 2009

Those people were selling their bots. I think the rules are quite more relaxed if you use it just for yourself from a legal point of view. But I wouldn't try it though.

Plorkyeran
Mar 22, 2007

To Escape The Shackles Of The Old Forums, We Must Reject The Tribal Negativity He Endorsed
The HonorBuddy ruling isn't particularly applicable to something which isn't distributed to other people, especially if you stop once banned. The damages they successfully argued for were the negative impacts of every single player in a game being a bot plus the time they had to invest into building better anti-botting technology to detect it.

Sad Panda
Sep 22, 2004

I'm a Sad Panda.

Dr. Stab posted:

I'd assume online blackjack would reshuffle after every hand and eliminate the edge from counting cards.

Nothing as complex as card counting. Simply OCR to save me having to manually click through 1000s of hands of BJ.


JawnV6 posted:

That said, you're not the first person to figure out this angle. It would not surprise me if trying to automate it would be illegal, against the terms of service, or otherwise not safe to execute long-term. Online poker games used to take extreme measures to prevent this sort of thing, intentionally obscuring their input to text-drawing syscalls and making pattern-matching difficult. Even if you're clever enough to deal with making the bot "look" like a person (randomize click location, randomize delays between clicks, go off-chart once an hour, etc.) there's still the threat of an administrator opening a private chat and seeing you continue to 'play' while ignoring them.

Definitely not thinking I'm the first person. Surprised I didn't find anything with a Google. Mainly seems to bring up some game where you pickpocket a bandit. I accept it's quite probably in a grey area, as matched betting in general is. I understand where you're coming from with the private chat angle, but that never happens on betting sites. It did when I used to macro in UO/FFXI however.


NihilCredo posted:

If you find beer money a useful motivation to learning programming, there's the tried-and-true path of making a video-game bot. Definitely not illegal (though definitely bannable.)

Definitely. I'm trying to learn Python anyway, so this could be a project to learn with. Googling around I found https://code.tutsplus.com/tutorials/how-to-build-a-python-bot-that-can-play-web-games--active-11117 although I'm on OS X so would rather make it work without having to load up Parallels.

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)

Sad Panda posted:

Is this something that could be done with a coding language like Autohotkey? My assumption is the biggest challenge will be OCR on the image to determine what cards the player and dealer both have. Past that, it's just a matter of clicking in a certain area to double/hit/stand/split.

I did this exact same thing years ago using C# and everything turned out ok, and I'm in the US. I learned how to make image classifiers too.

AHK is probably want you want to do though.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Seaside Loafer posted:

Might be against the sites terms and conditions but illegal is just silly. Everyone knows the blackjack rules.

Lookit this guy thinking there are no silly laws. What a maroon.

Combat Pretzel
Jun 23, 2004

No, seriously... what kurds?!
Someone intimately familiar with Qt and specifically the QTabWidget and its QTabBar? I'd like to shift the tabs a bit to the side for visual reasons, but the only way this works is using the "left" stylesheet attribute, like pretty much any tutorial says. But when I do that, a corner widget will overlap the controls, when things start getting cramped (say resizing window very small). It's like it shifts the tab buttons but not the layout rect. if I try to get margins, borders or paddings on the QTabBar, it gets flat out ignored.

Essentially this is my problem:



If I remove the shift via left-attribute, the overlap goes away.

Halp?

LP0 ON FIRE
Jan 25, 2006

beep boop
Update:
I changed this line:
set newFile to POSIX file path1
to:
set newFile to (path1 as POSIX file)

I don't know why, but it works :confused:

Original question:

Stupid AppleScript headache:

I'm trying to get a variable to work in conjunction with the file path. I'm using "titleVal" with path1. titleVal has been verified to be a string. When I use it, or any other string var, it skips over the rest of the code. No error. It's in a loop, so it continues the loop. If I have no variable in there, everything works fine.

I've tried "quoted form of titleVal" with still the same problem.

code:

set myString to source of current tab
set path1 to "/Users/Admin/Desktop/download captions/downloadedCaptions/" & titleVal & ".srt"
set newFile to POSIX file path1
												
open for access newFile with write permission
write myString to newFile
close access newFile		
						
exit repeat

LP0 ON FIRE fucked around with this message at 19:52 on Jan 10, 2018

Peristalsis
Apr 5, 2004
Move along.
I work in a Ruby on Rails shop, and we use a local GitLab instance for issue tracking, merge requests, etc. We've been doing code reviews by assigning merge requests to other developers, who look over the changes, comment on them, assign them back, etc. It's not a great system, for a few reasons, and I'm wondering what recommendations people have for better code review tools. This could be either a GitLab add-in, or something completely different that we integrate with our git repository in some way. It's even possible we could abandon GitLab entirely if some other suite works as well for issue tracking, and better for code reviews. It doesn't have to be free, though that would be nice (and would need at least a free trial period to check out).

leper khan
Dec 28, 2010
Honest to god thinks Half Life 2 is a bad game. But at least he likes Monster Hunter.

Peristalsis posted:

I work in a Ruby on Rails shop, and we use a local GitLab instance for issue tracking, merge requests, etc. We've been doing code reviews by assigning merge requests to other developers, who look over the changes, comment on them, assign them back, etc. It's not a great system, for a few reasons, and I'm wondering what recommendations people have for better code review tools. This could be either a GitLab add-in, or something completely different that we integrate with our git repository in some way. It's even possible we could abandon GitLab entirely if some other suite works as well for issue tracking, and better for code reviews. It doesn't have to be free, though that would be nice (and would need at least a free trial period to check out).

GitHub?

spiritual bypass
Feb 19, 2008

Grimey Drawer
UpSource looks cool and JetBrains IDEs have great code analysis features

Beef Hardcheese
Jan 21, 2003

HOW ABOUT I LASH YOUR SHIT


Are software requirements specifications documents generally considered "secret" or "protected" information? I'm starting to work on putting one together and I've found a lot of templates / samples / guides, but I'd like to at least take a look at one that was actually used. (I'm actually looking for the SRS for a specific piece of software that's open source, but the people involved with it are in the middle of a major upgrade and I'd prefer not to get on their bad side at a time like this).

rjmccall
Sep 7, 2007

no worries friend
Fun Shoe
GitHub’s code review tool is pretty solid now that they’ve added the ability to batch comments. It’s about 80% of what I’d want from an ideal tool and definitely good enough for typical use.

I use Phabricator on a different project, and while the code-review tool is theoretically slightly better, it’s also less stable (it loves to wedge itself and force a reload if you do a lot of comment-editing) and doesn’t handle stale comments as elegantly. On the other, its email interactions are quite a bit better, if that’s something you care about.

I use BitBucket on yet another project. It’s... acceptable, a lot like GitHub but without many of the little improvements, most significantly batching comments.

Adbot
ADBOT LOVES YOU

Peristalsis
Apr 5, 2004
Move along.


rt4 posted:

UpSource looks cool and JetBrains IDEs have great code analysis features


rjmccall posted:

GitHub’s code review tool is pretty solid now that they’ve added the ability to batch comments. It’s about 80% of what I’d want from an ideal tool and definitely good enough for typical use.

I use Phabricator on a different project, and while the code-review tool is theoretically slightly better, it’s also less stable (it loves to wedge itself and force a reload if you do a lot of comment-editing) and doesn’t handle stale comments as elegantly. On the other, its email interactions are quite a bit better, if that’s something you care about.

I use BitBucket on yet another project. It’s... acceptable, a lot like GitHub but without many of the little improvements, most significantly batching comments.

Thanks for the suggestions - it turns out that at least one of the other programmers is pretty frustrated with GitLab's code reviews, too. I'll take a look at GitHub for sure, and maybe one or two of the other suggestions. I think my supervisor is kind of interested in Jira, so I should probably look into its capabilities so that I know what I'm dealing with if he tries to convince everybody that it's the best thing ever.

---

Beef Hardcheese posted:

Are software requirements specifications documents generally considered "secret" or "protected" information? I'm starting to work on putting one together and I've found a lot of templates / samples / guides, but I'd like to at least take a look at one that was actually used. (I'm actually looking for the SRS for a specific piece of software that's open source, but the people involved with it are in the middle of a major upgrade and I'd prefer not to get on their bad side at a time like this).

In general, I'd assume so. That said, if you're doing this for your employer, they should be able to provide you with some older examples of what they're looking for, and asking for some is a very reasonable request for you to make. My experience is that they vary quite widely in style and quality even within an organization, so I'd also suggest that you not make a mountain out of a molehill. If it comes down to it, just do your best and go with it. Very few places will fire you because someone thinks your first spec document should have been better.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply