我安装了Android Studio 0.5.1,我的项目不再工作了.它提供的错误是:
The project is using an unsupported version of Gradle. Please use version 1.10.
Run Code Online (Sandbox Code Playgroud)
我试图更改gradle-wrapper.properties和gradle.build文件中的设置,但没有运气.
gradle-wrapper.properties文件:
#Wed Mar 12 11:11:46 CET 2014
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-all.zip
Run Code Online (Sandbox Code Playgroud)
我的gradle.build看起来像这样:
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:0.9.+'
}
}
apply plugin: 'android'
repositories {
mavenCentral()
}
dependencies {
compile fileTree(dir: 'libs', include: '*.jar')
compile 'de.timroes.android:EnhancedListView:0.3.1@aar'
}
android {
compileSdkVersion 19
buildToolsVersion "19.0.0"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src'] …Run Code Online (Sandbox Code Playgroud) 当我向jqgrid发送JSON响应时,我收到"undefined"消息,Firebug告诉我这个:
b.jgrid.formatter is undefined
[Break On This Error]
...input===true){b(".ui-pg-input",l).val(a.p.page);h=a.p.toppager?"#sp_1"+m+",#sp_1...
Run Code Online (Sandbox Code Playgroud)
这基本上没有告诉我多少.
当我发送空响应时会发生这种情况:
{"total":0,"page":1,"records":0,"rows":[]}
Run Code Online (Sandbox Code Playgroud)
或回复记录.然后在网格中可以看到记录.在显示"未定义"消息后,我无法浏览页面,当然,代码中出现了错误.
正如@Oleg建议我在这里提供更多信息:
jquery.validate.min.js jquery.validate.unobtrusive.min.js jquery-1.5.1.min.js jquery-ui-1.8.11.min.js jquery.jqGrid.min.js ui/jquery.ui.core.js ui/jquery.ui.widget.js ui/jquery.ui.datepicker.js
var grid = jQuery("#list").jqGrid({
datatype: 'json',
caption: 'Transaction Log',
hiddengrid: 'true',
postData: {
companyId: function () { return $("#SelectedCompany").val(); },
userId: function () { return $("#SelectedUser").val(); },
dateFromString: function () { return $("#DateFrom").val(); },
dateToString: function () { return $("#DateTo").val(); }
},
url: '@Url.Action("GetTransactionLogData")',
mtype: 'GET',
colNames: ['Ref.', 'TradeDate', 'Status', 'LegalEntity', ...],
colModel: [
{ name: …这是我为jqGrid创建Json响应的代码,以及用于定义单元成员的新关键字,我收到以下消息"找不到隐式类型数组的最佳类型".
var resRows = results.Select(record =>
new
{
id = record.Reference,
cell = **new** []
{
record.Reference,
record.TradeDate.ToShortDateString(),
record.Currency1,
record.Currency2,
record.Notional.ToString(),
record.EffectiveDate.ToShortDateString(),
record.Quote.ToString()
}
}).ToArray();
Run Code Online (Sandbox Code Playgroud)
我在这做错了什么?
我从Windows-1250代码页中的一些dll(它是一些外部数据源的包装)字符串接收,我想将它们正确地插入(作为unicode)到SQL Server数据库中的表.由于数据库中应该保存该数据的特定行是NVarchar类型,我只需要将其在我的C#代码中转换为unicode并将其作为参数传递.一切都很好,但我偶然发现转换步骤.
我尝试了以下但不起作用:
private static String getUnicodeValue(string string2Encode) //
{
Encoding srcEncoding = Encoding.GetEncoding("Windows-1250");
UnicodeEncoding dstEncoding = new UnicodeEncoding();
byte[] srcBytes = srcEncoding.GetBytes(string2Encode);
byte[] dstBytes = dstEncoding.GetBytes(string2Encode);
return dstEncoding.GetString(dstBytes);
}
Run Code Online (Sandbox Code Playgroud)
当我将这个返回的字符串插入表格时,我没有得到正确的字母,如Đ,đ,Č,č,Ć或ć.
请帮忙!:)
我试图通过提供对齐方式在约束布局中对齐图像和textview的顶部
<ImageView
android:id="@+id/img_medal"
android:layout_width="32dp"
android:layout_height="32dp"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:contentDescription="@string/default_content_description"
android:src="@drawable/medal_gold"
app:layout_constraintLeft_toLeftOf="@+id/view_award_region"
app:layout_constraintTop_toTopOf="@+id/view_award_region" />
<TextView
android:id="@+id/txt_medal_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="16dp"
android:layout_marginTop="0dp"
android:text="You are gold now."
app:layout_constraintLeft_toRightOf="@+id/img_medal"
app:layout_constraintTop_toTopOf="@+id/img_medal"
style="@style/SettingsMedalTitle"
/>
Run Code Online (Sandbox Code Playgroud)
,但是这些视图的顶部对齐,而不是内容对齐,因为字体的顶部和底部有一些空白。有谁知道如何解决这个问题?(问题可以在下面的图片中看到)
假设我定期(每 3 秒)需要读取一些RealmObjects的列表,并且我想将这些对象映射到将用于填充列表内容的简单数据对象。
对于那些想知道的人来说,有以下三个原因:
ViewHolder在我的情况下,计算s 中的视图的值和行为(可见性,即)非常复杂ListAdapterwhich 需要提供DiffUtilCallback哪些将在除 UI 之外的其他线程上执行,因此在其方法中进行所需的计算是不可能的,因为它们将在未创建它们的线程中使用。我不能简单地以基本方式使用协程从一个可用线程跳转到另一个,因为我将(并且我确实)最终收到“领域已经关闭”异常。
我想出的唯一解决方案是使用仅使用一个线程的调度程序,newSingleThreadContext("RealmSingleThreadContext")例如:
class RealmSingleThreadContext {
val ctx = NewSingleThreadedContext("RealmSingleThreadContext")
lateinit var realm : Realm
init {
// opening Realm connection for thread "RealmSingleThreadContext"
GlobalScope.launch(ctx) { realm = Realm.getDefaultInstance() }
}
fun close() {
GlobalScope.launch(ctx) { if (!realm.isClosed()) realm.close() }
}
}
Run Code Online (Sandbox Code Playgroud)
这个类通过 Dagger 作为单例提供,最终在最后,我将有一个线程在后台为整个应用程序做映射,我的“主”视图模型将调用这个类的onClosed方法close()方法。
这是我如何使用它:
class HomeViewModel @Inject constructor(/* other */var realmSingleThreadContext: …Run Code Online (Sandbox Code Playgroud) 这是我的代码:
int favouritesCount = user.getFavouritesCount();
int followersCount = user.getFollowersCount();
int friendsCount = user.getFriendsCount();
long userId = user.getId();
System.out.println("FavouritesCount: " + favouritesCount + ", followersCount: " + followersCount + ", friendsCount: " + friendsCount);
ArrayList<User> followers = new ArrayList<User>();
long nextCursor = 0;
do {
PagableResponseList<User> usersResponse = twitter.getFollowersList(user.getScreenName(), nextCursor);
System.out.println("size() of first iteration:" + usersResponse.size());
nextCursor = usersResponse.getNextCursor();
followers.addAll(usersResponse);
} while ( nextCursor > 0);
System.out.println( followers.size() > 0 ? "Getting followers:" : "No followers.");
for ( User user : …Run Code Online (Sandbox Code Playgroud) 这是C++ DLL中的代码:
extern "C" _declspec(dllexport) int testDelegate(int (*addFunction)(int, int), int a, int b)
{
int res = addFunction(a, b);
return res;
}
Run Code Online (Sandbox Code Playgroud)
这是C#中的代码:
public delegate int AddIntegersDelegate(int number1, int number2);
public static int AddIntegers(int a, int b)
{
return a + b;
}
[DllImport("tester.dll", SetLastError = true)]
public static extern int testDelegate(AddIntegersDelegate callBackProc, int a, int b);
public static void Main(string[] args)
{
int result = testDelegate(AddIntegers, 4, 5);
Console.WriteLine("Code returned:" + result.ToString());
}
Run Code Online (Sandbox Code Playgroud)
当我启动这个小应用程序时,我从这篇文章的标题中得到消息.有人可以帮帮忙吗?
提前致谢,
d
当我在我的quickfix配置文件中设置参数FileLogPath(带值:传出)并尝试执行以下操作时:
SessionSettings sessionSettings = new SessionSettings(CfgFile);
FileStoreFactory fileStoreFactory = new FileStoreFactory(sessionSettings);
FileLogFactory fileLogFactory = new FileLogFactory(sessionSettings);
ScreenLogFactory screenLogFactory = new ScreenLogFactory(sessionSettings);
MessageFactory messageFactory = new DefaultMessageFactory();
Run Code Online (Sandbox Code Playgroud)
之后尝试使用以下命令初始化socketInitiator:
socketInitiator = new ThreadedSocketInitiator(application, fileStoreFactory, sessionSettings, fileLogFactory, messageFactory);
Run Code Online (Sandbox Code Playgroud)
我得到例外
QuickFix.ConfigError: Configuration failed: FileLogPath not defined
Run Code Online (Sandbox Code Playgroud)
但是当我为FileLogFactory设置直接路径时
FileLogFactory fileLogFactory = new FileLogFactory("outgoing");
Run Code Online (Sandbox Code Playgroud)
一切都很好.
我究竟做错了什么?
配置文件看起来像这样:
[DEFAULT]
[SESSION]
ConnectionType=initiator
HeartBtInt=30
ReconnectInterval=5
FileStorePath=incoming
FileLogPath=outgoing
SenderSubId=xxxxx
Password=yyyyy
StartTime=00:00:00
EndTime=00:00:00
SocketConnectHost=aaa.aaa.aaa.aaa
SocketConnectPort=bbb
CheckLatency=N
BeginString=FIX.4.4
SenderCompId=rrrrrr
TargetCompId=vvvvvv
DataDictionary=./Specs/FIX44.xml
ValidateUserDefinedFields=N
Run Code Online (Sandbox Code Playgroud) 如何在上传文档的 Alfresco 中更改网页脚本中的“创建者”属性?
顺便说一句,我正在使用 Alfresco 4.2。
最好,D