Search Results

Search found 15 results on 1 pages for 'arrieta'.

Page 1/1 | 1 

  • Creating hard drive backup images efficiently

    - by Arrieta
    We are in the process of pruning our directories to recuperate some disk space. The 'algorithm' for the pruning/backup process consists of a list of directories and, for each one of them, a set of rules, e.g. 'compress *.bin', 'move *.blah', 'delete *.crap', 'leave *.important'; these rules change from directory to directory but are well known. The compressed and moved files are stored in a temporary file system, burned onto a blue ray, tested within the blue ray, and, finally, deleted from their original locations. I am doing this in Python (basically a walk statement with a dictionary with the rules for each extension in each folder). Do you recommend a better methodology for pruning file systems? How do you do it? We run on Linux.

    Read the article

  • Best format for backing up data in Blu Ray

    - by Arrieta
    We are in the process of backing up our hard drives to Blu Rays. I am creating tar.gz files and burning them to Blu Ray. Is it possible to use a simple (preferably Python-based) solution for creating images of those tar.gz files, of a predetermined size (to fit in the Blu Ray), and simply burn this images to the disc? Do you have any other approach for creating physical back-up of your hard drives?

    Read the article

  • Sqlite3 "chained" query

    - by Arrieta
    I need to create a configuration file from a data file that looks as follows: MAN1_TIME '01-JAN-2010 00:00:00.0000 UTC' MAN1_RX 123.45 MAN1_RY 123.45 MAN1_RZ 123.45 MAN1_NEXT 'MAN2' MAN2_TIME '01-MAR-2010 00:00:00.0000 UTC' MAN2_RX 123.45 [...] MAN2_NEXT 'MANX' [...] MANX_TIME [...] This file describes different "legs" of a trajectory. In this case, MAN1 is chained to MAN2, and MAN2 to MANX. In the original file, the chains are not as obvious (i.e., they are non-sequential). I've managed to read the file and store in an Sqlite3 database (I'm using the Python interface). The table is stored with three columns: Id, Par, and Val; for instance, Id='MAN1', Par='RX', and Val='123.45'. I'm interested in querying such database for obtaining the information related to 'n' legs. In English, that would be: "Select RX,RY,RZ for the next five legs starting on MAN1" So the query would go to MAN1, retrieve RX, RY, RZ, then read the parameter NEXT and go to that Id, retrieve RX, RY, RZ; read the parameter NEXT; go to that one ... like this five times. How can I pass such query with "dynamic parameters"? Thank you.

    Read the article

  • Reading ASCII numbers using "D" instead of "E" for scientific notation using C

    - by Arrieta
    Hello, I have a list of numbers which looks like this: 1.234D+1 or 1.234D-02. I want to read the file using C. The function atof will merely ignore the D and translate only the mantissa. The function fscanf will not accept the format '%10.6e' because it expects an E instead of a D in the exponent. When I ran into this problem in Python, I have up and merely used a string substitution before converting from string to float. But in C, I am sure there must be another way. So, how would you read a file with numbers using D instead of E for scientific notation? Notice that I do not mean how to read the strings themselves, but rather how to convert them to floats. Thanks.

    Read the article

  • C++ stack for multiple data types (RPN vector calculator)

    - by Arrieta
    Hello: I have designed a quick and basic vector arithmetic library in C++. I call the program from the command line when I need a rapid cross product, or angle between vectors. I don't use Matlab or Octave or related, because the startup time is larger than the computation time. Again, this is for very basic operations. I am extending this program, and I will make it work as an RPN calculator, for operations of the type: 1 2 3 4 5 6 x out: -3 6 -3 (give one vector, another vector, and the "cross" operator; spit out the cross product) The stack must accept 3d vectors or scalars, for operations like: 1 2 3 2 * out: 2 4 6 The lexer and parser for this mini-calculator are trivial, but I cannot seem to think of a good way for creating the internal stack. How would you create a stack of for containing vectors or doubles (I rolled up my own very simple vector class - less than one hundred lines and it does everything I need). How can I create a simple stack which accepts elements of class Vector or type double? Thank you.

    Read the article

  • Using Python's ConfigParser to read a file without section name

    - by Arrieta
    Hello: I am using ConfigParser to read the runtime configuration of a script. I would like to have the flexibility of not providing a section name (there are scripts which are simple enough; they don't need a 'section'). ConfigParser will throw the NoSectionError exception, and will not accept the file. How can I make ConfigParser simply retrieve the (key, value) tuples of a config file without section names? For instance: key1=val1 key2:val2 I would rather not write to the config file.

    Read the article

  • Printing to STDOUT and log file while removing ANSI color codes

    - by Arrieta
    I have the following functions for colorizing my screen messages: def error(string): return '\033[31;1m' + string + '\033[0m' def standout(string): return '\033[34;1m' + string + '\033[0m' I use them as follows: print error('There was a problem with the program') print "This is normal " + standout("and this stands out") I want to log the output to a file (in addition to STDOUT) WITHOUT the ANSI color codes, hopefully without having to add a second "logging" line to each print statement. The reason is that if you simply python program.py > out then the file out will have the ANSI color codes, which look terrible if you open in a plain text editor. Any advice?

    Read the article

  • How do you PEP 8-name a class whose name is an acronym?

    - by Arrieta
    I try to adhere to the style guide for Python code (also known as PEP 8). Accordingly, the preferred way to name a class is using CamelCase: Almost without exception, class names use the CapWords convention. Classes for internal use have a leading underscore in addition. How can I be consistent with PEP 8 if my class name is formed by two acronyms (which in proper English should be capitalized). For instance, if my class name was 'NASA JPL', what would you name it?: class NASAJPL(): # 1 class NASA_JPL(): # 2 class NasaJpl(): # 3 I am using #1, but it looks weird; #3 looks weird too, and #2 seems to violate PEP 8. Thoughts?

    Read the article

  • How to structure (normalize?) a database of physical parameters?

    - by Arrieta
    Hello: I have a collection of physical parameters associated with different items. For example: Item, p1, p2, p3 a, 1, 2, 3 b, 4, 5, 6 [...] where px stands for parameter x. I could go ahead and store the database exactly as presented; the schema would be CREATE TABLE t1 (item TEXT PRIMARY KEY, p1 FLOAT, p2 FLOAT, p3 FLOAT); I could retrieve the parameter p1 for all the items with the statement: SELECT p1 FROM t1; A second alternative is to have an schema like: CREATE TABLE t1 (id INT PRIMARY KEY, item TEXT, par TEXT, val FLOAT) This seems much simpler if you have many parameters (as I do). However, the parameter retrieval seems very awkward: SELECT val FROM t1 WHERE par == 'p1' What do you advice? Should go for the "pivoted" (first) version or the id, par, val (second) version? Many thanks.

    Read the article

  • Simple and efficient distribution of C++/Boost source code (amalgamation)

    - by Arrieta
    Hello: My job mostly consists of engineering analysis, but I find myself distributing code more and more frequently among my colleagues. A big pain is that not every user is proficient in the intricacies of compiling source code, and I cannot distribute executables. I've been working with C++ using Boost, and the problem is that I cannot request every sysadmin of every network to install the libraries. Instead, I want to distribute a single source file (or as few as possible) so that the user can g++ source.c -o program. So, the question is: can you pack the Boost libraries with your code, and end up with a single file? I am talking about the Boost libraries which are "headers only" or "templates only". As an inspiration, please look at the distribution of SQlite or the Lemon Parser Generator; the author amalgamates the stuff into a single source file which is trivial to compile. Thank you.

    Read the article

  • Filter objects within two seconds of one another using SQLAlchemy

    - by Arrieta
    Hello: I have two tables with a column 'date'. One holds (name, date) and the other holds (date, p1, p2). Given a name, I want to use the date in table 1 to query p1 and p2 from table two; the match should happen if date in table one is within two seconds of date in table two. How can you accomplish this using SQLAlchemy? I've tried (unsuccessfully) to use the between operator and with a clause like: td = datetime.timedelta(seconds=2) q = session.query(table1, table2).filter(table1.name=='my_name').\ filter(between(table1.date, table2.date - td, table2.date + td)) Any thoughts?

    Read the article

  • Read whole ASCII file into C++ std::string

    - by Arrieta
    Hello, I need to read a whole file into memory and place it in a C++ std::string. If I were to read it into a char, the answer would be very simple: std::ifstream t; int lenght; t.open("file.txt", "r"); // open input file t.seekg(0, std::ios::end); // go to the end length = t.tellg(); // report location (this is the lenght) t.seekg(0, std::ios::beg); // go back to the beginning buffer = new char[length]; // allocate memory for a buffer of appropriate dimension t.read(buffer, length); // read the whole file into the buffer t.close(); // close file handle // ... do stuff with buffer here ... Now, I want to do the exact same thing, but using a std::string instead of a char. I want to avoid loops, i. e., I don't want to: std::ifstream t; t.open("file.txt", "r"); std::string buffer; std::string line; while(t){ std::getline(t, line); // ... append line to buffer and go on } t.close() any ideas?

    Read the article

  • Why is Visual Basic used?

    - by Arrieta
    I don't mean to start a holy war here, but I cannot fathom why would anybody use Visual Basic for a new project. Can you explain me why is it used? What new applications (which a lay person may be familiar with) have been developed in it? Why is it chosen over other languages? Thanks.

    Read the article

  • Python-based password tracker (or dictionary)

    - by Arrieta
    Hello: Where we work we need to remember about 10 long passwords which need to change every so often. I would like to create a utility which can potentially save these passwords in an encrypted file so that we can keep track of them. I can think of some sort of dictionary passwd = {'host1':'pass1', 'host2':'pass2'}, etc, but I don't know what to do about encryption (absolutely zero experience in the topic). So, my question is really two questions: Is there a Linux-based utility which lets you do that? If you were to program it in Python, how would you go about it? A perk of approach two, would be for the software to update the ssh public keys after the password has been changed (you know the pain of updating ~15 tokens once you change your password). As it can be expected, I have zero control over the actual network configuration and the management of scp keys. I can only hope to provide a simple utility to me an my very few coworkers so that, if we need to, we can retrieve a password on demand. Cheers.

    Read the article

  • Many-to-one relationship in SQLAlchemy

    - by Arrieta
    This is a beginner-level question. I have a catalog of mtypes: mtype_id name 1 'mtype1' 2 'mtype2' [etc] and a catalog of Objects, which must have an associated mtype: obj_id mtype_id name 1 1 'obj1' 2 1 'obj2' 3 2 'obj3' [etc] I am trying to do this in SQLAlchemy by creating the following schemas: mtypes_table = Table('mtypes', metadata, Column('mtype_id', Integer, primary_key=True), Column('name', String(50), nullable=False, unique=True), ) objs_table = Table('objects', metadata, Column('obj_id', Integer, primary_key=True), Column('mtype_id', None, ForeignKey('mtypes.mtype_id')), Column('name', String(50), nullable=False, unique=True), ) mapper(MType, mtypes_table) mapper(MyObject, objs_table, properties={'mtype':Relationship(MType, backref='objs', cascade="all, delete-orphan")} ) When I try to add a simple element like: mtype1 = MType('mtype1') obj1 = MyObject('obj1') obj1.mtype=mtype1 session.add(obj1) I get the error: AttributeError: 'NoneType' object has no attribute 'cascade_iterator' Any ideas?

    Read the article

1