Openlayer zoomify dependency - javascript

I need a little help about the zoomify.
I want to display big images, everything is working, but I don't want to include all openlayer Javascript files which Javascript do I need there.
All the best,
Robert

OpenLayers has special tools to help us with our deployments. You can use them to build a personal OpenLayers file that has only and exactly what you need.
The link is here: http://docs.openlayers.org/library/deploying.html (read section 'Custom Build Profiles')

After downloading openlayer, in the directory build you will find different config file. You can make your own. For example in order to use only zoomify, this one should work.
[first]
[last]
[include]
OpenLayers/Map.js
OpenLayers/Layer/Zoomify.js
OpenLayers/Layer/Markers.js
OpenLayers/Layer/Boxes.js
OpenLayers/Marker/Box.js
OpenLayers/Control/Navigation.js
OpenLayers/Control/Zoom.js
OpenLayers/Protocol/HTTP.js
OpenLayers/Strategy/Fixed.js
OpenLayers/Strategy/BBOX.js
OpenLayers/StyleMap.js
OpenLayers/Rule.js
OpenLayers/Filter/Comparison.js
OpenLayers/Filter/Logical.js
[exclude]
Build the custom openlayer.js with python
python build.py mycustomconfig.cfg

Related

How to generate JavaScript from a template with terminal similar to Laravel's Artisan?

I have been recently been working with Laravel, and Artisan has several useful make commands that generates php from template stubs on the fly based off a class name, as well as allowing for custom make commands to speed things up.
Short of copy-pasting, there an easy tool that lets me generate plain JS in a similar way based on a templates that allows me to specify some variables to be replaced, then generated in my project?
The ultimate goal of mine for this project is to run a single terminal command with some arguments that generate all the files I need (at least 8-10 PHP files, as well as around 4 JS files), all put into the right directories that lets me do minimal "plugging in" so I can start using them right away. I can chain custom artisan commands, but the next step is getting some kind of terminal JS generator. The nature of the project is that there is approx. 12-14 files that need to be generated and generically filled in before being able to interface with a database table and the front end, so you can understand why I want to do this.
You can do it with bash like this
#!/bin/bash
file_location=path/to/dir/$1.js
if [ -e $1 ]; then
echo "File $1.js already exists!"
else
cat > $file_location <<EOF
let hi = '$2'
console.log(hi)
EOF
fi
$1 is the filename and $2 is another parameter you can pass to the script to be written in the js file.
I would look at hygen. I don't know what your output files are supposed to look like, but hygen allows you to create your own templates and generators. This has a relevant code snippet that displays some JS code. I can't give any advice beyond that as I've not used it thus far.
If this is looking like a bit too much, you can always use VS Code's templates to build up a base, but you won't have any params. A VS Code extension could overcome that I'd guess, but then you're not within a cli.

How to embedded font inside the .pptx file

I am creating a .pptx file using ASPOSE.Slides. I am trying to a embed font using Aspose, but it's not working because of some issues. Therefore i am searching for an alternative option to achieve the same functionality.
I want to embed my custom font in a .pptx file. Can you please provide suggestions for embedding fonts inside MS Power Point using Apache poi or other.
Please don't give the answers for static or local system.
As it was stated above you can do it easily without Apache.
Official site
You can view/add/delete the font by accessing C:\Windows\Fonts
#Bhagyashree,
Aspose.Slides allows you to embed the fonts inside presentation. I suggest you to please try using following sample code on your end to serve the purpose.
String dataDir = Utils.getDataDir(AddEmbeddedFonts.class);
Presentation pres=new Presentation(dataDir+"");
IFontData[] allFonts = pres.getFontsManager().getFonts();
IFontData[] embeddedFonts = pres.getFontsManager().getEmbeddedFonts();
for (IFontData font : except(allFonts, embeddedFonts))
{
pres.getFontsManager().addEmbeddedFont(font,EmbedFontCharacters.All);
}
pres.save("saved.pptx",SaveFormat.Pptx);
Please feel free to share if there is any issue incurring on your end.
I am working as Support developer/ Evangelist at Aspose.
With POI 4.1.0 (which will be released by approx. Feb. 2019), I've also added font embedding capabilities in Apache POI too. The provided methods are only the "half story", as you can't simply add .ttf/.otf files.
For the conversion of True-Type (.ttf) or Open-Type (.otf) fonts to Office-compatible EOT/MTX fonts, I'm using sfntly. The snftly classes aren't provided as maven artifacts yet and I don't like to import the whole chunk into POI nor release my repackaged version of googles code under my name, therefore you need to clone and adapt my example project.
For adding a MTX font stream to a slideshow (HSLF or XSLF, i.e. SlideShow is their common interface) you would call:
org.apache.poi.sl.usermodel.SlideShow.addFont(InputStream fontData)
For font subsetting, you would need the used codepoints, which can be extracted by:
org.apache.poi.sl.extractor.SlideShowExtractor.getCodepoints(String typeface, Boolean italic, Boolean bold)
For getting information about a MTX font data stream, there's a new helper class:
org.apache.poi.common.usermodel.fonts.FontHeader
I don't know how to change it with Apache, but you can easily change it with powerpoint ...

Loading customer sapui5 library inside component.js

According to the documentation here:
https://scn.sap.com/thread/3502503
http://jsbin.com/openui5-notepad-control-with-its-own-library-used-in-xmlview/1/edit?html,output
I build the following folder structure with following files:
/my/themes/sap_bluecrystal/library.css
/my/library.js
/my/Square.js
Now I am asking me how to load the library (inside Component.js) correct.
I tried following in Component.js
jQuery.sap.registerModulePath("my", "./my");
And in some View:
jQuery.sap.require("my.Square");
...
new my.Square({
text : "Test",
size : "200px"
})
All in all the Square control seems to be usable but the library.js and library.css is not loaded at all.
Any idea how to do it right?
Using bootstrap XML code inside index.html would not work if the app is running inside Fiori Launchpad.
Bonus question: Where to deploy a custom library inside SAP to be usable by multiple apps? One idea (but maybe that's wrong) is to create a BSP application just containing the library code?
The right way to load the library would be (instead of jQuery.sap.require):
sap.ui.getCore().loadLibrary("my");
This will load a "library-preload.json" file (if available) and also include the theme resources.
See https://openui5.hana.ondemand.com/#docs/api/symbols/sap.ui.core.Core.html#loadLibrary
First question I could solve for my own:
Replace
jQuery.sap.require("my.Square");
with
jQuery.sap.require("my.library");
Second question is still open :)

How to get LanguageModel JS File?

I have been using PocketSphinx.js for speech recognition on my website. I have Downloaded language model file (.dmp). But their code uses JS file for Language model. I dont know where to get JS file. Help me out. Thanks.
As per documentation, you can convert dmp file to js and load it afterwards, see the section https://github.com/syl22-00/pocketsphinx.js/#i-embedding-the-files-into-one-large-javascript-file. Something like
$ cmake -DEMSCRIPTEN=1 -DCMAKE_TOOLCHAIN_FILE=path_to_emscripten/cmake/Modules/Platform/Emscripten.cmake -LM_BASE=/lm/dmp/folder/name -LM_FILES=model.dmp ..
Also check an alternative section https://github.com/syl22-00/pocketsphinx.js#ii-package-model-files-outside-the-main-javascript where you can do:
# python .../emscripten/tools/file_packager.py .../pocketsphinx.js/build/pocketsphinx.js --embed model.dmp --js-output=model.dmp.js
Overall, you need smaller models, big models from CMUSPHINX downloads are too large

Visual representation of classes and/or objects

recently I started to work on some big project written in php/js.
It is really big and I have constant problem of backtracing what functions are called where.
Is there any tool, that would import all the code files and draw/write connections between classes, objects, functions and such?
Regards
BOUML can create UML diagrams out of your code
http://www.bouml.fr/
old 4.23 version is also free if that is needed
http://download.cnet.com/BOUML/3000-2094_4-10788888.html
I am using Intellij IDEA with the PHP Storm Plugin for my PHP/JS-Projects. There I'm able to right click a function and choose "Find Usage ALT+F7". Now I can see, where this function is getting called.
Intellij IDEA/PHP-Storm is also able to generate UML-Diagrams if needed.
I guess Netbeans, Eclipse+PHP-Plugin do have similar functions [maybe execpt of the uml-generator], if you need an IDE at no costs.

Categories

Resources