• Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in fork() processes

    Here is a python program with almost the same statements from os import fork, getpid from sys import exit def main(): i = 2 while i <= 4: print('PID', getpid(), …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in fork() processes

    The expression `i & 1` is true only if i is odd. This will happen only if i equals 3 in the loop. In that case `fork()` is executed and …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in [Urgent] Nothing boots anymore

    > I never did recover the data Everybody backs up!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in I have got a cold

    > I'm a self-destructive thing. More prosaically, you are a drug addict. It is time to rebel !
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in I have got a cold

    I hope you stopped smoking. Good luck with your disease.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in [Urgent] Nothing boots anymore

    You don't need a terminal if you burn the disk from here http://sourceforge.net/projects/boot-repair-cd/files/
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in [Urgent] Nothing boots anymore

    What does the boot-repair disk say ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Minimize the surface area of a can (Python)

    Your method can be called *optimization by scanning*. It has the advantage of requiring nothing but elementary python code to work. In applications, one would use an existing solver such …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in need help in python

    We don't know what `n` is. The easiest way is to make it an attribute of a `TheShuttles` instance. class TheShuttles: def __init__(self): self.n = 0 def getLeastCost(self, baseCost, seatCost, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in need help in python

    The if condition looks if the dictionary `tm` contains a key which is a tuple of length 1 containing the `word` as sole item. If it does not, a value …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to snippsat in Point in Polyhedron

    >because my anaconda distribution doesn't seem to have linprog (?) You can use `pip install` or `conda install`(Scripts folder) to get new stuff into Anaconda. For this is best to …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Point in Polyhedron

    `linprog()` needs scipy version >= 0.15.0. In ubuntu, I had to remove package scipy and reinstall scipy with the pip command (as of march 2015).
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How can I add Add \x ?

    It is not the right output. Consider the following example >>> from binascii import unhexlify >>> s = "f0" >>> A = unhexlify(s) >>> B = r"\x" + r"\x".join(s[n : …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How can I add Add \x ?

    Vegaseat's method does not work. It gives another string: '\\xf0\\xcb\\xf2\\x60\\xe0\\xca\\x8e\\xc2\\x43\\x10\\x89\\xfb\\x39\\x3a\\x1c\\x29\\x51\\x3a\\xaa\\xa5\\x84\\x7d\\x13\\xe8\\xbe\\x84\\x76\\x09\\x68\\xe6\\x4d\\xc6'
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How can I add Add \x ?

    Sequences such as `\xf0` represent a single byte (8 bits. Remark: in python 3, use `b'\xf0'`). Some bytes are better viewed as ascii characters. For example `'Q'` and `'\x51'` are …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in How can I add Add \x ?

    Hi. Use module binascii >>> from binascii import unhexlify >>> s = 'f0cbf260e0ca8ec2431089fb393a1c29513aaaa5847d13e8be84760968e64dc6' >>> t = unhexlify(s) >>> t '\xf0\xcb\xf2`\xe0\xca\x8e\xc2C\x10\x89\xfb9:\x1c)Q:\xaa\xa5\x84}\x13\xe8\xbe\x84v\th\xe6M\xc6'
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in code flat out doesnt run after while True

    The `while True` loop runs forever unless it contains a `break` or `return` statement, or an exception is raised. It means that your code repeats indefinitely the statement `whichcode = …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in for loop syntax error

    There are many syntax errors in your code. The documentation explains the syntax of the for statement https://docs.python.org/3/reference/compound_stmts.html#the-for-statement Schematically it is for SPAM in HAM: EGGS of course, `HAM` must …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to Leslie_1 in Taking Free Internet courses from Universities

    Some time ago, while trying to learn python, I stumbled across coursera.org. Via coursera.org, I found two python courses. They are free to follow, to enroll, and to enjoy. Since …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Point in Polyhedron

    Here is the basic idea #!/usr/bin/env python # -*-coding: utf8-*- '''doc ''' from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np from scipy.optimize import linprog def main(): point …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Point in Polyhedron

    It seems to me that this question is solvable by linear programming. The function `scipy.optimize.linprog()` should work with convenient parameters.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Code Embedding in a Post?

    Let's try cereal's technique def paire(x): return sqrt(-x**2+3*x+4), abs(x-2) for x in (-0.5, 1, 3.7): print x, paire(x) In kubuntu, I selected code in an editor with ^c, then pasted …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Type of Article dropdown box

    @Wojciech Really I don't understand why you don't start your own forum project with your own features. Obviously, you have many ideas about how to improve existing software, so why …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Trouble comparing dice roll results

    You can use tuples of integers to store the dice results, for example attacking_values = (random.randint(1,6), random.randint(1,6),)
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Acronym Program

    Replace `phrase[0]` with `words[0]`.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in PyQt reloading and updating the application code

    You could use my snippet to restart the program https://www.daniweb.com/software-development/python/code/260268/restart-your-python-program- . From `action_reload()`, you can call `restart_program()`. Before that, you can try to compile the main program in order to …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in No deletion of post/articles/reviews whatever

    @Wojciech I think you have two options: * You can create Wojciechweb and program your own forum application the way it should be done, * OR you can convince Dani …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Python Formated List

    Very good. It can be improved with `n = len(mylist) % 4`.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Convert C For Loop to Python For Loop

    Here is what you can do with an array for example >>> from array import array >>> spam = b'5470011234567000' >>> eggs = array('b', spam) >>> eggs array('b', [53, 52, …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Convert C For Loop to Python For Loop

    Your python code does not look like the C code. At line 7 and 11, it should be `m_key_code[idx] = ...`. Also `0` should probably be `n0` at the end …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    Not necessarily. The drawbacks of ORMs is that they are heavy, and often slow. For example on a concrete problem, I prefer by far to use the mysqldb module than …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    No, I don't see any problem. The most annoying point is that the query language is database-specific. Later on, you may feel the need for methods performing some queries in …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Need help modeling some parent-child classes

    It looks nice. How did you produce the UML diagram ?
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Convert C For Loop to Python For Loop

    Yes `{}` does not have the same semantics in C or in python. Use lists `[]` or tuples `()` for the `e_rotor*`. Or you can probably use a bytes e_rotor_10 …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Convert C For Loop to Python For Loop

    Great, good luck!
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Edit Post Bug

    I had this problem too. My solution is to refresh between c) and d) (with ^R). I'm using Qupzilla 1.8.6. I think it is always better to refresh before editing …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Convert C For Loop to Python For Loop

    We still don't know if you are using python 3, nor the type of enigma_string, which is necessary here (print `type(enigma_string)`). Assuming this is python 3 and enigma_string is a …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in printer/scanner for Linux

    It depends on what you call *good*. I have a Epson XP-700 at home and it works very well with linux kubuntu. Epson publishes free drivers for the printer and …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Reading from a website

    In python 3, `urlopen()` is in module `urllib.request`. You can go here https://docs.python.org/3/index.html and type the name of a function in the *quick search* box to find it in the …
  • Member Avatar for Gribouillis
    Gribouillis

    Gave Reputation to DaveAmour in Get difference in minutes

    Its 1
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Convert C For Loop to Python For Loop

    If you want to start at position 2, you only need for idx in range(2, key_length): Do you have a variable `m_keyCode` ? The body of the for loop depends …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in What are specifications/requirements of native, precise Linux program?

    Why not try D ? It was originally a language for windows because its creator Walter Bright wrote the first DMD compiler for windows, but it now works on various platforms …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in What are specifications/requirements of native, precise Linux program?

    You'll need some time and more googling to get a correct picture of all these languages. For example fortran's domain is not OS programming but engineering and numerical analysis. Wikipedia …
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in adding a number to every integer in a list

    I don't understand what `q` and `g` are in your code. If you want to add a number to every value in a list, you can do mylist = [83, …
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Generate unique words based on computer time

    This snippet defines a function returning new identifiers created from reading the computer's time.
  • Member Avatar for Gribouillis
    Gribouillis

    Replied To a Post in Generate unique words based on computer time

    Version 0.2.0 is a minor bugfix for python >= 3.3!
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Generate unique words based on computer time

    This snippet defines a function returning new identifiers created from reading the computer's time.
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Generate unique words based on computer time

    This snippet defines a function returning new identifiers created from reading the computer's time.
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Generate unique words based on computer time

    This snippet defines a function returning new identifiers created from reading the computer's time.
  • Member Avatar for Gribouillis
    Gribouillis

    Edited Generate unique words based on computer time

    This snippet defines a function returning new identifiers created from reading the computer's time.

The End.