在gradle中 - 我如何在lib目录(特别是lib/enttoolkit.jar和lib/mail.jar)中的jar输出jar中嵌入jar?
OSX:这可以从命令行工作:
alias ruby="/opt/local/bin/ruby1.9"
Run Code Online (Sandbox Code Playgroud)
但是在shell脚本中,它没有任何效果.我想写一个将在ruby 1.8和ruby 1.9之间切换的脚本,所以这需要是一个脚本 - 而不是在我的个人资料中.
看起来"source script.sh"有效,但是"./script.sh".为什么是这样?我怎样才能在脚本中复制这个?
我已经离开了Ruby世界一段时间(3年),但我回来参加一个项目.我现在被所有可用的宝石所震撼.人气/最佳宝石是否有宝石列表?所有宝石的当前列表在哪里?
出于某种原因,即使我禁用自动上限和自动更正我的UITextField,它仍然是我输入的第一个字母的大写.
这是代码:
UITextField* textField = [[[UITextField alloc] initWithFrame:CGRectMake(90.0, 10.0, 213.0, 25.0)] autorelease];
[textField setClearButtonMode:UITextFieldViewModeWhileEditing];
textField.returnKeyType = UIReturnKeyGo;
textField.autocorrectionType = FALSE;
textField.autocapitalizationType = UITextAutocapitalizationTypeNone;
textField.delegate = self;
if (inputFieldType == Email) {
label.text = @"Email:";
textField.keyboardType = UIKeyboardTypeEmailAddress;
emailTextField = textField;
textField.placeholder = @"Email Address";
} else { // password
textField.secureTextEntry = TRUE;
label.text = @"Password:";
if (inputFieldType == Password){
textField.placeholder = @"Password";
passwordTextField = textField;
}
if (inputFieldType == ConfirmPassword){
textField.placeholder = @"Confirm Password";
confirmPasswordTextField = textField;
}
}
Run Code Online (Sandbox Code Playgroud)
见截图: …
对于Google Chrome扩展程序,我需要捕获网页中的选定文本并发送到网络服务.我被卡住了!
首先我尝试了一个书签,但Mac上的Chrome似乎有一些书签错误,所以我决定写一个扩展名.
我在我的分机中使用此代码:
function getSelText(){
var txt = 'nothing';
if (window.getSelection){
txt = "1" + window.getSelection();
} else if (document.getSelection) {
txt = "2" + document.getSelection();
} else if (document.selection) {
txt = "3" + document.selection.createRange().text;
} else txt = "wtf";
return txt;
}
var selection = getSelText();
alert("selection = " + selection);
Run Code Online (Sandbox Code Playgroud)
当我点击我的扩展图标时,我得到一个"1".所以我认为在浏览器窗口之外选择的行为导致浏览器不再将文本视为"已选择".
只是一个理论....
想法?
我把这个片段从网上偷走了.但它看起来仅限于4096字节并且是非常难看的IMO.谁知道更好的方法?我实际上正在使用Groovy btw ...
String streamToString(InputStream input) {
StringBuffer out = new StringBuffer();
byte[] b = new byte[4096];
for (int n; (n = input.read(b)) != -1;) {
out.append(new String(b, 0, n));
}
return out.toString();
}
Run Code Online (Sandbox Code Playgroud)
编辑:
我在Groovy中找到了一个更好的解决方案:
InputStream exportTemplateStream = getClass().getClassLoader().getResourceAsStream("export.template")
assert exportTemplateStream: "[export.template stream] resource not found"
String exportTemplate = exportTemplateStream.text
Run Code Online (Sandbox Code Playgroud) 在生产与发展方面表现不同的"工头方式"是什么?那就是我们希望工头开始在开发中启动一堆东西,但是在heroku生产中我们不需要它启动(例如)solr.
试图为同事设置一个新的macbook.不顺利.
首先我安装OpenSSL:
Heathers-MacBook-Pro:~ heather$ rvm pkg install openssl
Fetching openssl-1.0.1c.tar.gz to /Users/heather/.rvm/archives
######################################################################## 100.0%
Extracting openssl to /Users/heather/.rvm/src/openssl-1.0.1c
Configuring openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Compiling openssl in /Users/heather/.rvm/src/openssl-1.0.1c.
Installing openssl to /Users/heather/.rvm/usr
Please note that it's required to reinstall all rubies:
rvm reinstall all --force
Updating openssl certificates
Run Code Online (Sandbox Code Playgroud)
然后我尝试用openssl安装ruby ...
Heathers-MacBook-Pro:website heather$ rvm install 1.9.3 --with-openssl-dir=$HOME/.rvm/usr
Fetching yaml-0.1.4.tar.gz to /Users/heather/.rvm/archives
Extracting yaml to /Users/heather/.rvm/src/yaml-0.1.4
Configuring yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Compiling yaml in /Users/heather/.rvm/src/yaml-0.1.4.
Installing yaml to /Users/heather/.rvm/usr
Installing Ruby from source to: /Users/heather/.rvm/rubies/ruby-1.9.3-p392, …Run Code Online (Sandbox Code Playgroud) Dunno发生了什么事,没有github对此问题的回应所以我在这里问.在一个月左右的时间里第一次尝试了一个git push并得到了这个.打开导出GIT_CURL_VERBOSE = 1并进行推送并获取此信息:
localhost:send2mobile_rails phil$ git push
Password:
* Couldn't find host github.com in the .netrc file; using defaults
* About to connect() to github.com port 443 (#0)
* Trying 207.97.227.239... * Connected to github.com (207.97.227.239) port 443 (#0)
* SSL connection using DHE-RSA-AES256-SHA
* Server certificate:
* subject: O=*.github.com; OU=Domain Control Validated; CN=*.github.com
* start date: 2009-12-11 05:02:36 GMT
* expire date: 2014-12-11 05:02:36 GMT
* subjectAltName: github.com matched
* issuer: C=US; ST=Arizona; L=Scottsdale; O=GoDaddy.com, Inc.; OU=http://certificates.godaddy.com/repository; CN=Go …Run Code Online (Sandbox Code Playgroud)