我正在从一个大规模的现有项目(Vizster)创建一个Java applet.我在Mac OS X上使用NetBeans 6.7.1和JDK 1.5.
我试图从它的单输出.jar文件运行applet,但是当我这样做时,它在Firefox的屏幕底部显示"applet loaded",并且在java控制台中没有任何内容,但是没有显示在小程序的窗口.我之前在Firefox中遇到过不同的错误,包括"appletNotLoaded:ClassDefNotFoundError"等错误以及安全错误,但我的java控制台中从未有任何输出.这是applet的html文件:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<applet codebase ="." code="zuve.ZuveApplet.class"
archive="ZuveApplet.jar"
height="1000" width="1000"/>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
其中zuve.ZuveApplet.class是我的main方法所在的位置,"ZuveApplet.jar"是输出jar文件的名称.这是ZuveApplet.java,主要方法类:
package zuve;
import vizster.Vizster;
import vizster.VizsterLib;
import java.applet.Applet;
public class ZuveApplet extends Applet {
public static final String DEFAULT_START_UID = "186297";
@Override
public void init() {
new Vizster();
}
public static void main(String[] argv) {
VizsterLib.setLookAndFeel();
//String startUID = argv.length > 0 ? argv[0] : DEFAULT_START_UID; …
Run Code Online (Sandbox Code Playgroud) 我想自定义图像添加到MKMapView
作为一个MKOverlayView
-我需要从能够覆盖的范围之外滚动限制用户.有没有现成的功能呢?还是其他任何建议?
谢谢,马特
我正在使用XCode 3.2.3和iOS 4.0上的OCUnit在我的iPhone应用程序上进行单元测试.我已成功设置我的测试环境以适当地传递和失败基本测试,但是当我导入自己的文件时(在这种情况下,"UserAccount.h",它无法编译并告诉我:
"_OBJC_CLASS _ $ _ UserAccount",引自:
然后它说"未找到符号".这让我感到某种链接器错误,但我不知道发生了什么.我已多次建造和清理所有目标,但无济于事.这是我的测试代码:
#import "SomeTestCase.h"
#import "UserAccount.h"
@implementation SomeTestCase
- (void)testUserAccount
{
// UserAccount.m //
UserAccount *testAccount = [[UserAccount alloc] initWithUsername:@"" password:@"" deviceToken:@""];
[testAccount registerNew];
NSLog(@"USERID = %@", testAccount.userID);
STAssertEquals([testAccount login], NO, @"Failure: Login should fail with blank username and password."); // should fail with no username or password
UserAccount *testAccount2 = [[UserAccount alloc] initWithUsername:@"user" password:@"" deviceToken:@""];
STAssertEquals([testAccount2 login], NO, @"Failure: Login should fail with blank password.");// should fail with no password
UserAccount *testAccount3 …
Run Code Online (Sandbox Code Playgroud) 我试图透露(通过动画)UIView.具体来说,我想要显示视图的中心部分,然后慢慢显示它的外边缘(有点像拉回窗帘).
我的第一个尝试是简单地将边界rect设置为更小并将其设置为视图框架的完整大小,但是这没有达到预期的效果,因为通过更改边界我也在更改框架.
如果我想要做的事情听起来不可能(至少不是以简单的方式),至少我希望能够有一些方法使主视图的子视图相对于屏幕静止,而不是他们的父视图,因为父级调整大小(这会产生类似的效果).
有任何想法吗?
谢谢,
-Matt
我试图使用iPhone OS 3.2在MKMapView上找到两点之间的欧几里德距离.问题是我在纬度和经度方面有这些坐标,这在数学上为我提供了足够的数据来找到距离,但它需要一些棘手的三角函数.有没有更简单的解决方案?
谢谢!
我正在尝试使用Dagger 1.2.2版的DI在Android Studio 1.0中设置Android单元测试.
每当我运行我的测试并尝试使用我的测试模块实例化ObjectGraph时,我会得到以下错误/ stacktrace:
java.lang.IllegalStateException: Module adapter for class java.util.Arrays$ArrayList could not be loaded. Please ensure that code generation was run for this module.
at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:45)
at dagger.internal.FailoverLoader$1.create(FailoverLoader.java:40)
at dagger.internal.Memoizer.get(Memoizer.java:56)
at dagger.internal.FailoverLoader.getModuleAdapter(FailoverLoader.java:57)
at dagger.internal.Modules.loadModules(Modules.java:43)
at dagger.ObjectGraph$DaggerObjectGraph.makeGraph(ObjectGraph.java:174)
at dagger.ObjectGraph$DaggerObjectGraph.access$000(ObjectGraph.java:138)
at dagger.ObjectGraph.create(ObjectGraph.java:129)
at com.company.app.HttpRequestManagerTest.setUp(HttpRequestManagerTest.java:35)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:191)
at android.test.AndroidTestRunner.runTest(AndroidTestRunner.java:176)
at android.test.InstrumentationTestRunner.onStart(InstrumentationTestRunner.java:555)
at android.app.Instrumentation$InstrumentationThread.run(Instrumentation.java:1837)
Run Code Online (Sandbox Code Playgroud)
这是破解代码(@ ObjectGraph.create
):
@Override
public void setUp() throws Exception {
super.setUp();
setContext(new MockContext());
mObjectGraph = ObjectGraph.create(Arrays.asList(new TestModule()));
mObjectGraph.inject(this);
}
Run Code Online (Sandbox Code Playgroud)
潜水更深,这里是TestModule
:
package com.company.app.provider;
import dagger.Module;
@Module(
overrides …
Run Code Online (Sandbox Code Playgroud) 我试图根据词典中的特定键来删除NSArray的NSArray.我看到的是这样的:
NSDictionary *person1 = [NSDictionary dictionaryWithObjectsAndKeys:@"John", @"firstName", @"Smith", "lastName", @"7898", @"employeeID"];
NSDictionary *person2 = [NSDictionary dictionaryWithObjectsAndKeys:@"Eric", @"firstName", @"Johnson", "lastName", @"1718" @"employeeID"];
NSDictionary *person3 = [NSDictionary dictionaryWithObjectsAndKeys:@"John", @"firstName", @"Smith", "lastName", @"1153", @"employeeID"];
NSMutableArray *personArray = [NSArray arrayWithObjects:person1, person2, person3, nil];
// insert some code to de-dupe personArray based SOLELY on the firstName and lastName keys
Run Code Online (Sandbox Code Playgroud)
请注意,有两名员工姓名相同但ID不同.我想做的只是回到一个只有person1和person2的新数组,因为person3具有相同的数据 - 我只是不关心这个特定问题中的"employeeID"值.
有任何想法吗?谢谢!
-Matt