调用TensorFlowInferenceInterface接口,fetch到矩阵减法结果是错的 5C

输出pb文件

 # -*- coding:utf-8 -*-
import tensorflow as tf

session = tf.Session()

matrix1 = tf.constant([[1., 3.]], name='input1')
matrix2 = tf.constant([[2., 2.]], name='input2')
mat_add = tf.add(matrix1, matrix2, name='output1')
mat_sub = tf.subtract(matrix1, matrix2, name='output2')

session.run(mat_add)
session.run(mat_sub)


tf.train.write_graph(session.graph.as_graph_def(), "./models/", "simple.pb", as_text=False)

session.close()

Android端调用TensorFlowInferenceInterface接口的主要代码

 inferenceInterface = new TensorFlowInferenceInterface(getAssets(),MODEL_FILE);

input1[0] = (float) 5.0; input1[1] = (float) 6.0;
input2[0] = (float) 2.0; input2[1] = (float) 3.0;


inferenceInterface.feed("input1", input1, new long[]{1,2});
inferenceInterface.feed("input2", input2, new long[]{1,2});

inferenceInterface.run(new String[]{"output1","output2"});

inferenceInterface.fetch("output1", output1);
inferenceInterface.fetch("output2", output2);


for(float f : output1)
    Log.i(TAG, "output1: " + f);
for(float f : output2)
    Log.i(TAG, "output2: " + f);

结果如下图图片说明
加法的结果一直是正确的,但减法的结果一直是[1.0, 1.0]。求大神告知原因啊!

1个回答

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
调用TensorFlowInference接口,能不能fetch到三维矩阵
如题,模型的输出是一个三维矩阵,我需要通过TensorFlowInference接口中的fetch方法获得三维矩阵,再通过DoubleMatrix进行三维矩阵的分析,但是看fetch的源码,都是获得的各种一维数组,想请问各位大神有没有方法直接fetch到三维矩阵?
Python3使用ibm-db 连接DB2 执行sql 时报错 SQLCODE=-332 ?
Python3使用ibm-db 连接DB2 执行sql 时报错 SQLCODE=-332 codepage转换错误,现在不能修改DB2 server的设置,请问怎么解决? 代码如下: ``` import ibm_db conn=ibm_db.connect("DATABASE=db;HOSTNAME=host;PORT=60000;PROTOCOL=TCPIP;UID=user;PWD=pwd",'','') sql = "SELECT * FROM T_PATENTINFO" stmt = ibm_db.exec_immediate(conn, sql) result = ibm_db.fetch_tuple(stmt) print(result) ``` 错误信息: ``` Traceback (most recent call last): File "C:\Users\xux\AppData\Local\Programs\Python\Python37\lib\site-packages\ibm_db_dbi.py", line 1434, in _fetch_helper row = ibm_db.fetch_tuple(self.stmt_handler) SQLCODE=-332 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:/PythonRepo/patent/db_fixture/ibm_db_connect.py", line 53, in <module> rresult = DB().search_patent() File "C:/PythonRepo/patent/db_fixture/ibm_db_connect.py", line 44, in search_patent result = self.cursor.fetchone() File "C:\Users\xux\AppData\Local\Programs\Python\Python37\lib\site-packages\ibm_db_dbi.py", line 1460, in fetchone row_list = self._fetch_helper(1) File "C:\Users\xux\AppData\Local\Programs\Python\Python37\lib\site-packages\ibm_db_dbi.py", line 1441, in _fetch_helper raise self.messages[len(self.messages) - 1] SQLCODE=-332 ```
载入PDF时发生错误?PDF.js v1.10.100 (build: ea29ec83) 信息:Failed to fetch
PDF.js v1.10.100 (build: ea29ec83) 信息:Failed to fetch
问个有关django+heroku的问题
``` Traceback (most recent call last): File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedTable: relation "auth_user" does not exist LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user... The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 351, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 325, in execute django.setup() File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models(all_models) File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/app/learning_logs/models.py", line 7, in <module> class Topic(models.Model): File "/app/learning_logs/models.py", line 8, in Topic choices=Help().choices() File "/app/learning_logs/help.py", line 9, in choices for user in users: File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py", line 162, in __iter__ self._fetch_all() File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py", line 965, in _fetch_all self._result_cache = list(self.iterator()) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py", line 238, in iterator results = compiler.execute_sql() File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql cursor.execute(sql, params) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/utils.py", line 97, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/six.py", line 658, in reraise raise value.with_traceback(tb) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: relation "auth_user" does not exist LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user... ``` 在heroku bash操作makemigrations,migrate中出现的错误 在本地用这些没问题 settings.py ``` """ Django settings for learning_log project. Generated by 'django-admin startproject' using Django 1.8.5. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import django_heroku BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'o47!#$sbu_&=)pnbk63ra!hjbx@+pc=2j42cf(&mx82&hs&ph_' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( 'whitenoise.runserver_nostatic', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', #my app 'learning_logs', 'users', #other app 'bootstrap3', ) MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', ] MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) ROOT_URLCONF = 'learning_log.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'learning_log.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True LOGIN_URL = '/users/login/' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') if os.getenv('DATABASE_URL') is not None: import dj_database_url DATABASES['default'] = dj_database_url.config() SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') ALLOWED_HOSTS = ['stark-anchorage-08076.herokuapp.com'] DEBUG = False BASE_DIR = os.path.dirname(os.path.abspath(__file__)) STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) django_heroku.settings(locals()) ``` views.py ``` from django.shortcuts import render from .models import Topic, Entry, Root, Suf_Pre_fix from django.http import HttpResponseRedirect, Http404 from django.core.urlresolvers import reverse from .forms import TopicForm, EntryForm, RootForm from django.contrib.auth.decorators import login_required from .help import Help from django.contrib.auth.models import User # Create your views here. def index(request): return render(request, 'learning_logs/index.html') @login_required def topics(request): topics = Topic.objects.order_by('date_added') context = {'topics': topics} return render(request, 'learning_logs/topics.html', context) @login_required def topic(request, topic_id): topic = Topic.objects.get(id=topic_id) entries = topic.entry_set.order_by('-date_added') context = {'topic': topic,'entries': entries} return render(request, 'learning_logs/topic.html', context) @login_required def new_topic(request): if request.method != 'POST': form = TopicForm() else: form = TopicForm(request.POST) if form.is_valid(): new_topic = form.save(commit=False) new_topic.owner = request.user new_topic.edit_able = request.POST.getlist("edit_able") new_topic.save() return HttpResponseRedirect(reverse('learning_logs:topics')) context = {'form': form, 'users':Help().users()} return render(request, 'learning_logs/new_topic.html', context) @login_required def new_entry(request, topic_id): topic = Topic.objects.get(id=topic_id) if request.method != 'POST': form = EntryForm() else: form = EntryForm(data=request.POST) if form.is_valid(): new_entry = form.save(commit=False) new_entry.topic = topic new_entry.edit_able = request.POST.getlist("edit_able") new_entry.save() return HttpResponseRedirect(reverse('learning_logs:topic',args=[topic_id])) context = {'topic':topic, 'form': form, 'users':Help().users()} return render(request, 'learning_logs/new_entry.html', context) @login_required def edit_entry(request, entry_id): entry = Entry.objects.get(id=entry_id) topic = entry.topic if not Help().check_user(request.user,entry.edit_able) or not Help().check_user(request.user,topic.edit_able): raise Http404 if request.method != 'POST': form = EntryForm(instance=entry) else: form = EntryForm(instance=entry, data=request.POST) if form.is_valid(): edit_entry = form.save(commit=False) edit_entry.edit_able = request.POST.getlist("edit_able") edit_entry.save() return HttpResponseRedirect(reverse('learning_logs:topic',args=[topic.id])) context = {'entry': entry, 'topic': topic, 'form': form ,'users':Help().users()} return render(request, 'learning_logs/edit_entry.html', context) @login_required def roots(request): roots = Root.objects.order_by('date_added') context = {'roots': roots} return render(request, 'learning_logs/roots.html', context) def root(request, root_id): root = Root.objects.get(id=root_id) things = root.things.order_by('-date_added') context = {'root':root, 'things':things} return render(request, 'learning_logs/root.html', context) ``` help.py ``` from django.contrib.auth.models import User class Help(): def __init__(self): pass def choices(self): users=User.objects.all() choices=[] a=1 for user in users: choices.append((a,str(user))) a+=1 return choices def check_user(self,user,users): try: str(users).index(str(user)) except: return False else: return True def users(self): users=[] for user in User.objects.all(): users.append(str(user)) return users def test_list(self,list1): for item in list1: print(type(item)) def test_word(self,item): print(item,type(item)) ```
问个有关python+django+heroku的问题
``` Traceback (most recent call last): File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) psycopg2.errors.UndefinedTable: relation "auth_user" does not exist LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user... The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 351, in execute_from_command_line utility.execute() File "/app/.heroku/python/lib/python3.6/site-packages/django/core/management/__init__.py", line 325, in execute django.setup() File "/app/.heroku/python/lib/python3.6/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate app_config.import_models(all_models) File "/app/.heroku/python/lib/python3.6/site-packages/django/apps/config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "/app/.heroku/python/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/app/learning_logs/models.py", line 7, in <module> class Topic(models.Model): File "/app/learning_logs/models.py", line 8, in Topic choices=Help().choices() File "/app/learning_logs/help.py", line 9, in choices for user in users: File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py", line 162, in __iter__ self._fetch_all() File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py", line 965, in _fetch_all self._result_cache = list(self.iterator()) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/query.py", line 238, in iterator results = compiler.execute_sql() File "/app/.heroku/python/lib/python3.6/site-packages/django/db/models/sql/compiler.py", line 840, in execute_sql cursor.execute(sql, params) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/utils.py", line 97, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/app/.heroku/python/lib/python3.6/site-packages/django/utils/six.py", line 658, in reraise raise value.with_traceback(tb) File "/app/.heroku/python/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) django.db.utils.ProgrammingError: relation "auth_user" does not exist LINE 1: ...user"."is_active", "auth_user"."date_joined" FROM "auth_user... ``` 在heroku bash操作makemigrations,migrate中出现的错误 在本地用这些没问题 settings.py ``` """ Django settings for learning_log project. Generated by 'django-admin startproject' using Django 1.8.5. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os import django_heroku BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'o47!#$sbu_&=)pnbk63ra!hjbx@+pc=2j42cf(&mx82&hs&ph_' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = ( 'whitenoise.runserver_nostatic', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', #my app 'learning_logs', 'users', #other app 'bootstrap3', ) MIDDLEWARE = [ 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'whitenoise.middleware.WhiteNoiseMiddleware', ] MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) ROOT_URLCONF = 'learning_log.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'learning_log.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': os.path.join(BASE_DIR, 'db.sqlite3'), } } # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True LOGIN_URL = '/users/login/' # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/' MEDIA_URL = '/media/' MEDIA_ROOT = os.path.join(BASE_DIR, 'media') STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles') if os.getenv('DATABASE_URL') is not None: import dj_database_url DATABASES['default'] = dj_database_url.config() SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https') ALLOWED_HOSTS = ['stark-anchorage-08076.herokuapp.com'] DEBUG = False BASE_DIR = os.path.dirname(os.path.abspath(__file__)) STATICFILES_DIRS = ( os.path.join(BASE_DIR, 'static'), ) django_heroku.settings(locals()) ``` views.py ``` from django.shortcuts import render from .models import Topic, Entry, Root, Suf_Pre_fix from django.http import HttpResponseRedirect, Http404 from django.core.urlresolvers import reverse from .forms import TopicForm, EntryForm, RootForm from django.contrib.auth.decorators import login_required from .help import Help from django.contrib.auth.models import User # Create your views here. def index(request): return render(request, 'learning_logs/index.html') @login_required def topics(request): topics = Topic.objects.order_by('date_added') context = {'topics': topics} return render(request, 'learning_logs/topics.html', context) @login_required def topic(request, topic_id): topic = Topic.objects.get(id=topic_id) entries = topic.entry_set.order_by('-date_added') context = {'topic': topic,'entries': entries} return render(request, 'learning_logs/topic.html', context) @login_required def new_topic(request): if request.method != 'POST': form = TopicForm() else: form = TopicForm(request.POST) if form.is_valid(): new_topic = form.save(commit=False) new_topic.owner = request.user new_topic.edit_able = request.POST.getlist("edit_able") new_topic.save() return HttpResponseRedirect(reverse('learning_logs:topics')) context = {'form': form, 'users':Help().users()} return render(request, 'learning_logs/new_topic.html', context) @login_required def new_entry(request, topic_id): topic = Topic.objects.get(id=topic_id) if request.method != 'POST': form = EntryForm() else: form = EntryForm(data=request.POST) if form.is_valid(): new_entry = form.save(commit=False) new_entry.topic = topic new_entry.edit_able = request.POST.getlist("edit_able") new_entry.save() return HttpResponseRedirect(reverse('learning_logs:topic',args=[topic_id])) context = {'topic':topic, 'form': form, 'users':Help().users()} return render(request, 'learning_logs/new_entry.html', context) @login_required def edit_entry(request, entry_id): entry = Entry.objects.get(id=entry_id) topic = entry.topic if not Help().check_user(request.user,entry.edit_able) or not Help().check_user(request.user,topic.edit_able): raise Http404 if request.method != 'POST': form = EntryForm(instance=entry) else: form = EntryForm(instance=entry, data=request.POST) if form.is_valid(): edit_entry = form.save(commit=False) edit_entry.edit_able = request.POST.getlist("edit_able") edit_entry.save() return HttpResponseRedirect(reverse('learning_logs:topic',args=[topic.id])) context = {'entry': entry, 'topic': topic, 'form': form ,'users':Help().users()} return render(request, 'learning_logs/edit_entry.html', context) @login_required def roots(request): roots = Root.objects.order_by('date_added') context = {'roots': roots} return render(request, 'learning_logs/roots.html', context) def root(request, root_id): root = Root.objects.get(id=root_id) things = root.things.order_by('-date_added') context = {'root':root, 'things':things} return render(request, 'learning_logs/root.html', context) ``` help.py ``` from django.contrib.auth.models import User class Help(): def __init__(self): pass def choices(self): users=User.objects.all() choices=[] a=1 for user in users: choices.append((a,str(user))) a+=1 return choices def check_user(self,user,users): try: str(users).index(str(user)) except: return False else: return True def users(self): users=[] for user in User.objects.all(): users.append(str(user)) return users def test_list(self,list1): for item in list1: print(type(item)) def test_word(self,item): print(item,type(item)) ```
我用vs跑的,每次都是找不到文件路径但我明明放在同一目录下,路径是对的,想请教一下这里fetch函数有没有写错,另外结构体数组如何传参?谢谢。
#define _CRT_SECURE_NO_WARNINGS #include<windows.h> #include<stdlib.h> #include<string.h> #include<stdio.h> #include<ctime> typedef struct STU { int id; char name[8]; }; STU stu[100]; int fetch(STU *stu,const char *s)//获取文件模块 { FILE* fp; int i = 1; fp = fopen(s, "r"); if (fp == NULL) { printf("File Open Error!Please check your filepath.\n"); return -1; } while (fscanf(fp, "%d;%s", &stu[i].id, &stu[i].name) > 0) { i++; } for (int j = 1; j < i; j++) { printf("%d;%s\n", stu[j].id, stu[j].name); } fclose(fp); } int main() { fetch(stu, "D:\\C project\\date12.txt"); return 0; }
阿里云服务器上安装git
下载解压完安装包执行 #3 编译 安装 make prefix=/usr/local/git all 总是报下边的错 LINK git-http-fetch /usr/bin/ld: cannot find -lcurl collect2: error: ld returned 1 exit status make: *** [git-http-fetch] Error 1 [root@izbp1aqyx7rkovd0g3x23gz git-2.3.0]# make prefix=/usr/local/git all LINK git-http-fetch /usr/bin/ld: cannot find -lcurl collect2: error: ld returned 1 exit status make: *** [git-http-fetch] Error 1 网上的乱七八糟的方法都试了还是不行
为什么在codeblocks里运行正常的程序,在devc++中却出现[Error] ld returned 1 exit status?
我照着教材在dev c++中打了一个自定义数组的库,第一次对头文件点编译图标毫无反应,对cpp文件点运行说源文件未编译。我只好把dev c++卸载了重装。 第二次再对头文件点编译无误。但对实现头文件的cpp点编译报[Error] ld returned 1 exit status。对应用的cpp点编译也是同一个错,点运行还是说源文件未编译。 我把相同的代码复制到codeblocks里,完全正常。 代码应该没问题。因为从没运行成功过,所以也不存在后台运行未关闭。我的电脑也没有装杀毒软件。马上机考只能用dev c++,但我实在不知道问题出在哪。求各位大神帮帮小弟! ![图片说明](https://img-ask.csdn.net/upload/202001/03/1578045503_233989.png) 代码如下 array.h ``` #ifndef _array_h #define _array_h struct doublearray { int low,high; double *storage; }; bool initialize(doublearray &arr,int low,int high); bool insert(const doublearray &arr,int index,double value); bool fetch(doublearray &arr,int index,double &value); void cleanup(const doublearray &arr); #endif ``` array.cpp ``` #include <iostream> using namespace std; #include "array.h" bool initialize(doublearray &arr,int low,int high) { arr.low=low; arr.high=high; arr.storage=new double[high-low+1]; if(arr.storage!=NULL) return true; else return false; } bool insert(const doublearray &arr,int index,double value) { if(index<arr.low||index>arr.high) return false; arr.storage[index-arr.low]=value; return true; } bool fetch(doublearray &arr,int index,double &value) { if(index<arr.low||index>arr.high) return false; value=arr.storage[index-arr.low]; return true; } void cleanup(const doublearray &arr) { if(arr.storage) delete []arr.storage; } ``` arrayapply.cpp ``` #include "array.h" #include <iostream> using namespace std; int main() { doublearray array; double value; int low,high; cout<<"low high"<<endl; cin>>low>>high; if(!initialize(array,low,high)) { cout<<"get space failed"<<endl; return 1; } for(int i=low;i<=high;i++) { cout<<"array["<<i<<"]= "<<endl; cin>>value; insert(array,i,value); } int j; cout<<"第几个元素?"<<endl; cin>>j; if(fetch(array,j,value)) cout<<"array["<<j<<"]= "<<value<<endl; else cout<<"下标越界"<<endl; cleanup(array); return 0; } ```
spring Cloud 连接超时 怎么解决?
``` server: port: 9003 spring: application: name: dm-eureka-server eureka: client: service-url: defaultZone: http://localhost:${server.port}/eureka/ fetch-registry: false register-with-eureka: false ``` ![图片说明](https://img-ask.csdn.net/upload/202001/02/1577932011_996729.png)
php查询mysql代码,如何除了name是'张三'的不显示外,,可查询显示其它所有前20条数据??
<?php require './common.php'; $datas1 = $datas2 = $datas3 = $datas4 = $datas = $data = array(); $query = mysql_query("SELECT `name`, `level` FROM player_2 ORDER BY `level` DESC LIMIT 20"); while($data = mysql_fetch_array($query)) { $datas1[] = $data; } mysql_close(); ?>
git命令pull和clone都报错Fetch failed: unable to access 'XXX': The requested URL returned error: 503
之前还是好好地,今天早上更新代码就失败了报错如下: ![图片说明](https://img-ask.csdn.net/upload/201912/13/1576202018_329021.jpg),有大神帮忙看一下嘛谢谢
为什么我的zuul配置的拦截器没有生效?
``` public class LoginFilter extends ZuulFilter { @Override // 过滤器的类型 pre route post error public String filterType() { return "pre"; } @Override // 执行顺序,返回值越小,优先级越高,为防止以后有更优先的过滤器,可以先写10 public int filterOrder() { return 0; } @Override // 是否执行该过滤器 public boolean shouldFilter() { return true; } @Override // 编写过滤器的业务逻辑 public Object run() throws ZuulException { // 初始化context上下文对象, 不像以前的 servlet spring RequestContext context = RequestContext.getCurrentContext(); // 获取request对象 HttpServletRequest request = context.getRequest(); // 获取参数 String token = request.getParameter("token"); System.out.println("token="+token); if(StringUtils.isBlank(token)){ // 为空,拦截,不转发请求 context.setSendZuulResponse(false); // 返回状态 成功/失败 context.setResponseStatusCode(401); // 设置响应提示 context.setResponseBody("requset error!"); } return null; // 返回值为null,代表该过滤器什么都不做 } } ``` ++++++++++ yml配置文件 ``` server: port: 10010 spring: application: name: my-zuul zuul: routes: service-provider: # 路由名称,随便写,一般是服务名 path: /service-provider/** # 包含这个路径的,跳转到下面的链接 # url: http://localhost:8086 serviceId: service-provider service-consumer: /c/** host: connect-timeout-millis: 3000 socket-timeout-millis: 3000 prefix: /api # 路由前缀 eureka: client: register-with-eureka: true fetch-registry: true # 这两句, 写成true error:Cannot execute request on any known server # 写成false error:Load balancer does not have available server for client service-url: defaultZone: http://localhost:10086/eureka ribbon: ReadTimeout: 12000 ConnectTimeout: 12000 eureka: enabled: true ``` ![图片说明](https://img-ask.csdn.net/upload/202001/05/1578194627_957484.png) ++++++++ ![图片说明](https://img-ask.csdn.net/upload/202001/05/1578194683_29110.png)
如何判断22点-24点之间加5分钟,凌晨1点到2点加5分钟,其余时间是加10分钟? 不要转换时间的,要显示2019-11-21 22:05:00 并且调用<?php echo ($drawTime);?>
$drawTime=date('Y-m-d H:i:s',$row["time"]+600); 这段代码如何判断22点-24点之间加5分钟,凌晨1点到2点加5分钟,其余时间是加10分钟? 不要转换时间的,要显示2019-11-21 22:05:00 并且调用<?php echo ($drawTime);?> $servername = "localhost"; $username = "qxc"; $password = "123456"; $dbname = "qxc"; // 创建连接 $conn = new mysqli($servername, $username, $password, $dbname); // Check connection if ($conn->connect_error) { die("连接失败: " . $conn->connect_error); } $sql = "SELECT * FROM qxc.jz_data where type='6' order by number desc LIMIT 1"; $result = $conn->query($sql); if ($result->num_rows > 0) { // 输出数据 while($row = $result->fetch_assoc()) { $number=$row["number"]; $data=$row["data"]; $arr=$row["data"]; $num1=$arr[0]+$arr[2]+$arr[4]+$arr[6]+$arr[8]; $time=date('Y-m-d H:i:s',$row["time"]); $drawTime=date('Y-m-d H:i:s',$row["time"]+300); $serverTime=date('Y-m-d H:i:s'); $drawCount=intval(substr($number,-3)); } } else { } $conn->close();
springcloud oauth2 微服务之间同feign调用,产生invalid_token
使用的是auth2的方式进行微服务的授权, 获取到token后调用服务都正常,但是如果服务之间通过feign互相调用, 就会出现token不正确的问题,生产者一方会出现如下警告: WARN 22880 --- [nio-8200-exec-2] o.s.b.a.s.o.r.UserInfoTokenServices : Could not fetch user details: class org.springframework.beans.factory.BeanCreationException, Error creating bean with name 'scopedTarget.oauth2ClientContext': Scope 'session' is not active for the current thread; consider defining a scoped proxy for this bean if you intend to refer to it from a singleton; nested exception is java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request.
Examining the Rooms 测试的问题
Problem Description A murder happened in the hotel. As the best detective in the town, you should examine all the N rooms of the hotel immediately. However, all the doors of the rooms are locked, and the keys are just locked in the rooms, what a trap! You know that there is exactly one key in each room, and all the possible distributions are of equal possibility. For example, if N = 3, there are 6 possible distributions, the possibility of each is 1/6. For convenience, we number the rooms from 1 to N, and the key for Room 1 is numbered Key 1, the key for Room 2 is Key 2, etc. To examine all the rooms, you have to destroy some doors by force. But you don’t want to destroy too many, so you take the following strategy: At first, you have no keys in hand, so you randomly destroy a locked door, get into the room, examine it and fetch the key in it. Then maybe you can open another room with the new key, examine it and get the second key. Repeat this until you can’t open any new rooms. If there are still rooms un-examined, you have to randomly pick another unopened door to destroy by force, then repeat the procedure above, until all the rooms are examined. Now you are only allowed to destroy at most K doors by force. What’s more, there lives a Very Important Person in Room 1. You are not allowed to destroy the doors of Room 1, that is, the only way to examine Room 1 is opening it with the corresponding key. You want to know what is the possibility of that you can examine all the rooms finally. Input The first line of the input contains an integer T (T ≤ 200), indicating the number of test cases. Then T cases follow. Each case contains a line with two numbers N and K. (1 < N ≤ 20, 1 ≤ K < N) Output Output one line for each case, indicating the corresponding possibility. Four digits after decimal point are preserved by rounding. Sample Input 3 3 1 3 2 4 2 Sample Output 0.3333 0.6667 0.6250
有没有大佬给注释一下代码,挺急的
``` elseif ($action=='export') { //导出CSV $result = mysql_query("select * from aa"); $str = "id,uniprot,url\n"; $str = iconv('utf-8','gb2312',$str); while($row=mysql_fetch_array($result)){ $name = iconv('utf-8','gb2312',$row['id']); $sex = iconv('utf-8','gb2312',$row['uniprot']); $str .= $name.",".$sex.",".$row['url']."\n"; } $filename = date('Ymd').'.csv'; export_csv($filename,$str); } function input_csv($handle) { $out = array (); $n = 0; while ($data = fgetcsv($handle, 10000)) { $num = count($data); for ($i = 0; $i < $num; $i++) { $out[$n][$i] = $data[$i]; } $n++; } return $out; } function export_csv($filename,$data) { header("Content-type:text/csv"); header("Content-Disposition:attachment;filename=".$filename); header('Cache-Control:must-revalidate,post-check=0,pre-check=0'); header('Expires:0'); header('Pragma:public'); echo $data; } ```
Digital Calculator 数字的计算器
Problem Description The Advanced Calculator Machinery (ACM) is going to release a new series of calculators. Like it or not, as a member of ACM, you are asked to develop the software for the new calculator. Here is the detailed technical specification. The general usage of the calculator is that users input expressions, the calculator computes and displays the final result, or error messages if there is something wrong. The expression is in infix notation and the calculator supports following operators: People always make mistakes. When user inputs an invalid expression, the calculator should display an error message, telling user that error occurs. There are totally four possible errors: 1. Syntax error: Any kind of syntax error, such as missing operators, redundancy operators and unpaired brackets. 2. Divide by zero: The right operand of operator “/” or “%” is zero. 3. Integer overflow: At any step of the calculation, any intermediate values go beyond the range of 32-bit signed integers. 4. Invalid exponent: The right operand of operator“^” is negative, or both operands are zero (we consider 0^0 undefined). The calculation works this way: at first the calculator omits all space characters of the expression, check the syntax, and then computes. It always finds the highest priority part of the expression, then operators which combines them, then calculate the result and continue the process, until the final result has been got or error occurs. For example, for expression 2^3^(-4*5), there are mainly 5 steps (we use brackets to note every part of the expression): 1. Check the syntax, no syntax errors. 2. Fetch the highest priority operator 4, no errors. 3. Do arithmetic -(4), get result -4, no errors. 4. Do arithmetic (-(4))*(5), get result -20, no errors. 5. Because operator “^” has right associativity, we do arithmetic (3)^((-(4))*(5)), e.g. (3)^(-20) first. -20 is a negative number, and negative numbers are not allowed as an exponent, so the calculator simply outputs error message and stops. Notes: Because “-“ has two meanings, the calculator will treat it as an unary operation at first, and if it fails, “-“ would be treated as minus operation then. Write a program to simulate the calculator. Input The first line of the input file is an integer T<=200, then following T test cases. Each test case has only one line, the input expression given to the calculator. Each expression has no more than 2000 characters. Output For each test case, output one line contains the case number and the final result or “ERROR!” if any error occurs. See sample for detailed format. Sample Input 6 2^(1 2 - 9)^(5%3) 9-8**7 4%(2^0-1) -5%-3+-5%3 7^--100 (7-3)^(3-7) Sample Output Case 1: 512 Case 2: ERROR! Case 3: ERROR! Case 4: -4 Case 5: ERROR! Case 6: ERROR!
SQL server 将游标查询结果显示在一个表中,现在是每一条显示一个表头
SQL server 将游标查询结果显示在一个表中,现在是每一条显示一个表头,语句该如何修改呢? ![图片说明](https://img-ask.csdn.net/upload/201912/19/1576686056_303771.png) declare @addr varchar(128) declare myCursor CURSOR FOR select distinct cCardCode from dbo.ZLKCardFlow open myCursor fetch next from myCursor into @addr while(@@fetch_status=0) begin select distinct c.cCardCode,c.cName, c.cstatus, a0 as '充值金额',b1 as '消费金额',(a.a0-b.b1) as '余额' from (select SUM(nMoney) a0 from dbo.ZLKCardFlow where cCardCode=@addr and cOPType='充值')a, (select SUM(nMoney) b1 from dbo.ZLKCardFlow where cCardCode=@addr and cOPType='消费')b, (select top 1 * from dbo.ZLKCardFlow where cCardCode=@addr order by cstatus desc )c fetch next from myCursor into @addr end CLOSE myCursor DEALLOCATE myCursor
Django执行python manage.py makemigrations 报错,数据库是postgresql,大神救救孩子
Traceback (most recent call last): File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\base\base.py", line 220, in ensure_connection self.connect() File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\base\base.py", line 197, in connect self.connection = self.get_new_connection(conn_params) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\postgresql\base.py", line 185, in get_new_connection connection = Database.connect(**conn_params) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\psycopg2\__init__.py", line 126, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) psycopg2.OperationalError The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 21, in <module> main() File "manage.py", line 17, in main execute_from_command_line(sys.argv) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\__init__.py", line 401, in execute_from_command_line utility.execute() File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\__init__.py", line 395, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\base.py", line 328, in run_from_argv self.execute(*args, **cmd_options) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\base.py", line 369, in execute output = self.handle(*args, **options) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\base.py", line 83, in wrapped res = handle_func(*args, **kwargs) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\core\management\commands\makemigrations.py", line 101, in handle loader.check_consistent_history(connection) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\migrations\loader.py", line 283, in check_consistent_history applied = recorder.applied_migrations() File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\migrations\recorder.py", line 76, in applied_migrations if self.has_table(): File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\migrations\recorder.py", line 56, in has_table return self.Migration._meta.db_table in self.connection.introspection.table_names(self.connection.cursor()) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\base\base.py", line 260, in cursor return self._cursor() File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\base\base.py", line 236, in _cursor self.ensure_connection() File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\base\base.py", line 220, in ensure_connection self.connect() File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\utils.py", line 90, in __exit__ raise dj_exc_value.with_traceback(traceback) from exc_value File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\base\base.py", line 220, in ensure_connection self.connect() File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\base\base.py", line 197, in connect self.connection = self.get_new_connection(conn_params) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\utils\asyncio.py", line 26, in inner return func(*args, **kwargs) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\django\db\backends\postgresql\base.py", line 185, in get_new_connection connection = Database.connect(**conn_params) File "D:\Program Files (x86)\Microsoft Visual Studio\Shared\Python37_64\lib\site-packages\psycopg2\__init__.py", line 126, in connect conn = _connect(dsn, connection_factory=connection_factory, **kwasync) django.db.utils.OperationalError
Kafka实战(三) - Kafka的自我修养与定位
Apache Kafka是消息引擎系统,也是一个分布式流处理平台(Distributed Streaming Platform) Kafka是LinkedIn公司内部孵化的项目。LinkedIn最开始有强烈的数据强实时处理方面的需求,其内部的诸多子系统要执行多种类型的数据处理与分析,主要包括业务系统和应用程序性能监控,以及用户行为数据处理等。 遇到的主要问题: 数据正确性不足 数据的收集主要...
volatile 与 synchronize 详解
Java支持多个线程同时访问一个对象或者对象的成员变量,由于每个线程可以拥有这个变量的拷贝(虽然对象以及成员变量分配的内存是在共享内存中的,但是每个执行的线程还是可以拥有一份拷贝,这样做的目的是加速程序的执行,这是现代多核处理器的一个显著特性),所以程序在执行过程中,一个线程看到的变量并不一定是最新的。 volatile 关键字volatile可以用来修饰字段(成员变量),就是告知程序任何对该变量...
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
GitHub开源史上最大规模中文知识图谱
近日,一直致力于知识图谱研究的 OwnThink 平台在 Github 上开源了史上最大规模 1.4 亿中文知识图谱,其中数据是以(实体、属性、值),(实体、关系、实体)混合的形式组织,数据格式采用 csv 格式。 到目前为止,OwnThink 项目开放了对话机器人、知识图谱、语义理解、自然语言处理工具。知识图谱融合了两千五百多万的实体,拥有亿级别的实体属性关系,机器人采用了基于知识图谱的语义感...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
微信支付崩溃了,但是更让马化腾和张小龙崩溃的竟然是……
loonggg读完需要3分钟速读仅需1分钟事件还得还原到昨天晚上,10 月 29 日晚上 20:09-21:14 之间,微信支付发生故障,全国微信支付交易无法正常进行。然...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
刷了几千道算法题,这些我私藏的刷题网站都在这里了!
遥想当年,机缘巧合入了 ACM 的坑,周边巨擘林立,从此过上了"天天被虐似死狗"的生活… 然而我是谁,我可是死狗中的战斗鸡,智力不够那刷题来凑,开始了夜以继日哼哧哼哧刷题的日子,从此"读题与提交齐飞, AC 与 WA 一色 ",我惊喜的发现被题虐既刺激又有快感,那一刻我泪流满面。这么好的事儿作为一个正直的人绝不能自己独享,经过激烈的颅内斗争,我决定把我私藏的十几个 T 的,阿不,十几个刷题网...
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
相关热词 c#中dns类 c#合并的excel c# implicit c#怎么保留3个小数点 c# 串口通信、 网络调试助手c# c# 泛型比较大小 c#解压分卷问题 c#启动居中 c# 逻辑或运算符
立即提问

相似问题

1
eureka配置了spring security后,客户端启动报错,请求不到服务器
4
重赏!关于ORACLE中的游标语句“fetch 游标 INTO A1,A2,A3”这类用法问题
3
Android studio 3.1及以上版本git fetch代码失败
1
小程序中fetch is not a function出错,请问如何修改成wx.request格式
3
如何查看feature分支的parent 分支?
4
前端小白fetch https请求失败如何解决
1
调用TensorFlowInference接口,能不能fetch到三维矩阵
5
微信小程序 如何读取数据库中当前登录用户对应的数据,并列表显示
1
使用spring boot 中的jpa 设置懒加载无效
0
mysql存储过程游标遍历表数据报错,1328 Incorrect number of FETCH variables
2
请问如下代码为什么报错:TypeError: Fetch argument None has invalid type <class 'NoneType'>
2
reactjs无法连接后台:Could not proxy request xxx from localhost:3000 to http://localhost:8080/
2
Reactjs fetch()报错net::ERR_EMPTY_RESPONSE
2
AttributeError: 'module' object has no attribute 'to_rgba'
2
Python调用微博API時出現403错误的问题 (HTTP METHOD is not suported?)
1
Module的effects中的某个方法call了一个接口,接口报错catch后再调用该方法为什么进不去这个方法了?
1
PHP中提示:Warning: mysqli_fetch_array().....应该怎么修改,万分感谢
1
fetch请求一个gbk网站的html内容, 返回 arrayBuffer,如何把里面的中文乱码转换正确?
3
git fetch origin master 命令之后 git的回复信息怎么解释
4
如何用C++调用jeesite的库中的内容