ASCII to MathML - javascript

I have a PHP-script that outputs: ((5^2x^2)^2+3)/(sqrt(sqrt(81)))
I want it to be formatted properly like you would write it.
Where can I find a ASCII to MathML converter like this: http://www.equationsheet.com/asciitomathml.php That is OpenSource in PHP or JavaScript so that I can use it on my webpage to format the mathematical fraction? (Because this is done in PHP closed source, but I need something that I can implement on my own server.)
My scripts outputs the math as that, and I need it to be displayed properly
I really appriciate that you spend your time helping me! :)

I recommend you to use MathJax.
It is used by many forums and also by StackExchange Mathematics!
It supports all modern browsers (even Internet Explorer 6!)
Very simple, just upload MathJax to your server and include 2 CSS/JS files! Some weeks ago, I installed it on a MediaWiki installation and it was easy as installing XAMPP ;)

You might also look at my jqMath JavaScript library at http://mathscribe.com/author/jqmath.html - it's like MathJax, but simpler, smaller, and much faster. Unlike ASCIIMathML, jqMath will work in any browser back to IE6, and is also open source. If you know LaTeX and want its full power for very advanced mathematics, and don't mind if pages load slowly, then use MathJax. But for examples like yours, jqMath will be faster, and use a simpler syntax based directly on MathML and Unicode. In your example, you would need to input {(5^2x^2)^2+3}/√√81 to jqMath. You can try this out at the page I linked to above.

Related

Find all hardcoded strings in React/Node project

My team and I took over a legacy project with only partially implemented i18n. Now we'd like to find all hardcoded strings in the project. Can you guys think of a regex, plugin (VS Code other other) or script/tool for this?
Interestingly, searching for this issue turns up mostly desktop programming languages.
You can use the VS Code extension i18n Ally: https://marketplace.visualstudio.com/items?itemName=Lokalise.i18n-ally
I'm also working on a text extraction project and this has made things a lot faster. If you highlight static/hardcoded text there is a shortcut action you can use that prompts you to create a corresponding key for the text and moves the text to your json file, speeds things up a lot. I created a keyboard shortcut for it like so:
{
"key": "shift+cmd+i",
"command": "i18n-ally.extract-text"
}
Back to your immediate question, the extension has a beta feature for detecting hardcoded strings that is pretty useful. One issue I have with it is I can't figure out yet if there's a way to stop it from detecting inline CSS strings; it would be nice to ignore all that.
Some of the features are experimental/in beta so I can't vouch for it being error proof, but so far it's been very useful for me. Hope that's helpful.

Retrieving a javascript processed Web page

What am I asking for is the ability to download a rendered / processed page via Google Chrome or Firefox I think.
For example, I don't want:
hendry#x201 ~$ w3m -dump http://hello.dabase.com
FAIL
I want:
$ $answer http://hello.dabase.com
Hello World
You should be able to do it using PhantomJS. It is running WebKit without the visuals, but you get the same fast and native supports for JavaScript, HTML/DOM, CSS, SVG, Canvas, and many others.
Disclaimer: I started PhantomJS.
Probably too early, but someone ported V8 to Go-lang, so now you could write your own client that makes use of this powerful combo:
http://bravenewmethod.wordpress.com/2011/03/30/embedding-v8-javascript-engine-and-go/
Looks quite straightforward, doesn't require an ugly Java/Rhino stack and adopts the next big programming language.
It looks similar to the problem http://simile.mit.edu/wiki/Crowbar is trying to solve.
You could use jsdom:- https://github.com/tmpvar/jsdom
I'd build a node driver for it, but it's supposed to work with Rhino etc.
I'd take a look at Rhino.
I'd use the excellent env.js library in conjunction with Rhino to simulate the browser environment as much as is technically possible. Once you've implemented some web spider bootstrap code you should be able to obtain the result you want above.
I'd be interested in other solutions to this though.

Why web browsers don't have jQuery built in? [duplicate]

This question already has answers here:
Why is jQuery not integrated within the browser
(7 answers)
Closed 4 years ago.
It seems like a good idea to me. or add the additional features to Javascript itself?
Because it's just one library of many. It may be popular but it's far from being the only choice. And it would also cause it to freeze at a particular version and make improvements much slower.
Plus there is little advantage anyway. It's fairly small and you can set it to be cachable indefinably by the brower so it will only be downloaded once anyway - if you have a new version it will have a new filename, so there is no harm in making it never expire.
I think this question should be a bigger discussion, but these answers are all bogus.
This is also 2 years later of course.
"it's just one library of many" - include the top 11 then.
"couldn't agree on common standard" - Kind of making jQuery a standard of it's own at this point.
"updated more often than browsers" or "make improvements slower" - So the browser won't have jQuery-1.9.x until next browser update, just don't put it in your project yet.
"Cache anyway" - Sure, it's still a transfer that doesn't have to happen, and there are a lot of people that haven't done a lot of surfing on their new device that you still want your site fast for and so on.
The thing is it is totally doable and would be better for the internet load; by how much is debatable. I could really see chrome at least replacing any net transfer to their CDN with a local copy, but I'm sure there is some legal, security or net neutrality issues with that. Just like I'm sure the main reason has something more to do with such matters and not these lame technical excuses that are obviously not thought through.
This could benefit other libraries too if developers could rely on the speed and availability of a complete library of tools like dojo, and not have to pick and choose just to cut weight. And also as most libraries have adopted the AMD or requireJS approach to package their projects, I believe there is a good argument for the enabling the browser to at least be informed of it's dependencies.
jQuery exists just because they (browser makers) couldn't agree on common standard.
You can consider jQuery to be a JavaScript plug-in. And browsers do not ship with plug-ins, otherwise the purpose of plug-ins would be irrelevant.
Plugins get updated more often than browsers - within a week the browser version of jQuery would be out of date :)
There's also the issue of versioning. Certain sites and extensions of jQuery require a certain version of jQuery. Right now it's up to the application to decide which version to use.
Probably because browsers are hard to update. Some freature of JQuery may eventually make their way into javascript, and I believe some of it has just recently. (well the idea's anyways) It takes years to add a feature to something like javascript, where the JQuery library can just release a new version.
There is actually a firebug or firefox plug in that allows you to inject JQuery into the page.. but thats just a development tool
Adding jQuery [type] functionality to the browser's in-built JS implementation (or making it a 1st-class plug-in) would overcome one basic problem:
As many have said, jQuery is a JS library - meaning, in case the penny didn't drop - that it is written in JS and has to be interpreted at run-time.
Embedding it would mean that it could be written in native code for the OS, making it much more performant.

Adding WYSIWYG to a site that is not your own?

This website that I use has a WYSIWYG that ONLY works in IE. And I refuse to use IE or to tell my non-tech team to use IE.
I was wondering if there is a user script or browser plugin that would enable anyone to inject a WYSIWYG such as CKeditor.com onto any site textarea?
Edit: I would also be willing to work on it myself if anyone wants to help or give advice. We could then post it on userscripts or something ...
Since you don't have access to the code, anything you do will be a hack.
With that in mind, I would start looking at Greasemonkey. It is a firefox plugin that allows you to inject javascript code into any web page on your machine. Its a long road, but that's probably your first step.
One word of warning however: While I share in your dislike of IE, it sounds like your hatred has grown to the point where it is being counterproductive. Seriously consider whether what you are about to do is worth the effort.
You can use this extension in Firefox as long as you get at least a textarea in that CMS: https://addons.mozilla.org/en-US/firefox/addon/6147/
Would a Firefox extension that displays websites as if they were in IE do the trick?
I like Stargazer712's answer (look into Greasemonkey), but there is another option.
Suck it up and use IE for just this site.
Hey, I hate IE6 and 7 as much as the next Web developer. I advise non-techies to stay away from it, and to use Firefox or Chrome. My answer isn't meant to be flip or funny.
Sometimes, if you need to get the job done, you choose the best tool for the job (even if you don't like using the tool) to get the work done in the most efficient manner possible. In this case, it sounds like using IE to access this particular Web site takes care of the problem without a single line of code or documentation written on your part.
The alternative is spending hours finding (and testing -- because you won't be the only user) an alternative...or worse, spending hours or days developing (and, again, testing) your own code to fix the problem that, at the end of the day, is really only caused by your strong dislike of the one software application that works.

Javascript, Firebug: How do I have multiple views or what is the right of way of doing development?

Most of my javascript work is done with Firebug and I feel annoying most of the times having to switch between the HTML mode and console mode (which again I split into output mode and input mode). When I switch to a different page to see the HTML and come back, I lose the code that I write. What is the best way to go about developing javascript applications using firebug?
Something like a mini IDE would be awesome: It just has to let me insert some code, examine the current page and then let me execute it. Any suggestions?
I use a simple text editor (vim) to write Javascript and HTML, and I check the result every now and then in Firefox. I have always two windows open: one for my text editor, and one with the current page open in Firefox. After saving a change in the Javascript, I switch to the browser and refresh the page to observe results. That was my workflow until recently.
A couple of weeks ago, I discovered the Combiner tool by Nicholas C. Zakas. To release my Javascript code, I am now using a complete build process based on Apache Ant, similar to what I was using while doing Java development previously.
The first step is to check the Javascript code with the JSLint tool by Douglas Crockford. I used to painfully copy and paste my Javascript code in the online version of the tool, once in a while; being able to run it on all my Javascript files at once with this Ant script is a huge convenience.
The second step is to combine all my Javascript files into a single file using the Combiner tool. The third step is to minify the Javascript code using YUI Compressor by Yahoo!. These last two steps allow to optimize the delivery of Javascript code to reduce page loading.
You can find an example Ant build file that you may adapt to your own needs. I am currently using this file to build my own Javascript library, bezen.org.
The other answers so far have been correct: I've never heard of anyone actually developing inside Firefox/Firebug, because it's a tool designed for debugging, not coding. To do your coding, you should use a tool designed for it (either a text editor or a full-fledged IDE).
But that being said, you might want to check out FireEclipse (Link). It will allow you to integrate Firebug with the Eclipse IDE (which itself has at least three different JS plug-ins to choose from). Alternatively I think the main (aka Web Standard Toolkit, aka WST) JS editor for Eclipse has some functionality which is similar to Firebug, but I've never used it so I don't know the details.
Hope that helps.
Write your HTML in an editor/IDE
Save your changes
Preview it in your browser
Debug using Firebug
Make your code edits in your SOURCE CODE
Repeat
Firebug is for debugging and allows you to do some "what if" fiddling while the page is live. This is not a replacement for an IDE.

Categories