prompt

Code challenge: Bash prompt path shortener

时光总嘲笑我的痴心妄想 提交于 2019-12-03 01:32:38
问题 I implemented a prompt path shortener for bash to be included in the PS1 environment variable, which shortens the working directory into something more compact but still descriptive. I'm curious what other ideas may exist. Here's the challenge: Create a bash function _dir_chomp which can be included into PS1 like this (line breaks inserted for readability): PS1='\[\033[01;32m\]\u@\h\[\033[01;34m\] $( _dir_chomp "$(pwd)" 20 )\[\033[01;37m\]$(parse_git_branch)\[\033[01;34m\] \$\[\033[00m\] '

Open Visual Studio command prompt from C# code

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am trying to open Visual studio Command prompt using C# code. Here is my code private void Execute ( string vsEnvVar ) { var vsInstallPath = Environment . GetEnvironmentVariable ( vsEnvVar ); // vsEnvVar can be VS100COMNTOOLS, VS120COMNTOOLS, VS140COMNTOOLS if ( Directory . Exists ( vsInstallPath )) { var filePath = vsInstallPath + "vsvars32.bat" ; if ( File . Exists ( filePath )) { //start vs command process Process proc = new Process (); var command = Environment . GetEnvironmentVariable ( "ComSpec" ); command = @ "" + command

Custom Bash prompt is overwriting itself

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm using custom bash prompt to show git branch. Everything is in /etc/bash/bashrc : function formattedGitBranch { _branch="$(git branch 2>/dev/null | sed -e "/^\s/d" -e "s/^\*\s//")" # tried these: echo -e "\e[0;91m ($_branch)" echo -e "\e[0;91m ($_branch) \e[m" echo -e $'\e[0;91m'"($_branch)" echo "($_branch)" echo "$(tput setaf 2) ($_branch) $(tput setaf 9)" printf "\e[0;91m ($_branch)" } # color is set before function call PS1='\[\033[01;34m\] \[\033[0;91m\]$(formattedGitBranch) \$\[\033[00m\] ' # color is set inside function PS1='\[\033

Shell Prompt Line Wrapping Issue

强颜欢笑 提交于 2019-12-03 00:53:34
问题 I've done something to break my Bash Shell Prompt in OS X (10.5.7) Terminal. This is the PS1 that I had configured: PS1='\[\e[1;32m\]\h\[\e[0m\]:\[\e[1;34m\]\w\[\e[0m\]\$ ' As far as I can tell I have the color commands escaping correctly. However when I scroll up and down in my command history I often get line wrapping issues if the historic commands wrap onto multiple lines. I simplified my prompts to the following: PS1='\[\e[1m\]\h:\w\$ \[\e[0m\]' PS2='> ' And I still see something like:

json xhr response opens a download file popup window

寵の児 提交于 2019-12-03 00:41:47
For one of our ajax request (with a .json response) some of our clients have complained that they are seeing a "File Download" prompt asking the user to download the .json response. I am baffled because considering that this is an xhr response, this should never happen. Has anyone seen this? Thanks Reza For people who are using ASP MVC and have the same problem with IE, use this when returning your response: return Json(result, "text/plain"); Edit: the standard type is: "application/json", but does not work with IE. using text/html is dangerous. try specifying a MIME type of "text/plain" in

anaconda3安装失败,要么不报错,要么failed create menus

匿名 (未验证) 提交于 2019-12-03 00:21:02
环境为winserver2008,就是开机菜单栏中anaconda3文件夹下面,只有一个prompt,其他啥都没有,prompt链接的快捷方式指向的文件也找不到。试过各种办法,最后发现,menu文件夹下根本就只有一个prompt的json,所以肯定是中间遇到了比较恶心的问题才不报错。 用everthing搜一下python这个关键字,发现某个角落里还藏着不知道谁什么时候安装的某个版本的python,看来是在path中先找到了这个python,果断给删了。 然后就work了,菜单栏里面各种图标都有了。 用别人动过的电脑就是坑。 文章来源: anaconda3安装失败,要么不报错,要么failed create menus

Don't make me manually abort a LaTeX compile when there's an error

时光怂恿深爱的人放手 提交于 2019-12-03 00:18:27
问题 As suggested here, latexmk is a handy way to continually compile your document whenever the source changes. But often when you're working on a document you'll end up with errors and then latex will panic and wait for user input before continuing. That can get very annoying, especially recently when I hacked up something to compile latex directly from an etherpad document, which saves continuously as you type. Is there a setting for latex or latexmk to make it just abort with an error message

JQData安装 | 最贴心教程,安装JQData全靠这篇指南

匿名 (未验证) 提交于 2019-12-02 23:38:02
Hi, 各位亲爱的小伙伴们! 首先,JQData是基于python的一个数据包,所以安装JQData的第一步是安装Python (没有接触过python或者python基础不好的小伙伴,可以关注 聚宽量化课堂的python讲堂 进行python学习)。 对于python安装包的选择,小编建议下载Anaconda,因为Anaconda提供了许多非常强大的工具包,小伙伴们只要下载安装Anaconda,就可以直接使用,而不需要挨个查找安装。小编在这里为大家提供Anaconda的 下载地址 。 在下载界面,可以看到Anaconda有两个大版本,一个是python 2.7 Version,一个是python 3.6 Verson。熟悉python的小伙伴可以根据自己的喜好进行版本选择。对于不熟悉Python的小伙伴,小编推荐 下载 python 3.6 Version ,因为在以后的使用中,可能发现有些工具包是不兼容python2.7的,而且JQData对于python3.6的兼容性是要强于python2.7的。 确定好python版本,下载时还需要确认自己的系统位数,不清楚系统位数的小伙伴,可以参看 百度经验 。查到自己电脑的位数后,选择下载对应的安装包即可。 如果小伙们发现自己下载的网速慢的话,小编给大家提供一个 镜像网站 ,这个是清华大学的开源软件镜像站地址,由于使用的是国内的服务器

后续(JS基础)

匿名 (未验证) 提交于 2019-12-02 23:34:01
- JavaScript-提问(prompt 消息对话框) 语法:prompt(str1, str2); 参数说明: str1: 要显示在消息对话框中的文本,不可修改 str2:文本框中的内容,可以修改 返回值: 点击确定按钮,文本框中的内容将作为函数返回值 点击取消按钮,将返回null 看看下面代码: var myname = prompt ( "请输入你的姓名:" ); if ( myname != null ) { alert ( "你好" + myname ); } else { alert ( "你好 my friend." ); } 结果: 实例: <!DOCTYPE HTML> <html> <head> <meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> <title> prompt </title> <script type = "text/javascript" > function rec (){ var score ; //score变量,用来存储用户输入的成绩值。 score = prompt ( "请输入您的成绩" ); if ( score >= 90 ) { document . write ( "你很棒!" ); } else if ( score >=

Automatically timing every executed command and show in Bash prompt? [duplicate]

老子叫甜甜 提交于 2019-12-02 23:34:00
This question already has an answer here: How can the last command's wall time be put in the Bash prompt? 11 answers I often happen to forget to explicitly prefix executions with the "time" command, ideally I would see in the next shell prompt how much real time the last command took (on every command). I already scoured through the bash documentation, but couldn't find anything related. Dennis Williamson You could do this: $ bind '"\C-j": "\C-atime \C-m"' Or put this in your ~/.inputrc : "\C-j": "\C-atime \C-m" Then when you want to do time sleep 1 you'd type sleep 1 and press Ctrl + J