2,646 Posted Topics

Member Avatar for Nether_1

Can you post the whole error message ? Edit: this is unrelated to the issue, but if you want to run the program several times, it would be good to add s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) immediately after calling `socket.socket()`.

Member Avatar for Nether_1
0
349
Member Avatar for Nathan_6

What I usually do is to install the *tmux* terminal multiplexer. Type sudo apt-get install tmux in the server terminal, then save this minimal configuration file in $HOME/.tmux.conf # These 3 lines define the prefix F1 pour tmux instead of C-b unbind-key C-b set -g prefix 'F1' bind-key 'F1' send-prefix …

Member Avatar for Gribouillis
0
1K
Member Avatar for Altjen_1

One way to discourage the user from opening the file with a text editor is to store binary data in the file. You could encrypt the file to produce a binary data file.

Member Avatar for tinstaafl
0
1K
Member Avatar for ajit.nayak

I don't understand the issue. You're sending and receiving data. You convert the received data to hex, then to integer by calling `int(d, 16)` and you say it confuses you but this is cryptic data and we don't know if it is correct or not so where is the problem …

Member Avatar for ddanbe
0
565
Member Avatar for Corey_3
Member Avatar for Gribouillis
0
712
Member Avatar for tkpanther

@Anurag Shekhar See pyTony's question here https://www.daniweb.com/programming/software-development/threads/277522/gui-scientific-calculator-homework#post1197744 and tkpanther's answer

Member Avatar for Gribouillis
0
22K
Member Avatar for Dennis_9

The main task of your program is to generate a sequence of pairs `(src, dst)` where src and dst are a path to an existing file or directory and the path to the not yet existing destination. Once the list is correct, you can call `shutil.move()` or `os.rename()` on each …

Member Avatar for Gribouillis
0
172
Member Avatar for _1_6

Nothing is wrong. Only you must call the method if you want it to be executed. So write `p.Sums()`.

Member Avatar for Gribouillis
0
276
Member Avatar for meron seyoum

Beside pointers, the real difficulty is memory management. When to call `new()` and `delete()`. Recent languages all come with garbage collection included and this changes everything in pointers management.

Member Avatar for rubberman
0
319
Member Avatar for chrisschristou

I suggest this code #include<stdio.h> int minoffset(int n, int* arr){ return n == 1 ? 0 : (*arr <= *(arr + (n = 1 + minoffset(n-1, arr+1))))? 0 : n; } int main(int argc, char const *argv[]) { int n=10; int tab[10] = {7,5,6,8,7,4,8,9,2,3}; int min = *(tab + minoffset(n, …

Member Avatar for AssertNull
0
543
Member Avatar for Wallace Jnr

We don't know who Mr Rioch D'lyma is, nor which book or code you're talking about. Can you please post some links to explain all this ?

Member Avatar for Gribouillis
0
691
Member Avatar for vegaseat

@Shreyaa In principle it works, but it would be written more *pythonically* this way def assignment(a, log, b, l): with(open("3ope.txt",'r')) as insname: for line in insname: a.append(instruction()) # .rstrip() removes white space at the end of the line a[-1].inst = line.rstrip() For python code, configure your editor to insert 4 …

Member Avatar for Gribouillis
2
125K
Member Avatar for toll_booth
Member Avatar for DerSoldi
0
2K
Member Avatar for Nik_1

The `print()` at line 6 needs a `end=""` argument. Also you could replace all the `end="t"` with `end=""`, and also `" {}"` with `"{:>5}"` which is better because every number will fit in a fixed length zone of 5 characters.

Member Avatar for makaijohn9
0
5K
Member Avatar for RMartins

@pythonBasic Please don't revive or highjack old threads. Start your own new discussion instead if you have questions.

Member Avatar for pythonBasic
0
726
Member Avatar for quatrosem

I don't understand the rules. Also there are 2 blue circles in the picture. How are the legal paths defined ?

Member Avatar for Gribouillis
0
473
Member Avatar for Pyscript.exe

In windows OS, the best solution is often to install a module from Christoph Gohlke's python binaries for windows. PyHook is [<Here>](http://www.lfd.uci.edu/~gohlke/pythonlibs/#pyhook). Edit: Download the wheel file (.whl), then type `pip install <filename.whl>`

Member Avatar for Pyscript.exe
0
4K
Member Avatar for rhys1619

I've found a `play_again()` function [<here>](http://stackoverflow.com/a/20439490). It can be adapted to your game by returning a boolean. Also the procedure to initialize the maze and the player must be called again, so I write a `reinit()` function to do that. Here is the result. It could be a good starting point. …

Member Avatar for Gribouillis
0
1K
Member Avatar for Nether_1

I don't understand why you need python to install an ftp server (you probably mean an sftp server). There must be a standard way to install an sftp server for your OS. Also I don't understand the "no third party content" part. Can you explain all this.

Member Avatar for Gribouillis
0
432
Member Avatar for Nether_1

It seems that you are trying to define a query language. What you must do is **parse** that query language. For example, you could allow the user to enter several search terms separated by commas. Then parsing this query means for example split the user request into a list of …

Member Avatar for Gribouillis
0
364
Member Avatar for Gribouillis

This snippets contains a python program to find a shortest solution to the problem of the farmer who whishes to cross a river. The boat can only contain two things, including the rower. The farmer comes with a wolf, a duck and a bag of corn, and he can't leave …

Member Avatar for Gribouillis
0
2K
Member Avatar for Arzak

RX bytes and TX bytes are not speed measurements, they show the total number of bytes received and transmitted by this interface (eth0). Are you a friend of zero_1 who posted the same question 1 week ago [Click Here](https://www.daniweb.com/programming/threads/504581/upstream-and-downstream-python#post2204463) ?

Member Avatar for Arzak
0
2K
Member Avatar for Builder_1

@AssertNull running astyle --style=allman --align-pointer=middle --max-code-length=79 farmer.cpp does a pretty good job on formatting Builder_1's code

Member Avatar for AssertNull
-2
2K
Member Avatar for williamsmith007

@happygeek I tried to remove the windows OS from your configuration, but I couldn't reach an acceptable state. What will OP do if he wants to upgrade his OS ?

Member Avatar for happygeek
0
337
Member Avatar for Nether_1

There are many ways to do that, you can use the pickle module or the json module to persist data on disk. A very simple solution is to use Raymond Hettinger's PersistentDict class. Download the code from here [Click Here](http://code.activestate.com/recipes/576642-persistent-dict-with-multiple-standard-file-format/) and save it under the name `persistentdict.py`. You can then …

Member Avatar for Gribouillis
0
804
Member Avatar for iFrolox
Member Avatar for Kayla_1

Before `print('No entry found')` you could add `print(name)` and `print(firstname)` to see why the `if name in firstname` returned false.

Member Avatar for woooee
0
920
Member Avatar for mailtosarach

There is a great module named [<psutil>](https://pypi.python.org/pypi/psutil) which can tell you all this import psutil for proc in psutil.process_iter(): try: pinfo = proc.as_dict() except psutil.NoSuchProcess: pass else: print(pinfo) break To save the data into tabular format, you could use a simple library such as [<tablib>](https://pypi.python.org/pypi/tablib).

Member Avatar for Gribouillis
0
311
Member Avatar for Mayukh_1

This seems to work, I'm looking for a sequence of characters which are not a newline, or a newline followed by a non alphanumeric character. import re content = """ Data: 01 18 01 23 45 67 89 AB CD EF FE DC BA 98 76 54 32 10 01 …

Member Avatar for Gribouillis
0
342
Member Avatar for zelrick

This python script may work. Python is very powerful for such tasks #!/usr/bin/env python # -*-coding: utf8-*- '''doc ''' from __future__ import (absolute_import, division, print_function, unicode_literals) from argparse import ArgumentParser import os.path if __name__ == '__main__': p = ArgumentParser(description='change names of some files') p.add_argument('dir', metavar='DIR', help='directory containing files to move') …

Member Avatar for CimmerianX
0
478
Member Avatar for Brian_18

Astyle [Click Here](http://astyle.sourceforge.net/astyle.html) looks nice. It is even included in ubuntu linux (but it is not coded in java!).

Member Avatar for JamesCherrill
0
3K
Member Avatar for Nether_1

The problem is that when a variable appears **on the left hand side** of the `=` operator in a function, such as in def foo(): started = "fubar" then the rule is that this variable is **a local variable** in function foo. It means that if there is another variable …

Member Avatar for Gribouillis
0
374
Member Avatar for Nether_1

The first rule of thread programming in python is **not to use the thread module**. Use the `threading` module instead. The reason is that the thread module is too low level for your needs. Read [Click Here](https://pymotw.com/2/threading/) first and update your code to use threading.

Member Avatar for Gribouillis
0
3K
Member Avatar for mswamy

Use module paramiko to connect the ssh server and execute commands. See this code [Click Here](https://www.daniweb.com/programming/software-development/threads/319372/sending-the-password-automatically#post1363982) for connection. Execute commands with `ssh.exec_command()`. See this post [Click Here](http://www.iodigitalsec.com/ssh-sftp-paramiko-python/) for example.

Member Avatar for mswamy
0
23K
Member Avatar for jaiop
Member Avatar for zero_1

I don't understand the question nor how it is related to python. I understand that you already have a script for Ubuntu, can you post that script or a link to it ?

Member Avatar for zero_1
0
832
Member Avatar for new_2_java
Member Avatar for Rajesh_21

Go [here](http://www.drjava.org/) and click "download jar file via http". Then open a terminal and go to the directory where the file `drjava...` has been downloaded. Then type java -jar drjava* In the window that opens, write public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } } …

Member Avatar for Gribouillis
0
195
Member Avatar for Rajesh_21

Go [here](http://www.drjava.org/) and click "download jar file via http". Then open a terminal and go to the directory where the file `drjava...` has been downloaded. Then type java -jar drjava* In the window that opens, write public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } } …

Member Avatar for Gribouillis
0
82
Member Avatar for dier02

You need a loop to handle the case where the answer is not yes or no. For example def yesno(question): while True: ans = input(question + ' (Y/n) ') ans = ans.strip().lower() if ans in ('', 'y', 'yes'): return 'yes' elif ans in ('n', 'no'): return 'no' else: print('Please answer …

Member Avatar for jnneson
0
395
Member Avatar for Nether_1

Your code is almost the same as code in this tutorial[Click Here](https://pythonprogramming.net/displaying-images-pygame/). There are missing calls to `arrowimg()` and `pygame.display.update()` at the end of your code. Also it is an error to use the same name `arrowimg` for the image and your function. Use 2 different names.

Member Avatar for Gribouillis
0
236
Member Avatar for Nether_1

Why do you need python 2.5. The obvious thing to do is to uninstall 2.5 and install 2.7.

Member Avatar for Nether_1
0
322
Member Avatar for divinity02

One problem with OO tutorials is that they teach you a very formal point of vue about OOP, how to carefuly plan subclasses, method overriding etc. After many years of OOP, I tend not to write many subclasses and not to override many methods because carefuly designed class hierarchies are …

Member Avatar for divinity02
0
477
Member Avatar for rose_2

I think there shouldn't be a `for` loop in `Read()`. Also there is an error in `get_smallest()` #include <cassert> #include <iostream> #include <vector> #include <string> #include <sstream> using namespace std; struct people { string name; int age; }; people Read(people p) { //for (unsigned int i = 0; i < …

Member Avatar for rose_2
0
167
Member Avatar for manaila
Member Avatar for engrjd91

The most obvious thing in your code is that "Members.txt" will be opened many times, one for each iteration of the lines in "Rules.txt". This is probably not what you want. You don't need to open each file more than once. To make things easier since you are new to …

Member Avatar for Gribouillis
0
485
Member Avatar for rob2

If `X` is a list instance, one can access its members with `X.tail` or `X.next`. On the other hand if `X` is a pointer to a list instance, one writes `X->tail` and `X->next`. It is only the syntax of C++. Notice that in the case of a pointer, there is …

Member Avatar for Gribouillis
0
233
Member Avatar for Lucas_9
Member Avatar for Gribouillis
0
1K
Member Avatar for Izio

Try `int('ff', base=16)` edit: also have a look at standard modules binascii and array.

Member Avatar for Izio
0
350
Member Avatar for Mayukh_1

A reasonable way to start good parsing is to write a tokenizer from __future__ import print_function import re from collections import namedtuple regex = re.compile(r'(\w+[.]\w+)|(\w+|[{}\[\],])|(\n)') d1 = { 'sourceFiles': 'SOURCEFILES', 'headerFiles': 'HEADERFILES', 'path': 'PATH', 'header': 'HEADER', 'source': 'SOURCE', '{': 'LB', '}': 'RB', '[': 'LS', ']': 'RS', ',': 'COMMA', } #Token …

Member Avatar for jacks009
0
430

The End.