alias

How to make Git “add --all” by default?

霸气de小男生 提交于 2019-12-03 16:29:59
问题 I just ran into this message: $ git add . warning: You ran 'git add' with neither '-A (--all)' or '--ignore-removal', whose behaviour will change in Git 2.0 with respect to paths you removed. Paths like 'README.md' that are removed from your working tree are ignored with this version of Git. * 'git add --ignore-removal <pathspec>', which is the current default, ignores paths you removed from your working tree. * 'git add --all <pathspec>' will let you also record the removals. Run 'git status

What is “template<class T> using owner = T;”?

北城以北 提交于 2019-12-03 16:22:21
Below is excerpted from gsl.h of Microsoft's gsl library ( https://github.com/microsoft/gsl ): namespace gsl { // // GSL.owner: ownership pointers // using std::unique_ptr; using std::shared_ptr; template<class T> using owner = T; ... }; I cannot understand what the following alias template means: template<class T> using owner = T; Any explanations? It means that for every T , owner<T> is an alias for T . It can be used as annotation to show which pointers are 'owner' ie: Example of non owning raw pointer template<typename T> class X2 { // ... public: owner<T*> p; // OK: p is owning T* q; //

SQL Alias of joined tables

断了今生、忘了曾经 提交于 2019-12-03 15:09:35
I have a query like this: select a1.name, b1.info from (select name, id, status from table1 a) as a1 right outer join (select id, info from table2 b) as b1 on (a1.id = b1.id) I only want to include everything where a1.status=1 and since I'm using an outer join, I can't just add a where constraint to table1, because all info from table2 that I want to be excluded will still be there, just without the name. I was thinking something like this: select z1.name, z1.info from ((select name, id, status from table1 a) as a1 right outer join (select id, info from table2 b) as b1 on (a1.id = b1.id)) as

Is it possible to alias an enum-class enumerator?

萝らか妹 提交于 2019-12-03 14:53:05
问题 Given a C++11 enum class, nested inside several long- and ugly-named namespaces: namespace long_and_ugly { enum class colour { red, green, blue }; } Can aliases be made of the enumeration values? With clang++ 3.5, it is possible to do what follows: using long_and_ugly::colour; // take all the values into the current namespace using long_and_ugly::colour::red; // take only 'red' into the current namespace function_taking_colour_argument( red ); // instead of fully referring to the value g++ 4

Prevent bash alias from evaluating statement at shell start

亡梦爱人 提交于 2019-12-03 14:37:24
问题 Say I have the following alias. alias pwd_alias='echo `pwd`' This alias is not "dynamic". It evaluates pwd as soon as the shell starts. Is there anyway to delay the evaluation of the expression in the ticks until the alias's runtime? 回答1: What you really want is a function, instead of an alias. pwd_alias() { echo "$PWD" } Aliases do nothing more than replace text. Anything with complexity calls for a function. 回答2: As jordanm said, aliases do nothing more than replace text. If you want the

Namespace scoped aliases for generic types in C#

空扰寡人 提交于 2019-12-03 13:47:11
Let's have a following example: public class X { } public class Y { } public class Z { } public delegate IDictionary<Y, IList<Z>> Bar(IList<X> x, int i); public interface IFoo { // ... Bar Bar { get; } } public class Foo : IFoo { // ... public Bar Bar { get { return null; //... } } } void Main() { IFoo foo; //= ... IEnumerable<IList<X>> source; //= ... var results = source.Select(foo.Bar); // <- compile error here } The compiler says: The type arguments for method 'System.Linq.Enumerable.Select(System.Collections.Generic.IEnumerable, System.Func)' cannot be inferred from the usage. Try

Does AngularJS have a syntax to alias a property within a div?

强颜欢笑 提交于 2019-12-03 13:29:19
问题 This is kind of a weird question, but here's the idea: Let's say I have a complex JSON object coming back from an HTTP call and attaching to the $scope . Something like this: $scope.obj = { user: { id: 10, name: { first: 'Joe', last: 'Smith' }, contact: { home: { street: '101 First St.', city: 'Myville', state: 'Jokelahoma', zip: '98765' }, email: 'joeshmoe@gmail.com', phone: '+12345678901' } }, purchase_hist: [ { item_id: 11004, date: 'Thu, 06 Aug 2015 13:51:17 GMT' }, { item_id: 97020, date

My Bash aliases don't work

被刻印的时光 ゝ 提交于 2019-12-03 13:17:11
I'm not sure why but my Bash aliases don't seem to work. Here is my .bashrc file # v 0.0.1 - 7/03/12 [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function* PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting # expanding history to 10000 commands export HISTSIZE=10000 # don't store repeated commands more than once export HISCONTROL=ignoredups # where to look for Java export JAVA_HOME=/Library/Java/Home # tomcat server configuration export CATALINA_HOME=/usr/local/apache-tomcat-6.0.35 # default editor export EDITOR=vim if [ -f ~

How does one - without inheritance - override a class method and call the original from within the new method?

◇◆丶佛笑我妖孽 提交于 2019-12-03 12:40:52
问题 I found one source which successfully overrode Time.strftime like this: class Time alias :old_strftime :strftime def strftime #do something old_strftime end end The trouble is, strftime is an instance method. I need to override Time.now - a class method - in such away that any caller gets my new method, while the new method still calls the original .now method. I've looked at alias_method and have met with no success. 回答1: This is kinda hard to get your head around sometimes, but you need to

Why is this Bash function within a git alias executing twice, and why does adding `exit` fix it?

醉酒当歌 提交于 2019-12-03 12:31:26
If I fail to explicitly call exit for certain function-based Bash scripts then there are additional unexpected executions for some functions. What is causing this? The behavior was first noticed while making a git alias as part of answering another user's question on StackOverflow . That alias was composed of this script ( which runs the function twice instead of once ): #!/usr/bin/env bash github(){ echo github; }; twitter(){ echo twitter; }; facebook(){ echo facebook; }; if [[ $(type -t "$1") == "function" ]]; then "$1"; else echo "There is no defined function for $1"; fi; But this slightly