Re: [9fans] Proof of concept inertial scrolling on macOS with devdraw/acme

2017-02-27 Thread Sevki Hasirci
Really cool.
On Sun, 26 Feb 2017 at 17:58, marius a. eriksen  wrote:

> It’s surprisingly pleasant to use (with a Mac laptop, a Magic Trackpad or
> aMagic Mouse)
>
> Demo here: https://www.youtube.com/watch?v=1XJFJ4coS48=youtu.be
>
> commit d782c880d4ca30fcacddfbab298dad82fe8277c3
> Author: marius a. eriksen 
> Date:   Sat Feb 25 21:48:50 2017 -0800
>
> devdraw/acme: support for inertial scrolling on macOS.
>
> diff --git a/src/cmd/acme/acme.c b/src/cmd/acme/acme.c
> index b471a29..d84322f 100644
> --- a/src/cmd/acme/acme.c
> +++ b/src/cmd/acme/acme.c
> @@ -614,6 +614,14 @@ mousethread(void *v)
>   }
>   /* scroll buttons, wheels, etc. */
>   if(w != nil && (m.buttons & (8|16))){
> + if((m.buttons >> 2) != 0){
> + winlock(w, 'M');
> + t->eq0 = ~0;
> + xtextscroll(t, m.buttons>>2);
> + winunlock(w);
> + goto Continue;
> + }
> +
>   if(m.buttons & 8)
>   but = Kscrolloneup;
>   else
> diff --git a/src/cmd/acme/text.c b/src/cmd/acme/text.c
> index 7634d92..72b29c2 100644
> --- a/src/cmd/acme/text.c
> +++ b/src/cmd/acme/text.c
> @@ -653,6 +653,35 @@ textcomplete(Text *t)
>   return rp;
>  }
>
> +void
> +xtextscroll(Text *t, int n)
> +{
> + uint q0;
> +
> +
> + if(n == 0)
> + return;
> +
> + if(t->what == Tag){
> + if(n<0)
> + texttype(t, Kscrolloneup);
> + else
> + texttype(t, Kscrollonedown);
> + return;
> + }
> +
> + fprint(2, "n=%d\n", n);
> +
> + if(n < 0){
> + n = -n;
> + q0 = t->org+frcharofpt(>fr, Pt(t->fr.r.min.x,
> t->fr.r.min.y+n*t->fr.font->height));
> + textsetorigin(t, q0, TRUE);
> + }else{
> + q0 = textbacknl(t, t->org, n);
> + textsetorigin(t, q0, TRUE);
> + }
> +}
> +
>  void
>  texttype(Text *t, Rune r)
>  {
> diff --git a/src/cmd/devdraw/cocoa-screen.m
> b/src/cmd/devdraw/cocoa-screen.m
> index 100cdd5..b83a3ff 100644
> --- a/src/cmd/devdraw/cocoa-screen.m
> +++ b/src/cmd/devdraw/cocoa-screen.m
> @@ -1044,7 +1044,8 @@ static void
>  getmouse(NSEvent *e)
>  {
>   float d;
> - int b, m;
> + int b, m, i;
> + static int accum;
>
>   if([WIN isKeyWindow] == 0)
>   return;
> @@ -1080,11 +1081,22 @@ getmouse(NSEvent *e)
>  #else
>   d = [e deltaY];
>  #endif
> +
> +
> +// fprint(2, "delta: %d\n", (short)d);
> +
> + //fprint(2, "d: %f %d\n", d, [e hasPreciseScrollingDeltas]);
> +
> + if((short)d==0)
> + return;
> +
>   if(d>0)
>   in.mscroll = 8;
>   else
>   if(d<0)
>   in.mscroll = 16;
> +
> + in.mscroll |= ((short)d)<<1;
>   break;
>
>   case NSMouseMoved:
>
> --
-s


Re: [9fans] Job interview questions

2016-11-11 Thread Sevki Hasirci
brilliant.

On Fri, Nov 11, 2016 at 11:16 AM Sergey Zhilkin  wrote:

> Well done !
>
> 2016-11-10 10:08 GMT+03:00 James A. Robinson :
>
> Priceless, thank you for making me laugh! :)
>
> On Wed, Nov 9, 2016 at 23:01 Kurt H Maier  wrote:
>
> On Thu, Nov 10, 2016 at 07:03:24PM +1300, Andrew Simmons wrote:
> > I’ve just been asked to respond to the following. Apart from number 8,
> where the answer is clearly “because they are clinically insane”, I am at a
> loss. Any hints from the group?
> >
>
> Happy to help.
>
> > 1)   What is the base object in .Net
>
> Despair.
>
> > 2)   Which version of Asp.Net MVC have you used
>
> The wrong one.
>
> > 3)   Explain MVC in general
>
> The 'model' is your database connection.  This never works.  The 'view'
> is what displays error messages to the user.  The 'controller' is what
> allows the user to send injection attacks to your datastore.
>
> > 4)   Which version of the .Net are you most familiar with
>
> 3.5, unless your organization has money, in which case 4.5 and above.
>
> > 5)   Explain why you would use an outer join vs an inner join
>
> An outer join is used when you don't clearly understand your search
> algorithm.  An inner join is used when you got your data structures
> wrong.
>
> > 6)   Can you explain the request Flow in Asp.Net MVC
>
> Sure!  It goes like this:  request-> collection -> base -> handlergetter
> -> handler -> controllerfactory -> controller -> actionrunner -> filter
> -> action -> result -> exception -> 500 error.
>
> > 7)   Explain Dependency Injection
>
> This is what we call passing arguments.
>
> > 8)   Why would a developer choose to use EF
>
> So that we don't have to know how to look up the arguments we want to
> pass.
>
> > 9)   What is the difference between Javascript and jQuery
>
> Nothing.  There is no such thing as javascript; it is an archaic term
> for jquery, which is now known as react.
>
> > 10) What are extensions methods
>
> These used to be called 'functions' but that term has been deprecated
> both because procedural programming is for squares and those functional
> programming kids keep overloading terminology.
>
> > 11) What source control systems have you used
>
> Is this a trick question?  Or are you considering 'github' and 'git' to
> be different things?  I don't understand what you are asking.
>
> > 12) Have you gathered systems requirements from clients? If so,
> please give some details
>
> Clients are the wrong place to gather systems requirements.  Attempting
> to interact with clients for any amount of time quickly leads to
> injection dependency.  The proper place to gather systems requirements
> is the project budget comptroller (to determine scale) and the executive
> vice president of sales (to determine scope).
>
> Fingers crossed for the followup interview!
>
> khm
>
>
>
>
> --
> С наилучшими пожеланиями
> Жилкин Сергей
> With best regards
> Zhilkin Sergey
>
-- 
-s