POV-Ray : Newsgroups : povray.off-topic : Context switching Server Time
5 Sep 2024 23:12:35 EDT (-0400)
  Context switching (Message 191 to 200 of 222)  
<<< Previous 10 Messages Goto Latest 10 Messages Next 10 Messages >>>
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

From: Jim Henderson
Subject: Re: Context switching
Date: 23 Apr 2010 17:25:46
Message: <4bd2105a$1@news.povray.org>
On Fri, 23 Apr 2010 18:03:30 -0300, Nicolas Alvarez wrote:

> 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 :)

Yep, that would work too. :-)

Jim


Post a reply to this message

From: Darren New
Subject: Re: Context switching
Date: 23 Apr 2010 19:30:38
Message: <4bd22d9e@news.povray.org>
Nicolas Alvarez wrote:
> 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.

There's no option included in the software as it comes from the manufacturer 
to make it work differently, no.

> It's not 
> the default UI, it's the *only* UI. 

"Default" means "unless you do something." :-)

-- 
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: Warp
Subject: Re: Context switching
Date: 24 Apr 2010 01:48:36
Message: <4bd28634@news.povray.org>
Nicolas Alvarez <nic### [at] gmailcom> wrote:
> >     fgrep '#include "header.hh"' *.cc

> There could be more spaces.

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

  Well, since it's not possible to have two #-commands in the same line,
and having anything else between the #include and the file name is unlikely,
you could just as well do it line:

    grep '#include.*"header.hh"' *.cc

-- 
                                                          - Warp


Post a reply to this message

From: Stephen
Subject: Re: Context switching
Date: 24 Apr 2010 01:55:05
Message: <4bd287b9@news.povray.org>
On 23/04/2010 6:47 PM, Jim Henderson wrote:
> On Fri, 23 Apr 2010 06:26:24 +0100, Stephen wrote:
>
>>> Not so much, though, I prefer the darkness generally. ;-)
>>>
>>>
>> Have you checked your reflection in a mirror, lately?
>
> It's too dark for mirrors. ;-)
>
> Jim

LOL

-- 

Best Regards,
	Stephen


Post a reply to this message

From: Orchid XP v8
Subject: Re: Context switching
Date: 24 Apr 2010 04:04:36
Message: <4bd2a614$1@news.povray.org>
Nicolas Alvarez wrote:

> 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 :)

Isn't trying to figure out why an arbitrary piece of code doesn't work 
formally equivilent to the Halting Problem? (With non-termination simply 
being the most basic kind of program bug...)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v8
Subject: Re: Context switching
Date: 24 Apr 2010 04:07:26
Message: <4bd2a6be$1@news.povray.org>
>> What's CreateObject?
> 
> It looks up names in the registry and translates them to 20-digit GUIDs.

See, you definitely know far more about COM than I do. I wasn't even 
aware that there *are* names associated with GUIDs...

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Orchid XP v8
Subject: Re: Context switching
Date: 24 Apr 2010 04:10:03
Message: <4bd2a75b$1@news.povray.org>
Nicolas Alvarez wrote:
> 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 :)

Or rather, I'd rather write my own program than use grep for a *complex* 
search. (E.g., find anything that's a valid XML fragment.)

-- 
http://blog.orphi.me.uk/
http://www.zazzle.com/MathematicalOrchid*


Post a reply to this message

From: Warp
Subject: Re: Context switching
Date: 24 Apr 2010 04:36:44
Message: <4bd2ad9c@news.povray.org>
Orchid XP v8 <voi### [at] devnull> wrote:
> Or rather, I'd rather write my own program than use grep for a *complex* 
> search. (E.g., find anything that's a valid XML fragment.)

  Don't start making unfair comparisons. 'grep' (as well as other similar
tools such as 'sed') is a line-based tool. It can match individual *lines*
of the input. It cannot be used to perform operations which would require
interpreting several lines (unless it has some non-standard extensions).

  Recognizing a valid XML fragment would require interpreting several lines
of the input (if you want to be able to match all possible cases), and hence
'grep' cannot be used for that.

  'grep' is most useful for finding things you know are all in one line,
and for filtering files with a known format (such as httpd logs).

  If you need more complicated things like that, then often 'awk' or 'perl'
can be used (still usually with shorter commands and faster than writing
your own program would). For example 'perl' can be used for the same things
as 'grep' and 'sed', but it has a vastly expanded set of match patterns and
other instructions.

-- 
                                                          - Warp


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.