Go to advanced search

by n67
Fri Dec 21, 2018 1:08 pm
Forum: Advanced users
Topic: How to get Raspberry's IP adress with c++ Code
Replies: 7
Views: 1777

Re: How to get Raspberry's IP adress with c++ Code

I'm not saying there is anything wrong with the way you're doing things. I think you want to use popen() to run, say, ifconfig, and parse what comes back. popen() is better than system() in this case, because it gives you access to the standard output of the command (without having to do an explicit...
by n67
Fri Dec 21, 2018 12:23 pm
Forum: Advanced users
Topic: How to get Raspberry's IP adress with c++ Code
Replies: 7
Views: 1777

Re: How to get Raspberry's IP adress with c++ Code

The usual and easy way to do this is to use system() or popen() to get the info from running one of the usual utilities (ipconfig, ip, etc). This should qualify as "doing it in C/C++". However, people often want to do it directly in their chosen programming language. This can, of course, be done, bu...
by n67
Fri Dec 21, 2018 12:14 pm
Forum: Beginners
Topic: distinguish between booting and rebooting
Replies: 16
Views: 1302

Re: distinguish between booting and rebooting

As usual, no clarification from OP, so we are left to try to figure it out on our own. My reading of the original thread was that he wants to distinguish between a cold boot (i.e., power on) and a warm boot (software initiated reboot). As has been noted, there's no real way to do this, from a softwa...
by n67
Fri Dec 21, 2018 12:06 pm
Forum: Troubleshooting
Topic: Network error: software caused connection abort
Replies: 2
Views: 431

Re: Network error: software caused connection abort

In my experience, this tends to happen when you have two machines on the network (LAN) with the same hostname. I.e., if you forget to change the hostname of a newly setup Raspberry Pi.
by n67
Thu Dec 20, 2018 9:05 pm
Forum: Python
Topic: View print data of all scripts running in one terminal ?
Replies: 4
Views: 639

Re: View print data of all scripts running in one terminal ?

Where is the output from the scripts currently going? It is generally not a good idea to run things that generate output (output that continues on for the life of a process and which you need to be able to see and refer to) in rc.local, since it is somewhat undefined where the output of rc.local goe...
by n67
Thu Dec 20, 2018 7:41 pm
Forum: Python
Topic: View print data of all scripts running in one terminal ?
Replies: 4
Views: 639

Re: View print data of all scripts running in one terminal ?

It sounds like you are looking for screen(1).

It also sounds like this has nothing to do with Python per se, but is rather a general systems question.

How are you currently launching all of your scripts? What "run this stuff on startup" method are you using?
by n67
Thu Dec 20, 2018 12:21 pm
Forum: Raspbian
Topic: Create a new user to replace defaut pi: no completion, color, .. in term
Replies: 5
Views: 1463

Re: Create a new user to replace defaut pi: no completion, color, .. in term

Oh, and one more thing. I think you should be using adduser instead of useradd. According to the man pages, adduser is the high level interface to the low level useradd.
by n67
Thu Dec 20, 2018 12:19 pm
Forum: Raspbian
Topic: Create a new user to replace defaut pi: no completion, color, .. in term
Replies: 5
Views: 1463

Re: Create a new user to replace defaut pi: no completion, color, .. in term

This is one of those things where, yes, if you mess around with it enough, you can, eventually, get it to work. I'm sure it has something to do with either the default shell or which files (.profile, .bash*, etc) you get copied over to the new user. Like I said, if you mess with it long enough, you'...
by n67
Thu Dec 20, 2018 5:59 am
Forum: Troubleshooting
Topic: obconf issue following upgrade to Stretch 4.14.79-v7+
Replies: 10
Views: 1526

Re: obconf issue following upgrade to Stretch 4.14.79-v7+

Yes. This is true. I noticed this a few days ago. BTW, you can enable multiple desktop functionality with the wmctrl program, which is in the repo. I find that this does most of what I need, so the loss of obconf is not a biggie. The one thing you can't do with wmctrl is to "name" the desktops. This...
by n67
Wed Dec 19, 2018 9:42 pm
Forum: Troubleshooting
Topic: Permission denied error even when using sudo.
Replies: 17
Views: 1341

Re: Permission denied error even when using sudo.

It is unlikely that this is a "make it executable" problem, given that:

1) It is a TXT file (according to the OP)
2) He is trying to delete all the text from the file.
by n67
Wed Dec 19, 2018 3:24 pm
Forum: Raspbian
Topic: 1 bug 1 flaw, no followup.
Replies: 10
Views: 1317

Re: 1 bug 1 flaw, no followup.

jamesh wrote:
Wed Dec 19, 2018 3:20 pm
I also have never heard of xkill.
https://linux.die.net/man/1/xkill

HTH
by n67
Wed Dec 19, 2018 3:20 pm
Forum: Beginners
Topic: Running Python script from USB
Replies: 5
Views: 569

Re: Running Python script from USB

I'm not au courant with Python, but I think the answer to your question is "No, by default". But you can fix it. I hit this recently, when I tried to build a program on a USB device. I unpack the TGZ file to a directory on the flash drive, then tried to do the usual "./configure". But it wouldn't fi...
by n67
Wed Dec 19, 2018 2:42 pm
Forum: Raspbian
Topic: Questions about nc (netcat) in Raspbian
Replies: 8
Views: 2118

Re: Questions about nc (netcat) in Raspbian

@fruitoftheloom, thank you for commenting on that. Do you mean it is the Debian Stretch for ARM distro includes the different (OpenBSD) version of nc and Raspbian just inherited that from that Debian ARM distro? If that is true, then I agree my question / suggestion should go to Debian maintainer i...
by n67
Tue Dec 18, 2018 9:08 pm
Forum: Troubleshooting
Topic: Permission denied error even when using sudo.
Replies: 17
Views: 1341

Re: Permission denied error even when using sudo.

PeterO wrote:
Tue Dec 18, 2018 8:22 pm
n67 wrote:
Tue Dec 18, 2018 5:19 pm
There's so many better ways...
If you aren't going to help why do you post replies to questions ?
PeterO
Like you did?
by n67
Tue Dec 18, 2018 5:19 pm
Forum: Troubleshooting
Topic: Permission denied error even when using sudo.
Replies: 17
Views: 1341

Re: Permission denied error even when using sudo.

hortimech wrote:
Tue Dec 18, 2018 5:14 pm
And, of course it should have been

Code: Select all

sh -c 'echo | sudo tee -a _autoplaylist.txt'
I see this "sudo tee -a" hack a lot on this board. Gosh, is it ugly. There's so many better ways...
by n67
Tue Dec 18, 2018 1:58 pm
Forum: Raspbian
Topic: Questions about nc (netcat) in Raspbian
Replies: 8
Views: 2118

Re: Questions about nc (netcat) in Raspbian

The situation with netcat really is a mess. First of all is the insanity of having (at least) two different names for the same program ("nc" and "netcat" - oh, and, also, "ncat"). Second is the fact that there are so many versions floating around. Then the insanity of whether or not it is (i.e., sho...
by n67
Sun Dec 16, 2018 10:46 pm
Forum: General discussion
Topic: swap file on usb -=problems&thoughts=-
Replies: 11
Views: 659

Re: swap file on usb -=problems&thoughts=-

Here's how I do it - I haven't actually tested what happens if you boot without the flash drive inserted, but I think it will do the right thing. 1) Disable the dphys-swapfile stuff (there's some systemctl command for that) 2) Create a swap partition (2G+ size) on your USB drive (flash drive). Figur...
by n67
Sun Dec 16, 2018 3:59 pm
Forum: General discussion
Topic: Wifi 5GHz not working
Replies: 27
Views: 1407

Re: Wifi 5G

hello everyone i have problem i can not connect 5G wifi to raspberry pi knows someone how this is coming
I don't see any references to 2.4Ghz or 5Ghz in the above text. Maybe I need glasses...
by n67
Sun Dec 16, 2018 3:01 pm
Forum: General discussion
Topic: Wifi 5GHz not working
Replies: 27
Views: 1407

Re: Wifi 5G

There are (at least) two possible interpretations of what OP means by "Wifi 5G".

I assumed he meant the upcoming new standard (we have 3G, and 4G. 5G is just around the corner!)

Everyone else seems to have assumed he meant 5Ghz.
by n67
Sat Dec 15, 2018 7:06 pm
Forum: Troubleshooting
Topic: Raspberry PI Model 2 B won't boot
Replies: 8
Views: 381

Re: Raspberry PI Model 2 B won't boot

Does this mean that, as the normal sizes of most people's average SD cards tends to move towards being in the 64 and greater category, that the standard advice of "Use SD Association formatting thing" is going to be phrased out?

(Since it apparently doesn't do the right thing with large cards)
by n67
Fri Dec 14, 2018 8:23 am
Forum: C/C++
Topic: How to detect if a program is running via c++ code
Replies: 11
Views: 1591

Re: How to detect if a program is running via c++ code

I had fun putting this together... /* Compile cmd: gcc -std=gnu99 -W -Wall -Werror -s -o getpids getpids.c */ #include <stdio.h> #include <stdlib.h> #include <string.h> #include <glob.h> unsigned getpids(char *pgm, int *pids, unsigned maxget, int (*cmp)(const char *,const char *)) { glob_t g; static...
by n67
Fri Dec 14, 2018 7:37 am
Forum: Raspbian
Topic: configure "pi" password before booting for the first time
Replies: 4
Views: 451

Re: configure "pi" password before booting for the first time

Hi, - I want to change it because I don't want it to be the default one. The fact that it won't warn me any more is an added bonus. OK - so you want to change it to just "something else". I.e, perhaps change it to "Thunder Bay", right? But the end user(s) will have to know what it is and will have ...
by n67
Fri Dec 14, 2018 7:09 am
Forum: Raspbian
Topic: configure "pi" password before booting for the first time
Replies: 4
Views: 451

Re: configure "pi" password before booting for the first time

Some context would help. What do you want to set it to? Is it just because if you don't change it, then a message pops up warning you to change it? Are you using the Lite or the Desktop version of Raspbian? Or something else? Incidentally, if you just want to change it to a known string, then you sh...
by n67
Thu Dec 13, 2018 11:17 pm
Forum: Troubleshooting
Topic: root crontab not running all commands
Replies: 4
Views: 205

Re: root crontab not running all commands

Yes - I just checked and parted is in /sbin - and I don't think /sbin is in the default (minimalist) PATH. Usually, the first thing I do when I start using cron on a new system is setup a job that runs just the "env" command. That gets me a list of the default cron environment. From there, it's usua...
by n67
Thu Dec 13, 2018 8:36 pm
Forum: Troubleshooting
Topic: root crontab not running all commands
Replies: 4
Views: 205

Re: root crontab not running all commands

I did not look closely at your command or how/why it may have failed. However, ... There are lots of things that can go wrong when using crontab, and it is best to keep things as simple as possible. You almost never want to have anything the least bit complicated in the crontab file; rather, about a...

Go to advanced search