我试图让用户在Android应用程序中"喜欢"Facebook粉丝页面.我能够使用像这样的代码成功"喜欢"像墙评论这样的对象,
mFacebook = new Facebook(APP_ID);
SessionStore.restore(mFacebook, this);
mAsyncRunner = new AsyncFacebookRunner(mFacebook);
Bundle parameters = new Bundle();
mAsyncRunner.request(COMMENT_ID + "/likes", parameters, "POST", new MyRequestListener(), "");
Run Code Online (Sandbox Code Playgroud)
但是,如果我输入页面ID而不是注释ID,我会在Facebook响应中收到此错误消息,
Response: {"error":{"type":"OAuthException","message":"(#200) App does not have permission to make this call"}}
Run Code Online (Sandbox Code Playgroud)
我在登录时获得"publish_stream"和"offline_access"发布权限,并使用SessionStore.restore()将它们提供给Facebook对象.
1)Facebook让应用程序"喜欢"粉丝页面吗?
2)如果是这样,任何关于我做错的想法?
谢谢,马特
为什么当我呼唤RtlDosPathNameToNtPathName_U
路径时\\?\C:
,而不是回来
\??\C:
Run Code Online (Sandbox Code Playgroud)
我回来了
\??\C:\?\\?\C:
Run Code Online (Sandbox Code Playgroud)
哪个明显不正确?
代码段(在D中):
struct CurDir { UnicodeString DosPath; HANDLE Handle; }
extern (Windows) static bool RtlDosPathNameToNtPathName_U(
in const(wchar)* DosPathName, out UnicodeString NtPathName,
out const(wchar)* NtFileNamePart, out CurDir DirectoryInfo);
wchar[] toNtPath(const(wchar)[] path)
{
UnicodeString ntPath;
CurDir curDir;
const(wchar)* fileNamePart;
enforce(RtlDosPathNameToNtPathName_U(path.ptr, ntPath,
fileNamePart, curDir));
try
{ return ntPath.Buffer[0 .. ntPath.Length / ntPath.Buffer[0].sizeof].dup; }
finally { RtlFreeHeap(RtlGetProcessHeap(), 0, ntPath.Buffer); }
}
writeln(toNtPath(r"\\?\C:")); //Returns the weird string
Run Code Online (Sandbox Code Playgroud)
更新:
我想出了问题 - 看我的答案.
尝试使用Hibernate 3.6和MySQL5.1选择一个实体,但我不断得到一个ClassCastException.
@Entity
@Table( name = "USER" )
public class User {
@Id
@Column(name= "user_id")
private Long userId;
@OneToOne()
@JoinColumn(name="status_id")
protected UserStatusType userStatusType;
@OneToOne()
@JoinColumn(name="region_id")
protected Region region;
@Entity
@Table( name = "REGION" )
public class Region
@Id
@Column(name = "region_id")
private Long regionId
@Entity
@Table( name = "USER_STATUS_TYPE" )
public class UserStatusType
@Id
@Column(name = "type_id")
private Long typeId
Run Code Online (Sandbox Code Playgroud)
在createQuery()中尝试使用HQL时,我不断收到ClassCastException:
session.beginTransaction();
User user = (User)session.createQuery(
"from User u, UserStatusType ust, Region r "
+ " where u.userId = ? …
Run Code Online (Sandbox Code Playgroud) 我正在运行Eclipse 3.6.1 Classic,默认情况下不附带Eclipse Marketplace插件.我浏览了Eclipse网站,但是我没有看到安装Eclipse Marketplace的可用插件.我只是没有看到它?
嗨,有没有人知道是否可以将图片显示为字符串网格的背景,或者是否有人知道任何可以执行此操作的免费网格组件.
谢谢
科林
如果我没有指定阶段,插件什么时候会执行?
例如,插件
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>1.0.1</version>
<executions>
<execution>
<configuration>
<!-- if you don't specify any modules, the plugin will find them -->
<!-- <modules> <module>learning.vaadin.gwt.ColorPickerWidgetSet</module> </modules> -->
</configuration>
<goals>
<goal>update-widgetset</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud) 我可以在一个文件中运行所有测试:
rake test TEST=path/to/test_file.rb
Run Code Online (Sandbox Code Playgroud)
但是,如果我想在该文件中只运行一个测试,我该怎么做?
我正在寻找类似的功能:
rspec path/to/test_file.rb -l 25
Run Code Online (Sandbox Code Playgroud) 在我工作的公司,我们有两个环境:测试和生产.由于成本原因,我们目前没有开始新的环境.
以下是我们遵循的流程:业务部门发布功能请求,开发实现并在测试环境中部署.然后进行业务测试(UAT),如果没问题,该功能将包含在下一个生产部署中.
问题显示在测试DB上.开发人员将测试环境视为他们的游乐场,有时他们将数据库保持在初始状态以进行测试.另一方面,商业人士认为测试数据库必须稳定,不应重置.我们希望解决此问题,并确定测试环境是否应属于开发团队或业务团队.(开发人员不希望企业在测试环境中嗤之以鼻,但业务团队正在为服务器付费.)
什么是环境的最佳实践?你能推荐一篇关于这个的文章吗?
我正在尝试让PowerMock与mockito一起使用,我在这里关注文档:http://code.google.com/p/powermock/wiki/MockitoUsage13.
为了简化一下,我们假设我有一个静态方法:
StaticObj.put(String key, String val) { ... }
Run Code Online (Sandbox Code Playgroud)
要测试的类是这样的:
public class ClassToTest {
public void doSomething(Params p) {
if (StringUtils.isNotBlank(p.getK()) StaticObj.put("k1", p.getK());
if (StringUtils.isNotBlank(p.getX()) StaticObj.put("x1", p.getX());
}
}
Run Code Online (Sandbox Code Playgroud)
在我的单元测试中,我想验证当它们不为空或为null时,为K和X调用StaticObj.put,所以我做了类似这样的事情:
public void testNormalCase() {
// assume that mocking setup for statics already happened in some @Before function..
Params params = new Params("k", "x");
ClassToTest classToTest = new ClassToTest();
classToTest.doSomething(params);
// now I want to verify:
PowerMockito.verifyStatic(times(1));
StaticObj.put("k1", "k1");
PowerMockito.verifyStatic(times(1));
StaticObj.put("x1", "x");
}
Run Code Online (Sandbox Code Playgroud)
这是有效的,这是我所期待的.什么不起作用,如果我注释掉K的验证,那么X的验证失败了!错误消息表明("x1","x")是预期的,但得到了("k1","k").为什么是这样?我没有正确编码吗?
此外,它让我相信以下类型的测试,可能完全通过错误的原因:
public void …
Run Code Online (Sandbox Code Playgroud) int flag = 0;
int price = 0;
while (flag==0)
{
printf("\nEnter Product price: ");
scanf("%d",&price);
if (price==0)
printf("input not valid\n");
else
flag=1;
}
Run Code Online (Sandbox Code Playgroud)
当我输入一个有效数字时,循环按预期结束。但是如果我输入的不是数字,比如hello
,那么代码就会进入无限循环。它只是继续打印Enter Product price:
和input not valid
。但它不会等我输入一个新号码。这是为什么?