Syntax Highlighter: can't find brush for XML - syntax-highlighting

I've been using SyntaxHighlighter for some time without any problems.
However, I recently restyled my blog and now when one page loads - a page which uses the XML brush - I get a popup saying
Can't find brush for: xml
I've checked and double-checked, and I'm absolutely certain that the shBrushXML.js file is being included in the downloaded JavaScript bundle (I can see SyntaxHighlighter.brushes.Xml in the minified JS).
I've also tested using other syntaxes on the same page and they're ok; it's just the XML brush.
Does anyone have any ideas why the XML brush is causing this problem?

This was caused by a small bug in another brush script (i.e. another SyntaxHighlighter brush).
I was also referencing a third party Razor syntax brush from here. This script has the line
SyntaxHighlighter.brushes.Xml = Brush;
Which should obviously be
SyntaxHighlighter.brushes.Razor = Brush;
Presumably this has been caused by the author copying the contents of the XML brush and then modifying it for Razor. On its own the XML brush worked, and on its own the Razor brush worked. The XML brush also worked when it was referenced after the Razor brush, and the Razor brush worked when it was referenced after the XML brush.
And now it's clear why.

I had same issue. Then I found that I was using lang=XML. However file shBrushXml.js had brush alias as xml. I made 2 changes which fixed the issue for me.
updated lang=xml in my file where I wanted syntax highlighting.
Updated shBrushXml.js
Changed
SyntaxHighlighter.brushes.Xml = Brush;
To
SyntaxHighlighter.brushes.Razor = Brush;

Related

Draft js performance issue when applying inline style to large selection

I am using Facebook's Draft.js library to create a inline text editor! Draft js has been exceptionally good so far but I am facing a performance bottlenect now! I have a color picker in my inline editor which allows the user to add text color to the selected content! It works fine when the selection is a small text but if the user's selection spans multiple lines, draft significantly slows down! One can even replicate this issue in React WYSIWYG example and the react's own color example! I am not sure whether this is a known issue or I have missed somthing, any advice on this is much appreciated!

X3DOM ImageTexture in a bl.ocks.org and animate it using d3.js

I have a X3DOM and D3.js gist and block that works fine on my local system, or on the web here: http://coderextreme.net/earth/raw/1256f90d9eea80c52d3d/index.xhtml but when I deploy to bl.ocks.org, the ImageTexture doesn't show up. Here is my block: http://bl.ocks.org/coderextreme/1256f90d9eea80c52d3d and gist: https://gist.github.com/coderextreme/1256f90d9eea80c52d3d The image shows up fine in gist.
Images work on this block, but they're not ImageTexture or X3DOM http://bl.ocks.org/d3noob/9662ab6d5ac823c0e444 This block might be used to help answer the question (probably some kind of URL issue, but nothing's showing up in the web console that I can see on the bl.ocks.org page).
There appears to be some kind of caching on bl.ocks.org or in my web browser. If blocks are cached, how to I flush the cache? That is, can you as a reader of this post see the outline of the continents in the block?
If the answer is modify the URL, please assist with that.
Note that this block was built with blockbuilder.org, but I used git to upload the image.
Here's how I reference the image in X3DOM (index.xhtml):
<Appearance>
<ImageTexture url='earth.png'/>
<TextureTransform id="tt" translation="0 0" scale="0.75 1"/>
</Appearance>
How do I get my block and image textures to show up which display the continents?
The answer was to convert from XHTML to HTML5 and remove self-closing tags.

BitmapFont in Skin doesn't draw labels correctly

I made a bitmap font using Hiero, called default.fnt and default.png. I can use these as a BitmapFont in LibGDX, and draw text with the font without problems, using font.draw(). But I can't use this font as the default font in a Skin. I've used the uiskin.json file from here(along with the rest of the skin, but I deleted the Droid Sans files before making my own font), because I have no idea how to make one of my own. From what I've read on the Internet, the .json file is correctly set up: it has the line com.badlogic.gdx.graphics.g2d.BitmapFont: { default-font: { file: default.fnt } }, which should make the default.fnt the default font for widgets that use the skin. Still, when I run the program, I see this:
There should be a label above the buttons, and the buttons should have text.
If I do this: startGameButton.getStyle().font = font;, where startGameButton is one of the buttons, and font is the BitmapFont created like this: font = new BitmapFont(Gdx.files.internal("uiskin/default.fnt"), Gdx.files.internal("uiskin/default.png"), false);, the buttons shows the text properly. I don't want to do this since it feels too much like a hack.
I'm following this tutorial, but I've had to look some things up in later revisions of his code, because LibGDX has changed since it was written.
MenuScreen.java(the screen where there are problems)
AbstractScreen.java
Also please tell me if there's a better way to make the menu UI, or if you need other files. The uiskin.json is linked above.
Thank you.
I fixed it. The Droid Sans bitmap image existed in two places, it was part of uiskin.png too. I don't know how, but it probably read the font's letters from that file instead of default.png. So in the end I just renamed the font's .fnt and .png(and the file parameter in the .fnt) and did a search-replace inside the skin's .json, and it all works fine now. I don't know exactly what caused it, but maybe default-font is a reserved word or something.
Anyway, it works now. Thanks to Jyro117 for making me think maybe I shouldn't replace the default but add my own font.

Manually upgrading Three.js JSON geometry files from r42 to r55

I have some JSON files that define geometries, as required by r42 of Three.js's JSONLoader class. The files are version 2 of the format.
Is it feasible to manually update these files between versions?
The first obvious difference is that the file is no longer JavaScript, but actual JSON. This was easy to correct for. However the new format has a metadata section, and thirty minutes of experimentation with is isn't getting me anywhere.
I'm seeing problems because the Geometry object's material properties has an empty materials array. The resulting geometry has multiple parts with different materials, as seen in r42.
Does anyone know how I might manually tweak these .json files to work with r55?
I have no complete knowledge how the internals of the format have changed, but here's a couple of hints:
If you have the source object, the best way would be to re-export/convert. There should now also be more converters and exporters to use if your source format is obscure. If the source is unknown, some Googling might be worth it.
metadata section doesn't matter, it isn't used for anything in the loader.
There is no more Geometry.materials. Instead, JSONLoader's callback returns the loaded materials as a separate parameter to the callback. See Migration Guide (r52->r53) for more on that. In fact, the loader interface has changed also in r46.
git log of some example model files (searching for changes there could be your way forward if you really need to manually migrate) suggests that there might be e.g. UV flipping which would be difficult to fix manually but could be worked around in code. But first you'd need to get something to display on screen.
Try dragging the file into the editor, then do File/Export Geometry.
Here is a fix for drag and drop into the editor. Add this code before the drop event in index.html. I tested this in Chrome ( 24.0.1312.56 ), Safari and Firefox in OSX.
document.addEventListener("dragover", function(e) {
e.preventDefault();
});
#mrdoob's answer worked after a few patches to the editor (here and here.)
However it's worth noting that upgrading the files by hand in a text editor is possible, especially if you don't have any UV coords.
Earlier versions did not use JSON -- they were JavaScript files. The conversion is straightforward.
You can either ignore the metadata section, or else port it from the comments into an object.
If you do have UV coords, then they must be mapped differently (I believe an axis is flipped)

Issues with WIDTH and HEIGHT percentages in a DIV via CSS (firefox doesn't work)

My brain is overflow about this issue, so let me share my frustration in order to look for someone having the same experience and, luckily, finding a solution.
The thing is the following:
http://jsfiddle.net/w4d2E/
In chrome, percentages work fine, but when trying the same in Firefox (latest version) the content div is not expanding horizontally and vertically anymore.
I've analyzed every similar question over here, but I can't find any valid answer.
Thanks in advance
P.S.: I've tried to use block display instead of the 'box' one in the 'content' layer, but still having the same behavior.
You're using XUL box layout. I suggest not doing that. -moz-box is NOT CSS flexbox layout, as you seem to think.
The problem here is display: -moz-box for body. If you remove it everything works fine. It appears to be a bug, so I suggest filing a report in the bug tracker.

Resources