我是新手c#,这是我正在努力获得一些经验的个人项目的摘录.
当调用getRecipe()此类之外的函数时,我出现以下错误.我要保持我List私人的CookBook类,但仍然能够获得一个参考的一个Recipes中List.我不想List公开.
任何意见是极大的赞赏!谢谢
错误
return type 'cookbook.Recipe is less accessible than method 'cookbook.CookBook.getRecipe(string)'
Run Code Online (Sandbox Code Playgroud)
public class CookBook
{
private List<Recipe> listOfRecipes = new List<Recipe> {};
public Recipe getRecipe(string name)
{
int i = 0;
while (listOfRecipes[i].getRecipeName() != name)
{
i++;
}
return listOfRecipes[i];
}
}
Run Code Online (Sandbox Code Playgroud) 我想在配置文件中搜索此表达式:"central.database".然后,我想将与"central.database"关联的设置更改为"SQLTEST".
配置文件的布局最初看起来像这样:
central.database = SQLFIRSTTEST
Run Code Online (Sandbox Code Playgroud)
这是我希望它在sed替换后看起来像:
central.database = SQLTEST
Run Code Online (Sandbox Code Playgroud)
我在bash脚本中这样做,欢迎任何建议,建议或替代解决方案!
(其实都central.database和SQLTEST这里来自bash的变量.)
我目前的代码(第三次尝试):
sshRetValue=$(ssh -p "35903" -i $HOME/sshids/idrsa-1.old ${1} <<EOF
sed -i "s/^\($CENTRAL_DB_NAME\s*=\s*\).*\$/\1$CENTRAL_DB_VALUE/" /home/testing.txt;
echo $?
EOF
)
Run Code Online (Sandbox Code Playgroud)
错误信息:
Pseudo-terminal will not be allocated because stdin is not a terminal.
sed: -e expression #1, char 58: unknown option to `s'
-bash: line 3: EOF: command not found
Run Code Online (Sandbox Code Playgroud) 我在尝试创建这些实体时收到以下错误.
TypeError: Class extends value undefined is not a function or null
我假设这与循环依赖有关,但是当使用表继承和一对多关系时应该如何避免这种情况?
它正在抱怨以下javascript BaseComic_1.BaseComic.
let Variant = class Variant extends BaseComic_1.BaseComic {
这是完整的文件.
"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Android手机创建本地数据库sqlite.
我有一个帮助类,如下所示,用于创建数据库并提供"帮助".
我想在我的代码的主要部分创建这个类的对象,它也在那里创建数据库和表.
问题:
每当我创建类的对象时,它似乎都没有调用onCreate帮助器中的方法.我以为这应该发生.我认为这onCreate基本上是班级的构造函数.(我相信我错了)
onCreate方法呢?public class SmartDBHelper extends SQLiteOpenHelper {
private static final String DATABASE_NAME = "smart_lite_db.db";
private static final int DATABASE_VERSION = 2;
private static final String NOTIFY_TABLE_NAME = "user_notify_data";
private static final String HR_TABLE_NAME = "user_hr_data";
private static final String NOTIFY_TABLE_CREATE =
"CREATE TABLE " + NOTIFY_TABLE_NAME +
" (counter INTEGER PRIMARY KEY, " +
"userresponse INTEGER, " +
"notifytime INTEGER);";
private static final String DATA_TABLE_CREATE …Run Code Online (Sandbox Code Playgroud) 有没有人知道如何在运行时调整jQuery Fancybox的大小?
初始化fancybox时我可以这样做:
$("tag").fancybox({ 'frameWidth': 500, 'frameHeight': 700 });
Run Code Online (Sandbox Code Playgroud)
我正在用动态内容填充fancybox,我希望它根据内容调整大小.
在包含大约140个项目/库的多项目设置中使用gradle构建时,构建时间需要1小时22分钟.而我正在使用--parallel.我们的ANT构建只需不到20分钟而无需并行构建.
这正是我所做的.
./gradlew clean
./gradlew build --parallel
Run Code Online (Sandbox Code Playgroud)
我做了一点测试,似乎德兴花了最长的时间.有没有办法让gradle过程重用它已经有的东西?如果已经构建了库,则应该重新使用已经dexed的库.
我看到了这个选项--no-rebuild,但是当我使用该选项时,它会说明以下内容
File '/path/to/project/build/libs/project.aar' specified for property 'bundle' does not exist.
Run Code Online (Sandbox Code Playgroud)
我用通用的东西替换了文件路径和项目名称.
使用Gradle 1.9-rc-3
其他信息(2014年1月15日):
preDexDebug并preDexRelease花了很长的时间上的每个项目.比任何其他任务都长得多.
进展(2014年1月15日):
好的,现在,我把preDexLibraries = false所有build.gradle文件都放进去了.但是,我仍然想知道一个集中的地方,我可以放入该条目,它会影响所有其他build.gradle文件.
但是,现在dexRelease并且dexDebug需要很长时间.有什么方法可以告诉构建只执行dexDebug或dexRelease跳过另一个?
进展(2014年1月15日):
使用assembleDebug工作.但是,它似乎仍然没有重新使用已经dexed库.因为德兴仍然需要永远.每个项目大约需要一分钟.有没有办法让gradle重新使用已经dexed的库?或者,为什么构建仍然需要大约一个小时?我们的ANT过程不到15分钟.
目前,我有一个适用于我们所有应用程序的构建过程ANT.我正在添加构建release现在和签署应用程序的功能.
目前我拥有ant.properties正确的属性.它适用于所有项目.当我构建项目时,它工作正常.标志,对齐并给我我需要的东西.但是,我们有很多应用程序,它们都是在构建过程中构建的.
所以,问题是,用户具有在输入密码Please enter keystore password和Please enter password for alias.
我想知道是否有办法ant为我们输入密码,或者是否有其他方式使用ant可以使用的密码?也许我可以在构建过程开始时提供密码,并且每次要求使用时都使用该密码.
谢谢
我正在尝试使用ant运行我的junit测试.测试是使用JUnit 4测试套件启动的.如果我直接从Eclipse运行它,测试完成没有错误.但是,如果我从ant运行它,那么许多测试都会失败,并且一遍又一遍地重复此错误,直到junit任务崩溃.
[junit] java.util.zip.ZipException: error in opening zip file
[junit] at java.util.zip.ZipFile.open(Native Method)
[junit] at java.util.zip.ZipFile.(ZipFile.java:114)
[junit] at java.util.zip.ZipFile.(ZipFile.java:131)
[junit] at org.apache.tools.ant.AntClassLoader.getResourceURL(AntClassLoader.java:1028)
[junit] at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.findNextResource(AntClassLoader.java:147)
[junit] at org.apache.tools.ant.AntClassLoader$ResourceEnumeration.nextElement(AntClassLoader.java:130)
[junit] at org.apache.tools.ant.util.CollectionUtils$CompoundEnumeration.nextElement(CollectionUtils.java:198)
[junit] at sun.misc.CompoundEnumeration.nextElement(CompoundEnumeration.java:43)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.checkForkedPath(JUnitTask.java:1128)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeAsForked(JUnitTask.java:1013)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:834)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.executeOrQueue(JUnitTask.java:1785)
[junit] at org.apache.tools.ant.taskdefs.optional.junit.JUnitTask.execute(JUnitTask.java:785)
[junit] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:288)
[junit] at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
[junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[junit] at java.lang.reflect.Method.invoke(Method.java:597)
[junit] at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
[junit] at org.apache.tools.ant.Task.perform(Task.java:348)
[junit] at org.apache.tools.ant.Target.execute(Target.java:357)
[junit] at org.apache.tools.ant.Target.performTasks(Target.java:385)
[junit] at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1337)
[junit] at org.apache.tools.ant.Project.executeTarget(Project.java:1306) … 我有一些问题Cursor.
我想知道不关闭一个有Cursor什么缺点?
它释放资源,但是哪些资源被解除分配?
如果我们不关闭Cursor?会有什么后果和程度?
不关闭a Cursor不会影响Activity一点,但它会在log cat中出错.