可信云是什么ID是不是唯一的?

below is my code i just want to display the data i inserted in the sqlite database to a text view but i have this error saying that the id is not unique.
package com.example.
import android.app.A
import android.database.C
import android.database.sqlite.SQLiteD
import android.os.B
import android.widget.B
import android.widget.TextV
public class Main extends Activity {
TextView scrName, fN
String screenName, fullN
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
db = openOrCreateDatabase("MyDataBase", MODE_PRIVATE, null);
db.execSQL("CREATE TABLE if not exists MyTable(ScreenName Varchar, FullName Varchar, id int(3) PRIMARY KEY);");
db.execSQL("Insert into MyTable VALUES('joff', 'tiquez', 1);");
cursor = db.rawQuery("Select * from MyTable", null);
cursor.moveToFirst();
scrName = (TextView) findViewById(R.id.scrName);
fName = (TextView) findViewById(R.id.fName);
while(cursor.isAfterLast() == false){
//retrieving the data from sqlite (im not sure if im doing it right)
String screenname = cursor.getString(cursor.getColumnIndex("ScreenName"));
String fullname = cursor.getString(cursor.getColumnIndex("FullName"));
//this are the textview
scrName.setText(screenname);
fName.setText(fullname);
cursor.moveToNext();
db.close();
this is my whole java code. thanks :)
解决方案 Well I think this project works fine when you run it first time. When you run it second time it gives error because id is your primary key and the row with the id 1 has been already inserted to your database.
To get rid of errors either :
1) uninstall the app and run it again
2) Don't make id as primary key
3) Catch the exception and handle it yourself
本文地址: &
下面是我的code我只是想显示我插在SQLite数据库到一个文本视图中的数据,但我有这个错误说的ID不是唯一的。
包com.example.进口android.app.A进口android.database.C进口android.database.sqlite.SQLiteD进口android.os.B进口android.widget.B进口android.widget.TextV公共类主要活动扩展{
TextView的scrName,FNAME;
SQLiteDatabase分贝;
串屏幕名,全名;
保护无效的onCreate(捆绑savedInstanceState){
super.onCreate(savedInstanceState);
的setContentView(R.layout.main);
DB = openOrCreateDatabase(“MYDATABASE”,MODE_PRIVATE,NULL);
db.execSQL(“CREATE TABLE如果不存在MyTable的(ScreenName链接VARCHAR,则全名varchar,将ID INT(3)主键);”);
db.execSQL(“INSERT INTO MyTable的VALUES('joff','tiquez',1);”);
光标= db.rawQuery(“选择MyTable的*”,NULL);
cursor.moveToFirst();
scrName =(的TextView)findViewById(R.id.scrName);
FNAME =(的TextView)findViewById(R.id.fName);
而(cursor.isAfterLast()== FALSE){
//从sqlite的检索数据(IM不能肯定是否即时通讯做是正确的)
字符串屏幕名= cursor.getString(cursor.getColumnIndex(“ScreenName链接”));
字符串全名= cursor.getString(cursor.getColumnIndex(“全名”));
//这是TextView的
scrName.setText(屏幕名);
fName.setText(全名);
cursor.moveToNext();
db.close();
}} 这是我整个的java code。感谢:)解决方案 嗯,我认为当你运行它第一次这个项目工作正常。当你运行它第二次提示错误,因为 ID 是主键和id为1的行已已插入到数据库中。
为了摆脱错误之一:
1),卸载应用程序,并再次运行2)不要使id作为主键3)捕获异常并自己处理
本文地址: &
扫一扫关注官方微信“可信ID”的概念及特色_网易河北
“可信ID”的概念及特色
用微信扫码二维码
分享至好友和朋友圈
“可信ID”即“可信赖的移动设备ID”又名“数字DNA”是一种移动设备标识ID。它能有效解决APP推广过程中的数据不透明,以及刷单、刷量等恶意行为,帮助APP开发者甄别优质推广渠道,过滤无效数据。北京数字联盟网络科技有限公司(简称数盟/数字联盟)开发“可信ID”,针对移动推广中的多种作弊场景,有效应对各类造假手段,确保移动APP开发者的推广费用获得真实、高效的回报。“可信ID”由88位数字、字母、符号本体码组成,用于准确描述移动设备,每个编码对象获得一个唯一的、不变的标识ID。产品特色,1、独特不重复:可信ID不随任何非硬件信息的变化而改变。2、安全防伪造:可信ID不采集用户行为数据;使用多种动态加密算法,无法篡改伪造。3、高可用性:数盟平台自运行以来无间断,每日处理数据20亿条,多采集中心,双存储中心。4、可校验性:可信ID由数盟算法生成,可以判断是否由数盟下发、对应的APP、开发者等信息,方便数盟服务器与开发者进行校验。5、结果准确:可信ID能有效识别模拟器、改码设备、山寨设备,存量用户识别率96%。6、详细数据:可信ID能为客户提供精确到秒的详细log数据。使用场景,1.APP推广防刷量:可信ID可识别虚拟机、真机改码等造假手段。2.O2O防刷单:提供O2O服务的公司能利用可信ID向数盟发起实时查询,鉴别设备真伪,审核参加优惠活动的用户资格。3.无效数据清洗:在甄别用户设备真伪的基础上,筛选出真实用户,完成有效的设备行为分析。4.全局白名单:利用可信ID建立白名单库,有效防止刷注册刷账户行为,消除广告以及恶意信息对平台内容带来的负面影响。5.防“小号农场”:利用可信ID对虚拟机的精准判断,封杀“小号农场”,维护开发者的利益。市场覆盖情况,截止2017年3月底,可信ID已经覆盖有效移动设备7.33亿部,每天数据库新增设备数量与国内移动设备销售数量基本保持一致。来源:/news/345582
本文来源:中国网
责任编辑:HEB203
加载更多新闻
阅读下一篇
5月15日上午,省委召开常委会会议,传达学习全国新的社会阶层人士统战工作会议精神,研究河北省贯彻落实意见。php 生成唯一id的几种解决方法
投稿:shangke
字体:[ ] 类型:转载 时间:
本篇文章介绍了“php 生成唯一id的几种解决方法”,需要的朋友可以参考一下
网上查了下,有很多的方法
1、md5(time() . mt_rand(1,1000000));
  这种方法有一定的概率会出现重复
2、php内置函数uniqid()
  uniqid() 函数基于以微秒计的当前时间,生成一个唯一的 ID.
  w3school参考手册有一句话:"由于基于系统时间,通过该函数生成的 ID 不是最佳的。如需生成绝对唯一的 ID,请使用 md5() 函数"。
  下面方法返回结果类似:5DDB650F--A100-501EF1348872
function uuid() {
if (function_exists ( 'com_create_guid' )) {
return com_create_guid ();
mt_srand ( ( double ) microtime () * 10000 ); //optional for php 4.2.0 and up.随便数播种,4.2.0以后不需要了。
$charid = strtoupper ( md5 ( uniqid ( rand (), true ) ) ); //根据当前时间(微秒计)生成唯一id.
$hyphen = chr ( 45 ); // "-"
$uuid = '' . //chr(123)// "{"
substr ( $charid, 0, 8 ) . $hyphen . substr ( $charid, 8, 4 ) . $hyphen . substr ( $charid, 12, 4 ) . $hyphen . substr ( $charid, 16, 4 ) . $hyphen . substr ( $charid, 20, 12 );
//.chr(125);// "}"
com_create_guid()是php自带的生成唯一id方法,php5之后貌似已经没有了。
3、官方uniqid()参考手册有用户提供的方法,结果类似:{E2DFFFB3-571E-6CFC-4B5C-9FEDAAF2EFD7}
public function create_guid($namespace = '') {
static $guid = '';
$uid = uniqid("", true);
$data .= $_SERVER['REQUEST_TIME'];
$data .= $_SERVER['HTTP_USER_AGENT'];
$data .= $_SERVER['LOCAL_ADDR'];
$data .= $_SERVER['LOCAL_PORT'];
$data .= $_SERVER['REMOTE_ADDR'];
$data .= $_SERVER['REMOTE_PORT'];
$hash = strtoupper(hash('ripemd128', $uid . $guid . md5($data)));
$guid = '{' .
substr($hash, 0, 8) .
substr($hash, 8, 4) .
substr($hash, 12, 4) .
substr($hash, 16, 4) .
substr($hash, 20, 12) .
您可能感兴趣的文章:
大家感兴趣的内容
12345678910
最近更新的内容
常用在线小工具

我要回帖

更多关于 镜子里的可信还是照片 的文章

 

随机推荐