alias

Why does variable expansion within an alias work “as intended” in only one of these cases?

我的梦境 提交于 2019-12-23 10:07:19
问题 This question was inspired in part by this one. alias foo='ls -1 $1' foo /etc displays the contents of /etc, one item per line. ls -1 /etc | tail displays the last ten items in /etc. But alias foo='ls -1 $1 | tail' foo /etc displays: tail: error reading `/etc': Is a directory 回答1: I have found variable expansion in aliases to be flaky, and not recommended: http://www.gnu.org/software/bash/manual/bashref.html#Aliases Use a function instead: function foo() { ls -1 $1; } 回答2: Aliases done this

Giving a function implementation more than one name in c++

↘锁芯ラ 提交于 2019-12-23 09:58:46
问题 Let say I have a basic 2D vector class something like class vector2 { int x, y; } these two values could be used to represent a position as well as a width and height. does C++ provide a away for me to impliment a function such as vector2::getXpos() and then also define vector2::getWidth() and have it use the same implementation. I know that I could just make both of these function inline, but the compiler might decide to not inline these functions. so if getWidth just called getXpos you

Understanding Oracle aliasing - why isn't an alias not recognized in a query unless wrapped in a second query?

こ雲淡風輕ζ 提交于 2019-12-23 08:50:47
问题 I have a query SELECT COUNT(*) AS "CNT", imei FROM devices which executes just fine. I want to further restrict the query with a WHERE statement. The (humanly) logical next step is to modify the query followingly: SELECT COUNT(*) AS "CNT", imei FROM devices WHERE CNT > 1 However, this results in a error message ORA-00904: "CNT": invalid identifier . For some reason, wrapping the query in another query produces the desired result: SELECT * FROM (SELECT COUNT(*) AS "CNT", imei FROM devices

Python os.path is ntpath, how?

那年仲夏 提交于 2019-12-23 08:03:10
问题 Can someone tell me how Python "aliases" os.path to ntpath ? >>> import os.path >>> os.path <module 'ntpath' from 'C:\Python26\lib\ntpath.pyc'> >>> 回答1: Look at os.py, lines 55-67: elif 'nt' in _names: name = 'nt' linesep = '\r\n' from nt import * try: from nt import _exit except ImportError: pass import ntpath as path import nt __all__.extend(_get_exports_list(nt)) del nt The import ntpath as path is the specific statement that causes os.path to be ntpath on your platforms (doubtlessly

Spaces in Cygwin/bash aliases?

一曲冷凌霜 提交于 2019-12-23 07:31:20
问题 I am attempting to set up aliases for my Cygwin bash shells, to run programs contained in the standard Windows C:\Program Files subdirectories. Unfortunately, the alias command really doesn't like spaces in a directory name, and nothing I've tried seems to work. I'm trying to get the following running: alias npp='/cygdrive/c/Program Files/Notepad++/notepad++.exe' I am currently cheating and using a soft link, but I would prefer to use an alias. 回答1: Escape Characters: alias npp="/cygdrive/c

How to create grep alias with arguments

爷,独闯天下 提交于 2019-12-23 05:22:20
问题 Lets say i have this search term: grep -i -r --include=*.xib "img_28301.png" ./ how would i go about creating an alias that allows me to do this: xibsearch img_28301.png and do the same thing? 回答1: It will be much cleaner to have a function for this: xibsearch() { grep -i -r --include=*.xib "$1" ./ } As alias doesn't support positional parameters. 回答2: As @anubhava points out, functions are generally the way to go here. However, in this case, if you really must use an alias, you can rearrange

Why does my oracle statement run differently on a windows database than linux?

核能气质少年 提交于 2019-12-23 03:12:31
问题 I don't know where to begin to debug this. Some developers have been writing some pl/sql code locally on their Windows machines that complete fine using Oracle 10.2.0.1.0 - 64bit. When it gets to production, which is Red Hat 5.3 and running 10.2.0.2.0, it gives me this error: ORA-00904: "S"."BARSTREAMREFERENCEID": invalid identifier Here is the gist of the code that is working in Windows: EXECUTE IMMEDIATE(' update candyman.CANDY_REFERENCES s set ( s.flavour, s.taste, s.colour, s

SQLite table aliases effecting the performance of queries

£可爱£侵袭症+ 提交于 2019-12-22 17:52:48
问题 How does SQLite internally treats the alias? Does creating a table name alias internally creates a copy of the same table or does it just refers to the same table without creating a copy? When I create multiple aliases of the same table in my code, performance of the query is severely hit! In my case, I have one table, call it MainTable with namely 2 columns, name and value. I want to select multiple values in one row as different columns. for example Name: a,b,c,d,e,f Value: p,q,r,s,t,u such

Is there a way to add Alias to Powershell Cmdlet programmatically?

匆匆过客 提交于 2019-12-22 09:18:15
问题 I am writing custom Powershell cmdlets for my application and I need to provide Aliases to some cmdlets. So lets say I have cmdlet Get-DirectoryListing and I want to add Alias (say 'gdl') to this cmdlet. How can I do this? The AliasAttribute doesn't work here, since it works only with Properties, Indexers or Field declarations. Also I know we can use Set-Alias command, but don't know where to put it. Is it possible to programmatically add multiple aliases to a cmdlet? 回答1: You need to create

Rename class members by inheriting class in C++

元气小坏坏 提交于 2019-12-22 05:19:22
问题 I would like to "rename" some members of my class ofVec4f . I know it's impossible in strict C++ but could I create a new class that inherits from my class and declare new members which are aliases or pointers to the original members? I tried the following: class ofVec4fGraph : public ofVec4f { public : float& minX; float& maxX; float& minY; float& maxY; ofVec4fGraph(float _minX,float _maxX, float _minY, float _maxY ) : minX(_minX), maxX(_maxX), minY(_minY), maxY(_maxY) { ofVec4f(_minX, _maxX