User avatar
solar3000
Posts: 1051
Joined: Sat May 18, 2013 12:14 am

Outdated webguy, update me

Mon Oct 30, 2017 8:30 pm

Outdated web developer here. Update me.

Was using this old tool => Use this new tool instead
apache1 and 2 => ??
php/perl/c for CGI => ??
javascript => same?
Linux => same?
mysql (now mariadb) => ?


Or in your own words, what set of tools do you use?

And what tools do you use to get information from your system to your web server to someone's browser?
Antikythera

User avatar
DougieLawson
Posts: 36854
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Outdated webguy, update me

Mon Oct 30, 2017 8:41 pm

Apache/NGinx/Lightttpd - used all three - although getting CGI working is orders of magnitude easier with Apache2 2.4
Perl/PHP/c - yes used all of those. Last CGI program I wrote was C with MariaDB (SQL updates) and MQTT (messaging to IoT devices. Same program in Perl was just too slow to get started.
Javascript - yes, using JQuery for dynamic HTML and AJAX (to drive that CGI program) is trivial.
MariaDB (drop-in replacement for MySQL) is better for concurrent updates, SQLite3 is OK if you can be 100% sure there's only one process/thread/task/CGI program running updates (or your database gets screwed).

I don't know why anyone would shy away from those things as they're well developed and they work. Why invent a new twelve-sided wheel when the round one we've had for years still works (it may just need a re-tread).

If you want to get funky and like visual programming (I don't) then switch to Node-Red.

If you like left-hand whitespace as a syntactic anomaly the switch to python.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: Outdated webguy, update me

Mon Oct 30, 2017 8:48 pm

Use NGINX. https://www.nginx.com/resources/wiki/ It does the job and works well on a Pi setup as Headless lightweight without the Gui. I do use Webmin on those servers to handle the backend stuff. Also easy to go in and update packages, remove them, clear Root and Admin email from the Cronjobs.

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 8:55 pm

A very good question.

Like I said elsewhere I did not want anything more to do with web development, Apache, PHP, CGI, MySql, etc Having had to deal with that mess in the 1990's. Until....

A few years back my company needed a 3D data visualization in the browser updated in real-time. Nobody wanted to touch it so we hired a FLASH contractor to do it for us.

As we were on a tight deadline, 6 weeks, and as I had heard rumors of being able to do 3D in HTML 5 using webgl, I started working on it in my spare time.

Turned out the 3D visulaization in the browser was easy, using Javascript and the THREE.js library:
https://threejs.org/

Turned out, pumping real-time data updates into this visualization in the browser was easy using HTML 5 web sockets. Especially using the socket.io library:
https://socket.io/

But that kind of dictated using Javascript on the server using node.js:
https://nodejs.org/en/

End result was that when it came time to show what we had got, my HTML5, javascript, THREE.js, socket.io, node.js solution was on stage and worked.

The FLASH thing was late. Never did get finished.

Anyway, since then I found that Javascript and node.js is a brilliant and efficient way to make all kind of web server things. Especially if your web server is on a Pi and you want to have it interface GPIO, serial ports and such to web pages.

Your mileage may vary.
Memory in C++ is a leaky abstraction .

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: Outdated webguy, update me

Mon Oct 30, 2017 9:16 pm

Dougie why not use Asm instead of Pearl. It would be faster.

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 9:19 pm

Yeah, Dougie is so old he is still using jQuery!
Memory in C++ is a leaky abstraction .

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 9:26 pm

Dougie,
I don't know why anyone would shy away from those things as they're well developed and they work.
Except they have never worked.

They looked like they did.

But then we discovered the billion holes in security on the web since then. And every day we find more.

(Well, when I say "we" I mean the guys who search out such things, black hat or white)

That patchwork quilt of languages and technologies that makes the web is a disaster.

Me, I like to keep it simple. In the hope there are less holes to worry about.
Memory in C++ is a leaky abstraction .

User avatar
The Traveler
Posts: 363
Joined: Sat Oct 21, 2017 3:48 pm

Re: Outdated webguy, update me

Mon Oct 30, 2017 9:39 pm

Or in your own words, what set of tools do you use?
For myself, Linux/Apache/php/mariadb and the bash shell. Just another LAMP stack. A few reasons; first and foremost, I like simple. I love php for it's simplicity. it's a fairly simple scripting language to apply and it was a web-centric language when it was conceived. The tool fits the work. I use the bash shell for OS calls and OS level tasks. It's simplicity to call bash from php when I need it. Secondly, I've been using Apache for over 20 years now. My first company was an ISP I started in '95 and Apache/Linux as the choice I made. Never regretted it. As for a db, I was a solid MySQL user for many years until I migrated to mariadb. Again, familiarity played a significant part as I'm getting older and I really don't want yet another learning curve. Mostly the reason I don't screw around with Javascript et al.

I'm not all wrapped in the whole "dynamic web" thing. My servers are easy to secure, reliable and stable. As Scotty from the Starship Enterprise once said, "The more complicated the plumbing, the easier it is to stop it up". Simple is good.

Cheers.
Retired IT professional, C programmer and "beardie weirdie".
RPi interests: Developing an Infinite Improbability Drive
“Thinking outside of the box allows you to get rewards outside of your reach.” Matshona Dhliwayo

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 10:04 pm

For myself, Linux/Apache/php/mariadb and the bash shell...I use the bash shell for OS calls and OS level tasks. ...solid MySQL
That right there is why security on the web has been a joke for two decades and more.

So many times have I seen pages of source code that include the syntax of HTML within PHP. Or the other way around. Then they also include the syntax of SQL and BASH and God knows what else.

All very easy to cobble together. But impossible to know where the flaws are that hackers can exploit. SQL injection attacks anyone?

By the way, MariaDB is MySQL.

A do agree though. I have my doubts about the whole "web app" thing. It's not what HTTP and HTML was designed for.

On the other hand I agree with Scotty, "Simple is good". That old mess of HTML, PHP, CSS, SQL all mixed up was not simple.
Memory in C++ is a leaky abstraction .

User avatar
DougieLawson
Posts: 36854
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Outdated webguy, update me

Mon Oct 30, 2017 10:20 pm

broe23 wrote:
Mon Oct 30, 2017 9:16 pm
Dougie why not use Asm instead of Pearl. It would be faster.
Because assembler costs a lot to develop. On the Raspberry I prefer C because one line of C is worth 100 lines of assembler (and just as quick at execution time). Since June 2015 I've written lots of zSeries mainframe assembler, so I'm still doing assembler programming but mostly when someone is paying me to do it.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

User avatar
DougieLawson
Posts: 36854
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Outdated webguy, update me

Mon Oct 30, 2017 10:27 pm

Heater wrote:
Mon Oct 30, 2017 9:19 pm
Yeah, Dougie is so old he is still using jQuery!
I like JQuery because it's giving me the flexibility of Javascript without all of the pain. I can't see the point of hand-crafting code when someone else has done the hard work for me. I think I've just reached the point where it's making sense.

I've even learned about JSON. See you can teach a crusty, grumpy old systems programmer a new trick.

Heck, I've even done some object oriented programming. Haven't got as far as OO-COBOL, but I can see some value in Java (which is a very elegant language and so totally unlike that mess of C++).
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 10:30 pm

Dougie,
On the Raspberry I prefer C because one line of C is worth 100 lines of assembler
I guess you might be speaking figuratively there but in case not I have a challenge for you.

Show me one line of normal kind of C code that ends up compiled to 100 lines of assembler. In whatever architecture.

But I'm with you. C is great. It's just that I have seen times when writing assembler is quicker, easier and smaller.
Memory in C++ is a leaky abstraction .

User avatar
The Traveler
Posts: 363
Joined: Sat Oct 21, 2017 3:48 pm

Re: Outdated webguy, update me

Mon Oct 30, 2017 10:44 pm

That right there is why security on the web has been a joke for two decades and more.
I'm old school enough to remember when we said, "The best network security is a one inch air gap".

Point is, security in ANY system connected to ANY network ISN'T secure. No matter the system, the apps, the hardware, somewhere there's a hole. So, I try to only work with applications to which I have source code access, like a LAMP stack. All one can do is apply best practices, log extensively and review code changes.

Cheers.
Retired IT professional, C programmer and "beardie weirdie".
RPi interests: Developing an Infinite Improbability Drive
“Thinking outside of the box allows you to get rewards outside of your reach.” Matshona Dhliwayo

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 10:50 pm

Dougie,
I like JQuery because it's giving me the flexibility of Javascript without all of the pain.
Please don't disappoint me. Please don't tell me that with all your years of experience you cannot tell the difference between a library and a language.

If you are using JQuery then you are using Javascript. As surely as we use C when we use libm.

jQuery does serve a great purpose as a library in the Javascript world. It wraps and simplifies the horrible nightmare that is the API (Application Programming Interface) to the browser's DOM (Document Object Model).

That is good but there are also many other libraries that can do that.

Most of the "pain" comes from the DOM. So many people have tried to alleviate that. Nothing to do with Javascript the language.

JSON is very convenient.

I'm not so hung up on the Object Oriented Programming thing. It's a style, an approach, that fits some cases, some times.
Memory in C++ is a leaky abstraction .

User avatar
DougieLawson
Posts: 36854
Joined: Sun Jun 16, 2013 11:19 pm
Location: Basingstoke, UK
Contact: Website Twitter

Re: Outdated webguy, update me

Mon Oct 30, 2017 11:02 pm

I know the difference, I know that I can write native javascript in stuff that's using the JQuery javascript library, but I'll native code to reduce the time taken to code a program. It's like the difference between raw static SQL and calling a stored proc (where I can rely on a DBA to optimise it).

The real answer is to do stuff that works and not care too much about how it's done (as long as it runs fast enough). I'd guess that's one reason for the bloat we see in Windows (and Linux on X86). We're a long way beyond counting machine cycles and rewriting machine code to save a few cycles in a loop.
Note: Having anything humorous in your signature is completely banned on this forum. Wear a tin-foil hat and you'll get a ban.

Any DMs sent on Twitter will be answered next month.

This is a doctor free zone.

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 11:07 pm

The Traveler,
I'm old school enough to remember when we said, "The best network security is a one inch air gap".
Of course. If your system has no inputs and no outputs it is very secure :)

Also useless.

As a practical matter this idea was proved wrong by STUXNET. Google it.

I'm dedicated to open source computing. In all walks of life.

But really, have you read and reviewed all the source of all the code you use? Even if you did are you sure bugs and security holes did not slip by you?

I would say, quite frankly, that having the source to the LAMP stack to read and review does not help make web apps built on it secure. Everything in the web world is designed to be insecure, from HTML upwards.

It all starts from Postel's law:

"TCP implementations should follow a general principle of robustness: be conservative in what you do, be liberal in what you accept from others"

You see that "liberal" part there? That continued into HTTP and HTML that would parse any old junk and try to accept it.

That is basically saying "Do not check your inputs" !!!

No hope for security after that.
Memory in C++ is a leaky abstraction .

User avatar
The Traveler
Posts: 363
Joined: Sat Oct 21, 2017 3:48 pm

Re: Outdated webguy, update me

Mon Oct 30, 2017 11:22 pm

I would say, quite frankly, that having the source to the LAMP stack to read and review does not help make web apps built on it secure. Everything in the web world is designed to be insecure, from HTML upwards.
Yeah, nothing is really secure and one can be as idealistic as one wants about it. I however, prefer pragmatic. It pays better.

Cheers.
Retired IT professional, C programmer and "beardie weirdie".
RPi interests: Developing an Infinite Improbability Drive
“Thinking outside of the box allows you to get rewards outside of your reach.” Matshona Dhliwayo

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 11:25 pm

That's OK Dougie, I'm all for using libraries to tackle problems that others have tackled before. Why reinvent the wheel? It's just that so many times I hear web developers talk about jQuery as if it was a different language to JS.

You are pushing my buttons there now. What "bloat" in Linux? What would you like to remove?
We're a long way beyond counting machine cycles and rewriting machine code to save a few cycles in a loop.
That is for sure.

Nothing to do with Linux or even Windows particularly. Even writing in assembler it is impossible to tell how long an instruction will take on a modern day processor. With it's memory caches and such.
Memory in C++ is a leaky abstraction .

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 11:30 pm

The Traveler,
Yeah, nothing is really secure and one can be as idealistic as one wants about it. I however, prefer pragmatic. It pays better.
Can I assume that because of people like you, with your attitudes, things like the Equifax disaster happen?

And you don't care. As long as you get paid more than the next guy?
Memory in C++ is a leaky abstraction .

User avatar
The Traveler
Posts: 363
Joined: Sat Oct 21, 2017 3:48 pm

Re: Outdated webguy, update me

Mon Oct 30, 2017 11:36 pm

Heater posted,
Can I assume that because of people like you, with your attitudes, things like the Equifax disaster happen?

And you don't care. As long as you get paid more than the next guy?

Ah, I see your game. Another forum troll. :roll:

Welcome to my ignore list. Goodbye.
Last edited by The Traveler on Mon Oct 30, 2017 11:43 pm, edited 3 times in total.
Retired IT professional, C programmer and "beardie weirdie".
RPi interests: Developing an Infinite Improbability Drive
“Thinking outside of the box allows you to get rewards outside of your reach.” Matshona Dhliwayo

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

Re: Outdated webguy, update me

Mon Oct 30, 2017 11:40 pm

I see you edited away your statement to the effect that you would rather take the money than try to be secure.

Who is the troll? I am happy to be ignored by you. Have a good life.
Memory in C++ is a leaky abstraction .

broe23
Posts: 903
Joined: Thu Jan 28, 2016 9:35 pm
Location: Central IL
Contact: Website

Re: Outdated webguy, update me

Tue Oct 31, 2017 8:05 am

DougieLawson wrote:
Mon Oct 30, 2017 10:20 pm
broe23 wrote:
Mon Oct 30, 2017 9:16 pm
Dougie why not use Asm instead of Pearl. It would be faster.
Because assembler costs a lot to develop. On the Raspberry I prefer C because one line of C is worth 100 lines of assembler (and just as quick at execution time). Since June 2015 I've written lots of zSeries mainframe assembler, so I'm still doing assembler programming but mostly when someone is paying me to do it.
Asm based OS's are now coming back and run a whole lot faster than anything written in C. It would be nice to see a asm based OS for the Pi. As for the codes, yes there are more lines, but you are getting into the raw language that has been used for years and will be continued to be used. The only bad thing is that most people do not get into it and take the other route to use Pearl.

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

Re: Outdated webguy, update me

Tue Oct 31, 2017 8:22 am

broe23,
Asm based OS's are now coming back..
Do you have an example?
...and run a whole lot faster than anything written in C
I very much doubt the "whole lot" part there.
It would be nice to see a asm based OS for the Pi
Why?
The only bad thing is that most people do not get into it...
I do agree. Anyone interested in programming should get familiar with assembler to some extent. If only because it's fascinating and fun.
...and take the other route to use Pearl
Not me. There are hundreds of more interesting languages to learn before having to suffer Perl.

Oh wait, did you really mean "Pearl"? That is a different language than "Perl".
https://en.wikipedia.org/wiki/PEARL_(pr ... _language)
http://www.real-time.de/misc/PEARL90-La ... 98-eng.pdf

Never heard of it before.
Memory in C++ is a leaky abstraction .

jahboater
Posts: 4929
Joined: Wed Feb 04, 2015 6:38 pm

Re: Outdated webguy, update me

Tue Oct 31, 2017 9:35 am

Heater wrote:
Mon Oct 30, 2017 10:30 pm
On the Raspberry I prefer C because one line of C is worth 100 lines of assembler
I guess you might be speaking figuratively there but in case not I have a challenge for you.

Show me one line of normal kind of C code that ends up compiled to 100 lines of assembler.
Yes must have been figuratively.

With the latest gcc you can intersperse the source code lines with the generated assembler so you can easily see how much asm is produced:-

gcc hello.c -S -fverbose-asm -Os -mcpu=cortex-a53 -mfpu=neon-fp-armv8 -o hello.s

This is extremely helpful for finding the relevant bit of assembler too - just search for the C source line.

I program in C because I like small fast code. Apart from the odd bit of inline assembler to exploit a hardware feature (rare, there are usually C intrinsics available) I would not now ever write assembler for speed. The compiler has so many advantages, for example:

1) it doesn't have to worry about portability or maintainability. It just produces code for the current target at the current time, with no expectation that it will ever be moved to anything else or read and debugged by a human.

2) It doesn't get tired. While a good assembler programmer might possibly do well for a few lines of assembler, the compiler will happily produced millions of lines, in seconds, all very highly optimized.

3) Its normal to decompose code into small manageable functions even if they are only used once. These are written and tested separately. The compiler does the exact opposite, and therefore has access to far more optimization opportunities than the human does.

4) There is so much to think about. For example, I suspect most assembler programmers only do simplistic scheduling, even then do they understand the hardware? movt usually depends on a prior movw, but separating them would be a bad idea on some ARM cpu's. The compiler knows it all and gets it right over millions of lines of code.

Back in the day (20+ years ago) if you wanted to write a subroutine in assembler for speed, one method was to write it in C and then hand optimize the assembler produced. If you did that now, firstly you would very likely not find any improvements - leading you to wonder why you don't just leave it in C. Secondly you might even find new optimizations or simplifications the compiler has done that can be applied to the original C (making the C code simpler is always a good thing). Thirdly if you do see anything you can improve, it probably means you have not understood something, or don't know the hardware well enough. Look again, long and hard, and the chances are you will see the compiler was right.

Assembler is great fun to write, but for me, if I want speed, especially for a largish program, I use gcc 7.2 and write C.

mfa298
Posts: 1387
Joined: Tue Apr 22, 2014 11:18 am

Re: Outdated webguy, update me

Tue Oct 31, 2017 10:12 am

solar3000 wrote:
Mon Oct 30, 2017 8:30 pm
Outdated web developer here. Update me.

Was using this old tool => Use this new tool instead
apache1 and 2 => ??
php/perl/c for CGI => ??
javascript => same?
Linux => same?
mysql (now mariadb) => ?
To go back to the original question. I'd say they're all valid still.

For small web apps it might be worth looking at some of the following as well:
Python with Flask
Python with Django
Ruby with Sinatra
Ruby with Rails
Node.js (JavaScript based backend platform)

For small applications all of those can run their own web server or can be integrated with something like apache or nginx (look at passenger and/or wsgi)

I've personally been doing some stuff with Ruby and Sinatra as I have a preference for Ruby over Python or Node.

As for Operating Systems Linux is still popular with some people looking at the BSDs and some OpenSolaris derivatives (I quite like SmartOS for servers - it's actually achieving some of what was promised for servers in the early days of Solaris 10)

Return to “General discussion”