POV-Ray : Newsgroups : povray.off-topic : Context switching Server Time
4 Sep 2024 17:24:28 EDT (-0400)
  Context switching (Message 183 to 192 of 222)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
From: Jim Henderson
Subject: Re: Context switching
Date: 23 Apr 2010 13:50:25
Message: <4bd1dde1$1@news.povray.org>
On Fri, 23 Apr 2010 09:04:37 +0100, Invisible wrote:

>>> Is there some advantage to supporting regular expressions?
>> 
>> Yes, because if you don't know the exact string you're looking for, you
>> can specify a more general string that is likely to be found.
> 
> Surely this almost never actually works though?

Obviously I'd prefer to spend my time doing something that "almost never 
actually works", right?  (IOW, the fact that I do in fact do this should 
demonstrate to you that it *does* actually work more often than not, 
because I'm not likely to waste my time doing something that is unlikely 
to work).

>> Doing that by hand would be very tedious and would take days, and even
>> then, I might not find what I was looking for.
> 
> As I say, not the kind of thing I ever need to do. (Although
> occasionally I wish it was possible to search this newsgroup...)

That's actually something I do use it for as well - I've been known to 
scrape newsgroups with a perl script, dump the contents, and then use 
grep to parse the output file to find a message I was looking for based 
on something in the message text.

>>>> As Warp said, you also can traverse a directory structure with grep
>>>> to find the file(s) that have the string in them.
>>> I didn't know that. I thought grep was just for searching within one
>>> file.
>> 
>> If I tell you the 'net is wonderful resource for information, what will
>> you say in response?  ;-)
> 
> Suffice it to say that since I don't need grep, I hadn't deeply
> researched its capabilities. (I only recently discovered that it's a
> search tool, for example.)

Well, perhaps you would benefit from using it (perhaps not), but just 
because you weren't aware of its capabilities, you never considered it as 
an option to accomplish a task.  It's only natural that one wouldn't use 
a tool that might be well suited for a task if one doesn't know about the 
tool or fully understand its capabilities.

Jim


Post a reply to this message

From: Jim Henderson
Subject: Re: Context switching
Date: 23 Apr 2010 13:50:59
Message: <4bd1de03$1@news.povray.org>
On Fri, 23 Apr 2010 07:00:25 -0400, Warp wrote:

> Neeum Zawan <m.n### [at] ieeeorg> wrote:
>>         So why compare with Linux? You're comparing with OpenSUSE.
> 
>   OpenSUSE is the only distro deserving of a mention... ;)

FTW! :-)

Jim


Post a reply to this message

From: Darren New
Subject: Re: Context switching
Date: 23 Apr 2010 15:33:42
Message: <4bd1f616$1@news.povray.org>
Orchid XP v8 wrote:
> Darren New wrote:
>> Invisible wrote:
>>> On the other hand, VBA doesn't seem to require you to memorise 
>>> 20-digit GUIDs or interface index numbers or any of the other stuff 
>>> that the COM documentation seems to indicate is necessary, so...?
>>
>> I'm not sure what the question is. What do you think CreateObject does?
> 
> What's CreateObject?

It looks up names in the registry and translates them to 20-digit GUIDs.

It's like complaining you don't see IP addresses in hyperlinks, so the web 
must not use IP.

-- 
Darren New, San Diego CA, USA (PST)
   Linux: Now bringing the quality and usability of
   open source desktop apps to your personal electronics.


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Context switching
Date: 23 Apr 2010 16:23:31
Message: <4bd201c3$1@news.povray.org>
Invisible wrote:
> No, I mean... I thought grep can only search within a single file (as
> can any decent text editor). I didn't realise it can search multiple
> files.
> 
> (I'm still having trouble thinking up a use-case for that. About the
> only thing I can think of is trying to find out which header file
> defines a particular symbol or something.)

Yesterday, the 'parted' tool was giving me a totally cryptic error message.

$ apt-get source parted
$ cd parted-2.2
$ grep -rn "error message here" .

-r makes search recursive, -n makes grep output line numbers next to the 
filenames. Then I opened a text editor on the file and line number that grep 
mentioned, and tried to figure out the code :)


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Context switching
Date: 23 Apr 2010 16:29:10
Message: <4bd20316@news.povray.org>
Warp wrote:
> Invisible <voi### [at] devnull> wrote:
>> Um... why? Three lines of text doesn't take "minutes" to write. And
>> that's about all it takes to search a folder for a file matching a
>> condition. (Obviously, it depends on how complicated the condition is...)
> 
>   How long does it take you to write a program which does the same thing
> as this:
> 
>     fgrep '#include "header.hh"' *.cc
> 

There could be more spaces.

grep '#include[[:space:]]\+"header.hh"' *.cc

How long would it take to write a program that can match that, taking into 
account that there could be multiple spaces?


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Context switching
Date: 23 Apr 2010 16:37:00
Message: <4bd204ec@news.povray.org>
Darren New wrote:
> Warp wrote:
>>   So what? I'm not interested in how much disk space the file is taking.
> 
> But most other people are. Hence the default UI.

Default UI? There is no option to make it work in a different way. It's not 
the default UI, it's the *only* UI.


Post a reply to this message

From: nemesis
Subject: Re: Context switching
Date: 23 Apr 2010 16:50:59
Message: <4bd20833@news.povray.org>
Invisible escreveu:
> Warp wrote:
>> Invisible <voi### [at] devnull> wrote:
>>> Mostly because even on a PC with hardware far in advance of what the 
>>> Amiga has, Windows was *vastly* slower.
>>
>>   Far in advance? 12MHz CPU (if you were rich), no hardware graphics
>> acceleration of any kind, 16 colors (again, if you were rich)... How is
>> that "far in advance of what the Amiga has"?
> 
> Because the PCs at college had 133 MHz CPUs and 32 MB of RAM - multiple 
> times the Amiga's 7 MHz CPU (admittedly of completely different design) 
> and 2 MB of RAM. And yet, on such a machine, even something as simple as 
> closing a window causes huge amounts of disk thrashing.

Something "as simple" is not as simple as it seems.  Like, something as 
simple as displaying lines of text on the screen could take a few 
seconds on early mainframes and PCs...

-- 
a game sig: http://tinyurl.com/d3rxz9


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Context switching
Date: 23 Apr 2010 17:03:31
Message: <4bd20b23$1@news.povray.org>
Jim Henderson wrote:

> On Thu, 22 Apr 2010 09:10:03 +0100, Invisible wrote:
> 
>> (I'm still having trouble thinking up a use-case for that. About the
>> only thing I can think of is trying to find out which header file
>> defines a particular symbol or something.)
> 
> Header file definitions, sure.
> 
> Some of the things I grep for regularly:
> 
> Which file contains contract information for a particular partner?
> 
> Which of the chat log files I have contains a reference to a particular
> website, user ID, password, or discussion?

Which of the lines in this chat log contains a normal message, as opposed to 
information like "Jim has joined #povray" or "Logfile started"?

I piped the result of that grep into 'sed' to extract only the username, 
then sort | uniq -c | sort -n, and I got an ordered list of who talks the 
most in the chatroom :)


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Context switching
Date: 23 Apr 2010 17:08:49
Message: <4bd20c61@news.povray.org>
Invisible wrote:
> 3. It really takes that much code just to do the same task as DIR /B C:\
>  C:\FileList.txt?

Says the guy who would rather write his own program to do specific searches 
than figure out grep :)


Post a reply to this message

From: Nicolas Alvarez
Subject: Re: Context switching
Date: 23 Apr 2010 17:18:08
Message: <4bd20e90@news.povray.org>
Invisible wrote:
> scott wrote:
>> Obviously it's just a simple example so you can see how it works.
> 
> Wikipedia seems to indicate that WSH supports JavaScript. I wonder if I
> can get that to work...

var fso = new ActiveXObject("Scripting.FileSystemObject");
var sFolder = "C:\\tmp";

var newFile = fso.CreateTextFile(sFolder+"\\FileList.txt", true);
var folder = fso.GetFolder(sFolder);
var files = folder.Files;

// yes, enumerating COM collections really is this messy in Javascript
var filesEnum = new Enumerator(files);
for (; !filesEnum.atEnd(); filesEnum.moveNext()) {
  var file = filesEnum.item();
  newFile.WriteLine(file.Name);
}

newFile.Close();
WScript.Echo("Done!");


Post a reply to this message

<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.