Go to advanced search

by swampdog
Thu Jan 24, 2019 5:26 am
Forum: Other programming languages
Topic: Raspberry Pi MySQL Remote Connection (error: 10061)
Replies: 5
Views: 1330

Re: Raspberry Pi MySQL Remote Connection (error: 10061)

cat<<EOF > z CREATE USER '${A_USER}'@'localhost' IDENTIFIED BY '${A_PASS}'; CREATE USER '${A_USER}'@'' IDENTIFIED BY '${A_PASS}'; GRANT ALL PRIVILEGES ON *.* TO '${A_USER}'@'localhost' WITH GRANT OPTION; GRANT ALL PRIVILEGES ON *.* TO '${A_USER}'@'' WITH GRANT OPTION; FLUSH PRIVILEGES; EOF mysql -u ...
by swampdog
Mon Jan 14, 2019 6:24 pm
Forum: Raspbian
Topic: Problem Disk with ext4 (was NTFS)
Replies: 5
Views: 679

Re: Problem Disk with ext4 (was NTFS)

Just on the offchance..

I plugged a cheap usb sata caddy into an rpi3 over xmas and noticed it will power down and vanish off the usb unless it's mounted reasonably quick - couple of minutes. "lsusb" / "lsscsi" for that and "tail -f /var/log/messages".
by swampdog
Mon Jan 14, 2019 5:21 pm
Forum: General programming discussion
Topic: TUTORIAL: File Sorting on the Raspberry Pi
Replies: 41
Views: 11427

Re: TUTORIAL: File Sorting on the Raspberry Pi

That's a rather dangerous operation, more so if you were to put it in a script. Why not use symlinks instead? #!/bin/bash NAM=`basename "$0"` empty=$(ls -A) [ -z "$empty" ] || { echo "$NAM: Nope. This folder isn't empty!" 1>&2 exit 1 } [ -z "$1" ] && { echo "$NAM: Usage: $NAM [ source folder ]" 1>&2...
by swampdog
Mon Jan 14, 2019 3:55 pm
Forum: C/C++
Topic: C++ IDE
Replies: 40
Views: 6975

Re: C++ IDE

How can qtcreator be installed on the Pi? $ sudo apt-get install qtcreator I'm not sure how much mileage you'll get out of it without an rpi3 though! One thing I did notice when I just installed it here was it didn't auto detect a compiler so.. Tools->Options->[Compilers]->Add->[GCC] Compiler Path=...
by swampdog
Fri Dec 21, 2018 4:51 pm
Forum: C/C++
Topic: accessing global 2-dim arrays from an object
Replies: 10
Views: 1404

Re: accessing global 2-dim arrays from an object

If memory is that short then get the max space immediately. That way you don't have to worry about it running out plus you'll need less code. $ g++ -o c -Os c.cc && strip c && ./c Checking omitted for brevity.. #include <cstdlib> #include <cstring> #include <cstdio> #define MENULEN 6 #define LINELEN...
by swampdog
Thu Dec 20, 2018 7:11 pm
Forum: C/C++
Topic: accessing global 2-dim arrays from an object
Replies: 10
Views: 1404

Re: accessing global 2-dim arrays from an object

$gcc -v 2>&1 | grep ^gcc gcc version 4.9.2 (Raspbian 4.9.2-10+deb8u1) $ g++ -o c -std=c++0x c.cc $ cat c.cc #include <iostream> #include <ostream> #include <iterator> #include <string> #include <cstring> #include <deque> #include <vector> //#define DLIST typedef std::string Str; #if defined(DLIST) t...
by swampdog
Sat Oct 15, 2016 2:03 am
Forum: C/C++
Topic: Learning C++ for the first time. Feedback?
Replies: 6
Views: 1301

Re: Learning C++ for the first time. Feedback?

I've a decade old "twiddly" co-ordinate class that serves no purpose other than being an exercise. It's a template'd thing.
by swampdog
Sat Oct 15, 2016 1:11 am
Forum: C/C++
Topic: The MagPi does C :-)
Replies: 124
Views: 20793

Re: The MagPi does C :-)

Can a discussion of the history of C go in another thread please ? Let's leave this one clear to discuss the content of any future tutorials or books. PeterO Agreed. Back to the plot. The most obvious complex C item, is strings. Every man & his dog has written "a brilliant string library". The conc...
by swampdog
Sat Oct 15, 2016 12:57 am
Forum: C/C++
Topic: Cross-Compile missing ld-linux-armhf.so.3
Replies: 2
Views: 5610

Re: Cross-Compile missing ld-linux-armhf.so.3

No. Both natively and within my cross (under centos 6) "ld-linux-armhf.so.3" points to some variant of "ld-2.*.*.so". Native.. $ lc -d /lib/arm-linux-gnueabihf/ld* -rwxr-xr-x 1 root root 134448 Apr 2 2016 /lib/arm-linux-gnueabihf/ld-2.19.so lrwxrwxrwx 1 root root 10 Apr 2 2016 /lib/arm-linux-gnueabi...
by swampdog
Fri Oct 14, 2016 10:49 am
Forum: C/C++
Topic: The MagPi does C :-)
Replies: 124
Views: 20793

Re: The MagPi does C :-)

Back in K&R I'd have happily written "void main(..)" K&R C does not include void. That came afterwards and is included in the ANSI standard. In the years following the publication of K&R C, several features were added to the language, supported by compilers from AT&T (in particular PCC[15]) and som...
by swampdog
Fri Oct 14, 2016 7:06 am
Forum: C/C++
Topic: Learning C++ for the first time. Feedback?
Replies: 6
Views: 1301

Re: Learning C++ for the first time. Feedback?

Here's some ideas on how to get more work out of less code. It's far from perfect btw. Just hints.. #ifndef TC #define TC class TestClass { private: int value; public: TestClass (); TestClass (int x); TestClass (const TestClass&); TestClass & operator=(const TestClass&); TestClass & operator*=(const...
by swampdog
Fri Oct 14, 2016 5:32 am
Forum: C/C++
Topic: The MagPi does C :-)
Replies: 124
Views: 20793

Re: The MagPi does C :-)

Thanks @jojopi, I was beginning to think I was the voice in the wilderness . Well, it's swings & roundabouts. Back in K&R I'd have happily written "void main(..)" because it meant you didn't care about the return value. Obviously "int main(..) {/*code*/;return 0;}" is the most portable way to proce...
by swampdog
Fri Oct 14, 2016 4:41 am
Forum: Raspbian
Topic: Create bootable windows usb on PI3 Rapsbian
Replies: 8
Views: 5831

Re: Create bootable windows usb on PI3 Rapsbian

Fwiw, here's the 'winusb' script out of the build I performed.. #!/bin/bash # Config # Quit the script if a command fails set -o errexit # Quit the script if a non-declared variable is referenced set -o nounset # Script path set +o nounset if [ "$scriptPath" = "" ]; then scriptName=$(basename $(read...
by swampdog
Wed Oct 12, 2016 11:18 pm
Forum: Raspbian
Topic: Create bootable windows usb on PI3 Rapsbian
Replies: 8
Views: 5831

Re: Create bootable windows usb on PI3 Rapsbian

No idea if it works (a fork of the original) but it can be made to build on the rpi.. https://github.com/slacka/WinUSB http://www.webupd8.org/2016/06/make-bootable-windows-10-usb-install.html ..and it turns out the non-gui part , 'winusb' is just shell script. Caveat is you'll need to be reasonably ...
by swampdog
Wed Oct 12, 2016 10:22 pm
Forum: C/C++
Topic: C++ program executed from PHP not exporting GPIO properly
Replies: 4
Views: 1078

Re: C++ program executed from PHP not exporting GPIO properl

I don't know php but replace your code with a bit of shell script which executes your code. That will allow you to edit the shell script to see what is going on.

#!/bin/bash
touch /tmp/z
echo $PATH
[etc]
by swampdog
Wed Oct 12, 2016 10:05 pm
Forum: C/C++
Topic: Put a variable in system () call? Or better way?
Replies: 6
Views: 958

Re: Put a variable in system () call? Or better way?

Just a note of warning. If you intend to have it respond to commands from the outside world you'll need some security in order to prevent it responding to anything but you. ;-)
by swampdog
Wed Oct 12, 2016 9:56 pm
Forum: Beginners
Topic: Port Forward on Pi acting as Wireless to Wired Bridge
Replies: 5
Views: 1824

Re: Port Forward on Pi acting as Wireless to Wired Bridge

If by "WWAN" you mean something which tells you about the Verizon Hotspot then then you'll have to ask someone who has experienced that system. Unfortunately from my point of view there's one of two possibilities: a) wlan0 is changing to 70.x.x.x b) wlan0 is staying as 192.168.1.98 and this verizon ...
by swampdog
Wed Oct 12, 2016 9:52 pm
Forum: Advanced users
Topic: cross compilation "__fixsfdi"
Replies: 7
Views: 1299

Re: cross compilation "__fixsfdi"

Nope. I never tried to. I did just try with gcc 6.2 and same result. I'm sure someone else posted some detail on it but my memory is terrible so no link. :-(
by swampdog
Wed Oct 12, 2016 9:22 pm
Forum: C/C++
Topic: Question about make files and a _start warning, linker
Replies: 13
Views: 1980

Re: Question about make files and a _start warning, linker

Now that i have been reading about openCV, i understand what you mean. I downloaded the openCV zip file. And it seems to be missing stuff that i need to install separately. I was hoping i would get a bunch of source, header and object files and just copy and paste those into my project folders. But...
by swampdog
Fri Oct 07, 2016 3:37 pm
Forum: Beginners
Topic: Port Forward on Pi acting as Wireless to Wired Bridge
Replies: 5
Views: 1824

Re: Port Forward on Pi acting as Wireless to Wired Bridge

There's not enough detail but it sounds like all you need is an INPUT rule to allow connections into the relevant web port.

iptables -A INPUT -i "idev" -p tcp --dport "iport" -m state --state NEW,ESTABLISHED -j ACCEPT

..where "idev" is your (iiuc) ppp0 and "iport" (probably 80).
by swampdog
Fri Oct 07, 2016 1:36 pm
Forum: C/C++
Topic: Question about make files and a _start warning, linker
Replies: 13
Views: 1980

Re: Question about make files and a _start warning, linker

You might find it useful to install an ubuntu virtual machine on your PC: vmware-player works fine for instance. That platform has the best support for cross-compiling to the rpi. I suggest this because it could save you work in the long run. I suspect your W-ARM makefile generator doesn't need to d...
by swampdog
Fri Oct 07, 2016 10:55 am
Forum: Other programming languages
Topic: Portable GUI C89 Programming.
Replies: 145
Views: 21166

Re: Portable GUI C89 Programming.

Coming back to the original ""portable GUI" title, it all comes back to using QT then doesn't it? They've done all the work, the source code is available, it's cross-platform and regardless of X/Wayland/WinApi etc your app will just "work" plus there are bindings for other languages like Python.
by swampdog
Thu Oct 06, 2016 10:41 am
Forum: C/C++
Topic: Generate a variable in an included file - keep it for others
Replies: 9
Views: 1133

Re: Generate a variable in an included file - keep it for ot

I did that with the bar() function above. Now I'm going to be really silly.. #include <stdlib.h> #include <string.h> #include <stdio.h> typedef struct foo { char *s; void (*ctor)(struct foo*); void (*dtor)(struct foo*); struct foo* (*opeq)(struct foo*,const char[]); } FOO; void str_ctor(FOO*self) { ...
by swampdog
Thu Oct 06, 2016 1:07 am
Forum: Beginners
Topic: SSH via putty from laptop
Replies: 41
Views: 12748

Re: SSH via putty from laptop

The green light has to flash to show that the pi is booting.So i assume that it is booting properly.. But you have a point. But apart from getting a monitor, what would you suggest me ? You can get one of those USB/Serial cables. Someone will have a link to it. The USB end goes into your computer. ...

Go to advanced search