182 Solved Topics
Remove Filter I'm trying to add /home/garrett/bin/libpy/ to my python path so I can import my own libraries, I would also prefer not to overwrite the default python path but rather append my own path to the default. When I try to `echo $PYTHONPATH` or `$PYTHONHOME` I get nothing and even if … | |
In the following program what is `ifstream`? It looks like it might be a Class name making `file_in` an object of that class passing `filename` as an argument but this particular book hasn't touched OOP yet so I wasn't sure. #include <iostream> #include <fstream> using namespace std; int main() { … | |
One of my C++ books was showing the line `cin.getline(arg, arg)` and later showing `getline(cin, arg)`. Why is the second one not object.function and yet have the object as one of the arguments? What's the difference? | |
What is the difference between these two classes? In the second one `protected:` looking like it isn't doing anything at all, there's nothing under it umbrella. class Tank { protected: int wheels; public: void setWheels(int newWheels) { wheels = newWheels; } int getWheels() { return wheels; } }; /////////////////////////////////////////////////////////////// class … | |
I'm reading my C++ book and I've come to a chapter on structures and unions. The book has tried to explain the difference but I'm not getting it's explanation. Playing with the structure examples in the book reminds me of accessing attributes to a python Class but apart from that, … | |
I'm reading 'C++ Programming in easy steps' and the program the book has given me will not compile. Compile line -> `g++ -g -Wall "${ARG}" -o "${ARG:: -4}" &&` ARG is command line argument 1. object.cpp:7:5: error: ‘string’ does not name a type string color; ^ object.cpp:14:19: error: ‘string’ has … | |
I just re-installed my Mint system and now I can't get php to work. I've tested apache and it seems to be working just fine, entering localhost into the URL brings up that default page in /var/www/ but when I created a small php file called testphp.php with nothing but … | |
I'm reading a book on C and it's telling me how to use gcc and about the -c option/flag. It reads "-c Compiles to an object (.o) file instead of an executable. This is important for creating library files." What is an object file and how is this good for … | |
I'm trying to mount my SD card to my computer because the auto mount feature isn't working for some reason. The card shows up on the first line of the 'lsusb' command, I know that's it because that line goes away when I take the card out and re-run the … | |
In the following program I'm getting the warning -> unused variable ‘fn’. I'm following along with a book so I don't know why it gave me that portion of code if it's unusable. Also, I don't understand this line at all. -> `void(*fn)(int& a, int* b) = add;` #include <iostream> … | |
(Linux) I just installed eyed3 for python using apt-get, everything installed fine but when I tried to import eyed3 I got a trackback error, no such module. Do I need to do something special to let python know where the module is at or do I need to move the … | |
Why am I getting the above error message when I run this program? I'm running this program with an mp3 file as an argument, the mp3 file is in the same directory as the python program. There are 30 space reserved for the Title at positoin 125 from the end … | |
Below is what I'm getting when I try nad start tor, any ideas? M ay 25 14:38:35.000 [notice] Bootstrapped 25%: Loading networkstatus consensus. May 25 14:38:45.000 [warn] Received directory with skewed time (server '193.23.244.244:443'): It seems that our clock is behind by 6 hours, 59 minutes, or that theirs is … | |
greens = dict(green="#0080000", olive="#808000", lime="#00FF00") >>> print("{green} {olive} {lime}".format(**greens)) -> #0080000 #808000 #00FF00 In the program above what are green, olive, and lime in the dict function? I've seen and read about supplying a function with keyword arguments but only when the function was written with default argument. Even then … | |
echo ${NUM:0:2} The above is just an example of the kind of code I'M using. I need a way to represent the end of the string. Is there a way to start from the right side of a line of text instead of the left? What I'M trying to do … | |
In this line -> `tcpSerSock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)` what is the first 'socket' after the '=' sign, is that refering to a socket class making tcpSerSock an object or just to a module called socket? After reading the documentation I see that socket.accept returns a connection and an address pair, … | |
I know python is an interpreted language but is there a way to compile your code? What if you write a program in python 3 and the user has python 2.x, or worse yet, doesn't have python at all. How can you create an executable via compiling or any other … | |
class MemberCounter: members = 0 def init(self): MemberCounter.members += 1 # m1 = MemberCounter() # m1.init() # MemberCounter.members -> 1 # m2 = MemberCounter() # m2.init() # MemberCounter.members -> 2 # m1.members -> 2 #m2.members -> 2 # m1.members = 'Two' # m1.members -> 'Two' # m2.members -> 2 In … | |
In my home network I have my desktop wired (eth0) to a Netgear range extender that is wirelessly linked to my Linksys AC1200 router. If I do ip route show I get the IP address of my router but not the Netgear range extender that has the association with the … | |
Does anyone know how I can set the default group for /var/log/apaches/error.log to be a part of my users group each time it is created by apache? | |
When I run: ---`mysql> SET PASSWORD FOR 'garrett'@'localhost' = PASSWORD('abc123');` I get: ---`ERROR 1133 (42000): Can't find any matching row in the user table` Also, when I run: ---`mysql> UPDATE mysql.user SET Password=PASSWORD('abc123') WHERE User='garrett' AND Host='localhost';` I get: ---`Query OK, 0 rows affected (0.00 sec)` ---`Rows matched: 0 Changed: … | |
Linux Mint 15 I'm trying to run this small script located in /etc/cron.hourly/ in order to learn how to use cron but it's not running, any ideas? And the "test" script in this case has already been set to executable. garrett@garrett-bedroom /etc/cron.hourly $ cat test touch /home/garrett/Desktop/CRONTABWORKED!.txt #ENE# | |
In the following code blocks I don't see any affect that my java scipt is having on my form. Any ideas? Thanks. Form: if($row['password'] == $passwd) { echo "<html>"; echo "<body>"; echo "<script src='check.js'></script>"; echo "<form id='form1' action='changepassword.php' method='post'>"; echo "<table>"; echo "<tr><td>"; echo "New Password<center><input type='text' name='newpassword1'></td></tr></center>"; echo "<tr><td>"; … | |
delete hash from users where email='emailaddress@hotmail.com'; Why is the above line not working? I want to delete the value in the hash column in the row the contains the specified email. | |
$userEmail = $db->query("SELECT email FROM users WHERE email='$email'"); $userPsswd = $db->query("SELECT password FROM users WHERE email='$email'"); Can someone tell me what I've done wrong in teh two lines above? I'm getting the following errors. PHP Warning: SQLite3::query(): Unable to prepare statement: 1, near "@hotmail": syntax error in /var/www/ET/password/accounts.php on line … | |
PHP Parse error: syntax error, unexpected end of file in /var/www/ET/password/changepassword.php on line 27 Can someone please tell me what I'm doing wrong in the following code to get the error above? <?php $db = new SQLite3('./users.db', SQLITE3_OPEN_READWRITE); if(!$db) { echo "Could not open/access DB"; } else { $userPsswd1 = … | |
In the following program the first strpos() function is working just just fine when searching for a matching email address in the text file as long as it's on the first line but the second entry it jumps streight to the else clause and echos "Unknown user name" even though … | |
(Linux) In the following program I'm trying to process the file accounts.txt line by line searching for a match to the form supplied variable '$email'. The function fgets() is stepping though the file line by line correctly but my attempts at using preg_match() and or strpos() to determine if that … | |
(Linux) In the following code all I'm trying to do is open a file but evertime I run this script the fopen function jumps right to the die() function. Any ideas? The file accounts.txt does exist in the same directory, and I also tried refrencing the file via ./accounts.txt . … | |
In the script below second & third line are working but not the first and fourth. The reason is because I am replacing the whole line, I actually only need to replace what's to the right of the '=' sign. Any idea on how I can accomplish this in sed? … | |
I'm getting this -> [Tue Sep 10 10:42:46 2013] [error] [client 127.0.0.1] PHP Warning: SQLite3::exec(): unable to open database file in /var/www/ET/insert.php on line 21, referer: http://localhost/ET/ I changed the owner of the DB file (et.sqlite3) to www-data and now this is what I'm getting. Before I changed the owner … | |
In the following code the Submit button actualy says "Submit Query" on my page but I can not find anywhere that I have written "Submit Query" in the file. Any ideas? I would like to change the second one. <html> <head> <title>Simiply Query</title> <link rel="stylesheet" type="text/css" href="mystyles.css" media="screen" /> </head> … | |
In the following small c++ program I'm trying to add '0' (zero characters) until the number of characters in the users input can be evenly divided by 3. I'v got it working except that it doesn't work when only on character is feed to the program. input -> 123 -> … | |
I created a small table with one entrey with three columns but I can't get it to show up in my php code. I'm not really doing anything with the form variables right now I'm mainly focused on getting the code below that to query my SQLite DB. <?php // … | |
I'm getting `sed: -e expression #1, char 35: unterminated s' command` when I try and run the following script. Any ideas? #/bin/bash # # # This script is to be used to re-write a configuration file # replacing select values, SSID, IP, device name, gateway, # and frequency with the … | |
Any idea why this is happening? garrett@bedroom ~ $ mysql ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) | |
(Linux System) Everytime I try to log into MySQL or create a database I get "Access denied for user@localhost". I just recently installed mysql using apt-get install and I don't recal creating a password or anything for it when I installed it. Any ideas? ![]() | |
In the following script I need to know if the configuration files is for a 2.4 or a 5.2 radio. This info is found in the filename so I'm trying to use grep -l *2.4* to find out if it's a 2.4 config file or not. If it's not the … | |
I How can I get the output from grep into a variable? In the following program I've tried the SSID line two ways but I am not getting what I want. `SSID=$(grep) ${FILE} -o empty-ssid` Gives me this garrett@bedroom ~/Desktop/folder/project $ ./testScript.sh ../OLD-172.28.50.30-system.cfg Usage: grep [OPTION]... PATTERN [FILE]... Try 'grep … | |
In the following program everything works fine when I enter 5 or 8, but if I enter 4 or 7 the program crashes with a Segmentation fault error. I'm just trying to add zeros until the number of characters in string is evenly divisible by 3 and I'm doing so … | |
How could I get the file name and the permissions to a file as a string? This is on a Linux system. | |
Any ideas on some good beginner projects for PHP? I'd like to at, some point in the future, get into front end development and although I have a little self taught programming knowledge I don't have any real work experience in I.T. or programming at all, just the programs you … ![]() | |
(Linux) In the following program when the command python permissions.ph is issued I simply get another prompt, but when python3 permissions.py is issued I get the error below. Why does python2 see tkinter but python 3 doesn't? garrett@bedroom ~/Projects/TestArea $ python permissions.py garrett@bedroom ~/Projects/TestArea $ python3 permissions.py Traceback (most recent … | |
I'm looking throug the documentation at python.org for modules and functions allow me to do basic operations on in a Linux file system. I need to do simple things like list the file and folders in a directory 'ls' and change director 'cd'. I found these two pages that looked … | |
In the following program, why is the count function failing? I'M getting an error that it needs at leat one argument and that I have given it 0. I have here count(number), how is number no an argument? According to the documentation the start and end points are optional. I … | |
Please take a look at my fstab below. I'm trying to mount the HD stb onto /home/garrett/ but I don't know waht options I should choolse. Thanks for any and all replies. # /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc … | |
In the following script I'm trying to have an automated task to move all the screen shots I have taken with the "Prt Scr" button from ~/Pictures to ~/Pictures/ScreenShots Any ideas why it's not working. I did it at first with the mv command but was told by my instructor … | |
I'M trying to get backtrack Linux to boot from a USB flash drive. The book I'M reading is haivng me to a lot of formating and what not on the flash drive from the CLI and then use rsync to copy the contents of the backtrack disk to the flash … | |
I'M wanting to write my own command/script for compiling my c++ files. I use g++ -g -Wall filename.cpp -o filename I'M trying to figure out how I can trip of the last four characters (.cpp) from a string. Any ideas? | |
Just purchased a new Samsung 250 Gig SSD, extern & internal. When I pluged it into my Mint Linux desktop via USB it never showed up or auto mounted. When I tried to run the command 'sudo mount /dev/sdc /mnt' it gave me this error, 'mount: you must specify the … |
The End.