Unwanted chars appended while rendering partial view in nodejs and expressjs - node.js

I'm trying to use nested view with DustJS (linkedin fork) with ExpressJS. While rendering the response system generates some escape chars in response. Which disturb the style and theme.
The same code renders fine as one view file, but when split code into two view files (one load as partial) than the problem arise.
Interesting thing is, it happens with two view engines I tried, the same issue, ECT and DustJS. Development on minimal components, Twitter Bootstrap 3.0 and express are additional component added so far.
My machine is running windows as operating system and development tool is visual studio. What could be reasons, has anyone find same trouble with these view engines?
View in Google Chrome Developer Tool.
Response-Text View
I tried to fiddle and tried to map the extra chars.

You have an UTF-8 BOM in one of the files you are using, usually in the first 3 bytes. Normally, a text editor will not show you these characters. Examine your used files with a hex editor (or write a script that examines those files for you) & store the offending file without that UTF-8 BOM, and configure all your editors to omit the BOM in future.

In addition to Wrikken's answer, if you are using Visual studio than it cab be fixed by advance save option.

Related

Previewing and Typing in Unicode font (Private Area / Basic Multilingual Plane) in Linux for SMuFL

I would like to make a change to an open source Android app which uses the Bravura font implementing the Standard Music Font Layout (SMuFL) fonts. I am developing on Linux.
The app displays musical notes with things like
<string name="notef_c5"> == ==</string>
which is displayed like
I now need to change things and I would like to see what I am going to do, rather than semi-randomly changing the Unicode numbers and see what happens. So I installed the font on my Linux desktop from github, by simply copying the SVG that the app is using into my global font directory and that did not work (fc-cache said /usr/share/fonts/svg/Bravura: caching, new cache contents: 0 fonts, 0 dirs). The same procedure for the OTF did work. This could be a problem down the line, since the app is using slightly modified version of the SVG, so any hint on that could help, but it's secondary regarding the question.
In fact I want to use "something" to display the font, and I tried many things, including Charmap and FontManager (which is almost the same as FontViewer). Charmap is the worst, displaying basically every single font installed on the machine even if I select just the Bravura (why is that???!) -- FontManager does the same (???!) -- FontViewer is almost passable, in that (when the "Characters" tab is selected) it display empty squares for the characters not defined in Bravura. Therefore with lots of careful scrolling it displays the "actual things" I am looking for, but it does not show their unicode values, and it's an extenuating search of few actual characters in a huge ocean of empty squares. So it's a no go anyway.
Is it possible that the best solution is just to blindly type Unicode values as described in the docs and see what happens? I know, if I were running Windows or Mac I could use Dorico SE but more generally there must be a better way of using Unicode in Linux, perhaps built for other purposes?
If you’re looking for specific symbols in the SMuFL specification, the full list of glyphs is available on the SMuFL website. (Note that the fonts themselves know nothing about music typesetting, they are simply collections of shapes to be used by a typesetting program. Even the simple example you provided is a composite of several carefully scaled and positioned glyphs, and simply changing the character codes may or may not work as intended.)
If you’re looking for ways to input Unicode characters on Linux, see the many suggestions provided here: How to type special characters in Linux?

MBCS File Menus generate ???? Characters

I am working on an MBCS app using MFC. I am trying to support Asian languages. For the purposes of this discussion, we'll say I'm trying to support Chinese. I am able to support Pop up dialogs via MessageBoxW and Dialog SCREENs by pasting Chinese characters directly into the RC file. I can't get file menus to work using either resource view or editing the RC file directly. Whenever I type in ANY Asian character, the screen shows ???. One ? for each character. I have tried modifying the menu in C++ using ModifyMenuW. I get more question marks. Visual Studio shows everything working, and the RC file is unicode (UTF-16). I can't easily convert my project to unicode mode. Spanish, French, and German all works fine (one of the Essets in German doesn't work, but that isn't a show stopper). What should I try next?
Thanks in advance!
Well, the easy answer would be change the application to Unicode, but this is not always simple, or possible at all.
Concerning using Unicode in a MBCS application, some things are possible and some others not. For example, I have made a MBCS application displaying and editing translations of program strings (messages, menues etc) in a ListView control, however ListView does have a specific message to turn it to Unicode (LVM_SETUNICODEFORMAT) and support operations (see also CCM_SETUNICODEFORMAT). Menus aren't controls though, but they do have "wide" (Unicode) functions.
If you want to use Unicode in your application, there are some tests you need to make. Success is not guaranteeded, but you can at least draw some conclusions and determine whether what you want to do is possible.
Test1:
You mentioned trying ModifyMenuW(), but this will try to modify an existing menu. Instead, try InsertMenuW() or InsertMenuItemW(). Any unicode string should be displayed properly, so try not just Chinese, but other laguages too (eg Greek or Russian). And btw, I can't see how French works and German doesn't (they use the same codepage - West European). What's the system codepage of your test-machine?
Test2: (if the above has failed)
Try changing the whole menu (SetMenu()) with having a single (unicode) menu item as its root.
Test3: (if the above have failed)
Then you need to check whether the window containing the menu must be Unicode. Create a simple "Hello World" Win32 application, or find a sample, if Visual Studio does not do this for you (these basically register the window class, create the main window and start the message-loop) - you must add a menu too, using the "wide" version of the menu functions explicitly. If this doesn't work, try changing the code that creates the window to unicode. This way you will know whether you need a unicode window, to own the menu.
Please make these tests and let us know the results. I will further post if needed.

Disable copy function in PDFTRON for Android

Is it possible to disable the copy option of the lib when selecting a text in the PDF using the PDFTron lib for Android?
I tried to search for the string, but also have not found it.
If you are using one of the mobile SDK's, or using our PDFViewWPF control for .Net 4+, then this is possible by modifying the tools code that is provided. There will one or two text selection tools, for which you can just comment out. Plus you would want to disable ctrl-c, and right click and select copy abilities. Exact code changes depends on platform. If you are using our older C++ PDFViewCtrl class this is harder to do, but I suspect you are not on this anyway.
Be aware though, there is no real way to prevent a user from extracting text from a PDF, since they can always open it in another PDF viewer and do it there.
See this form post for more info, including how to scramble the unicode values of text.
https://groups.google.com/forum/#!searchin/pdfnet-sdk/disable$20text/pdfnet-sdk/luWQmyhRDTw/z7UIGuu9uYkJ
Note, you will probably be interested in the PDFTron WebViewer technology, which provides much greater control over content. In particular, the original PDF file is never exposed to anyone for download. You can also encrypt the XOD file, so it cannot be opened in an XPS viewer, and you have full control over the UI, including disabling text search/extraction.
https://www.pdftron.com/webviewer/showcase/
https://www.pdftron.com/webviewer/index.html

Using latex in internet browsing

Why isn't possible (or feasible) to have latex code written on internet pages: latex being the page's source, like html.
This idea came when I was writing on wikipedia some math article and I realize that the current implementation is quite weak, either in presentation as some things that cannot be written inline.
So, a definitely prettier and simpler approach would be to introduce latex code within the page: the browser would interpret it and, using texlive or equivalent, compile the page with latex generated fonts. This could be inside a HTML, but the generation was using "pure" latex and not some javatex or else.
The latex interpreter could be a plugin of the browser, like Java once was.
This could have profound consequences, like scientific articles be shown on the internet without the need of .pdf or latex based documents be putted on internet in a one click away. The article was code with appropriate packages for internet viewing. The user could at anytime download generate the pdf equivalent of that page.
Any ideas why isn't this feasible /possible?
In general, using LaTeX for web pages is not a good idea - (La)TeX is designed for exact print output, not for a web view of some web page, where the exact display depends on window/screen sizes, user settings, etc.
Also, at least on my computer, TeX combined with a DVI viewer (or PDFTeX with a PDF viewer) is still quite slower than HTML with a web browser to render a similar sized page ... and there is no easy way to have DOM-like scripting for a LaTeX-page, other than regenerating it on each change. You don't want this.
For these parts where this makes sense (mathematic formulas), this actually already works: There are JavaScript interpreters for subsets of LaTeX (i.e. most of math mode), embedded in a normal HTML document. One example is MathJax, which is used on the more math-heavy (i.e. scientific) sites in the Stack Exchange network, like Cryptography Stack Exchange.

Can you do complex editing of Word Documents in a browser?

A friend of mine wants to have an application where people can upload documents in Word (or text) format, and then allow people to make edits to those documents within a browser.
Is there any mechanism that would support adding text "bubbles" for adding comments? Either floating, or off to the side.
Being able to save back to Word format is a must too. Or at least, some format supported by Word, that would still be editable. Saving it as an image is not acceptable.
I was thinking about opening the Word Document in an FCK Editor window, but FCK only seems to have "normal" inline text editing capabilities (although it is great).
Is this feasible?
Yes it is feasible. Google has done that (and it does have comments). So has Adobe. I'm sure there is more.
Xopus provides a programmable platform that allows you to define editable XML within a WYSIWYG environment. You could use it to define what you want to edit (XML), against which rules you want to edit it (an XSD) and how you want it to look while you edit it (XSL). Then you tie that all together with the Javascript API.
In other words, you could pretty easily define a document that contains multiple paragraphs with optional comments and then have them displayed as bubbles exactly the way you want them; when saved, a script on the server could be executed that converts the XML to a Word document.
Take a look at the demos.
If they are Word 2007 documents, you can use Silverlight. Here's an example application that uses Silverlight to open a Word 2007 document and display it in the browser.
Since StackOverflow is a programmer site, I'll assume you're a programmer. You can use Silverlight to add the bubbles and annotations to a Word 2007 document, but you'll need to know VB.NET or C#.
Take a look at docx2web.appspot.com which is (currently) a very bare bones editor with the distinguishing feature that the browser is directly manipulating (more or less) the "flat OPC" version of the docx.
This means that there is no lossy conversion on either the way in or the way out. So for example, when you save after editing, anything which was in the original docx is round tripped back to Word.
As far as support for older .doc is concerned, POI can be used to convert them to .docx (although your mileage may vary).
Why are you trying to compete with google docs?
I know that TinyMCE provides some rich controls for in browser editing. Last time i looked at it, it had 100% of the stuff i would normally use in word, and then some. On the other hand, i probably has 1% of the features that MS word provides. It would be VERY difficult to implement it all.
As far as saving to MS word compatible format. i am sure its possible. it would probably be easier to save to a non-doc format.
As far as popups etc, those can be easy built using jquery UI or any other javascript framework.
Bottom line: yes, its possible, but why?!
It is possible. For example eyeOS has a text processing application able to open and process Microsoft Office and OpenOffice.org text documents.

Resources