lazy article

Pages: 1234... 15
That's because I wrote that before I realised what you were talking about.
because I can't do it! Stupid maths teacher didn't even teach us how to do this stuff.
Dude, what grade are you in? There is definetly something wrong with either mine or your education system. I remember doing this 3 - 4 years ago...(depends on which part do you find troublesome)
Ah... time passes quickly.( Sometimes I feel old. I wonder how old people feel..)
I'm going to assume that "Grade" in your country of origin means "Year" in mine (neither makes much sense if you think about it), so 11; and it's finding x without using a brute-force method that I didn't like doing.
Last edited on
Hm maybe it should be something like "Level". It's "Year" over here too.
Last edited on
!! They should totally name is Level. Then I can say stuff like "Lol man, you gotta be lvl 10 before you can learn that!"
Lol.
In my country it is called 'class' for some reason (not in English). Every time someone asks 'what class are you in?' I get to guess what do they want to know.. Convenient.
No, this way I get five minutes just in case I made an accident :)


One of the many uses of a regular backup, which should be done regardless of whether you use the wastebasket or not.

I personally just delete stuff, no need for an undo mechanism, but I can always pull it out of the last backup if I do need it undone (though I can't remember having actually ever done that).
Level doesn't work, that's what some people call age! (I'm dead serious...people in my school will think of birthdays as "levelling up")

Seriously though, that script's a bit...absurd. I personally would have it check every 5 seconds or so, and if there's something in the bin, start the countdown to delete in 5 minutes. During the countdown, check every 5 seconds, and if the bin's empty, cancel.
1
2
3
4
5
class hamsterman {
    public:
        lesson* current;
        lesson* next;
}
?
I'm dead serious...people in my school will think of birthdays as "levelling up"


I have an awesome conversation logged from somewhere of people discussing that >_> I'll need to find it.
@chrisname
does that have a point?
I think he's asking what grade hamsterman's in this year, and what grade next year
does that have a point?

Not at all; I was just bored at the time.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import os
import time

trash = ".local/share/Trash/" # Location of trashcan
cmnd  = "rm -rf " # This will change on non-*nix systems

def has_files(directory):
    i, files, fname = 0, [], ""

    for fname in os.listdir(directory):
        i += 1
        print("Found file/dir %s" % fname)
    return (False, True) [i > 0]

def clear(directory):
    os.system(cmnd + directory + "*")

while True:
    if has_files(trash):        # Found files in trash directory
            print("Found files in trash.")
            time.sleep(300)     # Sleep for 5 minutes
            if has_files(trash) # Check again
                print("Emptying trash...")
                clear(trash)    # Clear the folder
                print("Done.")
            else                # Files must have been deleted externally...
                print("Files appear to have been deleted.")
    else:
        print("No files found in trash...")
    time.sleep(5) # Wait 5 seconds until next check 

fix'd.
Last edited on
Only time I think a problem would come from that is when a person puts a file into the Bin, then undeletes it, and 4:59 later "deletes" something else accidentally and it vanishes.
can't you make it check to see if they added another file?
Yep. What you should do is keep a map (or some other associative array) of filenames to times. After each second decrement all times by 1, and delete those that were 0 before the decrement.
Those are good ideas; but that would make it waaaaay more complex than I need it to be.

Then again, it does sound fun...
Then again, it does sound fun...


It's Python; everything in Python is fun.
Last edited on
Lol, ok :P I'll do it tonight; then finish my disk program.
Pages: 1234... 15