在工具包 LongListSelector中,曾经有一个属性IsFlatList需要设置为true才能显示平面列表而不进行任何分组.但是在手机控件中提供的LongListSelector中,缺少此属性.这就是我在做的事情
<phone:LongListSelector Name="myList" IsGroupingEnabled="False" LayoutMode="List" ItemsSource="{Binding Source ={StaticResource SortedList} }" CacheMode="BitmapCache" >
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<components:MyControl CacheMode="BitmapCache" MyItem="{Binding}"/>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
Run Code Online (Sandbox Code Playgroud)
如果我将控件更改为ListBox并删除LongListSelector特定属性,那么它将显示我的列表.
有人可以告诉我我错过了什么吗?我正在关注LongListSelector的这个(备注)文档
目前,当我使用以下方法创建密钥时
private KeyPair getKeyPair() throws NoSuchAlgorithmException, NoSuchProviderException, InvalidAlgorithmParameterException {
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("ECDsA", "SC");
ECGenParameterSpec ecSpec = new ECGenParameterSpec("secp256k1");
keyGen.initialize(ecSpec, new SecureRandom());
return keyGen.generateKeyPair();
}
Run Code Online (Sandbox Code Playgroud)
KeyPairGenerator有另一种方法,我可以在其中指定keySize,但我不知道如何通过ecSpec.
public void initialize(int keysize, SecureRandom random)
Run Code Online (Sandbox Code Playgroud) 当我在宽度为120的网格中使用进度条(IsIndertiminate = true)时,进度条动画似乎很奇怪.进度点似乎正在移动侧边,而它们之间没有任何适当的间距.而且,由于这个(较小的宽度),点分别在开始和结束时移开/越来越近的效果不是很明显.
那么,当我以有限的宽度显示progressBar时,如何让progressBar更好看.我试图在progressBar的属性中搜索并进行一些更改但是无法达到令人满意的状态.
编辑:在我的grid.row中,通过将progressBar的宽度设置为"auto",我能够实现理想的间距/外观(它仍然不完美但对我有用).
出于以下两个选项,您更喜欢哪一个初始化Gson对象?有人可以帮我理解这两种方式对Android应用程序性能的影响(启动时间?),如果有的话.
// inline creation
private final Gson gson = new Gson();
Run Code Online (Sandbox Code Playgroud)
VS
// need base creation, overhead of sync everytime while accessing gson object
private synchronized Gson getOrCreateGson() {
gson == null ? gson = new Gson() : gson;
return gson.fromJson(jsonString, clazz);
}
Run Code Online (Sandbox Code Playgroud) 要求:对于给定的命名曲线,请发送尽可能少的数据,以便接收方可以构造EC私钥。
我目前在Android上使用BouncyCastle / SpongyCastle。这是我到目前为止所了解的。
KeyPairGenerator keyGen = KeyPairGenerator.getInstance("EC");
ECGenParameterSpec ecGenParameterSpec = new ECGenParameterSpec("secp112r2");
keyGen.initialize(ecGenParameterSpec, new SecureRandom());
KeyPair keyPair = keyGen.generateKeyPair();
PrivateKey privateKey = keyPair.getPrivate();
// privateKey.getEncoded() -> gives DER encoded private key. I can construct PrivateKey from that easily
byte[] derEncodedPrivateKeyBytes = privateKey.getEncoded(); // byteArray length-> 80
KeyFactory kf = KeyFactory.getInstance("EC");
PrivateKey key = kf.generatePrivate(new PKCS8EncodedKeySpec(derEncodedPrivateKeyBytes));
Run Code Online (Sandbox Code Playgroud)
现在,使用Bouncy / Spongy城堡,我可以获得私钥的实际点,而derEncoding中没有任何其他信息。
ECPrivateKeyParameters param = (ECPrivateKeyParameters) ECUtil.generatePrivateKeyParameter(privateKey);
int lenghtOfKey = param.getD().toByteArray().length; // length - 14
Run Code Online (Sandbox Code Playgroud)
问:仅通过使用点D(privateKeyParam.getD())和曲线名称,如何才能重构PrivateKey对象?使用曲线名称,我可以获得ECCurveParameters。
编辑:我可以ECPrivateKeyParameters …
我想将十进制值四舍五入到最多两点.但对于任何小于0.01的数字,我想返回0.01.
RoundUp(0.146,2) should return 0.15
RoundUp(0.0003,2) should return 0.01
Run Code Online (Sandbox Code Playgroud)
在C#中,我目前使用的Math.Round,用MidpointRounding.AwayFromZero的参数,但对于
Math.Round(0.0003, 2, MidpointRounding.AwayFromZero);
Run Code Online (Sandbox Code Playgroud)
它返回0.
在Math命名空间中是否有任何内置方法,我可以使用它来获得所需的行为?
目前我正在使用这种方法
private double GetRoundUpValue(double price, int roundUpto)
{
Debug.Assert(roundUpto == 2 || roundUpto == 3);
var val = Math.Round(price, roundUpto, MidpointRounding.AwayFromZero);
Double minValue = roundUpto == 2 ? 0.01 : 0.001;
return val < minValue ? minValue : val;
}
Run Code Online (Sandbox Code Playgroud) java ×3
android ×2
bouncycastle ×2
.net ×1
c# ×1
ecdsa ×1
encryption ×1
gson ×1
math ×1
performance ×1
progress-bar ×1
silverlight ×1
spongycastle ×1
xaml ×1