在我的一个学校项目中,我被要求创建一个不使用STL的程序.
在程序中我使用了很多
Pointer* = new Something;
if (Pointer == NULL) throw AllocationError();
Run Code Online (Sandbox Code Playgroud)
我的问题是关于分配错误:
1.当分配失败时,是否有新的自动异常?
2.如果是这样,如果我没有使用STL(
3 #include "exception.h)我怎么能抓住它?是否
正在使用NULL测试?
谢谢.
我在Windows 7上使用eclipseCDT(C++)和MinGW.
我有ac#visual studio 2013项目.我想使用远程调试.在远程机器上设置一个与本地机器相同的目录(即c:\ project)时,它工作得很好,但我有一个特殊的目录结构,由我的TFS指定,甚至位于遥控器上不存在的另一个驱动器上机器(e :).我想知道如何在本地远程计算机上定义不同的工作目录.
我有一个工作的Android应用程序(也许更好地说HAD).
该应用程序正在使用一些第三方库,包括:Google地图,Firebase,firebaseui.在转换应用程序以使用新的firebase后,我偶然发现了两个主要问题:
这当然与旧的完全不同,并且出于与调试构建变体不同的一些奇怪的原因.
com.google.firebase.FirebaseException:发生了内部错误.[找不到服务器配置中的OAuth2客户端ID.]
同样,这个问题在调试变体中没有发生.
为了清楚起见,调试版本变体使用相同的代码库,但使用不同的firebase数据库.
android oauth-2.0 firebase firebase-authentication firebaseui
打电话的时候
FirebaseFirestore.getInstance().collection("myCollection").document("doc1").update("field1",myObject);
Run Code Online (Sandbox Code Playgroud)
我收到错误:
IllegalArgumentException:无效的数据.不支持的类型:com.myProg.objects.MyObject(在字段field1中找到)
尽管我可以使用Set方法将myObject添加到firestore,而不是使用Set方法.
MyObject类(最简单的例子):
public class MyObject{
public int i;
}
Run Code Online (Sandbox Code Playgroud)
在尝试之前编辑:我的数据库结构:
myCollection - >
Run Code Online (Sandbox Code Playgroud)doc1: field0 - "3" field1 - null
也试过没有field1
将Firestore安全规则保存在代码的源代码管理(Github)中是否明智?
此外,在首次克隆存储库并安装应用程序时(自动用于开放源代码项目),自动部署安全规则的最佳方法是什么?就我而言,这是一个在Android Studio中使用Gradle构建的Android应用。
android gradle firebase firebase-security google-cloud-firestore
我有一个由3个元素组成的自定义视图.我希望视图适应它可用的大小.我希望它看起来像
.
但为了使它看起来像这样我必须添加硬编码大小约束,从而使它无法自适应.
这就是它在所有图像视图上使用match_constraint的样子(不是我想要它的样子
):
这是xml布局.
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<android.support.constraint.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="in.avimarine.boatangels.activities.InspectionResultActivity"
tools:visibility="visible">
<ImageView
android:id="@+id/moored_boat_bowlines"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="@string/boat_drawing_content_description"
app:layout_constraintBottom_toTopOf="@+id/moored_boat_body"
app:layout_constraintEnd_toEndOf="@+id/moored_boat_body"
app:layout_constraintStart_toStartOf="@+id/moored_boat_body"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_monohull_mooring_bow"
tools:visibility="visible"/>
<ImageView
android:id="@+id/moored_boat_body"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="@string/boat_drawing_content_description"
app:layout_constraintBottom_toTopOf="@+id/moored_boat_sternlines"
app:layout_constraintDimensionRatio="h,1:1"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/moored_boat_bowlines"
app:layout_constraintVertical_chainStyle="spread_inside"
app:srcCompat="@drawable/ic_top_mv"
tools:visibility="visible"/>
<ImageView
android:id="@+id/moored_boat_sternlines"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginBottom="8dp"
android:contentDescription="@string/boat_drawing_content_description"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/moored_boat_body"
app:layout_constraintStart_toStartOf="@+id/moored_boat_body"
app:layout_constraintTop_toBottomOf="@+id/moored_boat_body"
app:srcCompat="@drawable/ic_monohull_dock_aft"
tools:visibility="visible"/>
</android.support.constraint.ConstraintLayout>
</merge>
Run Code Online (Sandbox Code Playgroud)
如何使这种自适应仍然看起来像第一张图像?
我有以下布局:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
android:id="@+id/rlMap">
<org.mapsforge.map.android.view.MapView
android:id="@+id/mapView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clickable="true"/>
<ImageView
android:layout_width="50dp"
android:layout_height="50dp"
android:id="@+id/windArrow"
android:layout_alignParentTop="true"
android:layout_alignParentEnd="true"
android:layout_gravity="top|right|end"
android:src="@drawable/arrow"
android:layout_alignStart="@+id/fab" />
<android.support.design.widget.FloatingActionButton
android:id="@+id/fab"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|right|end"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:src="@drawable/settings"
android:clickable="true"/>
</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)
以及OnCreate方法中的以下代码:
...
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
fab.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Log.d(TAG,"FAB Setting Clicked");
Intent i = new Intent(getApplicationContext(), AppPreferences.class);
startActivity(i);
}
});
...
Run Code Online (Sandbox Code Playgroud)
但是,当我按下按钮时,什么也没有发生,意图没有运行,并且日志也没有写入。
按钮动画正在工作,每当我按下按钮时,都会出现以下日志消息:
D / ViewRootImpl:ViewPostImeInputStage ACTION_DOWN
因此似乎有一些反应。
我究竟做错了什么?
我正在为我的Java Android项目使用在线SonarQube.com免费操作系统服务.
我遇到了几个错误,我用==而不是.equals()检查了字符串的相等性.
我发现sonarqube有一个好的规则来找到这些错误:对象应该与"equals()"进行比较.不幸的是,在默认的Java Sonarway质量配置文件中禁用了此规则.
我的问题是,由于我没有公共SonarQube.com服务器的管理员权限,有没有办法为我的项目激活此规则?
我对C#很陌生,正在为盲人和视障人士开发软件.
在软件中我想要一个文本框,当按下一个键时它会发出
声音,例如当按下它时会说j ...我找到了精彩的文本到语音引擎并尝试将它与keydown事件一起使用如下:
SpeechSynthesizer synth = new SpeechSynthesizer();
char mappedChar = (char)e.KeyValue;
synth.Speak(Convert.ToString(mappedChar));
synth.Dispose();
Run Code Online (Sandbox Code Playgroud)
不幸的是,它太慢了,需要大约.每次击键之间1秒.
将不胜感激任何建议.
android ×6
firebase ×3
c# ×2
allocation ×1
c++ ×1
exception ×1
firebaseui ×1
gradle ×1
java ×1
keydown ×1
mingw ×1
new-operator ×1
oauth-2.0 ×1
sonarqube ×1