在问这个问题之前,我在这里,这里,这里,这里和这里检查过.我想我的搜索能力很弱.
我使用的是WampServer版本2.2e.我有需要,我需要一个虚拟主机内的虚拟路径.让我说一下我拥有的两位主持人.
NameVirtualHost *:80
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/Wamp/www"
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
<VirtualHost *:80>
ServerName apps.ptrl
DocumentRoot "C:/Wamp/vhosts/ptrl/apps"
ErrorLog "logs/apps-ptrl-error.log"
CustomLog "logs/apps-ptrl-access.log" common
<Directory "C:/Wamp/vhosts/ptrl/apps">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.htm index.php
</VirtualHost>
Run Code Online (Sandbox Code Playgroud)
<VirtualHost *:80>
ServerName blog.praveen-kumar.ptrl
DocumentRoot "C:/Wamp/vhosts/ptrl/praveen-kumar/blog"
ErrorLog "logs/praveen-kumar-ptrl-error.log"
CustomLog "logs/praveen-kumar-ptrl-access.log" common
<Directory "C:/Wamp/vhosts/ptrl/praveen-kumar/blog">
allow from all
order allow,deny
AllowOverride All
</Directory>
DirectoryIndex index.html index.htm index.php
</VirtualHost> …Run Code Online (Sandbox Code Playgroud) 我知道我可以使用label方法作为别名,但我无法弄清楚如何在查询中使用带标签的元素 - 如下所示:
session.query(Foo.bar.label("foobar")).filter(foobar > 10).all()
Run Code Online (Sandbox Code Playgroud)
当然,这不起作用,因为没有名为foobar的变量.怎么可以实现呢?
(过于简化的例子只是为了便于理解...)
在测试我的php脚本是否与php-8兼容时,我遇到了以下代码:
function getDir($a, $o = 2) {
$d = Floor($a / $o);
return ($d % 2 === 0);
}
Run Code Online (Sandbox Code Playgroud)
在php-8之前,这工作正常,但是,在php-8 上它抛出:
致命错误:无法重新声明 getDir()
经过一段时间的搜索,我发现php-8引入了一个新的别名dir():
/** @param resource $context */
function getdir(string $directory, $context = null): Directory|false {}
Run Code Online (Sandbox Code Playgroud)
dir() 没有提到别名我不明白为什么ts-node在启用 esm 时无法解析别名
我做了一个小项目试图尽可能地隔离问题
package.json
{
"type": "module"
}
Run Code Online (Sandbox Code Playgroud)
tsconfig.json
{
"compilerOptions": {
"module": "es2020",
"baseUrl": "./",
"paths": {
"$lib/*": [
"src/lib/*"
]
},
},
"ts-node": {
"esm": true
}
}
Run Code Online (Sandbox Code Playgroud)
test.ts
import { testFn } from "$lib/module"
testFn()
Run Code Online (Sandbox Code Playgroud)
lib/module.ts
export function testFn () {
console.log("Test function")
}
Run Code Online (Sandbox Code Playgroud)
命令
import { testFn } from "$lib/module"
testFn()
Run Code Online (Sandbox Code Playgroud)
我是一个快乐的BASH用户.我不想切换到另一个shell(在这种情况下是ZSH).
ZSH具有更改目录的能力,无需键入:
cd /to/a/directory
Run Code Online (Sandbox Code Playgroud)
在不必键入的情况下更改目录的正确别名(或BASH函数)是cd什么?
在上面的例子中,移动到/ to/a /目录将完成如下:
/to/a/directory
Run Code Online (Sandbox Code Playgroud)
我试过了:
alias ''='cd '
alias ""='cd '
alias " "='cd '
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
也许我在展示我对C#或.NET框架的一些常用功能的无知,但我想知道是否有一种本机支持的方法来创建类型别名,如EmailAddress别名,string但我可以扩展它我自己的方法如何bool Validate()?
我知道using x = Some.Type;别名,但这些不是全局的,也不提供类型安全性,即可以string在当前文件中换出普通的别名.我希望我EmailAddress是自己的类型,独立,不能与string它阴影的类型互换.
我目前的解决方案是public sealed partial EmailAddress : IEquatable<EmailAddress>, IXmlSerializable使用T4模板生成类,生成样板隐式字符串转换运算符和其他类似的东西.这对我来说很好,并且给了我很大的灵活性,但在我的脑海里,我必须生成如此丰富的样板代码才能做一些像创建强类型别名一样简单的事情.
也许除了代码生成之外,这是不可能的,但我很好奇,如果其他人尝试过类似于他们的设计和你的经历.如果没有别的,也许这可以作为假设未来版本的C#中的这种别名功能的一个很好的用例.谢谢!
编辑:我想要的真正价值是能够使用表示数据的不同类型/格式的原始类型获得类型安全性.例如,a EmailAddress和a SocialSecurityNumber和a PhoneNumber,所有这些都string用作它们的基础类型,但它们本身并不是可互换的类型.我认为这会让你获得更具可读性和自我记录的代码,更不用说更多方法过载可能性的附加好处,而不是模糊不清.
我正在编写Python库API,我经常遇到我的用户想要相同函数和变量的多个不同名称的场景.
如果我有一个带有该函数的Python类,foo()并且我想为它调用别名,那就bar()太容易了:
class Dummy(object):
def __init__(self):
pass
def foo(self):
pass
bar = foo
Run Code Online (Sandbox Code Playgroud)
现在我可以毫无问题地做到这一点:
d = Dummy()
d.foo()
d.bar()
Run Code Online (Sandbox Code Playgroud)
我想知道的是,使用作为常规变量(例如字符串)的类属性而不是函数的最佳方法是什么?如果我有这段代码:
d = Dummy()
print d.x
print d.xValue
Run Code Online (Sandbox Code Playgroud)
我想d.x和d.xValue以ALWAYS打印同样的事情.如果d.x改变,它也应该改变d.xValue(反之亦然).
我可以想到很多方法可以做到这一点,但它们都没有像我想的那样顺利:
@property注释并弄乱setter__setattr__类函数以下哪种方式最好?或者还有另一种方式吗?我不禁觉得,如果为函数创建别名很容易,那对于任意变量来说应该很容易......
仅供参考:我使用的是Python 2.7.x,而不是Python 3.0,因此我需要一个兼容Python 2.7.x的解决方案(尽管如果Python 3.0可以直接解决这个问题,我会感兴趣).
谢谢!
我在c#中有以下行:
var name = (from x in db.authors
where fullName == "Jean Paul Olvera"
orderby x.surname
select new { x.id_author, fullName= String.Concat(x.name," ", x.surname) });
Run Code Online (Sandbox Code Playgroud)
我的问题是我想在where子句中使用别名,但我不能,'fullName'显示为未声明.
我刚碰到这条消息:
$ 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' to …Run Code Online (Sandbox Code Playgroud) 最近我在我的密钥库中添加了一个新别名来签署我的应用程序.
现在我丢失了带有别名的新生成文件,但请记住密码和别名,并使用较旧的文件复制文件.有没有办法使用这些东西重新创建别名?
alias ×10
c# ×2
python ×2
android ×1
apache2 ×1
bash ×1
class ×1
git ×1
git-config ×1
google-play ×1
keystore ×1
linq ×1
linux ×1
php ×1
php-8 ×1
shell ×1
sqlalchemy ×1
ts-node ×1
tsconfig ×1
typescript ×1
virtualhost ×1
wampserver ×1
windows ×1