我刚刚开始使用谷歌Chrome扩展程序开发,我的项目涉及制作一个扩展程序,点击该链接时会打印当前打开的页面/选项卡的URL.
因此,如果我在谷歌的主页上并点击我的扩展程序,我需要在扩展程序中输入" https://www.google.com/ "作为我的输出.
我需要使用javascript来执行此操作,并且无法找到我理解的代码以及执行此操作的代码.我读到了关于使用"window.location"和"document.href"的东西,但是这不会给我只是我的扩展名而不是当前标签的网址吗?
请帮我开始吧 提前致谢.
我知道当R中的命令行要求你完成当前命令时,提示符从<更改为+.有没有办法(比如快捷键)立即终止正在写入的命令并从'+'模式恢复到常规控制台'>'?
(现在我在StackOverflow上遇到了相关的问题但不幸的是没有一个解决方案对我有用,这就是为什么我不得不单独问这个问题)
我是Android的新手.问题:我需要一个充当按钮的图像.现在我明白这可以通过在标准按钮上使用图像或使用称为"ImageButton"的东西来实现(我猜这是强烈推荐的,尽管我不知道为什么).
要求:我需要详细的指导来解决这个问题.具体来说,在我遇到两个主要问题之前,我认为"把图像放在标准按钮上"更容易:我无法在中心设置图像(感谢drawable-top,bottom,left6,right)和一次我更改了背景颜色以匹配活动屏幕的背景颜色,按钮效果消失.简单地说,我需要一种简单方便的方法,让图像充当按钮或按钮,图像具有三种效果:聚焦,按下和默认.我使用ImageButton,但后来我不知道如何制作自定义形状或9patch图像以给它所有想要的效果,我对android提供的默认按钮非常满意.
有人可以帮我解决这个问题吗?我需要UI看起来不错,因此,需要对我的图像/按钮相应的效果.提前致谢 :)
这是我的图标图片:
我希望在此周围有某种悬停效果,表示图像已被按下,就像任何普通按钮一样.
我已经将包含字符串值(例如,表示)和浮动值(例如0.87)的CSV文件导入到phpMyAdmin数据库的表中.在我获取所有字符串值并仅保留具有十进制值的行之后,我需要将这些值从VARCHAR转换为DECIMAL/FLOAT,以便我可以对此属性执行MAX().
我该怎么做呢?每次我尝试通过phpMyAdmin中的GUI执行此操作时,我的所有值都会自动舍入为0和1.
请帮我!
我是Graph API的新手,并尝试编写一个简单的python脚本,该脚本首先标识用户喜欢的所有页面以及他/她所属的所有组.为此,我使用了以下内容:
To get the groups he has joined:
API: /{user-id}/groups
Permissions req: user_groups
To get the pages he has liked:
API: /{user-id}/likes
Permissions req: user_likes
and
url='https://graph.facebook.com/'+userId+'/likes?access_token='+accessToken +'&limit='+str(limit)
Run Code Online (Sandbox Code Playgroud)
现在我可以在JSON输出中看到组的ID,我想逐个点击它们并获取该组中发布的所有内容(帖子,评论,照片等).这是可能的,如果可以,我该怎么做?我需要做什么API调用?
我只是从Eclipse转移到令人生畏的Android Studio并且无法摆脱,似乎是一个相当常见的错误.
Error:Execution failed for task ':app:preDexDebug'.
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/usr/lib/jvm/java-7-oracle/bin/java'' finished with non-zero exit value 1
Run Code Online (Sandbox Code Playgroud)
我看了一遍,并尝试了各种解决方案,从简单地重新启动我的工作室,无效和清除缓存,删除JAR并尝试再次添加它们,但到目前为止没有任何作用.我是这个IDE的新手,所以我甚至不确定它是如何工作的以及构建文件应该是什么样子.
这是我当前的build.gradle(模块:app)
apply plugin: 'com.android.application'
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
defaultConfig {
applicationId "com.example.culami"
minSdkVersion 21
targetSdkVersion 21
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
}
}
}
dependencies {
compile 'com.android.support:appcompat-v7:21.0.3'
compile 'com.android.support:support-v4:21.0.3'
compile files('libs/WebSocket.jar')
compile files('libs/android-support-v13.jar')
compile files('libs/json-org.jar')
compile files('libs/socketio.jar')
}
Run Code Online (Sandbox Code Playgroud)
该项目是从Eclipse导入的,其原因是我遇到了json-org.jar和WebSocket.jar的一些构建问题.我无法解决这个问题,问题仍然存在.我不确定如何通过gradle添加这些依赖项,因为github页面并没有真正说明如何.
这是Gradle控制台的输出.
Executing tasks: [:app:assembleDebug] …
Run Code Online (Sandbox Code Playgroud) 我使用D3使用基于力的布局,并且想知道当我点击节点或标签时,我是否有可能被自动带到存储在该节点/标签中的URL?如果是,我怎么能实现这个目标?
这就是图形实际看起来的样子(标签表示URL本身)
我正在分享我用来生成D3图的javascript代码.在代码中,我目前正在使用虚拟数据,实际上将被URL替换.
document.addEventListener('DOMContentLoaded', function () {
drawVisual();
});
function drawVisual()
{
//document.getElementById('myMSG').innerHTML = "last name"+localStorage.lastname;
/*var getArr = [];
getArr = JSON.parse(localStorage.getItem('storeArray'));
document.getElementById('myMSG').innerHTML = getArr[1].parentURL;*/
//var w = 1024, h = 768;
var w=window.innerWidth
|| document.documentElement.clientWidth
|| document.body.clientWidth;
var h=window.innerHeight
|| document.documentElement.clientHeight
|| document.body.clientHeight;
//var w = 1024, h = 768;
//var vis = d3.select("#tab_5_contents").append("svg:svg").attr("width", w).attr("height", h);
var vis = d3.select("#forcedLayoutGraph").append("svg:svg").attr("width", w).attr("height", h);
var QueuedORG = [];
//QueuedORG = JSON.parse(localStorage.getItem('storeArray'));
QueuedORG.push({url: "Root", parentURL: "Root", used:0});
QueuedORG.push({url: "a", parentURL: "Root", …
Run Code Online (Sandbox Code Playgroud) MAX()函数是否仅返回它遇到的最大值的第一次出现?如果在相同最大值的不同行中出现多次,会发生什么?有没有办法使用MAX()函数获取所有这些行?请帮忙!
我是Android SDK的新手,我正在使用TextView和我的活动UI上的其他组件.当我将宽度设置为wrap_content
并使用时layout_gravity
,我能够将TextView置于父容器中心.但是,我现在需要为TextView提供一个沿父级宽度完全拉伸的背景,因此我将宽度设置为match_parent
.一旦我这样做,既layout_gravity
不能textAlignment="center"
也不能在视图中居中文本.这是我正在使用的代码:
<TextView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/trackName"
android:textColor="#ffffff"
android:layout_gravity="center"
android:textSize="28sp"
android:paddingTop="7dp"
android:paddingLeft="20dp"
android:background="#99000000" />
Run Code Online (Sandbox Code Playgroud)
这就是活动UI现在的样子:
如何解决此问题并将文本与TextView控件的中心对齐?请帮忙!
我正在开发一个使用Facebook SDK的Android应用程序(使用最新版本,3.6).这是我第一次使用SDK并尝试根据示例中提供的示例代码启动简单的登录页面工作(美味).我无法在我的xml布局中解析LoginButton.它无法引用com.facebook.widget.LoginButton.我尝试将类文件LoginButton源复制到我自己的名为FBLoginButton的类中,然后将布局文件编辑为如下所示:
<!-- <com.facebook.widget.LoginButton -->
<!--<com.facebook.scrumptious.LoginButton -->
<com.example.myproject.FBLoginButton
android:id="@+id/login_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="30dp"
android:layout_marginBottom="30dp" />
Run Code Online (Sandbox Code Playgroud)
虽然我的类FBLoginButton本身没有错误,但我收到错误:
The following classes could not be instantiated:
- com.example.insultdroid.FBLoginButton (Open Class, Show Error Log)
Run Code Online (Sandbox Code Playgroud)
我已经花了无数个小时试图让LoginButton工作但没有成功.重建,清理,重启日食; 我已经做到了!有人可以帮帮我吗!
添加一个快照,显示我已添加到依赖项的facebooksdk.jar中提供了LoginButton类.
我有一组43个变量/列默认命名为X1,X2,X3 ..... X46当我创建数据帧时.我需要用Q来重温X. 有更快的方法在R中执行此操作,还是必须在每个X上单独使用rename()?请帮助,我想学习有效的方法来实现这一目标!(我是新手R程序员)
我对Android开发相对较新,并且对设计指南和正确的布局技术没有非常深刻的理解.我正在使用需要如下所示的屏幕:
我目前使用的代码是几个线性布局块的混合,我知道这不是实现这种布局的正确方法.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="com.example.culami.WelcomePageActivity"
android:orientation="vertical" >
<TextView
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
android:text="@string/welcome_msg"
android:layout_gravity="center"
android:textSize="50sp" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="2"
android:orientation="horizontal"
android:layout_marginTop="15dp" >
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/userIcon1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:src="@drawable/user1"
android:contentDescription="@string/userProfileMSG"
android:layout_gravity="center"
android:onClick="" />
<TextView
android:id="@+id/nameUser1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/nameUser1"
android:layout_gravity="center"
android:textSize="24sp" />
</LinearLayout>
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content"
android:orientation="vertical" >
<ImageView
android:id="@+id/userIcon2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="3dp"
android:src="@drawable/user2"
android:contentDescription="@string/userProfileMSG"
android:layout_gravity="center"
android:onClick="" />
<TextView
android:id="@+id/nameUser2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:text="@string/nameUser2"
android:layout_gravity="center"
android:textSize="24sp" /> …
Run Code Online (Sandbox Code Playgroud) android ×5
facebook ×2
javascript ×2
layout ×2
r ×2
sql ×2
button ×1
command-line ×1
d3.js ×1
force-layout ×1
gradle ×1
java ×1
max ×1
mysql ×1
phpmyadmin ×1
prompt ×1
python ×1
rename ×1
text-align ×1
textview ×1
url ×1