我已经安装了grunt任务grunt-contrib-copy
.我把它嵌入我的Gruntfile.js
并通过加载任务grunt.loadNpmTasks('grunt-contrib-copy');
.
目前,我使用以下配置来创建包含我的js文件/文件夹子集的文件夹.
copy: {
options: {
processContent: [],
processContentExclude: ['build/**', 'bin/**', '.*', '*.orig', '*.bak', '.*/**', '*.log', 'dist/**', 'test/**', 'dev/**', 'pyserver/**', 'node_modules/**', 'doc/**']
},
du: {
files: [
{src: ['.conf1', '.conf2', './config.js'], dest: 'output/toolkit/', filter: 'isFile'},
{src: ['./css/**/*', './img/**/*', './js/**/*', './release/**/*', './lib/**/*', './locale/**/*'], dest: 'output/toolkit/'},
{expand: true, cwd: './', src: ['**'], dest: 'output/'}
]
}
}
Run Code Online (Sandbox Code Playgroud)
这工作正常,但每次我运行grunt副本它退出时出现以下错误消息:
Copying Gruntfile.js -> output/Gruntfile.js
Warning: Error while processing "Gruntfile.js" file. Use --force to continue.
Run Code Online (Sandbox Code Playgroud)
我想排除Gruntfile.js
和所有*.less …
我想在列表视图中显示用户个人资料图片.当我尝试从android调用graph-api来检索图像时,我总是得到以下错误.
java.io.IOException: Hostname <fbcdn-profile-a.akamaihd.net> was not verified
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpConnection.getSecureSocket(HttpConnection.java:170)
at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection$HttpsEngine.connect(HttpsURLConnection.java:398)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.sendRequest(HttpURLConnection.java:1224)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequestInternal(HttpURLConnection.java:1558)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.doRequest(HttpURLConnection.java:1551)
at org.apache.harmony.luni.internal.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1052)
at org.apache.harmony.luni.internal.net.www.protocol.https.HttpsURLConnection.getInputStream(HttpsURLConnection.java:252)
at com.facebook.android.Util.openUrl(Util.java:200)
at com.facebook.android.Facebook.request(Facebook.java:559)
Run Code Online (Sandbox Code Playgroud)
这是我使用的代码:
private static void retrieveProfilePicture(String userId) throws MalformedURLException, IOException{
facebook = FacebookHelper.getInstance();
Bundle bundle = new Bundle();
bundle.putString(Facebook.TOKEN, facebook.getAccessToken());
Object picture = facebook.request("/"+userId+"/picture", bundle, "GET");
Run Code Online (Sandbox Code Playgroud)
当我在浏览器中执行相同的调用(https://graph.facebook.com//picture?access_token=)时,我会在这样的URL上返回图像
https://fbcdn-profile-a.akamaihd.net/...
以什么格式传送给我的图像?带有引用映像的JSON(url)?
我想在我的Windows 2008 Server上安装我的tomcat v7.0.12作为服务.在tomcat页面上,我找到了本教程.但是service.bat
我的安装目录中没有文件.
在WS2008的服务概述中,无法轻松创建类似的新服务 new->service ...
是否可以以在中心点上具有所需模块的方式配置grunt?
我有以下项目结构
-Project
-- subproject
-- subproject
-- subproject
Run Code Online (Sandbox Code Playgroud)
我通过grunt和所有子项目构建项目,我也可以为自己构建每个子项目.目前我有一个Gruntfile.js,package.json和文件夹node_modules(~50mb),每个子项目和根级别都包含所有必需的模块.
那么是否可以将node_modules文件夹仅在一个级别上,例如在根级别上,子项目引用根级别上的node_modules?
-Project
--subproject
--subproject
--subproject
--node_modules
Run Code Online (Sandbox Code Playgroud)
有没有办法通过package.json或其他任何东西引用node_module文件夹?
编辑:
Gruntfile.js(子项目级别)
/*global module:false */
/*jshint node:true */
module.exports = function(grunt) {
"use strict";
// ================================================================================
// project configuration
// ================================================================================
grunt.initConfig({
pkg : grunt.file.readJSON('package.json'),
jshint: {
globals : {
d3:true,
Modernizr:true,
tempo:true
},
options: grunt.file.readJSON('.jshintrc')
},
csslint: {
subproject: {
src: 'css/**/*.css'
}
},
htmllint : {
subproject: {
src: 'html/**/*.html'
}
},
clean : [ 'output' ],
less : {
options: …
Run Code Online (Sandbox Code Playgroud) 我正在使用Grunt来构建我的Web项目.我安装了grunt-contrib-less
包并为我添加了一个任务grunt.initConfig({..});
less : {
options: {
paths: ['js/base']
},
files: {
'js/base/*.css' : 'js/base/*.less'
}
}
Run Code Online (Sandbox Code Playgroud)
当我运行目标较少的通过时grunt less
,它运行没有错误,但不会将较少的文件编译为css文件.
Running "less:files" (less) task
Done, without errors.
Run Code Online (Sandbox Code Playgroud)
我也通过节点安装了lessc包.做得lessc <source> <dest>
很好.
目前我已将文件选项直接指向一个目录,其中包含少量文件用于测试.即使我将整个文件名写入文件选项,它也没有发生......
后来我想扫描整个js目录并编译所有新修改的*.less文件.
我安装了以下版本:
grunt-cli v0.1.6
grunt v0.4.0
node v0.8.7
npm 1.1.49
Run Code Online (Sandbox Code Playgroud)
BR,mybecks
我有一个文件夹,其中包含许多带有子文件夹 (/...) 的文件夹,其结构如下:
_30_photos/combined
_30_photos/singles
_47_foo.bar
_47_foo.bar/combined
_47_foo.bar/singles
_50_foobar
Run Code Online (Sandbox Code Playgroud)
使用命令将显示find . -type d -print | grep '_[0-9]*_'
结构为** 的所有文件夹。但是我生成了一个仅捕获 */combined 文件夹的正则表达式:
_[0-9]*_[a-z.]+/combined
但是当我将它插入到 find 命令中时,不会打印任何内容。
下一步是为每个组合文件夹(在我的硬盘上的某处)创建一个文件夹,并将组合文件夹的内容复制到新文件夹中。新文件夹名称应与子文件夹的父名称相同,例如 _47_foo.bar。搜索后可以使用 xargs 命令来实现吗?
我的 ICS 应用程序中有一个带有搜索小部件的操作栏。我希望用户可以搜索应用程序附带的一些内容。因此,我想使用搜索小部件,显示一个结果列表,当用户输入新字符(与 Play 商店的功能相同)时,该列表会自动更新。我已经SearchView.OnQueryTextListener
在我的活动中实施并实施了两种方法onQueryTextChange(String newText)
和onQueryTextSubmit(String query)
. 在onQueryTextChange
我调用我的服务中,它返回键入建议的值。但是我没有计划,如何显示建议列表。我阅读了developer.android.com上的文章,但据我所知,它主要用于旧的搜索实现(< Honeycomb)。在 Search Widget API 示例中,建议是应用程序,安装在系统上,由SearchManager
. 我还没有找到涵盖此主题的教程或示例(搜索小部件中的自定义建议),有人知道这样的事情吗?
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.search_menu, menu);
SearchManager searchManager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView searchView = (SearchView) menu.findItem(R.id.menu_search).getActionView();
searchView.setOnQueryTextListener(this);
return super.onCreateOptionsMenu(menu);
}
@Override
public boolean onQueryTextChange(String newText) {
Log.i(TAG, "Query = " + newText);
if(newText.length() > 0){
//my suggestion service, returning an arraylist!
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
我读到,我需要从ContentProvider
扩展SearchRecentSuggestionsProvider
,但我不知道如何处理和创建此提供程序。我有一个searchable.xml
指的是 …
search android android-4.0-ice-cream-sandwich android-actionbar
我目前正在尝试使用React JS(v.0.14)和cordova.我想用一个带有cordova文件插件的Android模拟器的SD卡读取一些文件.
当我尝试启动应用程序时,我总是得到错误,这cordova.file.*
是未定义的.发生这种情况是因为,React组件在onDeviceReady
调用cordova之前呈现.我在ReactDOM.render
函数内部添加了函数onDeviceReady
,但这不起作用.
app.js
var app = {
initialize: function() {
this.bindEvents();
},
bindEvents: function() {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
onDeviceReady: function() {
console.log('on ready'); // Update DOM on a Received Event
ReactDOM.render(
<App />,
document.getElementById('app')
);
}
};
app.initialize();
var App = React.createClass({
getInitialState: function() {
return {tiles:[]};
},
componentDidMount: function() {
var PATH = cordova.file.externalRootDirectory + 'testdir/'; //Is called before onDeviceReady
},
render: function() {
return (
<div>
<Navigation title="Dashboard"/> …
Run Code Online (Sandbox Code Playgroud) 我尝试构建一个平台,它由两个独立的部分组成:后端和前端。\n后端由 Express.js 和 Passport.js 提供支持。它可以通过 localhost:3000 获得。\n前端使用 Googlespolymer-1.0 并在 localhost:8001 上运行。
\n\n我想在我的后端完成所有 API 工作。Ui调用并从后端获取数据。
\n\n当尝试对我的后端路由进行 Iron-ajax 授权请求时,我收到 CORS 错误:
\n\nXMLHttpRequest 无法加载 http://localhost:3000/auth/facebook。\n请求已重定向到 \'https://www.facebook.com/v2.2/dialog/oauth?response_type=code&redirect_uri=\xe2\x80\ xa6%3A3000%2Fauth%2Ffacebook%2Fcallback&scope=email&client_id=0815\', \n对于需要预检的跨域请求是不允许的。\n\n
用户界面片段:
\n\n\n\niron-ajax\n id="login"\n url=""\n method="GET"\n headers=\'{"X-Requested-With": "XMLHttpRequest"}\'\n 句柄-as="json"\n on-response="hresponse"\n debounce-duration="300">\n/iron-ajax>\n\n\n_handleTap: function () {\n var url = \' http://localhost:3000/auth/\' + this.service;\n this.$.login.url = url;\n this.$.login.generateRequest(); \n},\n\n\n
后端片段:
\n\n\napp.get(\'/auth/facebook\', Passport.authenticate(\'facebook\', { range: \'email\' }));\n\napp.get(\'/auth/facebook/ callback\', Passport.authenticate(\'facebook\'), function(req, res) {\n res.status(200).json({\n success: true,\n message: \'享受!\' ,\n 重定向: \'/route/to/nowhere\',\n }).end();\n });\n\n\n\n …
是否可以使用Googles GWT RPC机制创建文件上传?现在我正在使用一个带有doPost方法的简单HTTPServlet,它从表单中获取!
是否(没有像gwtupload这样的lib的帮助)可以通过GWTs FileUpload Widget将XML文件上传到RPC服务并使用文件的内容?
BR; mybecks
如何按输入顺序输出字典的值是可能的.
例:
我的意见:
[dicValue0 setObject:@"Start Date & Time" forKey:@"START_DATETIME"];
[dicValue0 setObject:@"Specify End" forKey:@"SPECIFY_END"];
[dicValue0 setObject:@"End Date & Time" forKey:@"END_DATETIME"];
[dicValue0 setObject:@"Open End" forKey:@"END_OPEN"];
Run Code Online (Sandbox Code Playgroud)
输出:
我可以编写一个循环,按输入的顺序对输出进行排序.但是,如果我有超过10000个值,这不是最好的和高效的方式.有什么来自苹果,这有助于我解决这个问题吗?
当用户按下我的UINavigationController视图上的后退按钮时,我想显示带有2个选项的UIAlertView.一个选项(OK)允许用户返回(到前一个屏幕),另一个选项(Cancel)将保留在当前控制器上.
我在viewWillDisappear中实现了以下代码(我在这里找到了):
-(void) viewWillDisappear:(BOOL)animated{
if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) {
// back button was pressed. We know this is true because self is no longer
// in the navigation stack.
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"All Data will be lost"
message:@"You must be connected to the internet to use this app."
delegate:self
cancelButtonTitle:@"Cancel"
otherButtonTitles:@"OK", nil];
alert.tag = 1;
[alert show];
[alert release];
}
[super viewWillDisappear:animated];
}
Run Code Online (Sandbox Code Playgroud)
问题是,在我按下Back后,视图立即跳转到previos屏幕并在此屏幕上显示UIAlertView.
在UIAlertView回调方法中,我使用了以下编码,但没有任何反应(我认为这是因为我之前已经在上一个视图中):
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex{
if(buttonIndex == 1)
NSLog(@"back");
//Go Back ...
}
Run Code Online (Sandbox Code Playgroud)
BR,mybecks
什么是更好的方法,使用应用程序内设置(启动屏幕)或使用设置包,如果没有输入任何显示启动弹出窗口?或者可以将两者结合起来?
BR,mybecks
gruntjs ×3
ios ×3
node.js ×3
android ×2
javascript ×2
objective-c ×2
xcode ×2
android-4.0-ice-cream-sandwich ×1
bash ×1
copy ×1
cordova ×1
facebook ×1
file-upload ×1
gwt ×1
gwt-rpc ×1
in-app ×1
less ×1
node-modules ×1
nsdictionary ×1
passport.js ×1
polymer ×1
polymer-1.0 ×1
reactjs ×1
regex ×1
search ×1
service ×1
tomcat7 ×1