我正在使用谷歌日历的API来显示我公司日历的精简版.我想让任何人在我的网站上查看我的日历版本.目前,只有我可以查看日历页面,如果我要与任何人共享页面URL,它不起作用 - 他们无法查看任何内容.
我在这里使用谷歌的起始代码:
var CLIENT_ID = 'MYID**';
var SCOPES = ["https://www.googleapis.com/auth/calendar.readonly"];
function checkAuth() {
gapi.auth.authorize(
{
'client_id': CLIENT_ID,
'scope': SCOPES,
'immediate': true
}, handleAuthResult);
}
function handleAuthResult(authResult) {
var authorizeDiv = document.getElementById('authorize-div');
loadCalendarApi();
}
function handleAuthClick(event) {
gapi.auth.authorize({
client_id: CLIENT_ID,
scope: SCOPES,
immediate: false
}, handleAuthResult);
return false;
}
function loadCalendarApi() {
gapi.client.load('calendar', 'v3', listUpcomingEvents);
}
function listUpcomingEvents() {
var request = gapi.client.calendar.events.list({
'calendarId': 'iorbmkj57ee8ihnko0va1snif8@group.calendar.google.com',
'timeMin': '2011-06-03T10:00:00-07:00',
'showDeleted': false,
'singleEvents': true,
'maxResults': 1000,
'orderBy': 'startTime'
});
Run Code Online (Sandbox Code Playgroud)
但我似乎无法找到将这个日历公之于众的地方.stackoverflow上的两个示例没有解释太多,我似乎无法连接Google的API文档中的任何内容.
长话短说:我的Android手机一直与亚行脱节.有人告诉我更新android studio,做到了.我在Intellij中打开我的项目并尝试在android上运行,我收到一个错误:
BUILD FAILED
Total time: 48.986 secs
Error: /Users/me/Desktop/comp/Development/comp-ionic/platforms/android/gradlew: Command failed with exit code 1 Error output:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileDebugJavaWithJavac'.
> java.lang.NullPointerException (no error message)
Run Code Online (Sandbox Code Playgroud)
我的第一个想法是我的格斗是错误的版本.对于这个特定的应用程序,我需要使用gradle版本2.14.1.
当我输入gradle -v我的版本3.3.
有没有办法删除/降级gradle从3.3到2.14.1?
或者这是另一个问题吗?
我今天才注意到我正在创建的网站有WWW或非WWW问题.如果你去http://www.taskconductor.com,它是一个不同的页面,其内容与http://taskconductor.com相同.
如果您要在http://www.taskconductor.com上登录(用户名:show@412customs.com,Pass:tester),那么请尝试访问http://taskconductor.com(没有WWW),它会使你再次登录 然后如您所见,当您检查Cookie时,您可以看到有两组Cookie.一个用于http://taskconductor.com,另一个用于http://www.taskconductor.com.
我已经看到这是一个问题,但我需要进行重定向吗?如果是的话,它必须是index.php吗?我真的更喜欢将所有主要内容都放在index.php上.
我怎么能绕过这个?
我正在使用ionic with angular来为Android和iOS创建一个应用程序.在Android上一切正常.iOS是问题(当然).
我正在使用类更改元素ng-class.我可以在HTML和CSS中看到safari检查器中的类更改.但我没有看到屏幕上的变化.我能看到变化的唯一方法是操作CSS选择器(就像打开/关闭一个样式一样简单).
这是带Angular的HTML:
<div class="avatar-view__initial__question question-hide" ng-class="{'question-show': speech.captured === true, 'question-hide': speech.captured === false}">{{question.text}}</div>
Run Code Online (Sandbox Code Playgroud)
和CSS
.avatar-view__initial__question {
text-align: left;
background-color: #E9EBEF;
font-size: 1.5em;
position: relative;
background-image: url(../img/icons/icon-ear.svg);
background-size: 50px;
background-repeat: no-repeat;
background-position: 10px center;
flex-shrink:1;
@extend .css-animate;
&.question-show {
padding: 20px 10px 20px 60px;
height: auto !important;
}
&.question-hide {
height:0 !important;
padding:0 10px 0 60px;
}
}
Run Code Online (Sandbox Code Playgroud)
正如我所提到的,CSS IS被施加,虽然我不能查看更改直到我操纵在检查员的任何样式(关于该元素).
这是一个错误吗?或者我可以解决的事情?
更新 我刚刚在iOS 9设备上试过它,它运行得很好.这似乎是一个十大问题.
更新2我觉得这是一个flexbox问题.我让它们作为一个列填充屏幕,但是当它没有内容时我给了底部一个零高度.这很有趣.我重新格式化了html,使其工作方式不同.但我想保留这个,以防其他人遇到这个问题.
更新了更多代码
我正在尝试抓取刚拍摄的照片并将其设置为ImageView编程.
按下图片按钮,
picture_button.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
takePhoto(mTextureView);
}
});
Run Code Online (Sandbox Code Playgroud)
它运行takePhoto方法:
public void takePhoto(View view) {
try {
mImageFile = createImageFile();
final ImageView latest_picture = (ImageView) findViewById(R.id.latest_picture);
final RelativeLayout latest_picture_container = (RelativeLayout) findViewById(R.id.latest_picture_container);
final String mImageFileLocationNew = mImageFileLocation.replaceFirst("^/", "");
Toast.makeText(getApplicationContext(), "" + mImageFile, Toast.LENGTH_SHORT).show();
Uri uri = Uri.fromFile(mImageFile);
Toast.makeText(getApplicationContext(), ""+uri, Toast.LENGTH_LONG).show();
latest_picture.setImageURI(uri);
latest_picture_container.setVisibility(View.VISIBLE);
} catch (IOException e){
e.printStackTrace();
}
lockFocus();
captureStillImage();
}
Run Code Online (Sandbox Code Playgroud)
哪个运行createImageFile()和captureStillImage()
private void captureStillImage() {
try {
CaptureRequest.Builder captureStillBuilder …Run Code Online (Sandbox Code Playgroud) 在Ionic 4中,我尝试使用modalController来打开模式。我可以打开模式并发送componentProps,但是我不确定如何接收这些属性。
这是我打开模态组件的方法:
async showUpsert() {
this.modal = await this.modalController.create({
component:UpsertComponent,
componentProps: {test: "123"}
});
return await this.modal.present();
}
Run Code Online (Sandbox Code Playgroud)
我的问题是;在实际的模态中,如何test: "123"进入变量?
我正在尝试创建一个函数,根据我正在与之交互的元素的类调用其他函数.
我希望能够使用元素的类来调用函数,而不是使用if语句.示例如下:
function validate(thisInput){
var thisClass = thisInput.attr("class").split(' ')[0];
validate + class(thisInput);
/*This is what I would like to happen:
the class is grabbed from above, then that class name (whatever it is)
calls it's own function. I will be creating a function for each class.
*/
}
function validateClassname(thisInput) {
//do something
}
Run Code Online (Sandbox Code Playgroud)
正如您所看到的,我正在尝试找到类名,使其成为自己的函数(不使用if语句来驱动它)然后让该函数执行它需要做的任何事情.
我看错了吗?我应该采用不同的方式吗?谢谢
我试图弄清楚如何做一个switch语句,我需要找到对象的类名,然后根据类名做一些事情(在switch语句中).
在这个例子中,我需要switch语句在类包含特定单词时执行我需要的任何操作,例如"person".
HTML
<div class="person temp something"></div>
Run Code Online (Sandbox Code Playgroud)
JavaScript的
$(document).on('mousedown', function(e) {
var clicked = $(e.target).attr('class');
console.log(clicked);
switch (clicked) {
case "person":
//do something
break;
default:
//do something
}
});
Run Code Online (Sandbox Code Playgroud)
不保证switch语句名称(例如"person")将位于第一个位置.
我知道我可以通过数组搜索特定的单词,但我不知道如何将其添加到这类内容中.
我正在关注youtube教程,试图学习Camera2 API.当然,我正在学习这个,同时我正在开发自己的应用程序.教程和我的应用程序之间的一个不一致之处在于,只有当我的应用程序必须处于横向状态时,教程才能使相机处于纵向模式.
我目前能够查看相机的预览,但是当我的应用程序是横向或水平时,相机预览看起来旋转了90度.这几乎感觉我可以旋转TextureView,但这看起来似乎不正确,就像我拍照时一样,它会被错误地旋转.
下面是与图像大小有关的代码(整个代码很长)
private void setupCamera(int width, int height) {
CameraManager cameraManager = (CameraManager) getSystemService(Context.CAMERA_SERVICE);
try {
CameraCharacteristics cameraCharacteristics = cameraManager.getCameraCharacteristics(camera_id);
StreamConfigurationMap map = cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP);
cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
mPreviewSize = getPreferredPreviewSize(map.getOutputSizes(SurfaceTexture.class), width, height);
mCameraId = camera_id;
} catch (CameraAccessException e) {
e.printStackTrace();
}
}
//TODO Look for a way to make this horizontal
private Size getPreferredPreviewSize(Size[] mapSizes, int width, int height) {
List<Size> collectorSizes = new ArrayList<>();
for (Size option : mapSizes) {
if (width > height) { //If …Run Code Online (Sandbox Code Playgroud) 我正在编写一个跟踪事件的应用程序。我正在使用 firestore 拥有一个主要集合,其中events将每个事件作为文档保存。每个文档都有自己的详细信息(包括roles对象)以及事件中自己的步骤集合。
集合对象如下所示:
events > [collection]
eventid1 > [doc]
steps > [collection]
location: "Even Center",
notes: "Some notes here",
timestamp: 1272153600,
title: "A great event",
roles:
userID1: 0, //numbers to define role type
userID2: 1,
userID3: 1,
Run Code Online (Sandbox Code Playgroud)
我想做的是查询roles.userID1存在的任何事件。我知道 firestore 没有子集合查询,所以这是我最接近解决这个问题的方法。
只有 3 个“角色”(0 = 所有者、1 = 编辑者、2 = 查看者)。我尝试编写三个查询并使用 组合查询.where("roles." + this.user.uid, "==", 0)。这会起作用(尽管事后我遇到了一些数组问题),但我不想为每个查看此内容的用户进行 3 次调用。
我在某处的随机评论中看到您可以使用查询.where("roles." + this.user.uid, "<", ""),但这对我不起作用。
有没有办法编写一个查询来查看对象中的键是否存在?