VSCode : mvbasic extension on editing Unidata code with MV marks in code, ie CHAR(253), CHAR(254) - unix

I have searched for a setting within the mvbasic extension within VSCode but I may have hit a dead end. I am new to using VSCode with the rocket mvbasic extension and still in the learning process, so please bear with me.
Our development for the most part has always been directly on the server using the editor within it to code and develop on a Unix/Aix platform with Unidata. Some of our code has array assignments with CHAR(253)/CHAR(254) characters within them. See the link to the image that shows how its done. Now I didn't do this code, the original software developer did this many many years ago and we just aren't going to go and change it all.
How code looks on actual server
The issue is when pulling the code to edit in VSCode, the extension is changing it, and I uploaded it back and didn't pay attention and it was implemented in our production incorrectly, which created a few bugs.
ALIST="H�V�P�R�M�D"
How code looks in VSCode
How code looks after uploaded back to server from VSCode
Easy to fix, no biggie, but now to my question.
Does anyone have this issue, or has a direction to point me into that maybe I need to create a setting to keep the characters in the correct ASCII format so that this doesn't happen again by mistake?

VSCode defaults to the sane choice for character encoding in 2022: utf-8, but sometimes you have to deal with legacy stuff.
https://code.visualstudio.com/docs/editor/codebasics#_file-encoding-support
If you click on the UTF-8 in the bottom right corner you can choose "Reopen with Encoding":
After that, you can select a different encoding. I chose DOS (CP437) at a guess and literal MV characters are displayed as superscript 2 (²), and for me I can save to the server and confirm those characters remain as #VM after a round trip (though for my terminal emulator they appear as } which is useful).
You can edit preferences and set "files.encoding": "cp437". One other thing that can be helpful if your programs don't have a standard extension (like .bas) as most don't is to set the default mode to basic so most of what you're editing will identify as MVbasic, and you can do a quick CTRL-K M to switch to any other modes if you're just pasting in something else like SQL.
Some useful links - the Rocket forums are helpful and the folks there are always super nice
https://community.rocketsoftware.com/forums/multivalue?CommunityKey=521bce2e-71d5-4d32-b560-dfa95e950eb5
The MV Extensions Community extension is a good group and always has been helpful when I've had issues. I've made some small contributions - they're very open. I prefer this extension, but honestly haven't done a deep comparison.
https://github.com/mvextensions

Related

Is it possible for a server to provide the same file to 2 people, on who understands only UTF-8 and the other, only ISO8559?

INTRO:
I'm in a situation because when uploading an inventory upload feed to Amazon, in 2021, they still don't understand UTF-8 encoding.
Here we have a file, in a wordpress installation, as the image for a visual product.
Example url : https://wordpresssite.com/uploads/Café-à-la-crème.jpg
Wordpress displays it fine.
Amazon reads a bunch of gibberish and can't find the file and gives an error.
Can we leave the file name on the source server as is and yet do something in cPanel or in
the excel file that lists this URL in a way that Amazon can also read it?
Is this ultimately as simple as telling Excel to encode that column differently before uploading?
Thank you in advance!
UPDATE : What I am trying now, is to export the Excel to CSV and then run it through line by line using PHP with a combination of tricks hoping to do a passable job of it. From what I see, there are many ways that "sorta" work, but nothing is sure.
UPDATE 2 : I realize that this doesn't solve my problem, because if Amazon changes the file name, changing an "é" to an "e", then it won't find the image either, so I'll have to go through all the images and find the ones with accents that I'm using.
QUESTION ABOUT PROCEDURE : I haven't been able to quite understand the way things work. I thought originally that this is about trying to get help when stuck. I have explained the problem and code isn't necessary. If I'm wrong, please tell me how it changes THIS situation? I'm using Excel, WordPress and I have to lose the UTF-8 accented characters that seem to cause Amazon's systems such grief (no judgement to Amazon, except that this resistance to UTF-8 is giving me brain shudders at the moment).
MORE INFO: If this helps, I'm writing in English but certain art products have a lot of French and some German in their names. I thought my example sufficient to illustrate what I was up against.
My problem is not how to convert the code but how to put the steps together to do what I need. It's because this whole process is not a simple iconv vs utf_decode() in php that it's extra stressful. Once I get the big picture sorted, the smaller steps are written about in many places where I could find more specifc details if I needed.
I'm not snarking here, but it seems that this kind of comment is just kicking someone when they are down. You are not the first to make such a suggestion over the years but again, I am curious how I could have explained any more than I have already — in a way that pertains to my actual problem.
Thanks for your response.
That URI is not properly encoded as per RFC 3986 (see also Wikipedia: percent/URL encoding). You cannot expect a server to blindly assume a requested URI to be UTF-8 encoded, but you can expect every server to support percent encoding:
https://wordpresssite.com/uploads/Caf%C3%A9-%C3%A0-la-cr%C3%A8me.jpg
In PHP this can be achieved thru rawurlencode(); in JavaScript it would be encodeURI().
Not sure what you want with Excel and CSV, but from what I understood it is unrelated to your actual problem.

How to embed maths in MediaWiki

I'm trying to transfer some maths content from and old wiki to my new MediaWiki.
The old page uses MathJax, and looks like this:
Here is the k-degree Taylor series for [[$ f(x) $]]
expanding around [[$ x=0 $]]
[[$ T_k(x) = f(0) + x\cdot f'(0) + \frac{x^2}{2!} f''(0) + \dots
+ \frac{x^k}{k!} f^k(0) $]]
This is what I've found so far:
http://www.mediawiki.org/wiki/Extension:MathJax -- appears to be discontinued.
http://www.mediawiki.org/wiki/Extension:SimpleMathJax -- I tried this and it works on OSX Chrome but gives rendering errors on OSX FireFox (https://github.com/jmnote/SimpleMathJax/issues/1)
http://www.mediawiki.org/wiki/Extension:Math -- this appears to be where the active development is occurring, but I haven't managed to get it working. Also it is a huge headache.
Have I missed anything?
What's the right way to enable maths content in a MediaWiki?
From what I can see, it is looking like: "render on server and provide PNG is faster, render on client using MathJax is simpler/cleaner"
SimpleMathJax is an absolutely minimal install. If only it worked on Firefox!
Math extension is looking like hard work, it looks like overkill -- it seems to support at least 4 different techniques for rendering.
A year after, the situation is getting even more confusing about how MediaWiki sites could process maths. If we all agree that texvc and maths formula displayed in png images are ugly and obsolete, it seems that Mathoid, according to https://www.mediawiki.org/wiki/Extension:Math, "is the most recommended option; Mathoid is the rendering mode that will be used on Wikipedia in the future.” .
But Mathoid requires an external server like Parsoid and they both (Mathoid and Parsoid) are in an heavy development. Therefore I looked for an other solution and found and tested successfully 'SimpleMathJax' (https://www.mediawiki.org/wiki/Extension:SimpleMathJax). It can be set like below
wfLoadExtension( 'SimpleMathJax' );
// MediaWiki 1.24 or earlier
// require_once "$IP/extensions/SimpleMathJax/SimpleMathJax.php";
works on any recent version of MediaWiki (latest version tested is mw1.28 of late December 2016).
However the code of the extension itself is not distributed with the numerous MediaWiki extensions from the WikiMedia fundation (which supports mathoid) but you can get it on github at https://github.com/jmnote/SimpleMathJax/archive/master.zip and expand it into your extension subdirectory with other extensions.
The math rendering is beautiful because it uses MathJax and MathJax (.org) is "an open-source JavaScript display engine for LaTeX, MathML, and AsciiMath notation that works in all modern browsers."
Most of the standard AMS LaTeX code seems to work fine (align etc).
It is called "simple" MathJax probably because it doesn't have the ambition of the MW MathJax extension to process all LaTeX and TeX facilities like numbering equations and process TeX macros, but it uses the original javascript CDN of mathjax.org and therefore is very simple to install and to use for short mathematical texts.
- If you want to process longer and even huge mathematical texts, you can try 'pandoc' which will transform your full LaTeX document into mediawiki source with the following command line:
$ pandoc -o foo.wiki -f latex -t mediawiki foo.tex
You do really want https://www.mediawiki.org/wiki/Extension:Math it is the standard way of doing things.
Maths rendering has been a problem on wikipedia for a long time now. The original system uses PNG images dates back to about 2005. It was the best that was available then, but it is really ugly, the font sizes don't match, the base line are all wrong and there is no anti-aliasing. The advantage is that its stable and works for all browsers.
Ever since then there has been attempts to improve the maths rendering. The first attempt was Blahtex which produced MathML but never got traction with the developers.
Then MathJax came along. The first implementation was as a user script
https://en.wikipedia.org/wiki/User:Nageh/mathJax this worked pretty well but needed the user to manually add it to their javascript skin files.
A couple of years ago MathJax got rolled into the main Math extension, with a user preference (off by default).
MathJax is the nicest current rendering but there are two major problems, browser support, it has to work on all possible browsers including the more limited ones on phones and ancient systems. The other is speed, as it is rendered by javascript it takes time to format the equations, this can be up to a minute for the more complex formula rich pages.
MathML is another possible option, however Firefox is the only browser with halfway decent support.
This has led to a problem with making a universal system. The current development is a system which allows client side MathJax/MathML rendering for those who want the best rendering, the old PNG rendering as a fallback and a new system which uses MathJax to render SVG on the server side.
As to what to actually do. I think the simplest is to ignore extensions completely and just use MathJax on the global javascript files. See https://en.wikipedia.org/wiki/Wikipedia:Common.js_and_common.css. This would be a pretty standard MathJax configuration.
Lets look at how the User:Nageh/mathJax script works, and adapt this for your setting. What he did is install a copy of mathjax on the webserver server, in his case it was all installed in his user space
https://en.wikipedia.org/w/index.php?title=Special%3APrefixIndex&prefix=Nageh%2FmathJax&namespace=2
If you have access to the server you could install the code in a more sensible place. Say for sake of argument MediaWiki/includes/MathJax. Then in common.js just have a line
importScript("/MediaWiki/includes/MathJax/MathJax.js");
or possible better
mw.loader.load("/MediaWiki/includes/MathJax/MathJax.js");
or even better
mw.loader.using("/MediaWiki/includes/MathJax/MathJax.js").done( function() {
MathJax.Hub.Config( ... );
} );
after than just have the MathJax hub setup you need. See https://www.mediawiki.org/wiki/ResourceLoader for details.

Anyone know how to set Notepad++ as default text editor for SAS, Stata and R?

Anyone know how to set Notepad++ as default text editor for SAS, Stata and R?
I'm having the hardest time finding anything online (particularly for SAS). Looking for ability to run code from Notepad++ as well as setup color coding.
Thanks.
Why not just go the GUI route: right click, e.g., any foo.R file and select "Open with...", then pick Np++ and click the "always open this file type.." button. Rinse, lather, repeat.
BTW, for R, if you don't already have it, get "NppToR" , a little app which lets you execute code directly from the Npp window.
On windows you can either:
manually edit the keys for the file type to set the value of HKEY_CLASSES_ROOT\FILE_TYPE\shell\edit\command where FILE_TYPE is the appropriate one for each of the files extensions you wish to change this is quite hard work or
you can use a program that does it for you such as the free Default Programs Editor
In either case the first thing to do is to back up the registry.
I would seriously suggest looking into using one of the many, some free IDEs as they will automatically include the run from edit environment, syntax highlighting, code completion and, in many cases, debugging as well.
Notepad++ is my favorite editor and I was in the same shoes as you are now.
I am assuming that you are in Windows (Notepad ++ doesn't exist in Mac, saddest thing for me)
Please follow the steps mentioned in the below webpage and do as the author says.
http://hafniumcity.com/notepad_color.php
Now for in-line editing , it may be not be the best choice for SAS. Although I haven't tried it much so not a good person to comment on it.

GNAT GPS on the fly syntax checking and getting the best out of the IDE

I've started using GPS for coding Ada at work - does anyone have any tips for getting the best out of the IDE? or any plugins I should be aware of?
For example is there a way to enable on the fly syntax/type checking - of the sorts you get in eclipse/visual studio where errors are underlined as you go?
Also what are people's general opinions on GNAT Workbench compared to GPS?
thanks
Matt
The GPS does not have a from of background syntax checking and that is by design. The idea behind GPS is that it is the compiler who decides what code is correct and what code is not correct. It means that if you want to know if your code is correct or not you have to compile it. On a Windows computer the short cut key for that is SHIFT+F4 and will only compile the specification or body file you are currently editing. Pressing F4 will compile your whole project. You will save time by using SHIFT+F4.
Another interesting feature is that the GPS uses cross-reference (XREF) information when navigation through the code. For example, let's say you would like to find all the places in your code where a specific subprogram is called. In GPS (GNAT PRO), right click on the subprogram you are interested in a press Find references. In the GPS GNAT Libre version you don't have a menu when right clicking in your code. In this case go to the Navigate menu and click on Find references there. If the GPS does not find any references and you know that the subprogram is used in the application it means that the XREF information needs to be updated. You may compile the whole application by F4 since the XREF information will be generated along with the binary that is produced. If you go to Edit and click on Key shortcuts you can set up a short cut key to generate the XREF information only. You may also find several interesting features there that you can set up a short cut key for.
The cross-reference information (XREF) is also used for refactoring (GNAT PRO specific functionality). It often works well for changing variable and subprogram names. Just make sure the cross-reference information is up to date!
Code snippets in GPS are also useful. You use them by writing a keyword followed by CTRL+O (not zero, O as in Orwell). To see the code snippets you can choose between go to Edit and click on Aliases. You can also create your own Aliases and code snippets to become a more productive Ada Software Engineer.
Good luck!
I do not think that GPS has a form of background syntax checking like Eclipse does, at least I haven't found it.
I wrote a small sized terminal program in GPS as my first Ada program and my opinion of it is generally negative.
The browser is very confusing and it is hard to find items you are looking for.
The editor has the nasty habit of adding a column to the left and removing it dynamically based on the item under your mouse. What that does is when you are trying to select text with the mouse, your text switches right and left by one character as you move which makes precise selection a difficult thing to do
Getting in the debugger involves too many steps and it generally moves your files in the editor to the EOF position when you set breakpoints, so you will do a lot of scrolling to go back to the sections of interest.
The debugger output looks fancy with all the graphical elements but it is also cumbersome to operate.
GPS offers better help features for Ada libraries though, it's generally easier to browse the standard libraries and check them out than in Eclipse.
All in all, if Eclipse works for you, you might want to stick with it or perhaps open both on the same project and switch to GPS for things like help etc.
I had a related question out here which is on hold now (as I expect your question will soon be due to it's broad content) but I did some research and I am generally dissatisfied with what is out there in the Ada field. The language is great but it suffocates under bad tools.
One last tip: You might want to try Slick Edit as it's text editor and browsing features are quite good, although they too have flaws with Ada (for instance the beautifier).
Good luck with your venture

Wordpress template code messed up

Here is a screenshot of what's happening to my wordpresss template code time after time:
https://www.box.net/shared/zrql76wiimr790587yxj
I thought at first it was a notepad++ problem. But this occured also on phpstorm.
Any idea why that's happening?
Your code isn't messed up, this is a question about how your system handles lineendings.
Linux and OSX save lineendings differently from Windows.
Linux and OSX saves lineendings with a Line Feed (LF):
\n
While windows saves it with Carriage Return + Line Feed (CR+LF):
\r\n
So what is probably happening is that your file has been written on a system that doesn't save lineendings in the windows format. Your editor most probably supports these kind of line endings and can handle it, look into the menus of your editor.
** Below is part of an edit and not part of my answer.**
You can check EditorConfig which can be helpful when you are trying to keep settings across projects and/or editors and also, if you keep your code under git, Dealing with line endings article from Github may be also helpful.
End of edit
Read more here: Wiki article

Resources