Comments on: Open and extensible https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/?s_tid=feedtopost Developing, testing, and integrating production grade software using MATLAB. Fri, 29 Jun 2018 21:39:53 +0000 hourly 1 https://wordpress.org/?v=6.2.2 By: On Cloud Reference Architectures » Developer Zone - MATLAB & Simulink https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-36624 Fri, 29 Jun 2018 21:39:53 +0000 https://blogs.mathworks.com/developer/?p=289#comment-36624 […] have blogged in the past about our approach to being open and extensible. These architectures are no exception and have been released on github.com to allow full […]

]]>
By: Invert Your Inner Control Freak! » Developer Zone https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-4298 Tue, 16 Feb 2016 04:43:24 +0000 https://blogs.mathworks.com/developer/?p=289#comment-4298 […] 18 Dec Open and extensible […]

]]>
By: Making code usable, useful and testable » Developer Zone https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-4074 Sat, 16 Jan 2016 02:35:09 +0000 https://blogs.mathworks.com/developer/?p=289#comment-4074 […] 18 Dec Open and extensible […]

]]>
By: Arvind Hosagrahara https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-3860 Mon, 28 Dec 2015 01:00:02 +0000 https://blogs.mathworks.com/developer/?p=289#comment-3860 The error you are seeing can be due to many reasons. I suspect that it is due to using the 1.8 version of the Java compiler. Typing the “ver” command in MATLAB will tell you which Java version MATLAB uses – you can find this information in the header of the output (eg: Java Version: Java 1.7.0_60-b19 …).

You could either try compiling this code above with the matched version of the JDK OR use the -source 1.7 -target 1.7 flags to generate class files for the specific VM version.

Please remember to package your class correctly. In my case, I had to use:

> javac -cp jazzy0-2-1.jar SpellCheck.java -source 1.7 -target 1.7 -bootclasspath "c:\Program Files\Java\jdk1.7.0_80\jre\lib\rt.jar"
> copy SpellCheck.class com\mathworks\spellcheck\.
> jar cvf SpellCheck.jar com\mathworks\spellcheck\SpellCheck.class

And finally, please ensure that the jazzy jar file is also on the Java classpath (I omitted writing about this step in the post). This is done in the same way:

>> javaaddpath(fullfile(pwd,'jazzy0-2-1.jar'));
]]>
By: Simon https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-3793 Wed, 23 Dec 2015 14:57:20 +0000 https://blogs.mathworks.com/developer/?p=289#comment-3793 Hi Arvind,
I really like the idea of your application. But somehow I am not able to get it running. I compiled using
javac -cp jazzy0-2-1.jar SpellCheck.java and jar cvf SpellCheck.class SpellCheck.jar. After importing this in Matlab I still get the the following error message:
Undefined function or variable ‘SpellCheck’.
Error in testDrive (line 11)
obj = SpellCheck();
Why?
Thanks

]]>
By: Arvind Hosagrahara https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-3780 Tue, 22 Dec 2015 20:15:41 +0000 https://blogs.mathworks.com/developer/?p=289#comment-3780 @sam – The MATLAB object wrapper that I use does have a switch to inspect only comments. It works off a simple test to see if the entire line is a comment. As you correctly note, to do this robustly for inline comments and block comments is a lot trickier than it initially appears. I took a swing at it but quickly decided to go the other way. Appending a list of common MATLAB keywords/functions to my dictionary allowed me to check the spelling of my variable names in the code and that was useful in itself.

In light of my last requirement (#5 – that this example not turn into a huge project by itself), I decided to call it a feature, not a bug! 🙂

Regular expressions are very powerful but I tend to steer clear of using them for parsing anything other than simple, well-structured content.

]]>
By: Arvind Hosagrahara https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-3779 Tue, 22 Dec 2015 19:47:40 +0000 https://blogs.mathworks.com/developer/?p=289#comment-3779 @oleg – I do know that other projects such as the MATLAB-Emacs integration do reach into the mlint infrastructure – this was described a while ago at:
https://blogs.mathworks.com/community/2009/09/14/matlab-emacs-integration-is-back/

The MATLAB object wrapper around this code produces an mlint-like textual output detailing the line number (when parsing entire files) and this was sufficient for my basic needs. I do agree that having it integrated into the editor would be nice. I plan to take a closer look at whether integrating into mlint is easy/possible over the next few days.

]]>
By: Sam Roberts https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-3775 Tue, 22 Dec 2015 17:25:24 +0000 https://blogs.mathworks.com/developer/?p=289#comment-3775 Hi Arvind,

On a slightly connected topic (since you’d typically like to spellcheck only the comments in your code), a while ago I attempted to craft a regular expression that, given a line of code, would return text in the line that contained a comment.

I’m not great at regular expressions, but it turned out to be much harder than it looked at first sight. So it’s easy to find percent symbols, but you need to exclude percent symbols that occur as part of a string (which they commonly do, for example as arguments to sprintf or fprintf). So you can then also find and exclude things between matching pairs of apostrophes. But even that turns out to be not enough, as the apostrophe can also be used to indicate a transpose, and you might have multiple transposes that looked like a pair of quotes. At that point I gave up.

Does anyone at MathWorks have a regular expression they could share that can be used to extract comments from a line of code? (Let’s not worry about block comments for the moment, I think I can do those separately).

Thanks,

Sam

]]>
By: oleg https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-3704 Sat, 19 Dec 2015 03:58:18 +0000 https://blogs.mathworks.com/developer/?p=289#comment-3704 Hi Arvind,
Is it possible to interface it with the mlint to highlight spelling errors?

]]>
By: Arvind Hosagrahara https://blogs.mathworks.com/developer/2015/12/18/open-and-extensible/#comment-3693 Fri, 18 Dec 2015 20:42:54 +0000 https://blogs.mathworks.com/developer/?p=289#comment-3693 I will create an enhancement request. I do know that our development team has a long list of exciting features planned for the MATLAB editor but my underlying point was that like vim, MATLAB offers a very mature environment to extend functionality. The idea behind the post is that users do not have to wait for things like this to ship in product as it is demonstrably easy to add functionality and customize the product to suit your needs.

]]>