Go to advanced search

by jahboater
Fri Jun 09, 2017 8:25 am
Forum: Beginners
Topic: Raspberry Pi 3
Replies: 12
Views: 1729

Re: Raspberry Pi 3

C/C++, Python2 and 3, Java, Bash etc are all installed in the standard Linux image. Which is here https://www.raspberrypi.org/downloads/ and help is here https://www.raspberrypi.org/help/ or on this forum if you cant find what you need. Spend some time looking around this web site. In the SBC world...
by jahboater
Fri Jun 09, 2017 12:58 am
Forum: Beginners
Topic: How Do I Create A Swap File On A Flash Drive?
Replies: 7
Views: 4337

Re: How Do I Create A Swap File On A Flash Drive?

The other method is:

Code: Select all

sudo dd if=/dev/zero of=/var/swap bs=1M count=1024
sudo chmod 0600 /var/swap
sudo mkswap /var/swap
sudo swapon /var/swap
by jahboater
Thu Jun 08, 2017 8:15 am
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

Back to posting clean code ...
Perhaps we need a sticky like this:-

https://stackoverflow.com/help/mcve

Minimal, Complete, and Verifiable examples.
by jahboater
Tue Jun 06, 2017 5:53 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

this makes it possible that adherence to the MISRA standard as a whole would have made the software less reliable." Thats worrying :-( I hope the software in my car was written before misra came about. I found CERT to be much more reasonable and actually helpful ... https://www.securecoding.cert.or...
by jahboater
Tue Jun 06, 2017 5:21 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

I agree - horrible! Perhaps "misra" is a contraction of "miserable" :)

I assume its because they have side effects.
Like foo( ++i, ++i ) would be bad for obvious reasons.
by jahboater
Tue Jun 06, 2017 4:57 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

I think you have a later copy of MISRA than mine (2012). Mine only goes up to section 9 which is the appendices. Edit: I just realized you probably have the C++ version which is bound to be bigger. I have the C version. I am in the fortunate position that I can pick and choose which parts of these c...
by jahboater
Tue Jun 06, 2017 4:36 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

I am not saying one shouldn't program to a standard but those standards are up for dispute and do vary from industry to industry. I don't think they do. ISO 9899:2011 (C11) is the same regardless of who you are or what industry you are in. Yes, coding standards such as CERT or MISRA may differ. (I ...
by jahboater
Tue Jun 06, 2017 3:00 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

For comparison then, what other similar languages do have the ability to define a "write only" register? Well in the embedded space you only really have assembler and C/C++ so not really a valid question :-) Yes exactly. But its hard to complain about the slow pace of the C standards when no other ...
by jahboater
Tue Jun 06, 2017 2:51 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

LdB wrote:I beat you by 20years I have software credits in 1982 so does that mean I win :-)
Wow! You have been coding in C/C++ for 50 years!

1982 is only 35 years ago, roughly when I started my first programming job.
by jahboater
Tue Jun 06, 2017 2:46 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

LdB wrote: It's really cute when you can read from a write only register and the compiler gives no warning because you still can't define a write only register in C/C++.
For comparison then, what other similar languages do have the ability to define a "write only" register?
by jahboater
Tue Jun 06, 2017 2:37 pm
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

There is actually a full list of the various new proposed C/C++ standards and what compilers accept what parts of it http://en.cppreference.com/w/cpp/compiler_support Interesting that the two free compilers, gcc and clang, alone have substantially complete support for the draft C++17. Many years ag...
by jahboater
Tue Jun 06, 2017 8:06 am
Forum: C/C++
Topic: Writing clean code isn't hard!
Replies: 138
Views: 13655

Re: Writing clean code isn't hard!

I liked these quotes ... There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult. -- C.A.R. Hoare Perfe...
by jahboater
Sun Jun 04, 2017 9:51 am
Forum: General discussion
Topic: owning /usr/local/bin
Replies: 19
Views: 4121

Re: owning /usr/local/bin

Perhaps 03777 to include the set user ID and set group ID bits too :)
by jahboater
Sat Jun 03, 2017 5:18 pm
Forum: Off topic discussion
Topic: Need to fill up a *really* big disk?
Replies: 12
Views: 3109

Re: Need to fill up a *really* big disk?

That's good practice for everyone. It strikes to the difference between an amateur programmer and a professional programmer. An amateur writes programs for his own use, he knows what inputs will give invalid outputs or just blow it up. The professional writes programs for *other* people to use, whe...
by jahboater
Thu Jun 01, 2017 5:57 pm
Forum: General discussion
Topic: correcting real time after reboot...
Replies: 17
Views: 3904

Re: It is about time . . .

And if your Internet connection is unreliable or intermittent, try chrony ("sudo apt install chrony" does everything).

See this link for a detailed comparison of NTP implementations:-
https://chrony.tuxfamily.org/comparison.html
by jahboater
Thu Jun 01, 2017 7:39 am
Forum: Other programming languages
Topic: ISLisp compiler on RaspberryPi updated
Replies: 5
Views: 1845

Re: ISLisp compiler on RaspberryPi updated

Do you have an example that would demonstrate any advantages of Lisp of other languages for us? If you ever use emacs, you soon end up programming in lisp. Well I did anyway. For example I missed the "whole line" things that some other editors can do (yy dd p etc in vi for example are not in emacs,...
by jahboater
Thu Jun 01, 2017 7:09 am
Forum: Beginners
Topic: Fastest way to boot RPi 3 fast
Replies: 13
Views: 9116

Re: Fastest way to boot RPi 3 fast

To see boot times for Raspbian do:- pi@Pi3:~ $ systemd-analyze Startup finished in 2.673s (kernel) + 4.706s (userspace) = 7.379s pi@Pi3:~ $ systemd-analyze blame 884ms networking.service 695ms lightdm.service 602ms keyboard-setup.service 386ms systemd-logind.service 317ms plymouth-start.service 312m...
by jahboater
Wed May 31, 2017 3:18 pm
Forum: Beginners
Topic: Fastest way to boot RPi 3 fast
Replies: 13
Views: 9116

Re: Fastest way to boot RPi 3 fast

profbit wrote: Isn't it risky to operate RPI 24/7? I am worried if this option will destroy my pi.
It will not.
Its perfectly safe and normal to run Pi's non-stop for years.
by jahboater
Wed May 31, 2017 7:37 am
Forum: C/C++
Topic: Problem with "clock" function
Replies: 2
Views: 1997

Re: Problem with "clock" function

clock() returns the processor time, not the time of day. Clearly the CPU is idle most of the time the motor is moving. See "man clock" The clock() function returns an approximation of processor time used by the program. I suggest the POSIX clock_gettime() function. Perhaps something like this to get...
by jahboater
Tue May 30, 2017 8:08 am
Forum: General discussion
Topic: making a new file in /usr/local/bin
Replies: 13
Views: 5791

Re: making a new file in /usr/local/bin

Just FYI , see the install command "man install" which is a common way of copying files to such directories.
by jahboater
Mon May 29, 2017 3:04 pm
Forum: Advanced users
Topic: Script to extend SD card life
Replies: 2
Views: 4573

Re: Script to extend SD card life

In addition to /tmp and /var/log in tmpfs all my Pi's have: /dev/mmcblk0p2 / ext4 defaults,noatime,commit=600 0 1 The commit=600 is both more efficient and reduces writes to the SD card compared to the 5 second default. The cost is greater risk from power outages (which are rare here). I always shut...
by jahboater
Mon May 29, 2017 11:21 am
Forum: Raspberry Pi OS
Topic: SSH security settings out of the box
Replies: 3
Views: 1970

Re: SSH security settings out of the box

YCN- wrote: If that's the case you should change the default port :
nano /etc/ssh/sshd_config -> change the port number
I would also change the port number for all the clients:
nano /etc/ssh/ssh_config (without the "d").
This just saves you having to give the -p or -P (for scp) option every time.
by jahboater
Mon May 29, 2017 8:56 am
Forum: Troubleshooting
Topic: Want headless via putty & download via wireless
Replies: 9
Views: 1950

Re: Want headless via putty & download via wireless

It seems you are over-thinking it. If this is all you want, then it is simple:- To put it in another way: I would like to control the RPi via Windows through Putty. At the same time download programs and or updates to the RPi via wireless or Ethernet (using an usb/ethernet adapter). The internet con...
by jahboater
Mon May 29, 2017 8:17 am
Forum: Raspberry Pi OS
Topic: SSH security settings out of the box
Replies: 3
Views: 1970

Re: SSH security settings out of the box

- allow root login without any password (must be a really BAD idea!) No, its more secure. Try it! You wont be able to login. It means you have to set up private/public key authentication for root on the Pi. Once that is done, the user does not need to give a password - hence the name without-passwo...
by jahboater
Sun May 28, 2017 7:02 am
Forum: Off topic discussion
Topic: My new tablet.
Replies: 50
Views: 8395

Re: My new tablet.

My memories of Windows was of constantly worrying about up to date anti-virus and other anti-malware stuff. I moved all my machines across to Linux a few years ago and have enjoyed ignoring AV ever since. The rich software development environment thats free with Linux is another bonus. Then there is...

Go to advanced search