Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Alexander Ilin
25.10.2016, 23:49, "Onorio Catenacci" :This issue is that certain tasks require administrator privilege onWindows and it's much more friendly to check the current user'sprivileges and inform the user that he or she needs to elevate toadmin than simply fall over. :)Well, that would mean that the proper solution would be to check not for the Admin group membership, but for access to the specific resources (registry keys, files, etc.) that are required for the operation you are about to perform, am I right? ---=---Александр 

--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Doug Coleman
Take a look at basis/windows/privileges/privileges.factor and
http://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-administrative-rights

On Tue, Oct 25, 2016 at 1:49 PM Onorio Catenacci  wrote:

> This issue is that certain tasks require administrator privilege on
> Windows and it's much more friendly to check the current user's
> privileges and inform the user that he or she needs to elevate to
> admin than simply fall over. :)
>
> Sadly before Windows 7 most users are on their machine as admins by
> default (which is, truly, a large part of the reason that Windows was
> such a fruitful hunting ground for people who liked to spread
> trojans).  A lot of users still have admin privileges by default but a
> few are smart enough to practice least-privilege.
>
> --
> Onorio
>
> On Tue, Oct 25, 2016 at 4:35 PM, Alexander Ilin  wrote:
> >
> > 25.10.2016, 23:13, "Doug Coleman" :
> >
> > You should be able to call the Windows APIs directly (if you can figure
> out
> > which ones!) and avoid using a script to call a binary.
> >
> >
> > That's true. I'm simply having fun with that little task. Parsing the
> output
> > and such.
> > If I needed to solve that problem in a proper way, I would not mess with
> the
> > whoami.exe, I'd look for WinAPI functions.
> > I'm not familiar with those, so can't really help here.
> >
> > I have an issue with the formulation of the task, though. Why do we need
> to
> > know if a user is an admin? Do we strictly want to check the
> Administrators
> > group membership, or do we want to test for some specific access
> privileges?
> > For instance, Power Users used to have some pretty big rights in their
> day,
> > without being full admins.
> > There is also the issue with elevation, which gives a user some rights
> > without making him/her an admin.
> >
> >
> http://stackoverflow.com/questions/581204/how-do-i-check-if-a-user-has-local-admin-privileges-in-win32
> >
> http://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-administrative-rights/8196291#8196291
> > https://support.microsoft.com/en-us/kb/118626
> >
> > ---=---
> > Александр
> >
> >
> >
> --
> > The Command Line: Reinvented for Modern Developers
> > Did the resurgence of CLI tooling catch you by surprise?
> > Reconnect with the command line and become more productive.
> > Learn the new .NET and ASP.NET CLI. Get your free copy!
> > http://sdm.link/telerik
> > ___
> > Factor-talk mailing list
> > Factor-talk@lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/factor-talk
> >
>
>
>
> --
> Onorio Catenacci
>
> http://onor.io
> http://www.google.com/+OnorioCatenacci
>
>
> --
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Onorio Catenacci
This issue is that certain tasks require administrator privilege on
Windows and it's much more friendly to check the current user's
privileges and inform the user that he or she needs to elevate to
admin than simply fall over. :)

Sadly before Windows 7 most users are on their machine as admins by
default (which is, truly, a large part of the reason that Windows was
such a fruitful hunting ground for people who liked to spread
trojans).  A lot of users still have admin privileges by default but a
few are smart enough to practice least-privilege.

--
Onorio

On Tue, Oct 25, 2016 at 4:35 PM, Alexander Ilin  wrote:
>
> 25.10.2016, 23:13, "Doug Coleman" :
>
> You should be able to call the Windows APIs directly (if you can figure out
> which ones!) and avoid using a script to call a binary.
>
>
> That's true. I'm simply having fun with that little task. Parsing the output
> and such.
> If I needed to solve that problem in a proper way, I would not mess with the
> whoami.exe, I'd look for WinAPI functions.
> I'm not familiar with those, so can't really help here.
>
> I have an issue with the formulation of the task, though. Why do we need to
> know if a user is an admin? Do we strictly want to check the Administrators
> group membership, or do we want to test for some specific access privileges?
> For instance, Power Users used to have some pretty big rights in their day,
> without being full admins.
> There is also the issue with elevation, which gives a user some rights
> without making him/her an admin.
>
> http://stackoverflow.com/questions/581204/how-do-i-check-if-a-user-has-local-admin-privileges-in-win32
> http://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-administrative-rights/8196291#8196291
> https://support.microsoft.com/en-us/kb/118626
>
> ---=---
> Александр
>
>
> --
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>



-- 
Onorio Catenacci

http://onor.io
http://www.google.com/+OnorioCatenacci

--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Onorio Catenacci
Thanks Doug--that's sort of what I was hoping for.  Like you my issue
would be figuring out which API's to call.


On Tue, Oct 25, 2016 at 4:13 PM, Doug Coleman  wrote:
> You should be able to call the Windows APIs directly (if you can figure out
> which ones!) and avoid using a script to call a binary.
>
> On Tue, Oct 25, 2016 at 1:02 PM Alexander Ilin  wrote:
>>
>> The same, but a bit more elaborate (and hopefully more readable):
>>
>> USING: documents.private io io.encodings.utf8 io.launcher kernel
>> math sequences sets splitting ;
>> IN: other
>>
>> ! Find the header line in the sequence and return it with its number.
>> : find-header ( lines -- num/f line/f )
>> [ members "= " = ] find ;
>>
>> ! Convert header line to column widths: "=== == =" -> { 3 2 1 }.
>> : column-widths ( line -- seq )
>> [ CHAR: space = ] split-when harvest [ length ] map ;
>>
>> : table-contents ( lines header-line-num -- lines' )
>> 1 + tail harvest ;
>>
>> : first-column ( lines column-widths -- lines' )
>> first [ head [ CHAR: space = ] trim ] curry map ;
>>
>> : user-groups ( -- seq/f )
>> "whoami /groups" utf8 [ contents ] with-process-reader split-lines
>> dup find-header
>> [
>> [ table-contents ] dip column-widths first-column
>> ] [ 2drop f ] if* ;
>>
>> 25.10.2016, 00:51, "Alexander Ilin" :
>>
>> Here's a small utility for you:
>>
>> USING: io.launcher io.encodings.utf8 sequences sets documents.private ;
>> : user-groups ( -- seq/f )
>> "whoami /groups" utf8 [ contents ] with-process-reader split-lines
>> dup [ members "= " = ] find
>> [
>> [ 1 + tail ] dip
>> [ CHAR: space = ] find drop
>> [ harvest ] dip
>> [ head [ CHAR: space = ] trim ] curry map
>> ] [ 2drop f ] if* ;
>>
>>
>> Usage:
>>
>> "Administrators" user-groups in?
>> -> `t`
>>
>> ---=---
>> Александр
>>
>>
>> ,
>>
>>
>> --
>> The Command Line: Reinvented for Modern Developers
>> Did the resurgence of CLI tooling catch you by surprise?
>> Reconnect with the command line and become more productive.
>> Learn the new .NET and ASP.NET CLI. Get your free copy!
>> http://sdm.link/telerik
>>
>> ,
>>
>> ___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>>
>>
>>
>> ---=---
>> Александр
>>
>>
>> --
>> The Command Line: Reinvented for Modern Developers
>> Did the resurgence of CLI tooling catch you by surprise?
>> Reconnect with the command line and become more productive.
>> Learn the new .NET and ASP.NET CLI. Get your free copy!
>> http://sdm.link/telerik___
>> Factor-talk mailing list
>> Factor-talk@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
> --
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>



-- 
Onorio Catenacci

http://onor.io
http://www.google.com/+OnorioCatenacci

--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] restricting ratio literals

2016-10-25 Thread Jon Harper
I would say no prefix at all for ratios, only base 10.
Also do people in the US consider 1+13/2 a number? Or is it really only
written as 7+1/2?

I think the number literals should only express what people consider as
numbers. They should not replace arbitrary mathematical operations (like
your 60/2.5 example) which are folded by the compiler anyway.

What do you think?

Le 25 oct. 2016 02:22, "John Benediktsson"  a écrit :

Those examples do look ugly -- maybe base 10 ratios only is not a bad idea.


But would it support the 0d prefix?  e.g. ``0d1+1/3``?





On Mon, Oct 24, 2016 at 10:23 AM, Jon Harper  wrote:

> Hi list,
> I'm reading the questions at https://github.com/factor/factor/pull/1362
> again
>
> I think we should only allow ratio literals in base 10. Currently we
> support
> 0xc+b/a or 0o4+7/3 or 0b1101+1101/110 but it looks ugly.
>
> What do you think ?
>
> Jon
>
> 
> --
> Check out the vibrant tech community on one of the world's most
> engaging tech sites, SlashDot.org! http://sdm.link/slashdot
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>


--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive.
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk
--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Alexander Ilin
 25.10.2016, 23:13, "Doug Coleman" :You should be able to call the Windows APIs directly (if you can figure out which ones!) and avoid using a script to call a binary. That's true. I'm simply having fun with that little task. Parsing the output and such.If I needed to solve that problem in a proper way, I would not mess with the whoami.exe, I'd look for WinAPI functions.I'm not familiar with those, so can't really help here. I have an issue with the formulation of the task, though. Why do we need to know if a user is an admin? Do we strictly want to check the Administrators group membership, or do we want to test for some specific access privileges? For instance, Power Users used to have some pretty big rights in their day, without being full admins.There is also the issue with elevation, which gives a user some rights without making him/her an admin. http://stackoverflow.com/questions/581204/how-do-i-check-if-a-user-has-local-admin-privileges-in-win32http://stackoverflow.com/questions/8046097/how-to-check-if-a-process-has-the-administrative-rights/8196291#8196291https://support.microsoft.com/en-us/kb/118626 ---=---Александр --
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Doug Coleman
You should be able to call the Windows APIs directly (if you can figure out
which ones!) and avoid using a script to call a binary.

On Tue, Oct 25, 2016 at 1:02 PM Alexander Ilin  wrote:

> The same, but a bit more elaborate (and hopefully more readable):
>
> USING: documents.private io io.encodings.utf8 io.launcher kernel
> math sequences sets splitting ;
> IN: other
>
> ! Find the header line in the sequence and return it with its number.
> : find-header ( lines -- num/f line/f )
> [ members "= " = ] find ;
>
> ! Convert header line to column widths: "=== == =" -> { 3 2 1 }.
> : column-widths ( line -- seq )
> [ CHAR: space = ] split-when harvest [ length ] map ;
>
> : table-contents ( lines header-line-num -- lines' )
> 1 + tail harvest ;
>
> : first-column ( lines column-widths -- lines' )
> first [ head [ CHAR: space = ] trim ] curry map ;
>
> : user-groups ( -- seq/f )
> "whoami /groups" utf8 [ contents ] with-process-reader split-lines
> dup find-header
> [
> [ table-contents ] dip column-widths first-column
> ] [ 2drop f ] if* ;
>
> 25.10.2016, 00:51, "Alexander Ilin" :
>
> Here's a small utility for you:
>
> USING: io.launcher io.encodings.utf8 sequences sets documents.private ;
> : user-groups ( -- seq/f )
> "whoami /groups" utf8 [ contents ] with-process-reader split-lines
> dup [ members "= " = ] find
> [
> [ 1 + tail ] dip
> [ CHAR: space = ] find drop
> [ harvest ] dip
> [ head [ CHAR: space = ] trim ] curry map
> ] [ 2drop f ] if* ;
>
>
> Usage:
>
> "Administrators" user-groups in?
> -> `t`
>
> ---=---
> Александр
>
>
> ,
>
>
> --
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik
>
> ,
>
> ___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
>
> ---=---
> Александр
>
>
> --
> The Command Line: Reinvented for Modern Developers
> Did the resurgence of CLI tooling catch you by surprise?
> Reconnect with the command line and become more productive.
> Learn the new .NET and ASP.NET CLI. Get your free copy!
> http://sdm.link/telerik___
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
--
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Factor As Scripting Language

2016-10-25 Thread Alexander Ilin
The same, but a bit more elaborate (and hopefully more readable): USING: documents.private io io.encodings.utf8 io.launcher kernelmath sequences sets splitting ;IN: other ! Find the header line in the sequence and return it with its number.: find-header ( lines -- num/f line/f )    [ members "= " = ] find ; ! Convert header line to column widths: "=== == =" -> { 3 2 1 }.: column-widths ( line -- seq )    [ CHAR: space = ] split-when harvest [ length ] map ; : table-contents ( lines header-line-num -- lines' )    1 + tail harvest ; : first-column ( lines column-widths -- lines' )    first [ head [ CHAR: space = ] trim ] curry map ; : user-groups ( -- seq/f )    "whoami /groups" utf8 [ contents ] with-process-reader split-lines    dup find-header    [    [ table-contents ] dip column-widths first-column    ] [ 2drop f ] if* ; 25.10.2016, 00:51, "Alexander Ilin" :Here's a small utility for you: USING: io.launcher io.encodings.utf8 sequences sets documents.private ;: user-groups ( -- seq/f )    "whoami /groups" utf8 [ contents ] with-process-reader split-lines    dup [ members "= " = ] find    [    [ 1 + tail ] dip    [ CHAR: space = ] find drop    [ harvest ] dip    [ head [ CHAR: space = ] trim ] curry map    ] [ 2drop f ] if* ; Usage: "Administrators" user-groups in?-> `t` ---=---Александр ,--The Command Line: Reinvented for Modern DevelopersDid the resurgence of CLI tooling catch you by surprise?Reconnect with the command line and become more productive.Learn the new .NET and ASP.NET CLI. Get your free copy!http://sdm.link/telerik,___Factor-talk mailing listFactor-talk@lists.sourceforge.nethttps://lists.sourceforge.net/lists/listinfo/factor-talk  ---=---Александр --
The Command Line: Reinvented for Modern Developers
Did the resurgence of CLI tooling catch you by surprise?
Reconnect with the command line and become more productive. 
Learn the new .NET and ASP.NET CLI. Get your free copy!
http://sdm.link/telerik___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk