[try Beta version]
Not logged in

 
lazy article

Pages: 1234... 15
Oct 19, 2009 at 12:27pm
That's because I wrote that before I realised what you were talking about.
Oct 19, 2009 at 3:50pm
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..)
Oct 19, 2009 at 6:08pm
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 Oct 19, 2009 at 6:10pm
Oct 20, 2009 at 3:13am
Hm maybe it should be something like "Level". It's "Year" over here too.
Last edited on Oct 20, 2009 at 3:13am
Oct 20, 2009 at 6:15am
!! They should totally name is Level. Then I can say stuff like "Lol man, you gotta be lvl 10 before you can learn that!"
Oct 20, 2009 at 7:19am
Lol.
Oct 20, 2009 at 1:40pm
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.
Oct 20, 2009 at 5:19pm
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).
Oct 20, 2009 at 8:01pm
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.
Oct 20, 2009 at 8:32pm
1
2
3
4
5
class hamsterman {
    public:
        lesson* current;
        lesson* next;
}
?
Oct 21, 2009 at 12:15am
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.
Oct 21, 2009 at 11:35am
@chrisname
does that have a point?
Oct 21, 2009 at 11:57am
I think he's asking what grade hamsterman's in this year, and what grade next year
Oct 21, 2009 at 1:34pm
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 Oct 21, 2009 at 4:13pm
Oct 21, 2009 at 7:25pm
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.
Oct 21, 2009 at 7:30pm
can't you make it check to see if they added another file?
Oct 21, 2009 at 7:32pm
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.
Oct 21, 2009 at 7:35pm
Those are good ideas; but that would make it waaaaay more complex than I need it to be.

Then again, it does sound fun...
Oct 22, 2009 at 1:20am
Then again, it does sound fun...


It's Python; everything in Python is fun.
Last edited on Oct 22, 2009 at 1:20am
Oct 22, 2009 at 7:35am
Lol, ok :P I'll do it tonight; then finish my disk program.
Pages: 1234... 15