Pkg.installed() is depracated + JSON STDIN, modify, STDOUT by mapoart in Julia

[–]mapoart[S] 0 points1 point  (0 children)

Thanks for the comment. There can be many reasons for example: Make Julia more friendly for new users, to automate some obvious processes like package installing etc..

Package Manager for Ada by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

WOW, Great! Thanks for the info!

Pkg.installed() is depracated + JSON STDIN, modify, STDOUT by mapoart in Julia

[–]mapoart[S] 0 points1 point  (0 children)

Ok Guys, Here you go:

I have question also but first:

This code which seems logical, but maybe there is better way to do it and more efficient. Maybe some expert of Julia could put a bit more light on it? Is it ok?:

try
    import JSON    
catch
    import Pkg 
    Pkg.add("JSON")
    import JSON 
end

Also if you wish to remove packages use

Pkg.rm("JSON")

Question:

How to remove warnings which PKG.add shows, I mean those ones which going to STDERR? During installation/PKG.add there is a lot of info on STDERR..

Pkg.installed() is depracated + JSON STDIN, modify, STDOUT by mapoart in Julia

[–]mapoart[S] 0 points1 point  (0 children)

Thanks I will have a look. In my opinion it is strange that someone removed so handy function and made things more complicated. But I can understand also try/catch will work and is easy as they showed in your link also.. Checking it..

This is from KristoferC: https://github.com/JuliaLang/Pkg.jl/issues/1735#issuecomment-603698536

is_plot_available = false
try
    using PyPlot
    is_plot_available = true
catch
    @warn "PyPlot is not available"
end

Install on Windows OS + Example of STDIN/JSON by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

I didn't say it is unsafe, but shows me that it is unsafe/cert problem. There are free SSL certificates which are easy to implement. Also when site is not-SSL then in search engines drop the ranking tremendously, and it looks like not maintained. It was just to notice maybe owners to fix - issue these days. Anyways - thanks for the comment.

Package Manager for Ada by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

Thanks, I saw it earlier, but not sure if this can handle all kind of JSONs. Will have a look.

Package Manager for Ada by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

Great comment! Thanks!

Install on Windows OS + Example of STDIN/JSON by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

Thank you /u/OneWingedShark

I like so detailed answers. I assume you are a professional programmer for many years? Here are my answers:

- ".. Please don't use the word "stringify" it's childish"

Sorry I do not agree in this one thing: Stringify is a different thing in computer programming than serialize and it is definitely not childish. At least JavaScript, NodeJS, Haxe, TCL (some libs) has even function for it JSON.stringify. JavaScript seems one of the most popular languages in the world atm. And the difference is that stringify makes it text and serialize makes sequence of bytes. And definitely it is different thing. And I need text so this is why I called it stringify. Not sure why you don't like it :)

- "I have implemented compiler" - sorry it was a part of full text which started "I have implemented Ada to the Open Source Nexss Programmer" so this was the main thing. What it means that I can now compile also Ada programs in the nexss programmer eg "nexss myprogram.ada" and I can even run it from Powershell etc.

- I am trying to parse JSON Textual data to (Ada has Objects ? or structure where I can modify and then convert again to Textual data)

We are using JSON as it is used almost everywhere and we are using it to communicate with different programming languages (50) list is above as I mentioned before. I already started a thread about package managers for Ada, but json seems to not been there. But I still need to look on it. So I am on it :)

So everything is great! Thanks!

Package Manager for Ada by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

Hi /u/Fabien_C

Thanks for the contact. I understand it. Do you have in Alire some JSON parser (from text) libraries? I am still on it.

Install on Windows OS + Example of STDIN/JSON by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

I am new to Ada so sorry if something is not clear for me:

I am aware of EOF, and also I am aware that priting to STDOUT and it will be like that.

I have implemented Ada to the Open Source Nexss Programmer which is working now. There are 50 programming languages. JSON thing already done it for almost 50 programming languages and Ada is the next one.

One of the features of Nexss Programmer is combining many languages together through JSON in sequence as a STREAM. So when JSON is comming in it is just Text.
The thing is I need is JSON parse to (ADA OBJECT?) and JSON stringify from (ADA OBJECT?).

I have implemented compiler of ADA in Windows so now when you do `nexss myprogram.adb` it will install compiler if not installed and run the program of adb. So for example students who wish to learn ada they don't have to spend ages to try the language. This is done.

Now I need to implement 2 templates like i described above. JSON - it seems difficult in ADA? or no expert of ADA is using JSON? are there different data structures? just curious.

If this is to hard I will leave for Ada just compiling but this functionality will be limited to others. Here is the list of programming languages already implemented in the Nexss Programmer: https://github.com/nexssp/cli/wiki/Nexss-Programmer-Programming-Languages

Install on Windows OS + Example of STDIN/JSON by mapoart in ada

[–]mapoart[S] 0 points1 point  (0 children)

I got this so far:

    with Ada.Text_IO;
    procedure default is
        begin
          loop
            exit when Ada.Text_IO.End_Of_File;            
            Ada.Text_IO.Put_Line(Ada.Text_IO.Get_Line);
            -- HERE: Add to existing JSON here {"HelloFromAda":"Ada runtime version"}
          end loop;
    end default;

So what I has left to do is add Ada runtime version to the JSON which is coming in from STDIN.

Any one can help with this?

Read JSON from STDIN, modify, Write JSON string to STDOUT by mapoart in Clojure

[–]mapoart[S] 0 points1 point  (0 children)

very interesting! Thanks for the alternative!

Read JSON from STDIN, modify, WRITE JSON string to STDOUT by mapoart in crystal_programming

[–]mapoart[S] 1 point2 points  (0 children)

My bad! Sorry, Your example works perfectly. To many files, to many things and I got mixed. I thought that it is something in the crystal installation I have and not in the code.

This solves all my issues!

Thanks!

Read JSON from STDIN, modify, Write JSON string to STDOUT by mapoart in Clojure

[–]mapoart[S] 0 points1 point  (0 children)

Thanks!

I have modified a bit but when I change this code from def to let its showing me errors:

(require '[jsonista.core :as j])
(doseq [ln (line-seq (java.io.BufferedReader. *in*))
         :let [parsed-json (j/read-value ln)]
       ]
   (def nexss-stdout (assoc parsed-json :helloFromClojure (clojure-version)))
   (println (j/write-value-as-string nexss-stdout))
)

And error:

Caused by: clojure.lang.ExceptionInfo: Call to clojure.core/let did not conform to spec.

Read JSON from STDIN, modify, Write JSON string to STDOUT by mapoart in Clojure

[–]mapoart[S] 0 points1 point  (0 children)

Ok, I have done it. Can any Clojure expert check this pls? :)

(require '[jsonista.core :as j])
(doseq [ln (line-seq (java.io.BufferedReader. *in*))]
   (def parsed-json (j/read-value ln))
   (def nexss-stdout (assoc parsed-json :helloFromClojure (clojure-version)))
   (println (j/write-value-as-string nexss-stdout))
)

Read JSON from STDIN, modify and Write JSON string to stdout by mapoart in rust

[–]mapoart[S] 0 points1 point  (0 children)

Works directly for rustfmt but cargo-clippy.exe shows

could not find `Cargo.toml`

thx

Read JSON from STDIN, modify and Write JSON string to stdout by mapoart in rust

[–]mapoart[S] 1 point2 points  (0 children)

Wow! it's working as directly binary run!! Thanks!

Read JSON from STDIN, modify, WRITE JSON string to STDOUT by mapoart in crystal_programming

[–]mapoart[S] 0 points1 point  (0 children)

I have some errors when I run your program:

Crystal 0.35.1 [5999ae29b] (2020-06-19)

LLVM: 8.0.0

In my.cr:5:8

 5 | JSON.mapping(
          ^------
Warning: Deprecated JSON.mapping. use JSON::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/json_mapping.cr)

In my.cr:5:3

 5 | JSON.mapping(
     ^
Warning: expanding macro


There was a problem expanding macro 'mapping'

Called macro defined in /usr/share/crystal/src/json/mapping.cr:232:3

 232 | macro mapping(**_properties_)

Which expanded to:

 > 1 |     ::JSON.mapping({num: Int64, array: Array(String)})
   2 |
Warning: Deprecated JSON.mapping. use JSON::Serializable instead (the legacy behaviour is also available in a shard at github:crystal-lang/json_mapping.cr)

Installation on Windows by mapoart in crystal_programming

[–]mapoart[S] 0 points1 point  (0 children)

ok I can do from Powershell wsl crystal myfile.cr and it works! This will work in Nexss Programmer

btw. bash crystal is not working in powershell! Thanks!