Python中怎么使用execute_script修改window.navigator.webdriver的值?

使用webdriver登录淘宝时window.navigator.webdriver值为true,怎么用execute_script修改window.navigator.webdriver的值为false。我想知道修改window.navigator.webdrier值的具体的JS代码

2个回答

        js = r"Object.defineProperty(navigator, 'webdriver', {get: () => undefined,});"                           
        self.driver.execute_script(js)   

只改这个不够的。现在都反爬技术早升级了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
a.import_list_no,b.import_no,c.GOODS_MODEL,a,b,c,什么意思?
select IMPORT_GOODS_STATUS,a.import_goods_bar, a.import_id,a.import_list_no,b.import_no,c.GOODS_MODEL,c.Goods_standard,c.Goods_unit,c.Goods_type, a.import_lot_no,import_plan_quantity,import_fact_quantity,import_fulfill_quantity,b.import_date,goods_code,goods_name, a.import_audit_date,a.import_remark from wms_import_notifydetail a left join wms_import_notify b on a.import_id=b.import_id left join wms_base_goods c on c.goods_id=a.import_goods_id where a.import_audit_flag='0' and a.import_noused_flag='0' and a.import_upload_flag='0' and a.import_execute_flag='0' order by a.import_id desc,a.import_list_no asc a.import_list_no,b.import_no,c.GOODS_MODEL,中的啊a,b,c,什么意思
执行python manage.py migrate命令有问题
我在windows系统搭建了开发环境,使用的是pytohn2.7版本,在本地开发环境验证测试,执行python manage.py migrate命令有问题: 我在这个位置执行的命令: ![图片说明](https://img-ask.csdn.net/upload/201912/16/1576467780_425609.png) 报错如下: ![图片说明](https://img-ask.csdn.net/upload/201912/16/1576467889_633346.png) D:\python2.7\python2.7\Lib\site-packages\django\conf\project_template>python manage.py migrate Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "D:\python2.7\python2.7\lib\site-packages\django\core\management\__init__.py", line 338, in execute_from_command_line utility.execute() File "D:\python2.7\python2.7\lib\site-packages\django\core\management\__init__.py", line 303, in execute settings.INSTALLED_APPS File "D:\python2.7\python2.7\lib\site-packages\django\conf\__init__.py", line 48, in __getattr__ self._setup(name) File "D:\python2.7\python2.7\lib\site-packages\django\conf\__init__.py", line 44, in _setup self._wrapped = Settings(settings_module) File "D:\python2.7\python2.7\lib\site-packages\django\conf\__init__.py", line 92, in __init__ mod = importlib.import_module(self.SETTINGS_MODULE) File "D:\python2.7\python2.7\lib\importlib\__init__.py", line 37, in import_module __import__(name) ImportError: No module named {{ project_name }}.settings 求大神指教,是我执行的目录位置有问题吗?
关于Django执行迁移文件时,ForeignKey里面加on_delete=models.CASCADE报错问题,谁知道时怎么回事?万分感谢!!
Django 在创建模型类后,执行一下代码迁移文件时,在ForeignKey里面不加on_delete=models.CASCADE会报错,加了后,其他又外键的模型类不报错,就这个报错。 ``` class GoodsType(BaseModel): """商品类型模型类""" name = models.CharField(max_length=20, verbose_name="种类名称") logo = models.CharField(max_length=20, verbose_name="标识") image = models.ImageField(upload_to="type", verbose_name="商品类型图片") class Mete: db_table = "df_goods_type" verbose_name = "商品种类" verbose_name_plural = verbose_name def __str__(self): return self.name class GoodsSKU(BaseModel): """商品SKU模型类""" status_choices = ( (0, "下线"), (1, "上线"), ) type = models.ForeignKey("GoodsType", on_delete=models.CASCADE, verbose_name="商品种类") goods = models.ForeignKey("Goods", on_delete=models.CASCADE, verbose_name="商品SPU") name = models.CharField(max_length=20, verbose_name="商品名称") desc = models.CharField(max_length=256, verbose_name="商品简介") price = models.DecimalField(max_digits=10, decimal_places=2, verbose_name="商品价格") unite = models.CharField(max_length=20, verbose_name="商品单位") image = models.ImageField(upload_to='goods', verbose_name="商品图片") stock = models.IntegerField(default=1, verbose_name="商品库存") sales = models.IntegerField(default=0, verbose_name="商品销量") status = models.SmallIntegerField(default=1, choices=status_choices,verbose_name="商品状态") class Meta: db_table = "df_goods_sku" verbose_name = "商品" verbose_name_plural = verbose_name class GoodImage(models): """商品图片模型类""" sku = models.ForeignKey("GoodsSKU", on_delete=models.CASCADE, verbose_name="商品") image = models.ImageField(upload_to="good", verbose_name="图片路径") class Meta: db_table = "df_goods_image" verbose_name = "商品图片" verbose_name_plural = verbose_name ``` 报错 ``` python manage.py makemigrations 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 "/home/u/.virtualenvs/dailyfresh/lib/python3.5/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/home/u/.virtualenvs/dailyfresh/lib/python3.5/site-packages/django/core/management/__init__.py", line 357, in execute django.setup() File "/home/u/.virtualenvs/dailyfresh/lib/python3.5/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/home/u/.virtualenvs/dailyfresh/lib/python3.5/site-packages/django/apps/registry.py", line 114, in populate app_config.import_models() File "/home/u/.virtualenvs/dailyfresh/lib/python3.5/site-packages/django/apps/config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 986, in _gcd_import File "<frozen importlib._bootstrap>", line 969, in _find_and_load File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 673, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 665, in exec_module File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed File "/home/u/jeth/dailyfresh/apps/goods/models.py", line 56, in <module> class GoodImage(models): TypeError: module.__init__() takes at most 2 arguments (3 given) ```
Python selenium 中如何使用 JavaScript 直接选择下拉框的某个选项呢?
有这样一段代码下拉框,选择分类: ``` <div class="widgets-selects direction-horizontal"> <div class="widgets-selects_container">选择分类<i class=""></i></div> <div class="widgets-selects_select_container" style="display: none;"> <a href="javascript:;" class="">社会</a> <a href="javascript:;" class="">国内</a> <a href="javascript:;" class="">国际</a> <a href="javascript:;" class="">体育</a> <a href="javascript:;" class="">科技</a> <a href="javascript:;" class="">娱乐</a> <a href="javascript:;" class="">军事</a> </div> </div> </div> ``` 选择了第一个分类“社会”后,代码变成了这样: ``` <div class="widgets-selects direction-horizontal"> <div class="widgets-selects_container" data-spm-anchor-id="a2s0i.db_video_write.content.i2.4a603caaqY4ZC8">社会<i class=""></i></div> <div class="widgets-selects_select_container" style="display: none;"> <a href="javascript:;" class="selected" data-spm-anchor-id="a2s0i.db_video_write.content.6">社会</a> <a href="javascript:;" class="" data-spm-anchor-id="a2s0i.db_video_write.content.7">国内</a> <a href="javascript:;" class="" data-spm-anchor-id="a2s0i.db_video_write.content.8">国际</a> <a href="javascript:;" class="" data-spm-anchor-id="a2s0i.db_video_write.content.9">体育</a> <a href="javascript:;" class="" data-spm-anchor-id="a2s0i.db_video_write.content.10">科技</a> <a href="javascript:;" class="" data-spm-anchor-id="a2s0i.db_video_write.content.11">娱乐</a> <a href="javascript:;" class="" data-spm-anchor-id="a2s0i.db_video_write.content.12">军事</a> </div> </div> </div> ``` 之前我用python selenium的操作是用click()命令点击一下“选择分类”,弹出下拉框,再在其中click()点击选择某个分类。 但我很希望能在python中用driver.execute_script()命令直接调用JavaScript实现选择某分类,可惜弄了半天也没琢磨出来,望大神来帮帮我呀,感激不尽。
用SSH SQL语句错误哪里有错呢
select this_.pid as pid2_0_, this_.pname as pname2_0_, this_.market_price as market3_2_0_, this_.shop_price as shop4_2_0_, this_.image as image2_0_, this_.pdesc as pdesc2_0_, this_.is_hot as is7_2_0_, this_.pdate as pdate2_0_, this_.csid as csid2_0_ from product this_ where this_.is_hot=? order by this_.pdate desc]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query org.springframework.dao.InvalidDataAccessResourceUsageException: could not execute query; SQL [select this_.pid as pid2_0_, this_.pname as pname2_0_, this_.market_price as market3_2_0_, this_.shop_price as shop4_2_0_, this_.image as image2_0_, this_.pdesc as pdesc2_0_, this_.is_hot as is7_2_0_, this_.pdate as pdate2_0_, this_.csid as csid2_0_ from product this_ where this_.is_hot=? order by this_.pdate desc]; nested exception is org.hibernate.exception.SQLGrammarException: could not execute query
python3.7,django 2.21,for...in...Python int too large to convert to C long
``` def index(request): obj = datas.objects.all() # 数据只有两条 for foo in obj: print(foo) return render(request, 'index.html', {'obj': obj}) ``` 报以下错误:求帮助 ``` Internal Server Error: / Traceback (most recent call last): File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\core\handlers\exception.py", line 34, in inner response = get_response(request) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\core\handlers\base.py", line 115, in _get_response response = self.process_exception_by_middleware(e, request) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\core\handlers\base.py", line 113, in _get_response response = wrapped_callback(request, *callback_args, **callback_kwargs) File "E:\PythonProjects\SMMS\db\views.py", line 12, in index for foo in obj: File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\models\query.py", line 274, in __iter__ self._fetch_all() File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\models\query.py", line 1242, in _fetch_all self._result_cache = list(self._iterable_class(self)) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\models\query.py", line 55, in __iter__ results = compiler.execute_sql(chunked_fetch=self.chunked_fetch, chunk_size=self.chunk_size) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\models\sql\compiler.py", line 1100, in execute_sql cursor.execute(sql, params) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\backends\utils.py", line 99, in execute return super().execute(sql, params) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\backends\utils.py", line 67, in execute return self._execute_with_wrappers(sql, params, many=False, executor=self._execute) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\backends\utils.py", line 76, in _execute_with_wrappers return executor(sql, params, many, context) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\backends\utils.py", line 84, in _execute return self.cursor.execute(sql, params) File "E:\PythonProjects\SMMS\venv\lib\site-packages\django\db\backends\sqlite3\base.py", line 383, in execute return Database.Cursor.execute(self, query, params) File "D:\Program Files\Python37\lib\sqlite3\dbapi2.py", line 64, in convert_date return datetime.date(*map(int, val.split(b"-"))) OverflowError: Python int too large to convert to C long ```
ImportError: No module named baseinstall
]# python manage.py startapp baseinsatll Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 385, in execute_from_command_line utility.execute() File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 354, in execute django.setup() File "/usr/local/lib/python2.7/site-packages/django/__init__.py", line 21, in setup apps.populate(settings.INSTALLED_APPS) File "/usr/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate app_config = AppConfig.create(entry) File "/usr/local/lib/python2.7/site-packages/django/apps/config.py", line 87, in create module = import_module(entry) File "/usr/local/lib/python2.7/importlib/__init__.py", line 37, in import_module __import__(name) ImportError: No module named baseinstall
问个有关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)) ```
使用will_paginate遇到的一个问题,rails2.1 will_paginate2.3.4
erb <table width="354" border="1"> <tr> <td width="33"><input type="checkbox" name="checkbox" id="checkbox"></td> <td width="85">用户名</td> <td width="214">昵称</td> </tr> <% for users in @users %> <tr> <td><input type="checkbox" name="checkbox2" id="checkbox2"></td> <td><%=h users.uname%></td> <td><%=h users.nick%></td> </tr> <% end %> </table> <p>&nbsp;</p> <%= will_paginate @users %> controller def admin_index @users = User.get_all_users_paginate(params[:page], 5) end route ActionController::Routing::Routes.draw do |map| map.admin_all_users "/admin/user/all", :controller => '/admin/user', :action => "admin_index" end 报错: ActionView::TemplateError (No route matches {:controller=>"admin/user", :action=>"admin_index", :page=>2}) on line #32 of admin/user/admin_index.html.erb: 29: </table> 30: <p>&nbsp;</p> 31: 32: <%= will_paginate @users %> 33: <%= render :partial => "user" %> D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/routing/route_set.rb:368:in `generate' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:131:in `rewrite_path' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:110:in `rewrite_url' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/url_rewriter.rb:88:in `rewrite' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:621:in `url_for' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/helpers/url_helper.rb:71:in `send' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/helpers/url_helper.rb:71:in `url_for' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:326:in `url_for' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:300:in `page_link' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:293:in `page_link_or_span' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:255:in `windowed_links' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/inflector.rb:283:in `inject' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:252:in `each' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:252:in `inject' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:252:in `windowed_links' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:225:in `to_html' vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb:117:in `will_paginate' app/views/admin/user/admin_index.html.erb:32:in `_run_erb_47app47views47admin47user47admin_index46html46erb' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `send' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:338:in `execute' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `send' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template_handlers/compilable.rb:29:in `render' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:35:in `render' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/template.rb:22:in `render_template' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_view/base.rb:245:in `render_file' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1108:in `render_for_file' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:841:in `render_with_no_layout' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/layout.rb:251:in `render_without_benchmark' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in `render' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/core_ext/benchmark.rb:8:in `realtime' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:51:in `render' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1157:in `default_render' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:1163:in `perform_action_without_filters' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:580:in `call_filters' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:573:in `perform_action_without_benchmark' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' D:/tools/ruby/lib/ruby/1.8/benchmark.rb:293:in `measure' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/benchmarking.rb:68:in `perform_action_without_rescue' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/rescue.rb:201:in `perform_action_without_caching' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:13:in `perform_action' D:/tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/connection_adapters/abstract/query_cache.rb:33:in `cache' D:/tools/ruby/lib/ruby/gems/1.8/gems/activerecord-2.1.0/lib/active_record/query_cache.rb:8:in `cache' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/caching/sql_cache.rb:12:in `perform_action' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `send' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:529:in `process_without_filters' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/filters.rb:569:in `process_without_session_management_support' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/session_management.rb:130:in `process' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/base.rb:389:in `process' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:149:in `handle_request' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:107:in `dispatch' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `synchronize' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:104:in `dispatch' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi' D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/dispatcher.rb:35:in `dispatch' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/rails.rb:76:in `process' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/rails.rb:74:in `synchronize' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/rails.rb:74:in `process' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:159:in `process_client' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:158:in `each' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:158:in `process_client' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `run' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `initialize' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `new' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:285:in `run' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in `initialize' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in `new' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel.rb:268:in `run' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/configurator.rb:282:in `run' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/configurator.rb:281:in `each' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/configurator.rb:281:in `run' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mongrel_rails:128:in `run' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/lib/mongrel/command.rb:212:in `run' D:/tools/ruby/lib/ruby/gems/1.8/gems/mongrel-1.1.5-x86-mswin32-60/bin/mongrel_rails:281 D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:502:in `load' D:/tools/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/servers/mongrel.rb:64 D:/tools/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' D:/tools/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:354:in `new_constants_in' D:/tools/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies.rb:509:in `require' D:/tools/ruby/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/server.rb:39 D:/tools/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' D:/tools/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' script\server:3 D:/tools/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.3.0/lib/ruby-debug.rb:96:in `debug_load' D:/tools/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.3.0/lib/ruby-debug.rb:96:in `main' D:/tools/ruby/lib/ruby/gems/1.8/gems/ruby-debug-ide-0.3.0/bin/rdebug-ide:74 D:/tools/ruby/bin/rdebug-ide:16:in `load' D:/tools/ruby/bin/rdebug-ide:16 Rendering D:/tools/ruby/lib/ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templates/rescues/layout.erb (internal_server_error) ruby/gems/1.8/gems/actionpack-2.1.0/lib/action_controller/templates/rescues/layout.erb (internal_server_error)
lua中如何使用os.execute实现io.popen的find功能
``` function QMPlugin.setarea1() local files = find_file("/User/Containers/Data/Application/*/Documents/clientconfig") if #files > 0 then local clientconfig = files[1] if #files > 1 then LuaAuxLib.TracePrint("发现"..#files.."个clientconfig文件目录!(自动清理)", 3) local latest_file = nil for k, f in pairs(files) do if latest_file == nil then latest_file = f else local r = io.popen("find "..latest_file.." -newer "..f) local old_file = f if not r then old_file = latest_file latest_file = f end -- 删除旧文件 local dir = string.sub(old_file, 1, -23) remove_file(dir) end end clientconfig = latest_file end local content = read_file(clientconfig) return content--按键中decode后返回 else LuaAuxLib.TracePrint("无法找到clientconfig文件目录!") end end function QMPlugin.setarea2(area_set,config) config.areaSetId = area_set.areaSetId config.areaSet = area_set.areaSet config.quick_help_info = nil config.local_all_login_record = nil return config--按键中encode end function QMPlugin.setarea3(config) local files = find_file("/User/Containers/Data/Application/*/Documents/clientconfig") if #files > 0 then local clientconfig = files[1] if #files > 1 then LuaAuxLib.TracePrint("发现"..#files.."个clientconfig文件目录!(自动清理)", 3) local latest_file = nil for k, f in pairs(files) do if latest_file == nil then latest_file = f else local r = io.popen("find "..latest_file.." -newer "..f) local old_file = f if not r then old_file = latest_file latest_file = f end -- 删除旧文件 local dir = string.sub(old_file, 1, -23) remove_file(dir) end end clientconfig = latest_file end local content = read_file(clientconfig) --return content--按键中decode后返回 else LuaAuxLib.TracePrint("无法找到clientconfig文件目录!") end write_file(clientconfig,config) return true end function find_file(path) local a = io.popen("find "..path.." -prune") local f = {}; for l in a:lines() do table.insert(f,l) end return f end function remove_file(path) return os.execute("rm -rf " .. path) end function read_file(file_name) local f = io.open(file_name, "r") if f ~= nil then local data = f:read("*a") f:close() return data end end function write_file(file_name, data) local f = io.open(file_name, "w") if f ~= nil then f:write(data) f:close() end end ``` 一共3处popen,2处重复 1.io.popen("find "..path.." -prune") 2.io.popen("find "..latest_file.." -newer "..f) 怎么使用os.execute才能实现相同操作
oracle 存储过程出错,高手修改
create or replace procedure ACCESS_PROD is begin execute immediate 'truncate table access_prod_inst'; select a.PROD_INST_ID, a.PRODUCT_ID, a.ACC_NBR, a.OWNER_CUST_ID, a.USE_CUST_ID, a.ADDRESS_DESC, a.PRODUCT_PROP, a.PAYMENT_MODE_CD, a.CREATE_DATE, a.FINISH_TIME, a.COL1, a.COL4, a.COL8, a.COL6, a.COL10, a.COMMON_REGION_ID, a.COMP_INST_ID, a.COMMENTS, a.COMM_COL1, a.COMM_COL2, a.CHANNEL_ID into access_prod_inst from access_prod_inst@crmbm a where a.lan_id='937'and a.state_cd='001'; execute immediate 'create index access_prod_inst on access_prod_inst (prod_inst_id,acc_nbr)'; commit; end ACCESS_PROD;
python MySQLdb 连接数据库太耗时
![图片说明](https://img-ask.csdn.net/upload/201712/10/1512916083_161612.jpeg) ``` #!usr/bin/python #!coding:utf-8 import MySQLdb import threading from config.config import Config from Clogger.logger import CLogger import time class Positions(object): __instance = None __positions = None __index = 0 __Lock = None __size = 0 def __init__(self): pass def __del__(self): Positions.__instance = None Positions.__positions = None Positions.__index = 0 Positions.__Lock = None Positions.__size = 0 def __new__(cls, *args, **kwargs): Positions.__Lock = threading.Lock() if not cls.__instance: try: Positions.__Lock.acquire() if not cls.__instance: cls.__instance = super(Positions, cls).__new__(cls, *args, **kwargs) cls.__instance.selectAll() finally: Positions.__Lock.release() def selectAll(self): try: print time.time() conn = MySQLdb.connect( host=Config.mysql_host, port=Config.mysql_port, user=Config.mysql_user, passwd=Config.mysql_password, db=Config.mysql_db, charset="utf8" ) print time.time() cursor = conn.cursor() except Exception, e: CLogger.logger().error(str(e)) exit() sql1 = "select towncode from addressComponents where province='%s' and city = '%s' and towncode is not null " \ "group by towncode" % (Config.current_province, Config.current_city) sql = "select lng, lat from pois where towncode in (%s);" % sql1 cursor.execute(sql) Positions.__positions = cursor.fetchall() Positions.__size = len(Positions.__positions) print Positions.__size if Positions.__size <= 0: CLogger.logger().info(str(Positions.__size)) exit(-1) @staticmethod def getPosition(): if not Positions.__instance: Positions.__new__() try: Positions.__Lock.acquire() index = Positions.__index Positions.__index += 1 Positions.__Lock.release() if index >= Positions.__size: return "Empty" return Positions.__positions[index] except Exception, e: CLogger.logger().error(str(e)) ```
利用conda install TensorFlow-gpu在win7上conda3.7版本上安装tensorflow后,测试时出现下面的问题
在测试import TensorFlow as tf print('hello'),出现下列问题,请问这是什么原因造成的,如何改? ``` Traceback (most recent call last): File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "D:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "D:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的程序。 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\ProgramData\Anaconda3\lib\site-packages\IPython\core\interactiveshell.py", line 3296, in run_code exec(code_obj, self.user_global_ns, self.user_ns) File "<ipython-input-2-d1ce02c95f3b>", line 1, in <module> runfile('C:/Users/jianjiu17/Desktop/deep-learning-from-scratch-master/uittle.py', wdir='C:/Users/jianjiu17/Desktop/deep-learning-from-scratch-master') File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile pydev_imports.execfile(filename, global_vars, local_vars) # execute the script File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile exec(compile(contents+"\n", file, 'exec'), glob, loc) File "C:/Users/jianjiu17/Desktop/deep-learning-from-scratch-master/uittle.py", line 1, in <module> import tensorflow as tf File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\__init__.py", line 24, in <module> from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\__init__.py", line 49, in <module> from tensorflow.python import pywrap_tensorflow File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 74, in <module> raise ImportError(msg) ImportError: Traceback (most recent call last): File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in <module> from tensorflow.python.pywrap_tensorflow_internal import * File "D:\Program Files\JetBrains\PyCharm 2019.1.3\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 28, in <module> _pywrap_tensorflow_internal = swig_import_helper() File "D:\ProgramData\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 24, in swig_import_helper _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description) File "D:\ProgramData\Anaconda3\lib\imp.py", line 242, in load_module return load_dynamic(name, filename, file) File "D:\ProgramData\Anaconda3\lib\imp.py", line 342, in load_dynamic return _load(spec) ImportError: DLL load failed: 找不到指定的程序。 Failed to load the native TensorFlow runtime. See https://www.tensorflow.org/install/errors for some common reasons and solutions. Include the entire stack trace above this error message when asking for help. ```
《pythno编程从入门到实践》18.2.2中makemigrations时出错是啥情况
Traceback (most recent call last): File "manage.py", line 15, in <module> execute_from_command_line(sys.argv) File "/Users/taoyu/Desktop/learning_log/ll_env/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line utility.execute() File "/Users/taoyu/Desktop/learning_log/ll_env/lib/python3.7/site-packages/django/core/management/__init__.py", line 357, in execute django.setup() File "/Users/taoyu/Desktop/learning_log/ll_env/lib/python3.7/site-packages/django/__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/taoyu/Desktop/learning_log/ll_env/lib/python3.7/site-packages/django/apps/registry.py", line 112, in populate app_config.import_models() File "/Users/taoyu/Desktop/learning_log/ll_env/lib/python3.7/site-packages/django/apps/config.py", line 198, in import_models self.models_module = import_module(models_module_name) File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "/Users/taoyu/Desktop/learning_log/learning_logs/models.py", line 5, in <module> class Topics(models.Model): File "/Users/taoyu/Desktop/learning_log/learning_logs/models.py", line 8, in Topics date_added = models.DateTimeField(auto_now_add=Ture) NameError: name 'Ture' is not defined
webdriver进一步爬取京东商品信息
各位大佬好: 刚接触python,想用webdriver实现爬取京东商品信息,举个例子:在京东首页搜索 手机 会显示许多商品结果,我想在搜索出来的基础(商品价钱,商品链接,商品店铺链接)上根据这个“商品店铺链接”进一步爬取这个店铺里面的信息, 请问我的思路是否可行(不一定非要用webdriver),如果可行能否指导下怎么进入这个商品店铺链接 悬赏可以修改这是我的代码: ``` from selenium import webdriver from selenium.webdriver.common.keys import Keys import time # noinspection SyntaxError def get_good(driver): try: # 通过JS控制滚轮滑动获取所有商品信息 js_code = ''' window.scrollTo(0,5000); ''' driver.execute_script(js_code) # 执行js代码 # 等待数据加载 time.sleep(2) # 3、查找所有商品div # good_div = driver.find_element_by_id('J_goodsList') good_list = driver.find_elements_by_class_name('gl-item') n = 1 for good in good_list: # 根据属性选择器查找 # 商品链接 good_url = good.find_element_by_css_selector( '.p-img a').get_attribute('href') # 商品名称 good_name = good.find_element_by_css_selector( '.p-name em').text.replace("\n", "--") # 商品价格 good_price = good.find_element_by_class_name( 'p-price').text.replace("\n", ":") # 评价人数 good_commit = good.find_element_by_class_name( 'p-commit').text.replace("\n", " ") # 店铺连接 #try: shop_url = good.find_element_by_css_selector( '.p-shop a').get_attribute('href') #except OSError: pass # 店铺名称 #try: shop_name = good.find_element_by_css_selector( '.p-shop a').get_attribute('title') #except OSError: pass good_content = f''' 商品链接: {good_url} 商品名称: {good_name} 商品价格: {good_price} 评价人数: {good_commit} 店铺名称: {shop_url} 店铺连接: {shop_name} \n ''' #qianjian = '旗舰店' #if qianjian in shop_name: # print('旗舰店不要') #else: print(good_content) with open('jd.txt', 'a', encoding='utf-8') as f: f.write(good_content) next_tag = driver.find_element_by_class_name('pn-next') next_tag.click() # except AttributeError: # pass # raise Exception("a must not be zero") time.sleep(2) # 递归调用函数 get_good(driver) time.sleep(10) finally: driver.close() if __name__ == '__main__': good_name = input('请输入爬取商品信息:').strip() driver = webdriver.Firefox() #driver.implicitly_wait(10) # 1、往京东主页发送请求 driver.get('https://www.jd.com/') # 2、输入商品名称,并回车搜索 input_tag = driver.find_element_by_id('key') input_tag.send_keys(good_name) input_tag.send_keys(Keys.ENTER) time.sleep(2) get_good(driver) ``` ps:环境:python3.7 需要引入下浏览器驱动,我用的火狐(45.0.2)引入的驱动是:geckodriver-v0.15.0
问个有关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连接服务器的redis 请求成功且抛出异常
During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/usr/local/lib/python3.7/site-packages/flask_cache/__init__.py", line 528, in decorated_function cache_key = decorated_function.make_cache_key(f, *args, **kwargs) File "/usr/local/lib/python3.7/site-packages/flask_cache/__init__.py", line 381, in make_cache_key timeout=_timeout) File "/usr/local/lib/python3.7/site-packages/flask_cache/__init__.py", line 350, in _memoize_version version_data_list = list(self.cache.get_many(*fetch_keys)) File "/usr/local/lib/python3.7/site-packages/werkzeug/contrib/cache.py", line 636, in get_many return [self.load_object(x) for x in self._client.mget(keys)] File "/usr/local/lib/python3.7/site-packages/redis/client.py", line 1039, in mget return self.execute_command('MGET', *args) File "/usr/local/lib/python3.7/site-packages/redis/client.py", line 673, in execute_command connection.send_command(*args) File "/usr/local/lib/python3.7/site-packages/redis/connection.py", line 610, in send_command self.send_packed_command(self.pack_command(*args)) File "/usr/local/lib/python3.7/site-packages/redis/connection.py", line 585, in send_packed_command self.connect() File "/usr/local/lib/python3.7/site-packages/redis/connection.py", line 489, in connect raise ConnectionError(self._error_message(e)) redis.exceptions.ConnectionError: Error 101 connecting to localhost:6379. Network is unreachable.
急求大神指点下我在delphi写的这个数据库双表查询插入的问题
我要实现的是A任务表,B任务执行状态两表关联查询后,得到A表中能执行的数据,查询出来的结果确实是A表中能执行任务的数据, 但是在向B表中插入这条A表数据执行状态的时候,插入B表中的数据ID不是之前查询A表出来数据的ID, 下面附上代码,求大大们指点 //定义了任务运行表插入数据操作过程 procedure TForm1.InsertData(exeid,status,starttime,endtime,result : string); begin qry3.Close; qry3.SQL.Clear; qry3.SQL.Text:= 'insert into task_operation(execute_id,status,start_time,end_time,result_log) values(:execute_id,:status,:start_time,:end_time,:result_log)'; qry3.Parameters.ParamByName('execute_id').Value := exeid; qry3.Parameters.ParamByName('status').Value := status; qry3.Parameters.ParamByName('start_time').Value := starttime; qry3.Parameters.ParamByName('end_time').Value := endtime; qry3.Parameters.ParamByName('result_log').Value := result; qry3.ExecSQL; end; //这就是AB连接查询然后执行插入的操作 qry4.Close; qry4.SQL.Clear; qry4.SQL.Text := 'select execute_id,weburl from task_description where task_description.excuteperiod_daily <= (select right(now(),8)) and task_description.execute_id not in' + '(select execute_id from task_operation where task_operation.start_time between (SELECT CAST(CAST(SYSDATE()AS DATE)AS DATETIME)) and (SELECT CAST((CAST(SYSDATE()AS DATE) + INTERVAL 1 DAY)AS DATETIME)))'; qry4.Open; qry4.First; while not qry4.Eof do begin weburl := qry4.FieldByName('weburl').AsString +'#'+ qry4.FieldByName('execute_id').AsString; start_time := FormatDateTime('yyyy-MM-dd hh:mm:ss',now); Form1.showWeburl(weburl); edt2.Text := weburl; edt1.Text := qry4.FieldByName('execute_id').AsString; ==〉此处的ID还是AB联结查询结果的ID exeid := qry4.FieldByName('execute_id').AsString; form1.insertData(exeid,'执行中',start_time,'','任务正在执行中'); 这边插入数据后,id就变了,请大神不吝赐教。
执行 python manage.py makemigrations 提示错误
Traceback (most recent call last): File "manage.py", line 23, in <module> main() File "manage.py", line 19, in main execute_from_command_line(sys.argv) File "D:\codeProgram\python3.7\lib\site-packages\django\core\management\__init__.py", line 381, in execute_from_command_line utility.execute() File "D:\codeProgram\python3.7\lib\site-packages\django\core\management\__init__.py", line 357, in execute django.setup() File "D:\codeProgram\python3.7\lib\site-packages\django\__init__.py", line 24, in setup apps.populate(settings.INSTALLED_APPS) File "D:\codeProgram\python3.7\lib\site-packages\django\apps\registry.py", line 114, in populate app_config.import_models() File "D:\codeProgram\python3.7\lib\site-packages\django\apps\config.py", line 211, in import_models self.models_module = import_module(models_module_name) File "D:\codeProgram\python3.7\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 728, in exec_module File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "D:\codeStudy\django企业开发实战\typeidea\typeidea\blog\models.py", line 8, in <module> class Category(models.Model): File "D:\codeStudy\django企业开发实战\typeidea\typeidea\blog\models.py", line 20, in Category owner = models.ForeignKey(User, verbose_name="作者") TypeError: __init__() missing 1 required positional argument: 'on_delete' ``` # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.contrib.auth.models import User from django.db import models class Category(models.Model): STATUS_NORMAL = 1 STATUS_DELETE = 0 STATUS_ITEMS = ( (STATUS_NORMAL, '正常'), (STATUS_DELETE, '删除'), ) name = models.CharField(max_length=50, verbose_name="名称") status = models.PositiveIntegerField( default=STATUS_NORMAL, choices=STATUS_ITEMS, verbose_name="状态") is_nav = models.BooleanField(default=False, verbose_name="是否为导航") owner = models.ForeignKey(User, verbose_name="作者") created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") class Meta: verbose_name = verbose_name_plural = '分类' class Tag(models.Model): STATUS_NORMAL = 1 STATUS_DELETE = 0 STATUS_ITEMS = ( (STATUS_NORMAL, '正常'), (STATUS_DELETE, '删除'), ) name = models.CharField(max_length=10, verbose_name="名称") status = models.PositiveIntegerField( default=STATUS_NORMAL, choices=STATUS_ITEMS, verbose_name="状态") owner = models.ForeignKey(User, verbose_name="作者") created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") class Meta: verbose_name = verbose_name_plural = '标签' class Post(models.Model): STATUS_NORMAL = 1 STATUS_DELETE = 0 STATUS_DRAFT = 2 STATUS_ITEMS = ( (STATUS_NORMAL, '正常'), (STATUS_DELETE, '删除'), (STATUS_DRAFT, '草稿'), ) title = models.CharField(max_length=255, verbose_name="标题") desc = models.CharField(max_length=1024, blank=True, verbose_name="摘要") content = models.TextField(verbose_name="正文", help_text="正文必须为MarkDown格式") status = models.PositiveIntegerField( default=STATUS_NORMAL, choices=STATUS_ITEMS, verbose_name="状态") category = models.ForeignKey(Category, verbose_name="分类") tag = models.ManyToManyField(Tag, verbose_name="标签") owner = models.ForeignKey(User, verbose_name="作者") created_time = models.DateTimeField(auto_now_add=True, verbose_name="创建时间") class Meta: verbose_name = verbose_name_plural = "文章" ```
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#委托 逆变与协变 c#新建一个项目 c#获取dll文件路径 c#子窗体调用主窗体事件 c# 拷贝目录 c# 调用cef 网页填表c#源代码 c#部署端口监听项目、 c#接口中的属性使用方法 c# 昨天
立即提问

相似问题

2
Selenium无法停止加载
2
Python selenium,无法定位页面中的日期选择框,尝试用JS关掉只读失败?
5
panda包导入出错 python
2
《pythno编程从入门到实践》18.2.2中makemigrations时出错是啥情况
1
SQL查询出错:java.lang.Exception: ERROR:ORA-03001: 未实施的功能
2
python3.7,django 2.21,for...in...Python int too large to convert to C long
2
python连接服务器的redis 请求成功且抛出异常
2
webdriver进一步爬取京东商品信息
1
python能成功爬取天气 不知道怎么加循环
1
利用conda install TensorFlow-gpu在win7上conda3.7版本上安装tensorflow后,测试时出现下面的问题
2
plsql中的存储过程execute immediate相关问题
1
manage.py运行makemigrations错误。。
1
如图 运行conda create -n py27 python=2.7 报错 该如何解决呢
1
关于Django执行迁移文件时,ForeignKey里面加on_delete=models.CASCADE报错问题,谁知道时怎么回事?万分感谢!!
0
Mac Python3.7, pyinstaller 生成的exe文件无法执行,报错Failed to execute script pyi_rth__tkinter
0
Python selenium 中如何使用 JavaScript 直接选择下拉框的某个选项呢?
0
tkinter界面最小化到托盘如何保持按钮启动的程序后台一直运行。
1
django.db.utils.InternalError: (1050, "Table 'django_content_type' already exists") 迁移文件建立数据表的时候一直报错
0
Dreamweaver+access做挂号系统提交表单出错?
1
执行python manage.py migrate命令有问题