This Linux system boots into full GUI in 8 seconds thanks to SSD...:)
This Linux system boots into full GUI in 8 seconds thanks to SSD...:)
-- Those who want slavery should have the grace to name it by its proper name. They must face the full meaning of that which they are advocating
I'm curios about that.. wonder why...
By hand and I admit its not my finest bit of work, nor an area I have expertiese in, but it works...
Yes, I know and have used awk... However not for about 20 years now... The problem here is that I have 4 or 5 files of what amounts to coordinates and data pertaining to those coordinates. I have to scale the coordinates to bigger squares and and count stuff inside the bigger range and output a file with the larger squares, counts of the stuff inside them and some other stats. It just seemed easier...
You might want to see:
Cheers,
Gordon
That package of RTB was made before the newer /dev/gpiomem interface was added into the kernel and you're right - it's not the best thing to do, however RTB drops root privs. immediately after initialising wiringPi which is essentially the first thing it does in main() after getopt.
It needs to do the getopt thing to work out what way to initialise wiringPi - BCM pins, board pins or wiringPi pins.
After that it's running as the user that called it, so things like file access, creation, etc. work as the calling user.
Check this by running it, then typing in:
x = openOut ("/tmp/testfile1")
then (in another terminal)
ls -l /tmp/testfile
and checking the ownership of the file created.
I'm doing some work on it so will bear that in-mind for the next time I make a package.
Alternatively, if you remove the set uid bit,
sudo chmod 755 /usr/bin/rtb
it will still work, just not initialise wiringPi for GPIO access.
One thing you can't do with /dev/gpiomem is change the internal pull up/down resistors, so if you need that, you need root.
Gordon (Author of wiringPi)
Your (desktop?) Linux system might do that today, but the Pi didn't 4 years ago.
Gordon
I Expected that to be the case.
& that seems to reduce the issue considerably (I still have minor concerns but those are founded by a healthy dose of paranoia rather than any reasoned argument).Indeed my comments were meant to be taken constructively.
-- The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.
Can't help, I'm afraid since I've never tried to extract sound from my RPi.
Yes, that sounds like something I might also do in C or Java.
-- martin@ | Martin Gregorie gregorie. | Essex, UK
Interestingly, I can read the first example quickly; not the second. I spend more time matching lines in the second example. I guess readability depends on experience.
/BAH
You have just found the reason that standards manuals limit structured programs to having subroutines no more than 60 lines (=1 page) long whereas GOTO programs can be 20 pages long.
My 'END' statements had a comment saying what it was attached to.
That limit would be a problem in my work world :-) I never had problems reading code which spanned more than one page. My programming style would use dispatch tables when entering a module for the first time.
that's nice if it's kept up to date. In my area, it would be out of date with the third programmer. We would put a stand-alone comment at the end of a logical piece of code to indicate the last page of the routine.
After each monitor edit, one of the procedures was to run a TECO macro over the sources to match angle brackets.
/BAH
I do this too. Often it's a pain in the neck, but occasionally it's useful. IBM PL/I has a nice "nest" compiler option that prints the containing block and group number for each statement, so you can easily visualize the structure.
-- Pete
Often it is easier, though less efficient*, to break deep nesting into subroutine calls, so each level of logic has its own 'block'..
*(static) inline functions can of course be used in C(++) to make the code more readable WITHOUT the overhead of actual subroutines. >-- All political activity makes complete sense once the proposition that all government is basically a self-legalising protection racket, is
That happens to me, particularly if the code contains a 'switch' statement and contains other stuff such as another 'switch', or conditionals.
That is my solution.
Which is what I do.
-- Using UNIX since v6 (1975)... Use the BIG mirror service in the UK:
The nice thing about modern editors is that they'll automatically associate end with the appropriate begin with a simple keystroke and/or highlighting (e.g. with the enhanced vi (vim), when the cursor is over a begin (e.g. { for C), it will highlight the corresponding end (}) and the '%' key will move the cursor between them.
Burroughs BPL language had 'END WHILE', 'END CASE', 'END IF' etc. in the language.
"A compiler", perhaps. "The compiler", well you need to be more specific.
In C, a static function has file scope, so it is not eligable to be a target for a call from another compilation unit, so there is no impediment to generating it inline. Although, with gcc, this should only happen if compile time optimization (-O) is requested.
If(brexit) { } //endif (brexit) etc etc.
I stick em in the comments otherwise I haven't a clue;)
-- If you tell a lie big enough and keep repeating it, people will eventually come to believe it. The lie can be maintained only for such
**gcc=THE compiler :-)
-- If you tell a lie big enough and keep repeating it, people will eventually come to believe it. The lie can be maintained only for such
Rather a sweeping statement. It will depend on the compiler. One might say that logically the compiler should always do this, but I can think of situations when I would rather it did not.
I'll leave identification of such a situation as an exercise.
-- Using UNIX since v6 (1975)... Use the BIG mirror service in the UK:
A few decades ago, MAINSAIL (MAchine INdependent Stanford Artificial Intelligence Language) allowed an optional string constant after BEGIN and END. If used, the compiler would enforce that the string constants match. That was quite helpful on occasion.
-- Robert Riches spamtrap42@jacob21819.net
Alas, no. At least not in the newest full Raspbian from the download page, dist-upgraded.
"2016-05-27"
It used to be there... Oh well.
Gordon
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.