How do I get dojo.currency.format to use the correct currency symbol when using a custom dojo build? - dojo

When I use my custom build of dojo, dojo.currency.format doesn't use the correct currency symbol.
This is the statement I use:
dojo.currency.format(1234.567, {currency: "USD"});
This is the result when I use the standard dojo release:
"$1,234.57"
This is the result when I use my custom build of dojo:
"¤1,234.57"
How can I get my custom dojo build to produce the correct results?

I encountered this issue when first trying to use the dojo build. It has to do with the character encoding of the files. Check out the character encoding of an unzipped release (non source). Compare that to the character encoding of files in unbuilt source, and the encoding of files are a custom build. To see if this is an issue, (in chrome) you can force the browser to render the contents in a given encoding. You can try this to see if it is actually the issue you are having.
The easy solution to this (for me at least) was to set the charset on the dojo script tags
<script type="text/javascript" src="/path/to/dojo" charset="UTF-8"></script>
Dojo has a couple of pages on encoding that are worth taking a look at.
If you are using shrinksafe in the build, you may also need to specify the encoding there:
java -jar -Dfile.encoding=UTF8 shrinksafe.jar

Does your build have access to dojo/cldr/nls directory for the localization files of your locale? Check in Firebug whether it attempts, but fails to load currency.js from mentioned directory.

Related

"You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file."Webpack, vue.js

I have a problem with images in Vue.js Webpack
My Vue.js template :
(don't pay attention at red-line)
My package.json:
webpack.config.js:
and I am getting this error:
"Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)"
i tried to add url-loader, but its not working. How to fix it?
The main problem here is that your are using Webpack dynamic import with fully dynamic argument. This is not allowed - see the documentation for import() - same limitations described there applies also to a require() where the argument is expression instead of simple static string
You dont need the rquire inside the img tag, if those images are local, just provide the path, relative to your current file, and the name of the image file. That should work.
Also do not use url-loader in these cases, url-loader converts images to base-64 if they are small enough, and that will not work for dynamic stuff most of the time.
You could also try importing all those local images, and then write some logic that will decide which image to to put in the src.
like:
import bike from '#/assets/images/bike.jpg'
//in the tempalte:
<img :src="bike" />
This also works nicely, and it will not confuse vue-loader with dynamic imports in the template... if you have recent es features availabkle you could use dynamic import as well, but that depends on you and your code base...

Typo3 LTS9 PDF dimensions are not read and displayed in 0x0

I am having an issue with PDF's in the latest Typo3 release. If I add PDF to the Image content element, I get this:
The file info looks like this:
Checking the Image Processing Test of Typo3, no errors are returned. PDF/AI also seems to be fine.
I tested several PDF's and AI files as well, they won't show dimensions either.
I have the suspicion that the command 'identify' does not work within Typo3, it still returns perfect results from shell.
Any idea where to look?
multiple reasons possible:
you just need to reimport metadata (scheduler task)
your PDF is coded in an unsual format (there is more then one option in PDF to include the title image)
missing/wrong rights:
maybe another program is executed from commandline than from PHP.
maybe the file can't be accessed correctly from ghostscript started from web

Unable to embed a screenshot to the SpecFlow html Report

I am executing my automation scenarios using SpecFlow with Visual Studio.
I want to Embed a custom image to the HTML report which was generated by SpecFlow. That image is a screenshot i am taking whenever scenario is failed in Hooks.
Please help me out.
This is what i am seeing in the html report - enter image description here
Take a look at the SeleniumWebTest sample project here. This sample project shows how to include a screenshot in your report. While the example is Selenium-based, the same principles apply to other frameworks.
A more in-depth explanation of how this works can be found here under "Including Screenshots". Essentially, you need to abuse the console and use it to output your images' file paths.
Any data written to the console is available in your report (this is how the trace details are received by the report). You will need to parse the data written to the console and strip out the file path you want to embed. Make sure that you strip the image path completely so that you don't output the file path as part of the other trace information received from the console.
Edit: I've since discovered that there seems to be an issue with the template in the sample project. The following section in the template is bugged:
class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ <a href="http://specflow.org/plus/documentation/,-/" data-page=",-"<img width='1000' src=").Replace("</a> ]SCREENSHOT", "</img>"))</pre>
This is because the console no longer seems to be formatting the file as a hyperlink, so the replacement string is never found. Updating this line in ReportTemplate.cshtml seems to have done the trick:
<pre class="log">#Raw(FormatTechMessages(traceEvent.TechMessages.TrimEnd()).Replace("SCREENSHOT[ ", "<img width='1000' src=\"").Replace(" ]SCREENSHOT", "\"</img>"))</pre>
As the console is no longer formatting the file as a hyperlink, you only need to replace the padding (in this case the "SCREENSHOT[]SCREENSHOT") from the string and instead enclose the path with the <IMG> tag. You also need to add the quotes around the file path.

Webpack: How to compile all less files in a project

I use webpack for JS and now I want to use it for styles. I have a lot of styles in different folders and i want to compile them all without requiring each of them mannaully. The question is how to gather all the .less files in the folders and compile them via less-loader?
This isn't how webpack is meant to work, really. If you really want to do this, grunt/gulp is going to be a better choice.
Webpack's require mechanism ensures you build only the CSS you need for any given entry point, and gives you dependency management as well. If you do want to use webpack, but don't want to use the style-loader to insert them into the DOM etc., you can use the Extract Text plugin to build your compiled CSS into a separate file.
I found some workaround using require.context.
First you need to create a js file in the root of the styles folder if you don't have one.
Use this code if you use css or less and always extract them
require.context('./', true, /(\.less$)|(\.css$)/);
First argument is relative path to folder in which webpack should search for the files, second tells that it should search in subfolders and the last one is regexp of the extension of the files that webpack should require. Then you need to requre this file or use it as entry point. This works if you use extract-text-webpack-plugin but doesn't work otherwise.
Using styles without extracting them to style separate file
The example above doesn't work if you don't extract them because webpack generate modules with styles but doesn't execute them. This is complete example that works in both cases:
(function (requireContext) {
return requireContext.keys().map(requireContext);
} (require.context('../', true, /(\.less$)|(\.css$)/)));

Replace Glyphicons with Font Awesome in CSS using LESS and Grunt

Short version: I would like to use a font set to REPLACE Glyphicons without also including Glyphicons CSS, and without modifying the source bootstrap.less file.
Long version:
Using Bootstrap's own Grunt file and source files as a base, by default a build process will include Glyphicons in the compiled CSS file.
Since I do not plan to use Glyphicons at all, the "lowest hanging fruit" for me is to go ahead and compile this way, but also include the font I will be using (for example, Font Awesome).
However, the more "elegant" way will be to only include the replacement font.
I can modify bootstrap.less, which includes this line:
#import "glyphicons.less";
such that the Font Awesome less file is used instead. However, the problem with this is that I am using Bootstrap as an "untouchable library" not as a modifiable source file. I want to be able to drop in new versions of Bootstrap at a moment's notice without the need to remember to change this modified line.
Does Grunt have the concept of "replace string A with string B in memory before the compile runs"? Or is there another way to accomplish my goal? Or should I just not worry about it and include both sets of compiled CSS?
I think you can use grunt-string-replace
https://github.com/erickrdch/grunt-string-replace