LWJGL Keyboard getEventKey() returns 0 - lwjgl

I have got a trouble with LWJGL (I'm new in it) and keyboard handling: I need to get keys pressing, and so on, there is my code:
while (alive) {
Display.update();
while (Keyboard.next()) {
System.out.println(Keyboard.getEventKey());
}
// Some draw calls
}
That's work OK with numbers, space, backspace and non-printable keys: ESC gives 1, Space gives 57, 9 gives 10, etc, but pressed letter-keys returns 0 (maybe, it means CHAR_NONE const), without reference to my keyboard layout: EN, RU or something else. Through getEventCharacter() returns valid symbols in both layouts.
That may be issue of my Arch (3.14 x64) or something nearby, I think, or have I got a mistake in code? Or may it be a bug?
I would appreciate any help.

I found out the solution: that's in setxkbmap: I've just
setxkbmap -model pc104 -layout us
and everything is normal now.

Related

Cannot create more then two c3js graphs on a page

We are using the following code (generated by php but finally this is on client side)
c3.generate({'bindto':'#b65d3422__salestaffcommunication_xepan_base_view_chart_chart','data':{'keys':{'x':'name','value':['Email','Call','Meeting']},'groups':[['Email','Call','Meeting']],'json':[],'type':'bar'},'axis':{'x':{'type':'category'},'rotated':true},'onrendered':function(ev,ui){$(".widget-grid").masonry({'itemSelector':'.widget'})}});
c3.generate({'bindto':'#f67e14d8__t_masscommunication_xepan_base_view_chart_chart','data':{'keys':{'x':'name','value':['Newsletter','TeleMarketing']},'groups':[['Newsletter','TeleMarketing']],'json':[],'type':'bar'},'axis':{'x':{'type':'category'},'rotated':true},'onrendered':function(ev,ui){$(".widget-grid").masonry({'itemSelector':'.widget'})}});
c3.generate({'bindto':'#517df254__ableworkforce_xepan_base_view_chart_chart','data':{'columns':[['present',11.111111111111]],'type':'gauge'},'color':{'pattern':['#FF0000','#F97600','#F6C600','#60B044'],'threshold':{'values':[30,60,90,100]}},'onrendered':function(ev,ui){$(".widget-grid").masonry({'itemSelector':'.widget'})}});
And last graph is not drawn. showing
SyntaxError (DOM Exception 12): The string did not match the expected pattern.
However, I can run ANY two and it works fine. that means all code is perfect but once second one is drawn ( no matter in which order). Third one doesn't draws.
Is it any known bug, or any workaround known.
Using v0.4.11 of c3 from c3js.org
Here is my jsfiddle
https://jsfiddle.net/2yy2mjaf/1/
Thank you.
IDs cannot start with a number, which is the case of your third ID.
The simple solution is just adding a letter to it:
'bindto':'#a517df254_ //just put an "a" before the number here
Here is your fiddle: https://jsfiddle.net/7dkLdg32/

if command not working Actionscript 3

I am making a console like program where you input text, and when you press enter, that text gets turned into the variable "code" which gets read by the if/elseif command to direct it to a certain frame.
When I did this though, actionscript completely ignored the if and just executed what was inside of the if.
There are no errors, but there is a warning. This is my full code
import flash.events.KeyboardEvent;
stop();
stage.focus=textbox;
var code:String=textbox.text;
textbox.addEventListener(KeyboardEvent.KEY_DOWN,thefunction);
function thefunction(event:KeyboardEvent){
if(event.charCode == 13){
code=textbox.text;
trace(code);
page();
}
}
function page(){
if(code="red"){
gotoAndPlay(19)
}
else{
gotoAndStop(1)
}
}
The warning is here=
function page(){
if(code="red"){
gotoAndPlay(19)
}
else{
gotoAndStop(1)
}
}
It says: Warning: 1100: Assignment within conditional. Did you mean == instead of =?
I then tried doing what it said, and nothing happens when I type in anything and press enter (charCode 13).
I have tried doing this with textbox.textinstead of the variable code, and still nothing happens. (trace(code) works fine, so it must be something with the bottom portion, but I'm not sure)
I am new to actionscript, so I do not know how to fix this (my excuse :D). If anybody knows how, I would love to figure out how to fix it.
first of all, as a general rule, you should never use the assignment operator (single =) in an if statement, always use the equality operator (double =)
what you're saying right now is "if you assigned the value 'red' to code without errors, then..." which of course is always true
then, to debug your problem, try to use trace("'" + code + "'"); to see exactly what your textfield contains. if you're still in doubt, convert your text in character codes and print those. Why? if there's a non-printable or non-visible character in your textfield, your if statement wouldn't match (think "red " == "red" > false)
my guess is that your textfield is set to multiline, so your enter key would be added to the text and break your check. set it to single line to avoid possible problems (if you do need a multiline input field, you need a smarter way to compare text, like using regular expressions and such ...)

Actionscript 3: Referencing data in groupings of movieclips

I'm a very new programmer. I'm making a character calculator for a friend of mine's game, but mostly for practice for myself.
I'm programming in Actionscript and have been trying to reference Data in Lists, which has been working fine, except when my lists are grouped together with anything else as one symbol(MovieClip).
I have looked around the internet and tried getChild() (though I am not positive symbols in other symbols mean they are children of them), as well as putting MovieClip(parent).ListName.Data to try and reference it. I have also simply tried putting ListParent.ListName.Data to reference it, but I'm afraid I'm at a loss.
I'm sure the answer is very obvious but Google, as it seemed, did not pinpoint my issue. Here is the code -- my list's dataProvider is pretty much just 1, 2, 3, 4, 5 for my data points, so here I'm trying to reference list selection 2:
earthponyRacials.earthponyList1.addEventListener(Event.CHANGE, testText);
function testText(event:Event) {
if(earthponyRacials.earthponyList1.data == 2){
trace("Function working?");
}
}
This is my reference error:
ReferenceError: Error #1069: Property data not found on fl.controls.List and there is no default value.
at CharacterCalculator_fla::MainTimeline/testText()
at flash.events::EventDispatcher/dispatchEventFunction()
at flash.events::EventDispatcher/dispatchEvent()
at fl.controls::SelectableList/handleCellRendererClick()
I'm sorry if this is a really obvious question.
You have to access the lists data using:
YourList.dataProvider.getItemAt( ItemsIndex ).data;
You can also get its label by replacing .data with .label
The items index is the same as accessing an array so item 2 is index 1 item 1 is index 0
Hope this helps!

is line folded? - How to check for folds in VIM

I'm writing some folding functions and I am at a point where I need to check if the current line is actually a fold.
The reason for this is because it is a custom fold method that depends on searching/matching certain lines.
For example, if the current line is folded and looks like:
-FOO------------------------
If you do something like:
getline('.')
You would basically get FOO so there is no way (that I know of) to know if I am at a fold or not.
Is there a helper function for this?
I would think it would have to be something like:
is_folded('.')
I could probably mess with the foldtext to assign a special title for the fold but I want to avoid this.
From :help eval.txt
foldclosed({lnum})
The result is a Number. If the line {lnum} is in a closed
fold, the result is the number of the first line in that fold.
If the line {lnum} is not in a closed fold, -1 is returned.
You can check for a given line if it returns -1 or a line number, you can probably implement your isfolded() function this way.
If you are looking for Vim script function or feature , it is a good idea to start by searching in eval.txt which contains lots of relevant information.

Is there a reason a function won't accept a number higher than 4 in AS3?

you know any reason why a function won't accept any number higher than 4?
This is all I'm doing. Works for 0-4, but once I hit 5 or higher, I get "A term is undefined and has no properties." But if I just put the number 5 in there, it all works just fine, so it's not an issue with the xml.. for some reason the function just won't accept anything higher than 4. weirding me out..... I can't see an explanation for it.
loadEpSynopsis(5);
function loadCharSynopsis(charNumber:Number):void
{
synopsisBox.titleText.text = bXml.characterlist.character[charNumber].charactername;
synopsisBox.descriptionText.text = bXml.characterlist.character[charNumber].characterdesc;
}
The value of "bXml.characterlist" is probably only 5 characters long, so indexing higher than that is returning "null", which has no "charactername" property.