520 Posted Topics
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 … | |
I'm trying to copy a file to my new iBasso DX50 music player but I can't create or removes files from the device, it worked fine the first day I got it. Any, this is what I'm getting if I try to move a file to the device. Error opening … | |
I know that all you really need to execute a python program is the python interpriter, what what if your program uses config files that might be in /etc, ~/.program, or C:\users\Name\Appdata ? How would you go about creating an installer for you python program and all of it's files … | |
#!/usr/bin/env python3 import sys import re file = sys.argv[1] f = open(file, 'rb') seek_positoin = 0 artist_string = b'artist=' line = b'' f.seek(seek_positoin) while artist_string.upper() or artist_string.lower() not in line: line = f.readline() if artist_string.upper() or artist_string.lower() in line: seek_positoin = line.find(artist_string) f.seek(seek_positoin, 1) word = f.read(10) #line = str(line) … | |
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 … | |
I'm trying to write a program to get the artist and album from mp3 files. A simple test run on the Alice in Chanins song Rooster yielded this result -> `b'Rooster\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'` I set read to read(20) and if you count Rooster plus all the \x00s you'll see that it 20, … | |
I'm going to try and extract the artist and album from the meta data of an mp3 file with python but I need a little help. This is what I get on the tag line when I open an mp3 file in vim: ----> `ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿTAGRooster^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@Alice In Chains^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@DIRT^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@1992` This is what … | |
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 … | |
When I try to compile the program at the bottom this is what I get. `-> qtprogram.cpp:1:24: fatal error: QApplication: No such file or directory` I got this code from a C++ QT book and I'm compiling this on Linux with this command. `-> g++ -g -Wall "${ARG}" -o "${ARG:: … | |
In my /var/www/ directory I have a lot of sub directories, one is learning/, which is where I place all my web projects that I'm following from different PHP or CSS/HTML books, another called projects/, for actualy projects I might undertake. I currently have port forwarding set up on my … | |
I just set up a samba media server and I got it up and running but it currently has to have a username and password to access the files. Do you know lines I need to edit in these two files to allow anyone, user or not to access the … | |
I have a 120 Gig iPod classic but I think it's HD must be getting some bad places, it at leat 3 years old, but I think a few years older. A lot of the songs will not play, I have to plug it into my Mint desktop and delete … | |
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 … | |
I'm trying to create this site with a solid black top bar the extends from the left img all the way to the right of the screen, then add some text on top of the horizontal block. I created the block just find but when I went to add text … | |
I have a Ubiquiti radio in the house and I think it's a 5.2 GHz. I did a scan to see if it could see my router's SSID but it could not. Could that be becaue my router may be a 2.4 GHz AP? Can one see the tother, does … | |
Server #!/usr/bin/python3 import socket from time import ctime HOST = '' PORT = 21567 BUFSIZ = 1024 ADDR = (HOST, PORT) udpSerSock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) udpSerSock.bind(ADDR) while(True): print('waiting for message...') data, addr = udpSerSock.recvfrom(BUFSIZ) udpSerSock.sendto(data, addr) print('...received from and returned to:', addr) udpSerSock.close() #END# Client #!/usr/bin/python3 import socket HOST = … | |
I need to link a momentary push swith to a raspberry pi. I need to know if it's possible to make the mps issue either a command to the Linux OS or a command to the browser that replicates pushing a specific HTML button a page in the browser? What's … | |
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, … | |
In the following program how does the line `r.size = 150, 100` actually set the values using this line -> `size = property(getSize, setSize)`? property has two arguments, getSize & setSize, it seems to me that would only allow it so get one value and set one value. #!/usr/bin/python3 class … | |
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 the following program why is pwd.getpwuid returning my user and group names followed by three commas? Where ar ethe commas coming from? #!/usr/bin/python3 import os, stat, pwd dirList = os.listdir() permissions = (stat.filemode(os.stat(dirList[1]).st_uid)) string = permissions + ' ' string = string + dirList[1] print(string) temp = os.stat(dirList[1]) print(temp.st_uid) … ![]() | |
I'm having trouble understanding the keyword 'this' in php. When and where does it need to be used? Why can you not simply use the variable name as you would normally do when not placing a variable inside a class? In the small test case program below I can't even … | |
How can I write bash script to force pre-written sql quaries and inserts into my sqlite3 DB? I am currently having to run my page in a browser and then the sqlite4 DB gets edited by php commands then I have to go back into sqlite3 and manually set everything … | |
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 … | |
Is there a function that I can use to find out if a file is a block device? And another for a character device. I'm trying to create a funtion that will build a string the is exactly like the result you get from running ls -l for a slightly … | |
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? | |
(Linux) `output = os.listdir()` In the above line of code I'm getting the name of the file(s) in a given directory, but how can I also get the permissions? This is what I want to see. -rwxr-xr-x 1 garrett garrett 158 Nov 23 10:49 dirlist.py drwxr-xr-x 2 garrett garrett 4096 … | |
<!DOCTYPE html> <html> <head> <link type='text/css' rel='stylesheet' href='style.css'/> <title>Get Started!</title> </head> <body> <p><?php echo ""; ?></p> </body> </html> I thought css needed to be imbeded or linked from the <sript> tag? | |
#!/usr/bin/python3 import sys input1 = sys.argv[1] def print_params(*params): print(params) print_params(input1) #END# In the above code how can I call all the command line arguments with the prin_params function without having to code input1, input2, input3, etc... When I'm doing testing liket this I would like to be able to just … | |
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 code below how do I get sed's find and replace value to cary over into the output that gets redirected to the .txt file at the end? Everything else gets replaced but everything in the if statement gets left behind. # example: ./configure input-file, SSID, IP, device-name, gateway, … | |
I just purchased a new ASUS desktop with a 1TB HD loaded with Window$ 8. I plugged in my two linux drives (OS & home DIR) but the screen was black and nothing would show up, I removed them again and now Windows is starting up again. Any ideas? | |
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>"; … | |
http://www.w3resource.com/javascript/form/string-length.php In the above link I see two different JS areas, Javascript function to restrict length of user input, & Javascript code. All I'm trying to do is validate that the users password of choice is at least x characters in length. Which one of these examples is what I'm … | |
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. | |
In the following program can someone please tell me why my script is skipping the first else clause and never printing "You have already changed your password"? Everything else is working fine but when I enter in a username and password that have already been entered into the system it … | |
$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 have a very small sqlite3 database with one row consisting of three columns but I can get the page to display the row to save my life. So far all I've been able to get the page to display is the first column of the one row that's in … |
The End.