我目前在我的Android应用程序中有一个视图,视图正在播放帧动画.我想为视图设置动画,将其大小增加到150%.当我对其应用缩放动画并完成缩放动画时,我希望视图在活动的其余部分生命周期中保持新的大小.不幸的是,当放大动画完成时,视图会快速恢复到原始大小.我怎样才能保持新的动画转换?
我正在使用
myView.startAnimation(AnimationUtils.loadAnimation(mContext,R.anim.scaleUp150));
Run Code Online (Sandbox Code Playgroud)
谢谢!
我有一个简单的查询需求:查找自2013年1月1日起订购的用户列表.
在SQL中,这是一个非常简单的查询.
但我正在使用Rails和Active Record.
所以我写道: User.joins(:orders).where("orders.created_at >= '2013-01-01 00:00:00'")
在我们的数据库中,我们自2013年1月1日起有75个用户发出了100个订单.(显然有些用户发了多个订单.)
但是,上面的表达式返回100个用户.(必须有重复.)
我试过了 User.joins(:orders).where("orders.created_at >= '2013-01-01 00:00:00'").uniq
这也行不通.
如何获得自2013年1月1日起订购的75位用户?
我有Docker版本1.10与嵌入式DNS服务.
我在docker-compose文件中创建了两个服务容器.它们可以通过主机名和IP相互访问,但是当我想从主机到达其中一个时,它不起作用,它只适用于IP但不适用于主机名.
那么,是否可以通过Docker 1.10中的主机名从主机访问docker容器,好吗?
更新:
泊坞窗,compose.yml
version: '2'
services:
service_a:
image: nginx
container_name: docker_a
ports:
- 8080:80
service_b:
image: nginx
container_name: docker_b
ports:
- 8081:80
Run Code Online (Sandbox Code Playgroud)
然后我按命令启动它: docker-compose up --force-recreate
当我跑:
docker exec -i -t docker_a ping -c4 docker_b - 有用docker exec -i -t docker_b ping -c4 docker_a - 有用ping 172.19.0.2- 它的工作原理(172.19.0.2是docker_b的)ping docker_a- 失败了结果docker network inspect test_default是
[
{
"Name": "test_default",
"Id": "f6436ef4a2cd4c09ffdee82b0d0b47f96dd5aee3e1bde068376dd26f81e79712",
"Scope": "local",
"Driver": "bridge",
"IPAM": { …Run Code Online (Sandbox Code Playgroud) 我一直在调试这个Rails的奇怪问题,给我"桌面的未知主键......",即使桌子的ID在那里.
我已经将数据库从一个heroku应用程序复制到另一个,在原始数据库上没有问题,新的一个给了我一个db错误.
这是错误:
ProductsController# (ActionView::Template::Error) "Unknown primary key for table collections in model Collection."
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/reflection.rb:366:in `primary_key'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/reflection.rb:480:in `association_primary_key'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:58:in `block in add_constraints'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `each'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `each_with_index'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:39:in `add_constraints'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association_scope.rb:31:in `scope'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association.rb:98:in `association_scope'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/association.rb:87:in `scoped'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_association.rb:573:in `first_or_last'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_association.rb:105:in `last'
/app/vendor/bundle/ruby/2.0.0/gems/activerecord-3.2.13/lib/active_record/associations/collection_proxy.rb:46:in `last'
/app/app/helpers/likes_helper.rb:62:in `significant_liker'
Run Code Online (Sandbox Code Playgroud)
引起它的那条线:
product.collections.last.try :user
Run Code Online (Sandbox Code Playgroud)
和表:
d8apjspa441pad=> \d collections
Table "public.collections"
Column | Type | Modifiers
----------------+------------------------+----------------------------------------------------------
id | integer | not null default nextval('collections_id_seq'::regclass)
name | character varying(255) |
user_id | integer |
permalink | character varying(255) |
category_id …Run Code Online (Sandbox Code Playgroud) postgresql ruby-on-rails heroku rails-activerecord heroku-postgres
我开始使用Dagger设置依赖注入,如下所示.因为我可能有错误,所以请鼓励我更正我的实施!该实现遵循项目提供的android-simple示例.在下面你可以看到我是如何成功添加依赖注入Activities和Fragments.我现在试着保持简单,所以我决定将Timber注入Android的log util的记录器替换.
import android.app.Application;
import java.util.Arrays;
import java.util.List;
import dagger.ObjectGraph;
import com.example.debugging.LoggingModule;
public class ExampleApplication extends Application {
private ObjectGraph mObjectGraph;
protected List<Object> getModules() {
return Arrays.asList(
new AndroidModule(this),
new ExampleModule(),
new LoggingModule()
);
}
private void createObjectGraphIfNeeded() {
if (mObjectGraph == null) {
Object[] modules = getModules().toArray();
mObjectGraph = ObjectGraph.create(modules);
}
}
public void inject(Object object) {
createObjectGraphIfNeeded();
mObjectGraph.inject(object);
}
}
Run Code Online (Sandbox Code Playgroud)
到现在AndroidModule没有任何地方使用,但可能会有所帮助时,Context并LayoutInflater …
android dependency-injection android-contentprovider android-asynctask dagger
我的android应用程序名称长三个字,但是当我把它放在手机中它变成两个字长.怎么解决这个?我看到许多应用程序有三个单词的例子:"高级任务杀手"
我拖了谷歌大学大约一个小时左右,但没有一个关于这个主题的好文档:-(希望有人可以提供帮助.我愿意买一本书,只要有人能告诉我哪一本.
我使用以下版本:
要开始在Active Record中使用会话存储而不是cookie,我做了以下操作:
更新config/initializers/session_store.rb.
评论第一行并取消注释最后一行,所以我有:
# Be sure to restart your server when you modify this file.
# Myapp::Application.config.session_store :cookie_store, key: '_elegato_session'
# Use the database for sessions instead of the cookie-based default,
# which shouldn't be used to store highly confidential information
# (create the session table with "rails generate session_migration")
Myapp::Application.config.session_store :active_record_store
Run Code Online (Sandbox Code Playgroud)rake db:sessions:create
invoke active_record
create db/migrate/20120729025112_add_sessions_table.rb
Run Code Online (Sandbox Code Playgroud)rake db:migrate
== CreateLinkedinUsers: migrating ============================================
-- create_table(:linkedin_users)
-> 0.0236s
== CreateLinkedinUsers: migrated …Run Code Online (Sandbox Code Playgroud)我有一个工厂(注册表DP)初始化类:
public class GenericFactory extends AbstractFactory {
public GenericPostProcessorFactory() {
factory.put("Test",
defaultSupplier(() -> new Test()));
factory.put("TestWithArgs",
defaultSupplier(() -> new TestWithArgs(2,4)));
}
}
interface Validation
Test implements Validation
TestWithArgs implements Validation
Run Code Online (Sandbox Code Playgroud)
并在AbstractFactory中
protected Supplier<Validation> defaultSupplier(Class<? extends Validation> validationClass) {
return () -> {
try {
return validationClass.newInstance();
} catch (InstantiationException | IllegalAccessException e) {
throw new RuntimeException("Unable to create instance of " + validationClass, e);
}
};
}
Run Code Online (Sandbox Code Playgroud)
但我不断得到无法推断功能接口类型错误.我在这做错了什么?
我目前正在研究Android Support Package v4 Rev 10的NotificationCompat功能.文档说'setContentText()'显示通知中的第二行.这适用于API 8直到API 15.但是,如果我尝试在API 16中使用此方法,我的通知将错过第二行.我只看到标题而不是第二行.添加多行是没有问题的(使用'addline()').
这是我使用的NotificationCompat.Builder的代码:
private NotificationCompat.Builder buildNormal(CharSequence pTitle) {
NotificationCompat.Builder builder = new NotificationCompat.Builder(
getSherlockActivity());
builder.setAutoCancel(true).setDefaults(Notification.DEFAULT_ALL);
// set the shown date
builder.setWhen(System.currentTimeMillis());
// the title of the notification
builder.setContentTitle(pTitle);
// set the text for pre API 16 devices
builder.setContentText(pTitle);
// set the action for clicking the notification
builder.setContentIntent(buildPendingIntent(Settings.ACTION_SECURITY_SETTINGS));
// set the notifications icon
builder.setSmallIcon(android.R.drawable.stat_sys_download_done);
// set the small ticker text which runs in the tray for a few seconds
builder.setTicker("This is your …Run Code Online (Sandbox Code Playgroud) 为了确保容器的健康检查,我需要对多个 URL 执行测试调用。
curl -f http://example.com和curl -f http://example2.com
是否可以执行多个curl 调用来进行docker 健康检查?
android ×4
docker ×2
activerecord ×1
animation ×1
dagger ×1
health-check ×1
heroku ×1
java ×1
java-8 ×1
lambda ×1
postgresql ×1
registry ×1
session ×1