Gtk vala css expected identifier - gtk3

Trying to link css to vala code but when I compile I get this error
error: syntax error, expected identifier
Any reason for why this is happening?
Css link code:
Gtk.CssProvider css_provider = new Gtk.CssProvider ();
css_provider.load_from_path ("style.css");
Gtk.StyleContext.add_provider_for_screen (Gdk.Screen.get_default (), css_provider, Gtk.STYLE_PROVIDER_PRIORITY_USER);

Related

How to get the textarea element in the linter onUpdateLinting callback

TLDR: How can I get a reference to the textarea HTML element within the linting onUpdateLinting function.
Long version: CodeMirror has a lint option which allows the setting of a function to be called when linting is complete. I want to use this to update an HTML element to show the number of errors in the code in the codeMirror instance. Because my page might have multiple codeMirror instances - think of tabs with codeMirrors on them - my approach is to discover the textarea then from that get the appropriate display element to show the error count on the tab.
However, I cannot find how to get that textarea reference from within the onUpdateLinting function.
My onUpdateLinting function is:
lint: {
onUpdateLinting: function onUpdateLinting(annotationsNotSorted, annotations, cm) {
let errCnt = annotationsNotSorted.length;
console.log(errCnt + " errors");
let textArea = cm.getTextArea(); // << fails with cm.getTextArea is not a function
}
Which throws error 'cm.getTextArea is not a function'.
I note that if I use getTextArea when I am creating the codeMirror instance then that does not throw the error.
My conclusion is that the cm being passed into the onUpdateLinting callback is not the 'proper' codeMirror instance.
However, the codeMirror docs (screengrab below) days that the
I found that on the first callback of the onUpdateLinting the cm parameter is undefined. I guess what is happening is that the codeMirror instance is not yet defined to the linter when the linter fires up. The answer was then to check the cm reference before using it.
lint: {
onUpdateLinting: function onUpdateLinting(annotationsNotSorted, annotations, cm) {
let errCnt = annotationsNotSorted.length;
console.log(errCnt + " errors");
if (cm.getTextArea){
let textArea = cm.getTextArea();
// code to find and set the display element.
}
}
However, this left me with the situation that the error count was not updated when the codeMirror was first set up. The answer was to move the config of the lint option out of the config object and into a call to setOption, so the code became:
let myCodeMirror = CodeMirror.fromTextArea(myTextArea, {..setup options NOT including lint..})
myCodeMirror.setOption("lint", {
onUpdateLinting: function onUpdateLinting(annotationsNotSorted, annotations, cm) {
let errCnt = annotationsNotSorted.length;
console.log(errCnt + " errors");
if (cm.getTextArea){
let textArea = cm.getTextArea();
// code to find and set the display element.
}
},
esversion: 6,// use this instead of plain 'true' to allow ES6 code such as 'const' and 'let' to pass without erroneous complaints from linter.
undef: true, // linter config option
unused: true // linter config option
});
Summary - the codeMirror instance is instantiated without the lint option, then when the setOption() call is made for the lint, the linter runs causing the callback function to fire and I get the first-time-thru affect that I need to show any errors when the code is loaded.

How do I open a game compiled for WebGL in Unity in Blazor?

I have created a Blazor Server project. In it, I wanted to put my WebGL game created in Unity3d on a separate page. In the end, after doing everything according to the example, I still can't get it to work. Although, I think, all things considered, but I see that the code markup index.html from WebGL game is different from other examples and there I haven't found a line of code:
unityInstance = UnityLoader.instantiate("unityContainer", "unity/WebGL/Build/WebGL.loader.js", { onProgress: UnityProgress });
I think I hooked it up right:
<script src="~/unity/WebGL/Build/WebGL.loader.js"></script>
#*<script src="~/unity/WebGL/Build/WebGL.framework.js.gz"></script>*#
<script src="~/unity/WebGL/run.js"></script>
I believe I wrote the mime type correctly:
var provider = new FileExtensionContentTypeProvider();
provider.Mappings.Remove(".data.gz");
provider.Mappings[".data.gz"] = "application/octet-stream";
provider.Mappings.Remove(".wasm.gz");
provider.Mappings[".wasm.gz"] = "application/wasm";
provider.Mappings.Remove(".js.gz");
provider.Mappings[".js.gz"] = "application/javascript";
provider.Mappings.Remove(".symbols.json.gz");
provider.Mappings[".symbols.json.gz"] = "application/octet-stream";
app.UseStaticFiles(new StaticFileOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(Directory.GetCurrentDirectory(), "wwwroot", "unity", "WebGL", "Build")),
RequestPath = "/Build",
ContentTypeProvider = provider
});
app.UseStaticFiles();
The error in the JavaScript console reads:
UnityLoader is not defined
If interested, here is my entire project:
https://github.com/EgorPavlovich/FPS.Servers.Test
I had to use the index.html file from the game build

Leaflet/Mapbox error - "Cannot read property 'minZoom' of undefined"

I'm creating a map using leaflet with the following code:
L.mapbox.accessToken = 'pk.##MY TOKEN HERE##';
var map = L.mapbox.map('map', 'mapbox.streets');
map.scrollWheelZoom.disable();
map.setView(new L.LatLng(32.75, -97.33), 10);
But when the page loads, I get a console error of
Cannot read property 'minZoom' of undefined
This error originates from the line that says:
var map = L.mapbox.map('map', 'mapbox.streets');
I've tried to set the minZoom value after the map variable is declared, but it doesn't work b/c by that point the error has already occurred. I've already tried to set the setView in the same map declaration line, but it didn't help either.
Has anybody ran across this error before?
try this:
var map = L.mapbox.map('map', 'mapbox.streets').setView([0, 0], 2);
source: Mapbox blog
Since it can't read the property, it looks like it's having problems finding a <div> with an id of map.
In your HTML page, try adding <div id="map"></div> in the body where you want your map to appear.

How to implement syntax coloring in a JFace SourceViewer using PresentationReconciler?

I am trying to build a standalone Editor for C Language using SWT/JFace. I have used the SourceViewer for the editor part. But I am getting problem in implementing the syntax highlighting. I have done the following:
public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer)
{
if(reconciler!=null)
return reconciler;
reconciler =new PresentationReconciler();
DefaultDamagerRepairer dr=new DefaultDamagerRepairer(getMultiScanner());
reconciler.setDamager(dr, MyPartitionerScanner.MULTILINE_COMMENT);
reconciler.setRepairer(dr, MyPartitionerScanner.MULTILINE_COMMENT);
...
...
return reconciler;
}
I have the above code in the my SourceViewerConfiguration. But nothing is happening in the editor.

Flash calling a FBJS

i use FBML for the FB application
I have a flash and the flash suppose to call a javascript on the page. I read so many websites trying to figure it out but still having problem.
Here is the Webpage with the javascript:
<fb:fbjs_bridge/>
<div id="swfContainer"></div>
<script>
// the javascript to call and change the text of ztest001
function callmenow(a) {
var obj = document.getElementById("ztest001");
obj.setTextValue("Calling");
}
// generating the SWF
var swf = document.createElement('fb:swf');
swf.setId('my_swf_id');
swf.setWidth('630');
swf.setHeight('520');
swf.setSWFSrc('http://hollywood-life.madscience-games.com/ztest/test1.swf');
document.getElementById('swfContainer').appendChild(swf);
</script>
<div onclick="callmenow('a')">call me now</div>
<div id="ztest001"> YOo </div>
And here it is the Flash code. (one frame. code is on the frame. with a text box "myvar1")
var connection:LocalConnection = new LocalConnection();
var connectionName:String = LoaderInfo(this.root.loaderInfo).parameters.fb_local_connection;
connection.allowDomain("apps.facebook.com", "apps.*.facebook.com");
function callFBJS():void{
myvar1.text = "START"; // debugging purpose
if (connectionName) {
myvar1.text = "Connection now"; // debugging purpose
var pArray = ['bs'];
connection.send(connectionName, "callmenow", "callmenow", pArray);
myvar1.text = "SENT";
}
}
callFBJS();
Well, when I test, the flash loads. The code goes through everything and shows "SENT" in the flash text box. However, it doesn't seem like it is calling the javascript and changing the text in the HTML page.
Have I done something wrong? I tried the ExternalInteface.call method but this doesn't work either.
ALSO, when i run it in FireFox, not error popup.
however, when i run it in IE, I got this:
VerifyError: Error #1033: Cpool entry 36 is wrong type.
ReferenceError: Error #1065: Variable FBJS is not defined.
Did you try changing:
connection.send(connectionName, "callmenow", "callmenow", pArray);
to
connection.send(connectionName, "callFBJS", "callmenow", pArray);