为了在Eclipse中创建我的第一个简单的Kotlin项目,我按照Kotlin官方网站上的Eclipse Luna入门教程中的步骤进行了操作,即:
main方法在"src"文件夹中创建文件"hello.kt"但是,我在Eclipse控制台中不断收到以下错误:
错误:无法找到或加载主类HelloKt
我已经仔细检查了我的项目的运行配置,它确实将"主类"设置为HelloKt(我100%确定它不存在).此外,当我点击"搜索"按钮时,Eclipse找到的唯一项目HelloKt - (default package)(同样不存在).
为了完整起见,请在下面找到hello.kt文件代码:
fun main(args: Array<String>) {
println("Hello, World")
}
Run Code Online (Sandbox Code Playgroud)
我注意到教程和我做的之间有以下不同之处:
jdk1.6.0_45,而我正在使用jdk1.7.0_79.请注意,我使用的是最新版本的Kotlin Eclipse插件,因此这与此帖中的情况不同.这些是我当前安装中的版本:
在运行应用程序时,这些差异是否会导致错误?
您是否看到/了解有关此方案的任何潜在原因或已知错误?
更新(2017年5月14日)
试用Eclipse Neon.3(eclipse.buildId = 4.6.3.M20170301-0400),JDK 1.8.0_111,Kotlin 0.8.2.v20170314-0957(kotlin-eclipse-policy 0.8.2.v20170314-0957,kotlin-weaving -feature 0.8.2.v20170314-0957,Equinox Weaving SDK 1.2.0.201701131634).问题依然存在.
我正在使用createSQL()Hibernate中的方法在我的数据库中进行插入操作.
我想要做的是删除自定义SQL语句,以便我可以将MD5()函数应用于表上的字段.这就是为什么我不能简单地使用这种save(Object)方法.
我从Eclipse IDE收到一条警告说:
The method createSQLQuery(String) from the type QueryProducer is deprecated.
尽管如此,插入操作仍按预期执行.
我在我的项目中使用的当前版本的Hibernate是5.2.5.Final.
所以,问题是:是否有另一种方法可以在这个版本的Hibernate中实现相同的目的,以摆脱那个烦人的警告?
我也知道添加@SuppressWarnings("deprecation")注释会解决问题,但我不确定它是否会在将来引起任何问题.
值得一提的是,我是使用这个框架的初学者.
我正在尝试使用Synaptics SDK在Synaptics触摸板上获取设备句柄,特别是使用SYNCTRLLib中的方法.但是,该SYNCTRL方法未能找到它,返回-1.
Syn.cs:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SYNCOMLib;
using SYNCTRLLib;
namespace TP_Test1
{
class Syn
{
SynAPICtrl SynTP_API = new SynAPICtrl();
SynDeviceCtrl SynTP_Dev = new SynDeviceCtrl();
SynPacketCtrl SynTP_Pack = new SynPacketCtrl();
int DeviceHandle;
//Constructor
public Syn ()
{
SynTP_API.Initialize();
SynTP_API.Activate();
//DeviceHandle == -1 ? Can't find device?
DeviceHandle = SynTP_API.FindDevice(new SynConnectionType(), new SynDeviceType(), 0);
//Below line causing Unhandled Exception
SynTP_Dev.Select(DeviceHandle);
SynTP_Dev.Activate();
SynTP_Dev.OnPacket += SynTP_Dev_OnPacket;
}
public void SynTP_Dev_OnPacket()
{ …Run Code Online (Sandbox Code Playgroud) 我试图在连接到Oracle DB的以下两个错误上研究此问题:
java.sql.SQLException:Io异常:Socket读取超时我的理解:
java.sql.SQLException:Io异常:套接字读取超时:这是连接成功的情况但由于某种原因,套接字/数据为空并最终超时,因为没有可用的数据.是否可以在本地Oracle DB环境中复制上述错误?步骤是什么?
感谢您抽出宝贵时间作出回应.
谢谢.
我今天想开始测试快速路线,但我可以弄清楚如何测试渲染翡翠视图。
这是我的代码:
路线:
router.get('/', function(req: any, res: any) {
res.render('index', { title: 'Express' });
});
Run Code Online (Sandbox Code Playgroud)
测试:
describe('GET / ', () => {
it('renders index', (done) => {
request(router)
.get('/')
.render('index', { title: 'Express' })
.expect(200, done);
});
});
Run Code Online (Sandbox Code Playgroud)
当然.render会导致错误。我应该如何测试渲染?
那是我目前的REST GET方法.
@GET
@Path("/URI/{input1}")
@Produces(MediaType.APPLICATION_JSON)
public List<T> getDetails(@PathParam("input1") String input1) throws ServiceException;
Run Code Online (Sandbox Code Playgroud)
现在我想再添加3个输入参数.我可以创建一个包含所有4个输入参数的POJO对象,并将该POJO传递给GET方法,而不是将所有4个参数添加为pathparams
@GET
@Path("/URI")
@Produces(MediaType.APPLICATION_JSON)
public List<T> getDetails(InputPojo input) throws ServiceException;
Run Code Online (Sandbox Code Playgroud)
带输入参数的POJO类:
class InputPojo {
String input1;
String input2;
String input3;
// Getters and Setters.
}
Run Code Online (Sandbox Code Playgroud)
或者这是针对REST GET规范的,我不能使用Java POJO对象作为输入参数?
我正在实现自定义“ AuthenticationProvider”。如果未通过身份验证,则会在“ authenticate”功能内引发异常,如下所示。
public class DelegatingLdapAuthenticationProvider implements AuthenticationProvider {
private ActiveDirectoryLdapAuthenticationProvider primaryProvider;
private List<ActiveDirectoryLdapAuthenticationProvider> secondaryProviders = new ArrayList<>();
public DelegatingLdapAuthenticationProvider() {
}
@Override
public Authentication authenticate(Authentication authentication) throws AuthenticationException {
Authentication result = null;
AuthenticationException exception = null;
try {
result = primaryProvider.authenticate(authentication);
} catch (AuthenticationException e) {
exception = e;
for (ActiveDirectoryLdapAuthenticationProvider secondaryProvider : secondaryProviders) {
try {
result = secondaryProvider.authenticate(authentication);
if (result.isAuthenticated()) {
break;
}
} catch (AuthenticationException e1) {
exception = e;
}
}
}
if (result …Run Code Online (Sandbox Code Playgroud) 我正在编写一个 Visual Studio 2015 扩展,它查看用户右键单击的类的内容。
我已经得到了ProjectItem,但是你如何从中得到SemanticModel( 和) 呢?SyntaxTree
我需要查找文件中声明的某些类型的属性。我编写了一个代码分析器,它可以为您提供SemanticModel上下文,但我不知道如何在这里获取它。搜索没有发现任何有用的东西。我已经找到了如何SyntaxTree通过读取文件内容来解析 ,但对于SemanticModel. 理想情况下,我会连接到 VS 已经为该文件构建的模型。
我使用RecyclerViewwith GridLayoutManager来显示网格图案中的一些项目.它运行良好并在网格内的2列中显示项目.
但是当项目的数量是奇数时,我希望最后一项必须是全宽(与宽度相同RecyclerView).
无论如何使用GridLayoutManager或我必须建立自定义设计?
请帮忙.
#include<stdio.h>
#include<conio.h>
#include<alloc.h>
int * makearray(int );
void readdata(int *,int );
void printdata(int *,int );
void main()
{
int *a,num;
clrscr();
printf("enter the size of array\n");
scanf("%d",&num);
a=makearray(num);
readdata(temp,num);
printdata(a,num);
getch();
}
int * makearray(int n)
{
int *temp;
temp=(int *)malloc(sizeof(int)*n);
printf("address of temp is %x and value of temp is %d and first value of temp is garbage i.e %d\n",&temp,temp,*temp);
return temp;
}
void readdata(int *x,int n)
{
for(n--; n>=0; n--)
{
printf("enter the value in cell[%d]\n",n);
scanf("%d",x+n);
} …Run Code Online (Sandbox Code Playgroud)