这可能听起来很傻,但我无法在任何地方找到如何指定ScaleTAnimation的pivotXType和pivotYType.
我知道如何以编程方式进行,但我需要通过XML指定它(我需要它用于活动之间的转换,使用overridePendingTransition方法)
这是有效的代码:
Animation animation=new ScaleAnimation(1,0,1,0,ScaleAnimation.RELATIVE_TO_SELF,(float)0.5,ScaleAnimation.RELATIVE_TO_SELF,(float)0.5);
animation.setDuration(1000);
Run Code Online (Sandbox Code Playgroud)
这是XML,没有我正在寻找的XML属性
<?xml version="1.0" encoding="utf-8"?>
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="1"
android:toXScale="0"
android:fromYScale="1"
android:toYScale="0"
android:pivotX="0.5"
android:pivotY="0.5"
android:duration="2000"
/>
Run Code Online (Sandbox Code Playgroud)
我查看了http://developers.androidcn.com/reference/android/view/animation/ScaleAnimation.html上的文档,但没有找到任何答案.谢谢.
我花了几个小时来搜索这个错误,我几乎测试了它在Google上的所有内容.
我想在C#中使用TCP,.NET4和VS2010访问服务.
我有一个非常小的服务:
namespace WcfService_using_callbacks_via_tcp
{
[ServiceContract(CallbackContract = typeof(ICallback), SessionMode = SessionMode.Required)]
public interface IService1
{
[OperationContract]
string Test(int value);
}
public interface ICallback
{
[OperationContract(IsOneWay = true)]
void ServerToClient(string sms);
}
[ServiceBehavior(ConcurrencyMode = ConcurrencyMode.Multiple)]
public class Service1 : IService1
{
public string Test(int value)
{
ICallback the_callback = OperationContext.Current.GetCallbackChannel<ICallback>();
the_callback.ServerToClient("Callback from server, waiting 1s to return value.");
Thread.Sleep(1000);
return string.Format("You entered: {0}", value);
}
}
}
Run Code Online (Sandbox Code Playgroud)
使用此Web.config:
<?xml version="1.0"?>
<configuration>
<system.web>
<compilation debug="true" targetFramework="4.0" />
</system.web>
<system.serviceModel>
<services>
<service …Run Code Online (Sandbox Code Playgroud) 我在使用Factory Girl中的回调模型和方法时遇到了一些困难.使用这篇文章http://robots.thoughtbot.com/post/254496652/aint-no-calla-back-girl我开始给它一个去,现在我在规范中出错了.我是Rails的新手......所以我可能会遗漏一些非常基本的东西.
错误是:失败/错误:@ user = Factory(:admin_user)未定义方法'each'for#
型号:
class User < ActiveRecord::Base
# Include default devise modules. Others available are:
# :token_authenticatable, :confirmable, :lockable and :timeoutable
devise :database_authenticatable, :registerable, :lockable,
:recoverable, :rememberable, :trackable, :validatable, :token_authenticatble
# Setup accessible (or protected) attributes for your model
attr_accessible :username, :email, :role_ids, :password, :password_confirmation, :remember_me
has_many :userroles
has_many :roles, :through=>:userroles
def role?(role)
return !!self.roles.find_by_name(role.to_s.camelize)
end
end
class Role < ActiveRecord::Base
attr_accessible :name
validates :name, :presence=>true,
:length=>{:minimum=>4, :maximum=>30}
has_many :userroles
has_many :users, :through=>:userroles
end …Run Code Online (Sandbox Code Playgroud) 在hginit.com上,典型的hg工作流程描述为:
1.如果你有一段时间没有这样做,请获取其他人正在使用的最新版本:
hg pull
hg up
2.做一些改变
3.提交他们(本地)4.
重复步骤2-3直到你你有一些很好的代码,你愿意对其
他人施加影响
5.当你准备好分享时:
hg pull来获取其他人的变化(如果有的话)
hg merge将它们合并到你的
测试中!确保合并没有搞砸
hg commit(合并)hg push
我经常使用hg,这对我来说都很有意义.我刚刚开始使用git,而且我没有找到任何描述典型工作流程的内容,如上面的引用.我希望有人可以解释这两个工具之间的工作流程差异,并描述git中的典型工作流程.
嗨,我有一个PHP脚本,读取文本文件.当文本文件大小超过某个限制时,脚本会出错并停止.当我将文件分成两部分时,它可以工作.那么PHP中的设置在哪里增加读取文件内存?
我正在使用git svn公司强制的svn服务器获得一些git goodness.我刚刚变得非常糟糕,我正试图找出最好的恢复方法.
这是发生的事情:
首先,我有这个
---1 (master)
\--B--C--D--E (feature/fix-widgets)
Run Code Online (Sandbox Code Playgroud)所以然后我做了git checkout master,然后git svn rebase在master上下拉这些提交.我没想到我的功能分支和主人之间有任何冲突,因为更改是在一个完全不同的文件夹中.所以在这一点上,我想我有这个:
---1--2--3--4 (master)
\--B--C--D--E (feature/fix-widgets)
Run Code Online (Sandbox Code Playgroud)
1--2--3--4从svn提交的提交在哪里.
接下来,我做的git checkout feature/fix-widgets,然后git rebase master.有一些冲突,有些事情没有加起来,所以我决定撇开并更仔细地看待事情.我这样做git rebase --abort,希望这能让我恢复到变形前的状态.
我这样做git rebase --abort并收到以下消息
$ git rebase --abort
error: git checkout-index: unable to create file somedir/somefile.cs (Permission denied)
fatal: Could not reset index file to revision 'be44daa05be39f6dd0d602486a598b63b6bd2af7'.
Run Code Online (Sandbox Code Playgroud)现在我不知道该怎么做.git status表明我已经开启了feature/fix-widgets,但是我有一大堆阶段性的更改,以及之前提交的大量未跟踪文件.如果我能回来,我会没事的E.
我正在尝试从小部件远程控制动态壁纸.他们在同一个APK中,但显然是不同的过程.调用动态壁纸的"活动"对我来说没什么用处,因为它是一个不同的过程.小部件有简单的按钮,按下时,
那么(我认为)我需要的是IPC和AIDL.
首先,我在壁纸一侧创建了AIDL,效果很好.它有三种方法,没有额外的参数.但是当我将客户端添加到窗口小部件时,我收到一个错误,告诉我无法绑定到该远程接口,因为窗口小部件已经是BroadcastListener.我尝试在不需要Widget成为BroadcastListener的情况下获取按钮处理,但这似乎是不可能的.
好吧没问题吧?我刚刚在窗口小部件中创建了一个绑定到远程接口的服务,因为虽然窗口小部件是BroadcastListener,但服务不是,一切都应该没问题.
或者我想.
好吧,我正在获取小部件的按钮来触发小部件服务.绑定到远程服务会产生以下警告:
无法启动服务Intent(act = com.blabla.IRemoteService):找不到.
我在小部件的服务中使用getApplicationContext()来绑定到远程的东西.我在清单中有小部件服务,但我没有远程服务.当我把它放在那里时,我得到一个非特定的InstantiationException.
在Widget的服务onStart()我这样做:
getApplicationContext().bindService(new Intent(IWallpaperRemote.class.getName()),
mConnection, Context.BIND_AUTO_CREATE);
Run Code Online (Sandbox Code Playgroud)
我也有...
private ServiceConnection mConnection = new ServiceConnection() {
public void onServiceConnected(ComponentName className,
IBinder service) {
mService = IWallpaperRemote.Stub.asInterface(service);
isBound = true;
Log.i("WidgetServiceConnection", "binding to service succeeded");
}
public void onServiceDisconnected(ComponentName className) {
mService = null;
isBound = false;
Log.i("WidgetServiceConnection", "binding to service lost!");
}
};
Run Code Online (Sandbox Code Playgroud)
我的问题是:有没有人成功地从一个小部件进入另一个应用程序的远程调用?考虑到我在这里谈论一个动态壁纸,以及我对在小部件过程中调用活动但在动态壁纸中引起函数调用不感兴趣的事实,除了IPC之外我还有哪些选项,如果有的话?
如果IPC是去这里的方式,我做错了什么?
我正在使用Javascript编写RSS阅读器XMLHttpRequest.
对于一些RSS Feeds,我没有遇到任何问题,但在某些情况下,xmlDocument.firstChild属性始终如此NULL
在尝试查看有效的XML和无效的XML之间的差异后,我发现以下是导致错误的原因.
<item>
<description>
<![CDATA[This is a description for a test [...]]]>
</description>
</item>
Run Code Online (Sandbox Code Playgroud)
因为在这个描述标签中我有一个结束括号后跟CDATA的右括号导致我的错误,我用C#使用LINQ为相同的XML制作了一个代码,一切正常.
在CDATA的右括号之前的右括号引起了这种奇怪的行为.作为测试我尝试使用C#和LINQ读取相同的XML,一切正常.
然后我尝试在右括号之间添加一个空格,如下所示
<![CDATA[This is a description for a test [...] ]]>
它奏效了!
我的javascript代码
function LoadRSS() {
http_request.onreadystatechange = function () { showContent(http_request); };
http_request.open("GET", "./feeds/test.xml", true);
http_request.send(false);
}
function showContent(http_request) {
if (http_request.readyState == 4) {
if (http_request.status == 200) {
var parser = new DOMParser();
var xml_doc = parser.parseFromString(http_request.responseText, "text/xml");
alert(xml_doc.firstChild)
}
else {
xml_doc = null; …Run Code Online (Sandbox Code Playgroud)