基本上,Android 谷歌登录在用户按下登录按钮之后和谷歌完成登录过程之前闪烁一个小的空白框.这一切都发生得非常快,但我想摆脱白盒子.我假设这个白框是尝试显示进度条的失败.
编辑:添加正在发生的事情的图形重新创建...
我在三星Tab 3上测试.
此问题不包括用户第一次登录或撤消访问后的情况.
GoogleSignInOptions gso = new GoogleSignInOptions.Builder(GoogleSignInOptions.DEFAULT_SIGN_IN)
.requestEmail()
.requestIdToken(getString(R.string.google_server_client_id))
.build();
// google login stuff
googlebutton = (com.google.android.gms.common.SignInButton) findViewById(R.id.googlebutton);
googlebutton.setOnClickListener(this);
googlebutton.setStyle(SignInButton.SIZE_STANDARD, SignInButton.COLOR_LIGHT);
// Build GoogleApiClient with access to basic profile
mGoogleApiClient = new GoogleApiClient.Builder(this)
.enableAutoManage(this /* FragmentActivity */, this /* OnConnectionFailedListener */)
.addApi(Auth.GOOGLE_SIGN_IN_API, gso)
.build();
Run Code Online (Sandbox Code Playgroud)
和登录功能......
private void gSignIn() {
Intent signInIntent = Auth.GoogleSignInApi.getSignInIntent(mGoogleApiClient);
startActivityForResult(signInIntent, RC_SIGN_IN);
}
Run Code Online (Sandbox Code Playgroud)
理想情况下,我想恢复正常的进度条行为.
这是我的傻瓜......
apply plugin: 'com.android.application'
android {
compileSdkVersion 23
buildToolsVersion '23.0.0'
defaultConfig {
applicationId "xxxxxxxxx"
minSdkVersion 17 …Run Code Online (Sandbox Code Playgroud) 我喜欢使用 systemd 的日志来查看和管理我自己的脚本的日志。我已经意识到您可以根据每条消息从我的用户脚本登录日志。
echo 'hello' | systemd-cat -t myscript -p emerg
Run Code Online (Sandbox Code Playgroud)
有没有办法将所有消息重定向到日志,甚至是由其他命令生成的消息?喜欢..
exec &> systemd-cat
Run Code Online (Sandbox Code Playgroud)
更新:
取得了部分成功。从终端尝试了Inian的建议。
~/scripts/myscript.sh 2>&1 | systemd-cat -t myscript.sh
Run Code Online (Sandbox Code Playgroud)
它起作用了,stdout 和 stderr 被定向到 systemd 的日志。奇怪的是,
~/scripts/myscript.sh &> | systemd-cat -t myscript.sh
Run Code Online (Sandbox Code Playgroud)
在我的 Bash 终端中不起作用。
当其他程序调用我的脚本时,我仍然需要找到一种方法在我的脚本中执行此操作。
我试过..
exec 2>&1 | systemd-cat -t myscript.sh
Run Code Online (Sandbox Code Playgroud)
但它不起作用。
更新2:
从航站楼出发
systemd-cat ~/scripts/myscript.sh
Run Code Online (Sandbox Code Playgroud)
作品。但我仍在寻找一种从脚本中执行此操作的方法。
在我的jpg解码器中,我有一个带有if语句的循环,它将始终为true或始终为false,具体取决于图像.我可以创建两个单独的函数来避免if语句,但我好奇地想知道效率对效率的影响是使用函数指针而不是if语句.如果为true,它将指向内联函数,如果为false,则指向空内联函数.
class jpg{
private:
// emtpy function
void inline nothing();
// real function
void inline function();
// pointer to inline function
void (jpg::*functionptr)() = nullptr;
}
jpg::nothing(){}
main(){
functionptr = &jpg::nothing;
if(trueorfalse){
functionptr = &jpg::function;
}
while(kazillion){
(this->*functionptr)();
dootherstuff();
}
}
Run Code Online (Sandbox Code Playgroud)
这可能比if语句快吗? 我的猜测是否定的,因为内联将是无用的,因为编译器将不知道在编译时内联哪个函数并且函数指针地址解析比if语句慢.
我已经对我的程序进行了描述,而且当我运行程序时,我预期会出现明显的差异......我没有遇到明显的差异.所以我只是出于好奇而想知道.
是
if(!test)
Run Code Online (Sandbox Code Playgroud)
比...快
if(test==-1)
Run Code Online (Sandbox Code Playgroud)
我可以生产组装,但是生产了太多的组件,我无法找到我追求的细节.我希望有人知道答案.我猜它们是相同的,除非大多数CPU架构都有某种"比较为零"的捷径.
谢谢你的帮助.
我真的是Perl的新手。我有以下...
#!/usr/bin/perl
#config file
$config = "$ENV{'HOME'}/.config/.wallpaperrc";
open my $handle, '<', $config;
chomp(my @lines = <$handle>);
close $handle;
@regular = map(/^regular\.roll (.*)$/, @lines);
print(@regular);
Run Code Online (Sandbox Code Playgroud)
它可以工作,但是当我只期望一个匹配并且只想要一个匹配时,使用数组似乎很尴尬和不合适。如果我使用@regular标量,则该函数将返回匹配数目。
我试图搜索答案,但是在Bash中使用Perl grep的所有问题都使结果感到困惑。
是
int array[100] = {};
Run Code Online (Sandbox Code Playgroud)
比...快
int array[100];
for(int i=0; i<100; ++i){
array[i] = 0;
}
Run Code Online (Sandbox Code Playgroud)
还是相等?有什么区别?
我有类似于以下代码的代码
boost::thread myThread
unsigned char readbuffer[bignumber];
unsigned char writebuffer[bignumber];
for(int i=0; i<bignumber; ++i){
functiondostuff();
for(int j=0; j<2; ++j){
functiondomorestuff();
myThread = boost::thread(&myClass::myFunction, this, j, i);
}
}
Run Code Online (Sandbox Code Playgroud)
myFunction从缓冲区读取并写入另一个缓冲区.它永远不会写入写缓冲区中的相同位置.我在这里做过线程的根本错误吗?使用相同的线程名称循环创建线程是不是很糟糕?它运行平稳一段时间然后我得到以下异常.
在抛出'boost :: exception_detail :: clone_impl>'的实例后调用终止what():boost :: thread_resource_error:资源暂时不可用Aborted
这个例外是什么意思?任何想法都会有所帮助.
我有一个文件名数组,其中可能包含空格。我正在使用该shuf命令,但它使用文件名中的空格作为分隔符,并在随机播放时分解文件名。有办法解决这个问题还是我必须放弃该shuf命令?有什么建议么?
#!/bin/bash
vids=()
vids+=("file with spaces.txt")
for arr in "${vids[@]}"; do
echo -e "$arr\n"
done
vids=( $(shuf -e "${vids[@]}") ) #shuffle contents of array
for arr in "${vids[@]}"; do
echo -e "$arr\n"
done
exit 0
Run Code Online (Sandbox Code Playgroud)
输出:
file with spaces.txt
file
with
spaces.txt
Run Code Online (Sandbox Code Playgroud)