How to set language on highcharts.client.Chart - gwt

HOW does one set the language on org.moxieapps.gwt.highcharts.client.Chart
setting the Highcharts.options (in Java) as:
Highcharts.Options options = new Highcharts.Options();
options.setGlobal(new Global().setUseUTC(false));
String[] cat = new String[] {"Jan.", "Fev.", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Set.", "Out.", "Nov.", "Dez."} ;
options.setLang(new Lang().setMonths(cat));
Highcharts.setOptions(options);
has NO effect. Remains in English.
trying to set:
chart.getXAxis()
.setCategories("Jan.", "Fev.", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Set.", "Out.", "Nov.", "Dez.");
fails:
--> Chromium fails:
V8 error: Allocation failed - process out of memory (invalid array length). Current memory usage: 890 MB
--> Firefox complains of a script error
Fails even using documented example of:
chart.getXAxis().setCategories(....)
HELP please!

Lol!
I needed to
options.setLang(new Lang().setShortMonths(cat));
!!!

Related

Keep getting 'Unexpected identifier' when running tests

I am trying to copy a tutorial for a Wordle solving bot but its just not going well. whenever I try to run a test on the code it doesn't work at certain points, I'll either get 'Uncaught SyntaxError: Unexpected identifier'. I'm doing this on UIlicious.
Here's what I've got so far:
I.goTo("https://www.powerlanguage.co.uk/wordle/")
I.click("reject")
I.see("Guess the Wordle")
I.click('/html/body', 40, 80)
let guessWord = null
for(Let r=0 ; r<6 ; ++r) {
guessWord = solver.suggestWord(gameState)
I.type(guessWord);
I.pressEnter()
I.wait(2)
}
let rowList = document.querySelector("game-app").shadowRoot. //
querySelector("game-theme-manager"). //
querySelector("#board").querySelectorAll("game-row");
you are probably referring to the article I wrote here : https://uilicious.com/blog/automate-wordle-via-uilicious/
This test script, is designed specifically to use uilicious.com, so you will need to edit and run it through the platform.
You can do so via the snippet here : https://snippet.uilicious.com/test/public/N5qZKraAaBsAgFuSN8wxCL
If you have syntax error there, do let me know with a snippet link - and I will try to help you respectively.
Also the snippet you provided so far, excludes the "solver" class which was initialised much further down.

BPF Ring Buffer Invalid Argument (-22)?

I wanted to use eBPF's latest map, BPF_MAP_TYPE_RINGBUF, but I can't find much information online on how I can use it, so I am just doing some trial-and-error here. I defined and used it like this:
struct bpf_map_def SEC("maps") r_buf = {
.type = BPF_MAP_TYPE_RINGBUF,
.max_entries = 1 << 2,
};
SEC("lsm/task_alloc")
int BPF_PROG(task_alloc, struct task_struct *task, unsigned long clone_flags) {
uint32_t pid = task->pid;
bpf_ringbuf_output(&r_buf, &pid, sizeof(uint32_t), 0); //stores the pid value to the ring buffer
return 0;
}
But I got the following error when running:
libbpf: map 'r_buf': failed to create: Invalid argument(-22)
libbpf: failed to load object 'bpf_example_kern'
libbpf: failed to load BPF skeleton 'bpf_example_kern': -22
It seems like libbpf does not recognize BPF_MAP_TYPE_RINGBUF? I cloned the latest libbpf from GitHub and did make and make install. I am using Linux 5.8.0 kernel.
UPDATE: The issue seems to be resolved if I changed the max_entries to something like 4096 * 64, but I don't know why this is the case.
You are right, the problem is in the size of BPF_MAP_TYPE_RINGBUF (max_entries attribute in libbpf map definition). It has to be a multiple of a memory page (which is 4096 bytes at least on most popular platforms). So that explains why it all worked when you specified 64 * 4096.
BTW, if you'd like to see some examples of using it, I'd start with BPF selftests:
user-space part: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/prog_tests/ringbuf.c
kernel (BPF) part: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/bpf/progs/test_ringbuf.c

Why I get this error (new Set(...)).slice is not a function?

I tried to run this code in any of the online code editors but I always get error
(new Set(...)).slice is not a function
Code:
myarray = ['d','s', 'a'];
chr_arr = [...new Set(myarray)];
why I get this error ?
you can't edit stackbiltz beacuse tsconfig.json is not available unfortunately .
but for now you can use Array.from
myarray = ['d','s', 'a'];
chr_arr = Array.from(new Set(myarray));
More info https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/from
This only valid on ECMA Script 6
You need configure in tsconfig.json but online code editor (stackbliz) can't edit
https://angular.io/guide/typescript-configuration

autoopen macro in LibreBase, after upgrade to last Kubuntu

With the advice I received in fine tuning a goto bookmark libreoffice macro and here too, I had successfully created a macro that in LibreWriter went to the last point where the cursor was at the end.
After upgrading from Kyubuntu 17.04 to Kubuntu 17.10, with the new version of LibreOffice I get an error message, not in Writer, not in Calc, but in Base:
BASIC runtime error. Property or method not found: supportsService
and is highlighted the line If NOT thisComponent.supportsService (" com.sun.star.text.TextDocument ") Then. Apparently supportsService is not recognized in LibreBase.
I refer to the whole macro:
sub vai_qui
If NOT ThisComponent.supportsService ("com.sun.star.text.TextDocument") Then
Exit Sub
End If
oBookmarks = ThisComponent.getBookmarks ()
If NOT oBookmarks.hasByName ("here") Then
Exit Sub
End If
ViewCursor = ThisComponent.CurrentController.getviewCursor ()
Bookmark = ThisComponent.Bookmarks.getByName ("here") .Anchor
ViewCursor.gotorange (Bookmark, False)
ViewCursor = ThisComponent.CurrentController.getviewCursor ()
Bookmark = ThisComponent.Bookmarks.getByName ("here") .Anchor
ViewCursor.gotorange (Bookmark, False)
end sub
"BASIC runtime error."
This is not a BASE error, it's a BASIC error. Two very different things. BASE is the database component of LO. BASIC is a programming language that can be used to automate LO components in general, e.g. it works with Writer, Calc, Draw, Base, ...

Unable to run compiled Matlab code that uses "Presentation" for report generation

I am trying to convert a simple program that uses "Presentation" (from reportgen package) to a .exe.
The code is as follows:
makePPTCompilable();
import mlreportgen.ppt.*
slides = Presentation('mySlideAddPresentation.pptx');
slide1 = add(slides,'Title and Picture');
plane = Picture(which('tulips.jpg'));
plane.X = '4in';
plane.Y = '4in';
plane.Width = '5in';
plane.Height = '2in';
add(slide1,plane);
close(slides);
I get the following error on running the complied version:
" Undefined function 'Presentation' for input arguments of type 'char'"
Any idea what I am missing here?I am on 2015b, used the following link for help: https://www.mathworks.com/help/rptgen/ug/compile-a-presentation-program.html
You need to make the reportgen compilable, see here and here
In my code I put:
if ismcc || isdeployed
% Make sure DOM is compilable
makeDOMCompilable()
end
Then it compiles fine! :)