MattMarquise
Posts: 2
Joined: Tue Apr 20, 2021 10:48 pm

HTML, CSS, and JS?

Wed Apr 21, 2021 12:31 am

I want to create a UI for a software that will be displayed on the PI's official 7" touchscreen, however from my endless google searches I am unable to determine if HTML, CSS, and JS can be used on a raspberry pi and be displayed not in a web browser but rather in a full screen mode. So is it possible? Also is it possible to have a framework such as Laravel, React, or Vue on a PI?

MiscBits
Posts: 249
Joined: Wed Jan 27, 2021 12:48 pm

Re: HTML, CSS, and JS?

Fri Apr 23, 2021 12:19 am

Bit baffled as to what would render the HTML etc onto the screen if not a browser??? I would have thought you would use the browser in kiosk mode for full screen

This page may help with Laravel set-up.
Is a computer language with goto's totally Wirth-less?

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: HTML, CSS, and JS?

Fri Apr 23, 2021 2:37 am

MiscBits wrote:
Fri Apr 23, 2021 12:19 am
Bit baffled as to what would render the HTML etc onto the screen if not a browser???
Many things. Applications that have a HTML renderer to create their display. For example they might use the Electron framework: https://www.electronjs.org/docs/tutorial/quick-start. The much discussed here Visual Study Code editor is a great example of an Electron application: https://www.electronjs.org/docs/tutorial/quick-start.

Or they might use a web view widget like the QWebView in the Qt GUI libs: https://wiki.qt.io/Open_Web_Page_in_QWebView or webkit in the GTK libs.

So, in answer to MattMarquise' question: Yes it is possible to use HTML, CSS, JS in an application . And yes one can use Javascript libraries like React or Vue in an application.
Memory in C++ is a leaky abstraction .

User avatar
Gavinmc42
Posts: 5631
Joined: Wed Aug 28, 2013 3:31 am

Re: HTML, CSS, and JS?

Fri Apr 23, 2021 4:41 am

Got my eye on Embedded webkit
https://wpewebkit.org/
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

MiscBits
Posts: 249
Joined: Wed Jan 27, 2021 12:48 pm

Re: HTML, CSS, and JS?

Fri Apr 23, 2021 4:14 pm

@Heater and Gavinmc42 - thanks for those something new for me to stick my nose into :-)
Is a computer language with goto's totally Wirth-less?

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: HTML, CSS, and JS?

Fri Apr 23, 2021 5:15 pm

Well there is the thing. People have been trying for two decades or more to make it possible to write nice looking GUI applications on Unix/Linux. Like people expected on Windows and Mac. Notably the Qt GUI framework and a bit later GTK. Not to mention the efforts before that like the X Athena Widgets.

They were all various shades of ugly as hell and not so easy for a programmer to use.

Then people realised, wait a minute, those web browsers do all the GUI magic one could ever want. All the buttons, check boxes, text boxes, images, SVG, video, 3D acceleration, styles, themes one could dream of. They have been made so easy to use even Javascript enabled web monkey's can do interesting things with them. Not only that those browser engines are cross-platform, running on Unix, Linux, Mac and Windows.

So there was born the idea to abandon traditional GUI applications and do everything in the browser. Or why not rip the rendering engine out of a browser and use that to create applications. Enter Electron. And apparently the Qt web view thing.
Memory in C++ is a leaky abstraction .

User avatar
Gavinmc42
Posts: 5631
Joined: Wed Aug 28, 2013 3:31 am

Re: HTML, CSS, and JS?

Sat Apr 24, 2021 2:07 am

Hmm Electron, oh uses the Chromium engine.
Does it run on Pi's?
Going to need Pi4's?

Just did a 20 Pi project with web interface GUI.
Now got used to CSS, HTML and JS.
Still a mess of code, but it works and changes can be done live ;)
I'm dancing on Rainbows.
Raspberries are not Apples or Oranges

drtechno
Posts: 230
Joined: Fri Apr 09, 2021 6:33 pm

Re: HTML, CSS, and JS?

Thu May 13, 2021 7:37 pm

MattMarquise wrote:
Wed Apr 21, 2021 12:31 am
I want to create a UI for a software that will be displayed on the PI's official 7" touchscreen, however from my endless google searches I am unable to determine if HTML, CSS, and JS can be used on a raspberry pi and be displayed not in a web browser but rather in a full screen mode. So is it possible? Also is it possible to have a framework such as Laravel, React, or Vue on a PI?
yes, you have to install the webserver packages of your choice (apache, inginx) and install the server requirements for any of those frameworks , but its going to be a resource hog, like normal, because of all the layers of processing.

The most lightweight and efficient one is phoenix/elixir/erlang packages https://www.phoenixframework.org because it compiles it and runs as a compiled binary.

most web browsers have a "kiosk" mode. firefox command line for that is: firefox --kiosk

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: HTML, CSS, and JS?

Thu May 13, 2021 11:39 pm

drtechno wrote:
Thu May 13, 2021 7:37 pm
yes, you have to install the webserver packages of your choice (apache, inginx) and install the server requirements for any of those frameworks , but its going to be a resource hog, like normal, because of all the layers of processing.
You don't need to install any web server if you are using HTML, CSS, JS together with React or other browser side framework in an application created with Electron.

Not so familiar with using the likes of webkit or other web GUI widgets but most likely it's not essential to use a server like Nginx of Apache there either.
drtechno wrote:
Thu May 13, 2021 7:37 pm
The most lightweight and efficient one is phoenix/elixir/erlang packages https://www.phoenixframework.org because it compiles it and runs as a compiled binary.

most web browsers have a "kiosk" mode. firefox command line for that is: firefox --kiosk
Or using Node.js and writing your server side part of you application in Javascript is a very easy way to go.

I would not worry about "resource" hog whatever you do. Even euinsg Nginx together with Node.js is hardly a drain on the memory or performance available on a Pi for most tasks.

Currently, with an eye towards resource saving but mostly for correctness reasons I use Rust and the Rocket library for this:
https://www.rust-lang.org/
https://rocket.rs/
Memory in C++ is a leaky abstraction .

drtechno
Posts: 230
Joined: Fri Apr 09, 2021 6:33 pm

Re: HTML, CSS, and JS?

Fri May 14, 2021 12:17 am

Heater wrote:
Thu May 13, 2021 11:39 pm

You don't need to install any web server if you are using HTML, CSS, JS together with React or other browser side framework in an application created with Electron.

Not so familiar with using the likes of webkit or other web GUI widgets but most likely it's not essential to use a server like Nginx of Apache there either.

Or using Node.js and writing your server side part of you application in Javascript is a very easy way to go.

I would not worry about "resource" hog whatever you do. Even euinsg Nginx together with Node.js is hardly a drain on the memory or performance available on a Pi for most tasks.

Currently, with an eye towards resource saving but mostly for correctness reasons I use Rust and the Rocket library for this:
https://www.rust-lang.org/
https://rocket.rs/
Never played with it, but it just looks like repackaged c++ /java. So many ways to bake a cake.

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: HTML, CSS, and JS?

Fri May 14, 2021 12:57 am

drtechno wrote:
Fri May 14, 2021 12:17 am
Never played with it, but it just looks like repackaged c++ /java. So many ways to bake a cake.
You are talking about Rust I presume. I'm not sure what you are getting at.

Rust is a programming language so yes, very much like C++/Java or any other programming language on a superficial level.

Yes there are many ways to bake the programming language cake. I mentioned one, Rust, you mentioned two others, elixir/erlang. There are of course hundreds of programming languages out there today. They sprout like weeds. Perhaps we will find the perfect recipe one day.

To your specific comparisons with C++ and Java:

Rust compiles to stand alone executables like C++ and so it can provide performance on a par with C++. Currently it uses the same LLVM code generator as the Clang C++ compiler. Rust is a far more coherent and logically designed language, where C++ is an ever expanding mess of features bolted on to C. Rust is far more fussy about type checking and memory usage thus removing whole classes of bugs that are easy to make in C++.

Rust is very different to Java. Rust has no need for an interpreter/virtual machine/garbage collector. Being compiled to binaries like C as I said. Performance therefor far better than Java and resource usage far less. It is not have that ridiculous "every thing is an object" OOP model of Java. Again Rust is far more fussy about types and memory usage than Java.

Rust is the first programming language "cake recipe" I have come across in decades that actually offers genuinely new interesting and helpful features as well as being practically useful. Since say, ALGOL or Occam. I love it for its emphasis on program correctness and performance but the is so much more to like about it as well.

Anyway, we love all languages here. Well, except any whose names begin with "P" :)
Memory in C++ is a leaky abstraction .

drtechno
Posts: 230
Joined: Fri Apr 09, 2021 6:33 pm

Re: HTML, CSS, and JS?

Fri May 14, 2021 7:16 pm

Heater wrote:
Fri May 14, 2021 12:57 am
Anyway, we love all languages here. Well, except any whose names begin with "P" :)
There is nothing wrong with languages that start with a P. Its how they are utilized, or shall I say, mis utilized like cms managers and social media sites, and the lack of information on the best and secure practices. Because http1.1 request methods actually compromise the security of the web storage on a standard web server even without php or cgi. But all of these C based languages have security holes in them as well. Even Rust.

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: HTML, CSS, and JS?

Sat May 15, 2021 8:47 am

drtechno wrote:
Fri May 14, 2021 7:16 pm
There is nothing wrong with languages that start with a P.
The "P" languages I am thinking of are demonstrably terrible. They are dynamically/weakly typed and sloppy about memory use. As such they give little help to the programmer in highlighting/preventing mistakes in coding. Mistakes that eventually show up at run time as incorrect results, crashes, security vulnerabilities, etc. They also have terrible performance. Clearly they are not suitable for anything other than trivial small programs where correctness is not an issue.
drtechno wrote:
Fri May 14, 2021 7:16 pm
Its how they are utilized, or shall I say, mis utilized like cms managers and social media sites, and the lack of information on the best and secure practices.
I can agree with that. As indicated by what I said they are not suitable for huge systems where reliability and/or security are concerns. Never mind performance. Like CMS and social media giants.

On the other hand that is a bit of an odd statement given that PHP was specifically devised to create web sites. Which is what CMS and Social media things are. Python is also often promoted for that kind of role.
drtechno wrote:
Fri May 14, 2021 7:16 pm
But all of these C based languages have security holes in them as well. Even Rust.
I could claim that C and similar have no security holes at all. The security issues arise when they are used in security sensitive applications. The security holes one creates are not inherent to C or any other language. As you said above "Its how they are utilized".

We should be clear about terms here. In the Rust world they speak of memory "safety". Which is arrived at by strict type checking, and strict checks of memory usage. Such that one cannot: Use uninitialised data, use null pointers, use pointers to old deallocated memory, deallocate memory twice, exceed array bounds, etc, etc. Thus preventing a huge number of typical programming errors.

"Security" is a different thing. Which basically boils down to ensuring only the right people can read and/or write data or use other resources.

Clearly a "safe" language does not ensure a "secure" system. If one is using clear text protocols, failing to authenticate users correctly and so on then one has an insecure system no mater how safe the programming language used is.

But security and safety are intertwined. A buffer overflow that can be exploited as a security hole may well be a simple programming error that would have been prevented at, compile time, by using a safe language.

Microsoft has estimate that 70% of the security vulnerabilities reported in their products were found to be such memory misuse programming errors that could have been made if a language like Rust were used: https://msrc-blog.microsoft.com/2019/07 ... cure-code/ Others have reported similar findings.

Actually I'm curious what kind of security hole you have in mind when claiming that even Rust has them. Could you give an example?

Finally I would not call Rust "C based". Yes it has a superficially similar syntax and compiles down to executables like C does. But Rust has taken inspiration from the best language features found in many other languages, including things like Python, Ruby, Haskell. I prefer to think of it as on a language tree branch sprouting from ALGOL. A language that also valued program correctness. C is on a different branch off of ALGOL.
Last edited by Heater on Sat May 15, 2021 8:18 pm, edited 1 time in total.
Memory in C++ is a leaky abstraction .

drtechno
Posts: 230
Joined: Fri Apr 09, 2021 6:33 pm

Re: HTML, CSS, and JS?

Sat May 15, 2021 8:12 pm

Heater wrote:
Sat May 15, 2021 8:47 am


Actually I'm curious what kind of security hole you have in mind when claiming that even Rust has them. Could you I've an example?
You can always look up the vulnerabilities, just like the hackers do:

https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=rust

But the main one that is currently dangerous, is the one that comes with embedding code inside pictures, that sanitation or validation doesn't catch it. Mainly because all of the programs (graphics editors, web browsers, etc) that read the file, are the ones that needed patching, and some web browser on some phones don't get the patch, much less desktop software companies that would be oblivious to that vulnerability.

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: HTML, CSS, and JS?

Mon May 17, 2021 9:04 am

drtechno wrote:
Sat May 15, 2021 8:12 pm
You can always look up the vulnerabilities, just like the hackers do:
https://cve.mitre.org/cgi-bin/cvekey.cgi?keyword=rust
That is an interesting collection of CVEs. Like I said, one can write insecure programs no matter how "safe" ones language is with respect to types and memory usage. We can see that from the thousands of CVEs in Java listed there.

How would a hacker filter those CVEs to find all the ones written in C or C++? When I try to search with keywords like "C", "C++", "Cpp" it returns nothing.
drtechno wrote:
Sat May 15, 2021 8:12 pm
But the main one that is currently dangerous, is the one that comes with embedding code inside pictures, that sanitation or validation doesn't catch it. Mainly because all of the programs (graphics editors, web browsers, etc) that read the file, are the ones that needed patching, and some web browser on some phones don't get the patch, much less desktop software companies that would be oblivious to that vulnerability.
I'm not sure I follow you there. Is that code that is supposed to be imbedded in an image or code that maliciously sneaked into an image? I can't see how Rust would ever get to run code that just happens to be in the bytes of image data.
Memory in C++ is a leaky abstraction .

drtechno
Posts: 230
Joined: Fri Apr 09, 2021 6:33 pm

Re: HTML, CSS, and JS?

Mon May 17, 2021 8:00 pm

Heater wrote:
Mon May 17, 2021 9:04 am

That is an interesting collection of CVEs. Like I said, one can write insecure programs no matter how "safe" ones language is with respect to types and memory usage. We can see that from the thousands of CVEs in Java listed there.

How would a hacker filter those CVEs to find all the ones written in C or C++? When I try to search with keywords like "C", "C++", "Cpp" it returns nothing.
If you went to the website, you would have known how to search it.
Heater wrote:
Mon May 17, 2021 9:04 am

I'm not sure I follow you there. Is that code that is supposed to be imbedded in an image or code that maliciously sneaked into an image? I can't see how Rust would ever get to run code that just happens to be in the bytes of image data.
This bug has been around for 35 years. I'm glad you don't know how to do it.

But writing a program the most secure way doesn't guarantee anything. Because the server itself could be attacked, which you have no control of that on a free web site hosting. Much less there is always a way around the highest security firewalls, WAP. or other security measures. If someone wants to ruin you they can with the right hacker.

Beyond the obvious code and character transformations that causes code injection:

The character that is enclosed by, The character the line it ends by, the character it is escaped by, the character that joins command.

Python is a type of space character, Rust is a type of forward slash character, php is a type of quotes character, and so on.

That will be all. Do your own research, as we grown past the scope of the topic.

Heater
Posts: 18194
Joined: Tue Jul 17, 2012 3:02 pm

Re: HTML, CSS, and JS?

Mon May 17, 2021 11:13 pm

drtechno wrote:
Mon May 17, 2021 8:00 pm
If you went to the website, you would have known how to search it.
But I did go to the web site. And I found some different ways to get at CVEs. What I did not fond was a way to get every CVE that involved C or C++ code. I was hoping you could suggest how to do it, I obviously missed something.
drtechno wrote:
Mon May 17, 2021 8:00 pm
This bug has been around for 35 years. I'm glad you don't know how to do it.
Which bug exactly? Or do you mean the general class of bus that involve code embedded in other objects? PDF's for example, or Word documents.
drtechno wrote:
Mon May 17, 2021 8:00 pm
But writing a program the most secure way doesn't guarantee anything. Because the server itself could be attacked, which you have no control of that on a free web site hosting. Much less there is always a way around the highest security firewalls, WAP. or other security measures. If someone wants to ruin you they can with the right hacker.
Very true. Depending on someone else's computer and their OS and other code leaves one totally out of control of it's security or lack of security.
drtechno wrote:
Mon May 17, 2021 8:00 pm
Beyond the obvious code and character transformations that causes code injection:...
Yep. I agree, using a type and memory safe language does no mean one cannot write insecure code. Not sanitising inputs is a fine example. However having a type and memory safe language will prevent many security issues that could be caused by simple programmer mistakes. It will also help getting such input sanitisation right.
drtechno wrote:
Mon May 17, 2021 8:00 pm
That will be all. Do your own research, as we grown past the scope of the topic.
Sorry, part of my research is asking and discussing with people who know and have experience whenever I can.
Memory in C++ is a leaky abstraction .

Return to “General programming discussion”