vendredi 11 septembre 2015

Bash readline history previous line before history expansion

There are usually the keys Up and Ctrl+P mapped to previous-history Readline command in Bash which moves back in history to previous line with history expanded.

How to move to the previous line before History expansion? E.g. to line like

!!:gs/20010910/20010911/



via Chebli Mohamed

Should I use sync or blocking channels?

I have several go routines and I use unbuffered channels as sync mechanism. I'm wondering if there is anything wrong in this(e.g. compared with a WaitGroup implementation). A known "drawback" that I'm aware of is that two go routines may stay blocked until the 3rd(last) one completes because the channel is no buffered but I don't know the internals/what this really means.

func main() {
    chan1, chan2, chan3 := make(chan bool), make(chan bool), make(chan bool)
    go fn(chan1)
    go fn(chan2)
    go fn(chan3)
    res1, res2, res3 := <-chan1, <-chan2, <-chan3
}



via Chebli Mohamed

Polymer 1.0: google-signin sign in still success when user revoke permissions

I am using a google-signin element to have access to user's access scopes. I found, if I as a user authorize the my app with certain scopes, then revoke those scopes without clicking on "Sign out" button (basically the google-signin element), the google-sign is result as onSigninSuccess event even without the authorization.

This is weird. It should be onSigninFailure because the app doesn't have the corresponding scopes of authorizations from the user.



via Chebli Mohamed

Difference between \z and \Z and \a and \A in Perl

Hello Can you please tell me the difference between \z and \Z as well as \a and \A in Perl with a simple example ?



via Chebli Mohamed

Boost Geometry doesn't copy the attributes of my custom point class

I am attempting to use Boost Geometry with a custom vertex class that has x,y and many parameters for rendering such as texture coordinates. I registered the custom class using BOOST_GEOMETRY_REGISTER_POINT_2D and the algorithms such as union_ work but only x,y are valid. (I am a C++ veteran but have never learned generic programming.) I can demonstrate the problem when I take an instance of my vertex and use boost::geometry::append( boostPolygon, myVertex );

I can trace the append call in the debugger and I see that a default constructed instance of my vertex is being created and then the accessors of my vertex class are being called to copy the x, and y values leaving all the rest of the parameters as set in the default constructor.

What I really want is for boost::geometry::append() to behave exactly like boostPolygon.outer().push_back( myVertex); So I replaced the append call with the above push_back and it added the points to the polygon as I wanted but then when I called union_() on the polygons they lost all the members other than x and y again.

I figure that what I want is a typical use-case so it is best to ask rather than guess how to handle this. I've seen the examples of how to adapt a class but my template kung-fu isn't enough to follow along. So do I need to add more adaption or is there something simple I need to do?

Scott



via Chebli Mohamed

Background of user control hide the controls inside of him

http://ift.tt/1NmaMtn

I Have user control i set him background, but the problem is that the background hide the controls inside of him



via Chebli Mohamed

EasyMock record phase mock as argument

Is it possibile with EasyMock during the register phase to register a method call whose arguments is a mock? E.g:

String s = 'a string';

ClassA a = createMock(ClassA.class);
ClassB b = createMock(ClassB.class);
ClassC c = createMock(ClassC.class);

expect(c.bFactoryMethod()).andReturn(b);
a.someMethod(s, b);
replayAll();

ClassToTest toTest = new ClassToTest();
toTest.wrapperMethodThatCallsSomeMethod(s);
verifyAll();

EasyMock complains about:

java.lang.IllegalStateException: missing behavior definition for the preceding method call



via Chebli Mohamed