Questions tagged [alias]

An alias is an alternative name. In computer science, the most common contexts are command aliases in shells, column aliases in databases, or variable references in languages like C++.

For bash aliases use the tag.

4406 questions
52
votes
6 answers

Using Statement with Generics: using ISet<> = System.Collections.Generic.ISet<>

Since I am using two different generic collection namespaces (System.Collections.Generic and Iesi.Collections.Generic), I have conflicts. In other parts of the project, I am using both the nunit and mstest framework, but qualify that when I call…
Jason More
  • 6,983
  • 6
  • 43
  • 52
51
votes
5 answers

Class alias in Ruby

I am developing a new Rails app based on a similar existing one. In my old app, I have Coupon class, which is very similar to Ticket in my new app. I want to reuse all code in Coupon, but with a new class name. Since refactoring is cumbersome in…
AdamNYC
  • 19,887
  • 29
  • 98
  • 154
48
votes
4 answers

C++ namespace alias in entire class scope

I expected to be able to use a namespace alias in a class declaration but get a compiler syntax error. struct MyClass { namespace abc = a_big_namespace; void fn() { abc::test(); } }; The only way I can get it to work is to put…
Ant
  • 1,668
  • 2
  • 18
  • 35
47
votes
8 answers

How can I define a bash alias as a sequence of multiple commands?

I know how to configure aliases in bash, but is there a way to configure an alias for a sequence of commands? I.e say I want one command to change to a particular directory, then run another command. In addition, is there a way to setup a command…
stormist
  • 5,709
  • 12
  • 46
  • 65
46
votes
6 answers

How to use aliases defined in .bashrc in other scripts?

In ~/.bashrc, I defined some aliases. But I cannot use them in other shell scripts, where I can only use aliases defined right there. Even though I sourced bashrc, it still did not work. What should I do? PS. I'm in bash.
Dutor
  • 483
  • 1
  • 4
  • 7
46
votes
17 answers

SQL Table Aliases - Good or Bad?

What are the pros and cons of using table aliases in SQL? I personally try to avoid them, as I think they make the code less readable (especially when reading through large where/and statements), but I'd be interested in hearing any counter-points…
tbreffni
  • 5,082
  • 5
  • 31
  • 30
45
votes
6 answers

Open files in existing Gvim in multiple (new) tabs

I have put some aliases in my .bashrc to open a group of project files in gvim, each in their own tab: gvim -p This is all well and good, except there are several groups of files I might want to move…
kajaco
  • 2,547
  • 3
  • 24
  • 33
44
votes
6 answers

How do I create an alias where the arguments go in the middle?

I'm trying to define an alias where the arguments are inserted in the middle, instead of appended to the end. I tried defining it like this: alias grep_logs="grep $1 */log/*.log" where $1 is the first argument to grep_logs, such that: grep_logs…
sferik
  • 1,795
  • 2
  • 15
  • 22
42
votes
3 answers

In C#, why is "int" an alias for System.Int32?

Since C# supports Int8, Int16, Int32 and Int64, why did the designers of the language choose to define int as an alias for Int32 instead of allowing it to vary depending on what the native architecture considers to be a word? I have not had any…
Mike Nakis
  • 56,297
  • 11
  • 110
  • 142
42
votes
4 answers

python sqlalchemy label usage

I know I can use the label method for alias, but I can't figure out how to use the labeled element later in the query - something like the following: session.query(Foo.bar.label("foobar")).filter(foobar > 10).all() Of course, this doesn't work…
Ofir
  • 1,565
  • 3
  • 23
  • 41
41
votes
2 answers

Table Variables with an Alias in a Delete From Statement

I want to delete rows from a SQL Server 2000/2005 table variable based on the presence of other rows in the same table (delete all 0 count rows if a non-0 count row exists with the same date). Here is a simplified example that should only delete…
Anagoge
  • 933
  • 1
  • 14
  • 23
41
votes
3 answers

Joining 2 SQL SELECT result sets into one

I've got 2 select statements, returning data like this: Select 1 col_a col_b Select 2 col_a col_c If I do union, I get something like col_a col_b And rows joined. What i need is getting it like this: col_a col_b col_c Joined on data in…
Vance
  • 413
  • 1
  • 4
  • 4
40
votes
5 answers

MySQL alias for SELECT * columns

I'm creating a view that is using data that comes from the same table twice. As a result, same column names appear twice. Thus, i need to give aliases to these columns. If i were to do it, i'd write it as: SELECT u.* as 'one_*', u2.* as 'two_*' FROM…
aaaaaa
  • 2,588
  • 3
  • 26
  • 31
37
votes
7 answers

How to create an alias of database in SQL Server

We have a very old software has been created around 10 years ago and we don't have source code. The software uses two databases, DB01 and DB02 on the same SQL Server 2012 instance. There is SQL statements such as db01..table1 join db02..table2, but…
Dmitriy Sosunov
  • 1,075
  • 3
  • 10
  • 25
36
votes
4 answers

Define git alias with the same name to shadow original command

I'm trying to use to use the same name for an alias as the existing command, so that the alias shadows the original command (preventing me from deleting files off the working tree). [alias] rm = rm --cached diff = diff --color Unfortunatly…
M.Hebot
  • 363
  • 3
  • 7