How can I interact with the Github API using Perl6? - http

I want to use the Github API in a script and I want to use it as an experience to get better using Perl6. However, I cannot even get a simple proof of concept to work.
Through some testing I realized that Github requires that you supply a valid user agent so I turned to HTTP::UserAgent. No matter what I try, I get the following error:
Internal Error: 'server returned no data'
in block at /Applications/Rakudo/share/perl6/site/sources/FD28A8E22DFE16B70B757D9981C7B6C25543060C (HTTP::UserAgent) line 259
in any at /Applications/Rakudo/share/perl6/site/precomp/F91BAB44DF15C5C298C627DD5E0F9D819ED79939.1517344679.60204/FD/FD28A8E22DFE16B70B757D9981C7B6C25543060C line 1
in method new at /Applications/Rakudo/share/perl6/site/sources/DDDD4497B34FC81BC1F5FF467999BC4DA2FA1CEB (HTTP::Response) line 25
in method get-response at /Applications/Rakudo/share/perl6/site/sources/FD28A8E22DFE16B70B757D9981C7B6C25543060C (HTTP::UserAgent) line 291
in method request at /Applications/Rakudo/share/perl6/site/sources/FD28A8E22DFE16B70B757D9981C7B6C25543060C (HTTP::UserAgent) line 159
in method get at /Applications/Rakudo/share/perl6/site/sources/FD28A8E22DFE16B70B757D9981C7B6C25543060C (HTTP::UserAgent) line 102
in method get at /Applications/Rakudo/share/perl6/site/sources/FD28A8E22DFE16B70B757D9981C7B6C25543060C (HTTP::UserAgent) line 105
in block <unit> at reporter.pl6 line 12
There is even an example in the the repo that doesn't seem to work for me.
#!/usr/bin/env perl6
use v6;
use HTTP::UserAgent;
my $ua = HTTP::UserAgent.new;
$ua.timeout = 1;
my $response = $ua.get('https://github.com');
if $response.is-success {
say $response.content;
} else {
die $response.status-line;
}
Any tips on how to connect to Github via Perl 6? I really love many aspects of the language but this type of thing is discouraging.
EDIT: I went on #perl6 irc and no one was able to reproduce this on other OSes. I got it to work on Debian. The issue seems to be with OS X

Although in alpha stage, WebServices::GitHub is perfectly serviceable. You can use it to download user information, or you can use my fork if you want to interact with issues. This program, for instance, is used to download some issues from a particular repo.

Related

How to fetch part of read only message in imap?

What is the exact FETCH command that is used to read only the text body of message 1?
I tried this below and variations of it but it says BAD Error in IMAP and Unknown command.
**FETCH 1:1 (BODY[HEADER.FIELDS (TEXT)]**
Im executing this in Ubuntu on a terminal for my upcoming exam.
Try _ FETCH 1 (BODY[TEXT]). Why do you have asterisks around your command? You find the possible arguments to the FETCH command in RFC 3501. You can also play around with the interactive tool that I wrote.

First token could not be read or is not the keyword 'FoamFile' in OpenFOAM

I am a beginner to programming. I am trying to run a simulation of a combustion chamber using reactingFoam.
I have modified the counterflow2D tutorial.
For those who maybe don't know OpenFOAM, it is a programme built in C++ but it does not require C++ programming, just well-defining the variables in the files needed.
In one of my first tries I have made a very simple model but since I wanted to check it very well I set it to 60 seconds with a 1e-6 timestep.
My computer is not very powerful so it took me for a day aprox. (by this I mean I'd like to find a solution rather than repeating the simulation).
I executed the solver reactingFOAM using 4 processors in parallel using
mpirun -np 4 reactingFOAM -parallel > log
The log does not show any evidence of error.
The problem is that when I use reconstructPar it works perfectly but then I try to watch the results with paraFoam and this error is shown:
From function bool Foam::IOobject::readHeader(Foam::Istream&)
in file db/IOobject/IOobjectReadHeader.C at line 88
Reading "mypath/constant/reactions" at line 1
First token could not be read or is not the keyword 'FoamFile'
I have read that maybe some files are empty when they are not supposed to be so, but I have not found that problem.
My 'reactions' file have not been modified from the tutorial and has always worked.
edit:
Sorry for the vague question. I have modified it a bit.
A typical OpenFOAM dictionary file always contains a Foam::Istream named FoamFile. An example from a typical system/controlDict file can be seen below:
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "system";
object controlDict;
}
During the construction of the dictionary header, if this Istream is absent, OpenFOAM ceases its operation by raising an error message that you have experienced:
First token could not be read or is not the keyword 'FoamFile'
The benefit of the header is possibly to contribute OpenFOAM's abstraction mechanisms, which would be difficult otherwise.
As mentioned in the comments, adding the header entity almost always solves this problem.

Openmdao 1.7.3 error with unicode variables in python2

In the file openmdao/core/problem.py on lines such as 1619 and 1638, it checks if a variable is a string by using:
isinstance(inp, str)
however, this will return false if inp is unicode in python2, and eventually cause the program to raise an exception. In python2, the correct syntax is:
isinstance(inp, basestring)
I understand that basestring is not available in python 3, but there are several ways to write python 2/3 compatible code. Can this be fixed?
feel free to submit a pull request, but please add a test that checks the new functionality

Silencing ChromeDriver.exe logging

I am running ruby unit tests against Chrome using watir-webdriver. Whenever a test is run and chromedriver.exe is launched output similar to below appears:
Started ChromeDriver
port=9515
version=26.0.1383.0
log=C:\Home\Server\Test\Watir\web\chromedriver.log
[5468:8796:0404/150755:ERROR:accelerated_surface_win.cc(208)] Reseting D3D device
[5468:8996:0404/150758:ERROR:textfield.h(156)] NOT IMPLEMENTED
[WARNING:..\..\..\..\flash\platform\pepper\pep_module.cpp(63)] SANDBOXED
None of this impacts the correct functioning of the tests, but as one might imagine the appearance of "ERROR" and "WARNING" might be rather confusing to, for example, parsing rules in Jenkins looking for failures. Sure I can get really fancy with regular expression in the parsing rules, but it would be really nice to turn off this verbose and unnecessary logging on the part of chromedriver.exe. I have seen many mentions of this searching for an answer. No one has come up with a solution. Yes, chromedriver possibly has a "--silent" option, but there seems to be no way to pass that to the executable. Code similar to below is supposed to work, but has zero effect as far as I can see. Any ideas?
profile = Selenium::WebDriver::Chrome::Profile.new
profile['--cant-make-any-switches-work-here-how-about-you'] = true
browser = Watir::Browser.new :chrome, :profile => profile, :switches => %w[--ignore-certificate-errors --disable-extensions --disable-popup-blocking --disable-translate--allow-file-access]
Here's help for anyone else searching
Find ...selenium\webdriver\chrome\service.rb
Path start may differ on your system
And I added "-silent" to the passed parameters .... However, this silenced everything but the error/warning messages.
def initialize(executable_path, port)
#uri = URI.parse "http://#{Platform.localhost}:#{port}"
server_command = [executable_path, " -silent", "--port=#{port}"]
#process = ChildProcess.build(*server_command)
#socket_poller = SocketPoller.new Platform.localhost, port, START_TIMEOUT
#process.io.inherit! if $DEBUG == true
end
set chromeOptions with key --log-level=3 this should shut it up
I was able to divert the hundreds, yes hundreds, of chrome driver log messages that were showing up in cucumber stdout by using the :service_log_path argument.
#browser = Watir::Browser.new :chrome, :service_log_path => 'chromedriver.out'
the '-silent', or '--silent', or ' -silent', or ' --silent' parameter suggested above did nothing when I added it to ...selenium\webdriver\chrome\service.rb. And having to tweak the gem itself is not a particularly viable solution.
I couldn't find a place to capture the chromedriver stderr and divert it to null (not to mention having to handle doing that in windows and in *nix/osx)
The driver should default to something way less verbose. In this case INFO is way too verbose as hundreds of log entries pop out as INFO, 90%+ of them identical.
At least the :service_log_path argument works most of them.
You can try -Dwebdriver.chrome.logfile="/dev/null" and/or -Dwebdriver.chrome.args="--disable-logging" to the options of java that runs selenium-server-standalone-what.ever.jar

abap runtime error program line too long

Good day. The programs function is to take an equipment number (or none), display that number with a description (or all) in alv, and then run IE03 should the user double click on
Program worked fine in client 110, but in 150 a runtime error happens. This morning I tried to make a new program with a shorter name (only lead I had), activated it (window popped up asking me to activate the previous version as well). That didn't work and now the original doesn't work in either.
The program "SAPLSKBH" is terminating because program line is too long, being 78 chars wide which is too much for the internal table "\FUNCTION=K_KKB_FIELDCAT_MERGE\DATA=L_ABAP_SOURCE[]"
It sounds like you are using REUSE_ALV_GRID_DISPLAY for output, is that correct?
Check you source code; somewhere you have a line that is more than 78 characters. The function K_KKB_FIELDCAT_MERGE takes the source code of your program to produce a structure that corresponds to the table/structure you give it. (In the old days, there was a limit of 78 characters width for a line of ABAP code, and this is an old function module).
You can alternatively build a field catalog yourself in code, rather than use this function.

Resources