| |
| |
| |
|
Page: 1 2 3
Comments:
<0> hello <0> does somebody here knows if there's a way to find out the creation date of a file? <0> file atime returns the last access time file mtime returns the last modification time <1> yes <1> u need a MYSQL databse to do this first <0> why?? <2> Mythox: use "file stat" <2> file stat $path foo; puts $foo(ctime) <0> oh ok thanks <0> is there a way to set that value too? <2> nope <3> yeah you can <2> with an external bin, yes <3> naw
<3> you can use file atime ... or file ctime <2> there is no file ctime command <2> you're thinking of atime and mtime <3> hrm...guess so i swore there was an atime/ctime/mtime <3> guess i never noticed that <3> you would think if you can set access and modification you could set creation <3> Mythox, just exec the 'touch' bin standard on all *nix systems <2> most nix filesystems don't have a creation time for inodes <2> which is why there is no 'file ctime' command <3> bsd does <2> freebsd's UFS records the birthdates (which is the same thing) <2> yeah <2> ufs in general <3> right <3> all bsds are ufs based <3> free/net/open/etc... <3> ffs/ufs are pretty closely related as well <3> and besides if the file command supports switches for mac osx and darwin...dunno why it wouldn't support ctime for *bsd filesystems <4> =) <5> ctime is inode modification time <6> mh <7> if i want to store a two paired value like <name>, <id> would i use a dictionary? <8> if -> http://www.tcl.tk/man/tcl8.4/TclCmd/if.htm <7> i would just use an array <7> but then what are dictionaries for? <0> just to store and search lists of plenty of words <7> ah <7> and thats faster then a nested list? <7> anyway array is good for my purpose then i guess <7> so now i just need to parse the file to get name and id i wonder whats faster loading the file into memory first and then parse it or directry parse it by going through it line by line <9> the latter <9> since loading it first does not yield any advantage <9> you traverse the file and store its contents in O(n) <7> well going through it while in memory is probably faster, no since reading whole file is faster then many little reads <7> ; string range <10> Gotisch: #878 (1135 clicks) Tcl error: wrong # args: should be "string range string first last" <7> mh something like that <7> while {[gets $file line] >= 0} { if {[string range $line 0 4] == "GUID"} { set a [string range $line 6 end] } } <7> where a would then be the guid <7> just need name then <9> wrong <7> what? <9> reading a file line by line is very fast <9> your libc reads the file chunk-wise anyway <9> reading the file to memory first just doubles your mem requirements <9> just use a line-wise read primitive like gets <7> ye seems fast enough <7> ill test it with inmemory too <9> otoh - with your 100 line testcase you wont see any difference <9> Gotisch: you ever written a scanner or parser? or heard a lecture on it ? <7> mh the file im parsing is 30mb <11> dict ? <10> dict -> http://Tcl.Tk/man/tcl8.5/TclCmd/dict.htm <7> ok testfile is just 1mb <7> but still <7> 120000 lines <9> Gotisch: ok, for that kind of size you _want_ to read/parse the file on the fly <9> it's _meant_ to be done that way <7> i can imagine :) <7> well the fastes i found was just sourcing the file
<7> but its kinda hard since its not in the right format :] and i dont want to rewrite the unkown proc <9> that's because the primitive tcl-loader that is nativly implemented parse the file <9> if you can do that - go ahead <7> ill stick with line by line <7> seems to be fast enough <9> hehe... "fast enough" funny. it's the fastest there is <9> again: the libc reads the file chunk-wise anyway <9> probably at 4k or 8k chunks <9> or even mmap()s it and leaves it to the kernel to fill in <7> i mean fast enough to do it in tcl <7> else i would have to parse it in c and then just p*** it to interpreter <11> how are you treating the file since you dont do a read, Gotisch? <9> yeah <7> treating? <7> gets <11> i mean, what are you doing with the data you get? <7> saving it in an array <11> hrm <7> actually it will be array(name) -> id <11> a textfile you need to parse or what? <7> yes <7> i need to get name and id out of it <11> oh, right <7> because in the db is only saved the id <7> so ill allow searching by name <7> by looking up right id for it <11> wouldn't 'set dat [split [read [set fid [open your_file.txt r]]] \n][close $fid]; foreach ln $dat { do_your_stuff }' be a proper alternative? <7> mh <7> ye i tested it <7> % time {readandparsedirectly} <7> 1123802 microseconds per iteration <7> % time {readinmemorythenparse} <7> 882958 microseconds per iteration <7> seems reading it into memory first is faster <7> but not by much <7> gotta test it with bigger file <11> 1mb is not a lot to keep in mem these days <7> ill try with the 30mb file <11> 30 MB of text? <11> that's crazy ;> <7> yes <7> dont get me started :] <9> Gotisch: did you account for the file reading time, too? <7> yes <7> ill show you the procs <9> include the loading and time everything together <11> from what he showed they were divided into two different procedures, so most likely they were stand-alone procedures <7> http://paste.tclhelp.net/?id=5du <11> i gotta eat <9> Gotisch: depressing <9> now, also measure the memory requirements :) <7> :] <7> tell me a good way to do so :p <9> umh <9> i dont do tcl :) <7> you cant measure it in tcl imho <7> and if you can you need debug enabled <7> i think i dont have it enabled <9> isnt there some global info command for the runtime env ? <7> ; memory <10> Gotisch: #964 (3141 clicks) Tcl error: invalid command name "memory" <7> you need tcl with debug enabled to get memory <9> ;info mem <10> Raimi: #966 (1192 clicks) Tcl error: bad option "mem": must be args, body, cmdcount, commands, complete, default, exists, functions, globals, hostname, level, library, loaded, locals, nameofexecutable, patchlevel, procs, script, sharedlibextension, tclversion, or vars <7> http://www.tcl.tk/man/tcl8.4/TclCmd/memory.htm <7> lets hope my laptop can handle that file <7> i dont have that much ram <9> heehee <7> % time {readandparsedirectly} <7> 14944012 microseconds per iteration <7> % time {readinmemorythenparse} <7> 19956040 microseconds per iteration <7> haha :] <7> i guess i would need to do it like a hundret times to be sure
Return to
#tcl or Go to some related
logs:
#networking theenglishmansion gallery expr[llength...] in tcl
wetgorilla #computers ubuntu oidentd Unable to setup listening socket #debian #beginner #gamedev asians wear
|
|