问:
django.db.utils.OperationalError: no such table: bookmarks_mytag
I am getting django.db.utils.OperationalError: no such table: bookmarks_mytag trying to install a django project.
The repo is at http://bitbucket.org/codyc54321/bookwormbud.git

We did

```<code>touch db.sqlite3
python manage.py migrate
</code>```

and it blows up:

```<code>(bookwormbuddy) john@john-Precision-3510:~/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca$ python manage.py runserver
Performing system checks...

Unhandled exception in thread started by <function wrapper at 0x7f7adbb5e140>
Traceback (most recent call last):
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookwormbud/urls.py", line 24, in <module>
    url(r'^',           include('bookmarks.urls',   namespace='bookmarks')),
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/urls.py", line 4, in <module>
    from bookmarks import views
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/views.py", line 24, in <module>
    from bookmarks.forms        import ArticleForm, TagForm, TagSelectForm, EditArticleForm, AddedDateCalendarForm, LastViewedDateCalendarForm
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 120, in <module>
    class TagSelectForm(forms.ModelForm):
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 127, in TagSelectForm
    choices=get_tag_choices()
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 112, in get_tag_choices
    if tags:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __nonzero__
    return type(self).__bool__(self)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 254, in __bool__
    self._fetch_all()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 886, in execute_sql
    raise original_exception
django.db.utils.OperationalError: no such table: bookmarks_mytag
^C(bookwormbuddy) john@john-Precision-3510:~/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca$ touch db.sqlite3
(bookwormbuddy) john@john-Precision-3510:~/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca$ python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 327, in execute
    self.check()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks
    issues.extend(super(Command, self)._run_checks(**kwargs))
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookwormbud/urls.py", line 24, in <module>
    url(r'^',           include('bookmarks.urls',   namespace='bookmarks')),
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/urls.py", line 4, in <module>
    from bookmarks import views
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/views.py", line 24, in <module>
    from bookmarks.forms        import ArticleForm, TagForm, TagSelectForm, EditArticleForm, AddedDateCalendarForm, LastViewedDateCalendarForm
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 120, in <module>
    class TagSelectForm(forms.ModelForm):
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 127, in TagSelectForm
    choices=get_tag_choices()
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 112, in get_tag_choices
    if tags:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __nonzero__
    return type(self).__bool__(self)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 254, in __bool__
    self._fetch_all()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 886, in execute_sql
    raise original_exception
django.db.utils.OperationalError: no such table: bookmarks_mytag
</code>```

The project installs immediately on a different laptop, but I don't remember how it was set up. The sqlite db has been deleted and remade empty as it was said to do on SO. Any help appreciated, thank you

答:
You are creating an empty db file manually. You dont need to create that file manually. Delete your "db.sqlite3" file, then run command,

```<code>python manage.py makemigrations
</code>```

If above command says "No changes detected", then run this command,

```<code>python manage.py makemigrations app_name
</code>```

where, app_name will be your directory name in which models.py file is located,

using above command, you have successfully created migration files,
Now, simpy run,

```<code>python manage.py migrate
</code>```

I hope this help

Body:
I am getting django.db.utils.OperationalError: no such table: bookmarks_mytag trying to install a django project.
The repo is at http://bitbucket.org/codyc54321/bookwormbud.git

We did

touch db.sqlite3
python manage.py migrate

and it blows up:

(bookwormbuddy) john@john-Precision-3510:~/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca$ python manage.py runserver
Performing system checks...

Unhandled exception in thread started by <function wrapper at 0x7f7adbb5e140>
Traceback (most recent call last):
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/autoreload.py", line 227, in wrapper
    fn(*args, **kwargs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/commands/runserver.py", line 125, in inner_run
    self.check(display_num_errors=True)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookwormbud/urls.py", line 24, in <module>
    url(r'^',           include('bookmarks.urls',   namespace='bookmarks')),
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/urls.py", line 4, in <module>
    from bookmarks import views
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/views.py", line 24, in <module>
    from bookmarks.forms        import ArticleForm, TagForm, TagSelectForm, EditArticleForm, AddedDateCalendarForm, LastViewedDateCalendarForm
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 120, in <module>
    class TagSelectForm(forms.ModelForm):
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 127, in TagSelectForm
    choices=get_tag_choices()
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 112, in get_tag_choices
    if tags:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __nonzero__
    return type(self).__bool__(self)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 254, in __bool__
    self._fetch_all()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 886, in execute_sql
    raise original_exception
django.db.utils.OperationalError: no such table: bookmarks_mytag
^C(bookwormbuddy) john@john-Precision-3510:~/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca$ touch db.sqlite3
(bookwormbuddy) john@john-Precision-3510:~/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca$ python manage.py migrate
Traceback (most recent call last):
  File "manage.py", line 22, in <module>
    execute_from_command_line(sys.argv)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/__init__.py", line 363, in execute_from_command_line
    utility.execute()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/__init__.py", line 355, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 283, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 327, in execute
    self.check()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 359, in check
    include_deployment_checks=include_deployment_checks,
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 62, in _run_checks
    issues.extend(super(Command, self)._run_checks(**kwargs))
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/management/base.py", line 346, in _run_checks
    return checks.run_checks(**kwargs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
    new_errors = check(app_configs=app_configs)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 16, in check_url_config
    return check_resolver(resolver)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/core/checks/urls.py", line 26, in check_resolver
    return check_method()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 254, in check
    for pattern in self.url_patterns:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 405, in url_patterns
    patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/utils/functional.py", line 35, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/urls/resolvers.py", line 398, in urlconf_module
    return import_module(self.urlconf_name)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookwormbud/urls.py", line 24, in <module>
    url(r'^',           include('bookmarks.urls',   namespace='bookmarks')),
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/conf/urls/__init__.py", line 50, in include
    urlconf_module = import_module(urlconf_module)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/urls.py", line 4, in <module>
    from bookmarks import views
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/views.py", line 24, in <module>
    from bookmarks.forms        import ArticleForm, TagForm, TagSelectForm, EditArticleForm, AddedDateCalendarForm, LastViewedDateCalendarForm
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 120, in <module>
    class TagSelectForm(forms.ModelForm):
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 127, in TagSelectForm
    choices=get_tag_choices()
  File "/home/john/Documents/cody_work/codyc54321-bookwormbud-f7f43c3908ca/bookmarks/forms.py", line 112, in get_tag_choices
    if tags:
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 258, in __nonzero__
    return type(self).__bool__(self)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 254, in __bool__
    self._fetch_all()
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 1118, in _fetch_all
    self._result_cache = list(self._iterable_class(self))
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/query.py", line 53, in __iter__
    results = compiler.execute_sql(chunked_fetch=self.chunked_fetch)
  File "/home/john/anaconda3/envs/bookwormbuddy/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 886, in execute_sql
    raise original_exception
django.db.utils.OperationalError: no such table: bookmarks_mytag

The project installs immediately on a different laptop, but I don't remember how it was set up. The sqlite db has been deleted and remade empty as it was said to do on SO. Any help appreciated, thank you

Body:
You are creating an empty db file manually. You dont need to create that file manually. Delete your "db.sqlite3" file, then run command,

python manage.py makemigrations

If above command says "No changes detected", then run this command,

python manage.py makemigrations app_name

where, app_name will be your directory name in which models.py file is located,

using above command, you have successfully created migration files,
Now, simpy run,

python manage.py migrate

I hope this help


来源: stackexchange

问:
denied: requested access to the resource is denied: docker
I am following this link to create my first docker Image and it went successfully and now I am trying to push this Image into my docker repository from this link. But whenever I am trying to push this Image into repository, I  got this type of error.

```<code>denied: requested access to the resource is denied
</code>```

Note: I have successfully login into docker

答:
OS: Ubuntu16.04

Reason: I deleted the client config file(~/.docker/config.json)

Solution:

Restart docker.

service docker restart.

It needs to input Login info, then generates config file automatically.

docker login --username=yourdockerhubername --email=youremail@company.com

ContentLicense: CC BY-SA 4.0

Body:
I am following this link to create my first docker Image and it went successfully and now I am trying to push this Image into my docker repository from this link. But whenever I am trying to push this Image into repository, I  got this type of error.

denied: requested access to the resource is denied

Note: I have successfully login into docker


问:
.htaccess authentication for only one subdirectory
I have a .htaccess file that is requesting login credentials on every page of my website. The .htaccess is located only within my dev folder. However whenever I go to my live website(not dev) Im still asked for login credentials.

What I would like: To only have .htaccess request password on my dev subdirectory. So for example when I go to dev.mywebsite.com I will be asked for the login credentials.

This is my file path for my live website /www/live_website

This is my file path for my dev website /www/live_website/dev

(The .htaccess file only exists in the /www/live_website/dev)

Here is what my .htaccess looks like:

```<code>AuthUserFile /www/live_website/dev/.htpasswd
AuthType Basic
AuthName "Please login"
Require valid-user
</code>```

UPDATE:SOLVED

I solved this issue by editing my .htaccess to this. For a full explination see my reply to Capsule below or my answer below.

```<code>RewriteEngine on
RewriteCond %{HTTP_HOST} ^dev.mywebsite.com
RewriteRule ^(.*)$ http://mywebsite.com/dev/$1 [L,NC,QSA]

SetEnvIf Request_URI ^/dev require_auth=true

# show Basic auth dialogue only when SHOW_AUTH is set
AuthType Basic
AuthUserFile /www/live_website/dev/.htpasswd
AuthName “Please login“

# Setup a deny/allow
Order Deny,Allow

# Deny from everyone
Deny from all

# except if either of these are satisfied
Satisfy any

# 1. a valid authenticated user
Require valid-user

# or 2. the "require_auth" var is NOT set
Allow from env=!require_auth
</code>```

答:
I solved this by changing the subdomain from dev.mywebsite.com to redirect to mywebsite.com/dev and then had .htaccess request login credentials upon the redirect.

The new .htaccess file in my dev folder below.

```<code>    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^dev.mywebsite.com
    RewriteRule ^(.*)$ http://mywebsite.com/dev/$1 [L,NC,QSA]

    SetEnvIf Request_URI ^/dev require_auth=true

    # show Basic auth dialogue only when SHOW_AUTH is set
    AuthType Basic
    AuthUserFile /www/live_website/dev/.htpasswd
    AuthName “Please login“

    # Setup a deny/allow
    Order Deny,Allow

    # Deny from everyone
    Deny from all

    # except if either of these are satisfied
    Satisfy any

    # 1. a valid authenticated user
    Require valid-user

    # or 2. the "require_auth" var is NOT set
    Allow from env=!require_auth
</code>```

ContentLicense: CC BY-SA 3.0

Body:
I have a .htaccess file that is requesting login credentials on every page of my website. The .htaccess is located only within my dev folder. However whenever I go to my live website(not dev) Im still asked for login credentials.

What I would like: To only have .htaccess request password on my dev subdirectory. So for example when I go to dev.mywebsite.com I will be asked for the login credentials.

This is my file path for my live website /www/live_website

This is my file path for my dev website /www/live_website/dev

(The .htaccess file only exists in the /www/live_website/dev)

Here is what my .htaccess looks like:

AuthUserFile /www/live_website/dev/.htpasswd
AuthType Basic
AuthName "Please login"
Require valid-user

UPDATE:SOLVED

I solved this issue by editing my .htaccess to this. For a full explination see my reply to Capsule below or my answer below.

RewriteEngine on
RewriteCond %{HTTP_HOST} ^dev.mywebsite.com
RewriteRule ^(.*)$ http://mywebsite.com/dev/$1 [L,NC,QSA]

SetEnvIf Request_URI ^/dev require_auth=true

# show Basic auth dialogue only when SHOW_AUTH is set
AuthType Basic
AuthUserFile /www/live_website/dev/.htpasswd
AuthName “Please login“

# Setup a deny/allow
Order Deny,Allow

# Deny from everyone
Deny from all

# except if either of these are satisfied
Satisfy any

# 1. a valid authenticated user
Require valid-user

# or 2. the "require_auth" var is NOT set
Allow from env=!require_auth

Body:
I solved this by changing the subdomain from dev.mywebsite.com to redirect to mywebsite.com/dev and then had .htaccess request login credentials upon the redirect.

The new .htaccess file in my dev folder below.

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^dev.mywebsite.com
    RewriteRule ^(.*)$ http://mywebsite.com/dev/$1 [L,NC,QSA]

    SetEnvIf Request_URI ^/dev require_auth=true

    # show Basic auth dialogue only when SHOW_AUTH is set
    AuthType Basic
    AuthUserFile /www/live_website/dev/.htpasswd
    AuthName “Please login“

    # Setup a deny/allow
    Order Deny,Allow

    # Deny from everyone
    Deny from all

    # except if either of these are satisfied
    Satisfy any

    # 1. a valid authenticated user
    Require valid-user

    # or 2. the "require_auth" var is NOT set
    Allow from env=!require_auth


问:
Wordpress Site down for my own IP address
I just migrate my site to another hosting provider using wordpress Duplicator plugin. Before waiting for DNS propagate, i already change the host file so that I can run the installer file from Duplicator. When everything is done, I revert the host file to original, but then my site appear as white screen of death (other browsers) and 500 error (chrome). But it looks perfectly fine when I test it from other ip adress (mobile 4g, or home wifi), it only fail for my work wifi. Does anyone know what's wrong with this?

ps: I have checked my own IP address is not blocked

答: please clear your cookies, flush dns and restart your router. should do the trick</p>


问:
What's the magic of arrays in C#
```<code>int[] a = new int[5];
string[] b = new string[1];
</code>```

The types of both a and b inherit from the abstract System.Array, but there is no real classes in the built-in library(it seems that there are some runtime types, you can't find the type defination class of an int[]). Can you tell me what happens while compiling? And why did they(the c# team) make this design(I mean why it's not something like Array<T>,instead they are using an abstract class with compiler magics)?

答:
There is such class. You cannot inherit it, but when you write "int[]" the compiler creates a type that inherits System.Array. So if you declare a variable:

```<code>int[] x;
</code>```

This variable will have a type that inherits System.Array, and therefore has all its methods and properties.

This is also similar to delegates. When you define a delegate:

```<code>delegate void Foo(int x);
delegate int Bar(double x);
</code>```

Then the type Foo is actually a class that inherits System.MulticastDelegate and Bar is a class that inherits System.Delegate.

ContentLicense: CC BY-SA 2.5

Title: What's the magic of arrays in C#

Body:
int[] a = new int[5];
string[] b = new string[1];

The types of both a and b inherit from the abstract System.Array, but there is no real classes in the built-in library(it seems that there are some runtime types, you can't find the type defination class of an int[]). Can you tell me what happens while compiling? And why did they(the c# team) make this design(I mean why it's not something like Array<T>,instead they are using an abstract class with compiler magics)?

Body:
There is such class. You cannot inherit it, but when you write "int[]" the compiler creates a type that inherits System.Array. So if you declare a variable:

int[] x;

This variable will have a type that inherits System.Array, and therefore has all its methods and properties.

This is also similar to delegates. When you define a delegate:

delegate void Foo(int x);
delegate int Bar(double x);

Then the type Foo is actually a class that inherits System.MulticastDelegate and Bar is a class that inherits System.Delegate.


问:
Spring Data Initialization issue
I have a Spring Boot application. I have a configuration service application which provides all configurations for my application. I created a client which pulls all settings for the application and puts them into the context.
I created java class which does this job:

```<code>@Configuration
public class ContextConfiguration {

    @PostConstruct
    public void getContextConfiguration(){
        ConfigServiceResponse configurations = configurationServiceClient.getConfigurations(configurationEnv);
        Properties properties = generateProperties(configurations.getConfigParameterList());

        MutablePropertySources propertySources = env.getPropertySources();

        propertySources.addFirst(new PropertiesPropertySource("APPLICATION_PROPERTIES", properties));
    }
 }
</code>```

Also I created java class for configuration of DataSource:

```<code>@Configuration
public class PersistentConfiguration {

    @Value("${db.url}")
    private String serverDbURL;

    @Value("${db.user}")
    private String serverDbUser;

    @Value("${db.password}")
    private String serverDbPassword;

    public DataSource dataSource() {
        return new SingleConnectionDataSource(serverDbURL, serverDbUser, serverDbPassword, true);
    }
}
</code>```

With this configuration the App worked well. Until I migrated to Spring Data. I just added dependency to the Gradle configuration:

```<code>compile("org.springframework.boot:spring-boot-starter-data-jpa")
</code>```

After I added dependency, I can see an exception while the app is starting:

Error creating bean with name 'persistentConfiguration':
  Injection of autowired dependencies failed; nested exception is
  java.lang.IllegalArgumentException: Could not resolve placeholder
  'db.url' in value "${db.url}

If I remove dependency the App starts with no issues.

And the previous class which configures client and calls it to get data even was not invoked.

答:
In order to let Spring know it should process your ContextConfiguration first, add a DependsOn annotation to the PersistentConfiguration like so:

```<code>@DependsOn("contextConfiguration")
@Configuration
public class PersistentConfiguration {
    ...
</code>```

The problem is that nothing in your PersistentConfiguration tells Spring that it depends on the ContextConfiguration, although it does because the former uses variables only initialized by the latter.

This is exactly what DependsOn is for. From the JavaDoc:

Any beans specified are guaranteed to be created by the container before this bean. Used infrequently in cases where a bean does not explicitly depend on another through properties or constructor arguments, but rather depends on the side effects of another bean's initialization.

Title: Spring Data Initialization issue

Body:
I have a Spring Boot application. I have a configuration service application which provides all configurations for my application. I created a client which pulls all settings for the application and puts them into the context.
I created java class which does this job:

@Configuration
public class ContextConfiguration {

    @PostConstruct
    public void getContextConfiguration(){
        ConfigServiceResponse configurations = configurationServiceClient.getConfigurations(configurationEnv);
        Properties properties = generateProperties(configurations.getConfigParameterList());

        MutablePropertySources propertySources = env.getPropertySources();

        propertySources.addFirst(new PropertiesPropertySource("APPLICATION_PROPERTIES", properties));
    }
 }

Also I created java class for configuration of DataSource:

@Configuration
public class PersistentConfiguration {

    @Value("${db.url}")
    private String serverDbURL;

    @Value("${db.user}")
    private String serverDbUser;

    @Value("${db.password}")
    private String serverDbPassword;

    public DataSource dataSource() {
        return new SingleConnectionDataSource(serverDbURL, serverDbUser, serverDbPassword, true);
    }
}

With this configuration the App worked well. Until I migrated to Spring Data. I just added dependency to the Gradle configuration:

compile("org.springframework.boot:spring-boot-starter-data-jpa")

After I added dependency, I can see an exception while the app is starting:

Error creating bean with name 'persistentConfiguration':
  Injection of autowired dependencies failed; nested exception is
  java.lang.IllegalArgumentException: Could not resolve placeholder
  'db.url' in value "${db.url}

If I remove dependency the App starts with no issues.

And the previous class which configures client and calls it to get data even was not invoked.

Body:
In order to let Spring know it should process your ContextConfiguration first, add a DependsOn annotation to the PersistentConfiguration like so:

@DependsOn("contextConfiguration")
@Configuration
public class PersistentConfiguration {
    ...

The problem is that nothing in your PersistentConfiguration tells Spring that it depends on the ContextConfiguration, although it does because the former uses variables only initialized by the latter.

This is exactly what DependsOn is for. From the JavaDoc:

Any beans specified are guaranteed to be created by the container before this bean. Used infrequently in cases where a bean does not explicitly depend on another through properties or constructor arguments, but rather depends on the side effects of another bean's initialization.


问:
Connect Microsoft QnA Maker to Bot Framework
I have created a bot using QnA Maker and set up a FB App connected to our FB page and Microsoft Bot Framework.  However, something is missing.  How do I connect Microsoft QnA maker to Bot Framework?  (FWIW - the goal is a FB Messenger bot that answers FAQ regarding a non profit event).  Thanks</p>

答: You cannot directly link the QnAMaker endpoint to FB. You first need to create a Bot Service using the QnAMaker template and then enable it on FB channel. See https://learn.microsoft.com/en-us/bot-framework/azure/azure-bot-service-quickstart</p>


问:
Foreach on IEnumerable property and CheckBoxFor in ASP.Net MVC
I believe this question applies to any of the "For" Html helpers, but my specific problem is using CheckBoxFor...

I have a model that is of type IEnumerable, where rights is a simple POCO.  This model is actually a property of a bigger model that I created an EditorTemplate for.  Here is the bigger picture of my model:

```<code>public class bigmodel
{
     public string Title {get; set;}
     public string Description {get; set;}

     [UIHint("ListRights")]
     public IEnumerable<rights> Rights {get;set;}
}

public class rights
{
    public bool HasAccess {get; set;}
    public string Description {get;set;}
}
</code>```

I created an editortemplate called "ListRights" that my main view uses.  For example: <%=Html.EditorFor(m => m.Rights) %>.

In ListRights.ascx, I want code like this:

```<code><table>
  <% foreach(rights access in Model)
  { %>
      <tr>
        <td>
            <%=Html.CheckBoxFor( access ) %>
        </td>
        <td>
            <%=access.Description %>
        </td>
      </tr>
  <% } %>
</table>
</code>```

I know the CheckBoxFor line does not work, but I want to do something that generates the same result, as if access was a property on the model.

In the above example, I would like everything to autobind on post.

I've tried faking the CheckBox with code similar to this, but it doesn't autobind:

```<code><table>
  <% for(int i=0; i < Model.Count(); i++)
  { %>
      <tr>
        <td>
            <%=Html.CheckBox(string.Format("[{0}].HasAccess",i), Model.ElementAt(i).HasAccess)%>
        </td>
        <td>
            <%=access.Description %>
        </td>
      </tr>
  <% } %>
</table>
</code>```

Any suggestions?

答:
I guess you had problems because this didn't work

```<code><%=Html.CheckBoxFor(access) %>
</code>```

and this didn't work either

```<code><%=Html.CheckBoxFor(access=>access.HasAccess) %>
</code>```

but this should work

```<code><%=Html.CheckBoxFor(x=>access.HasAccess) %>
</code>```

Body:
I believe this question applies to any of the "For" Html helpers, but my specific problem is using CheckBoxFor...

I have a model that is of type IEnumerable, where rights is a simple POCO.  This model is actually a property of a bigger model that I created an EditorTemplate for.  Here is the bigger picture of my model:

public class bigmodel
{
     public string Title {get; set;}
     public string Description {get; set;}

     [UIHint("ListRights")]
     public IEnumerable<rights> Rights {get;set;}
}

public class rights
{
    public bool HasAccess {get; set;}
    public string Description {get;set;}
}

I created an editortemplate called "ListRights" that my main view uses.  For example: <%=Html.EditorFor(m => m.Rights) %>.

In ListRights.ascx, I want code like this:

  <% foreach(rights access in Model)
  { %>

            <%=Html.CheckBoxFor( access ) %>

            <%=access.Description %>

  <% } %>

I know the CheckBoxFor line does not work, but I want to do something that generates the same result, as if access was a property on the model.

In the above example, I would like everything to autobind on post.

I've tried faking the CheckBox with code similar to this, but it doesn't autobind:

  <% for(int i=0; i < Model.Count(); i++)
  { %>

            <%=Html.CheckBox(string.Format("[{0}].HasAccess",i), Model.ElementAt(i).HasAccess)%>

            <%=access.Description %>

  <% } %>

Any suggestions?

Body:
I guess you had problems because this didn't work

<%=Html.CheckBoxFor(access) %>

and this didn't work either

<%=Html.CheckBoxFor(access=>access.HasAccess) %>

but this should work

<%=Html.CheckBoxFor(x=>access.HasAccess) %>


问:
clang tool: how to treat .h header as C++ file
I am trying with some clang extra tools such like clang-check, but I found it cannot handle .h file as expected, if the file is renamed as .hpp file, it will be OK, but I don't want to change the file extension. Is there any method to let the clang-check to treat .h header as c++ file?</p>

答: with -extra-arg-before=-xc++ option can resolve my problem</p>


问:
Powershell String Expansion Conundrum
Very simple concept, need to create Exchange OPATH recipient filter syntax from variable.

```<code>$rf = { ((Company -eq $company_name) -and (Alias -ne $null)) }
</code>```

Company name is a simple string.

When trying to run     Set-AddressList command, I receive a     Cannot bind parameter 'RecipientFilter' to the target, Invalid Filter Syntax error

I have tried many ways of concatenating string and variables, but it seems that Exchange isn't expecting a normal string for this RecipientFilter parameter, if I convert a working filter to a variable-based concatenated string, all stops working

答:
Interesting! According to this technet article, -ReceipientFilter is supposed to accept a string. I wouldn't be surprised if Set-AddressList does syntax validation on that string, but a string is a string is a string.

$rf, as you have it defined above, isn't a string, though - it's a ScriptBlock. Here's what I ran:

```<code>$Company = "Contoso"
$Alias = "*jerry*"
$rf = { (($Company -eq "Contoso") -and ($Alias -ne $null)) }
$rf | Get-Member
</code>```

Encasing the $rf = assignment in single quotes gets us a string:

```<code>$rf = '{ (($Company -eq "Contoso") -and ($Alias -ne $null)) }'
</code>```

I don't have an Exchange environment to test on, though. If that doesn't work for you, could you provide the full Set-AddressList command to diagnose?

Title: Powershell String Expansion Conundrum

Body:
Very simple concept, need to create Exchange OPATH recipient filter syntax from variable.

$rf = { ((Company -eq $company_name) -and (Alias -ne $null)) }

Company name is a simple string.

When trying to run     Set-AddressList command, I receive a     Cannot bind parameter 'RecipientFilter' to the target, Invalid Filter Syntax error

I have tried many ways of concatenating string and variables, but it seems that Exchange isn't expecting a normal string for this RecipientFilter parameter, if I convert a working filter to a variable-based concatenated string, all stops working

Body:
Interesting! According to this technet article, -ReceipientFilter is supposed to accept a string. I wouldn't be surprised if Set-AddressList does syntax validation on that string, but a string is a string is a string.

$rf, as you have it defined above, isn't a string, though - it's a ScriptBlock. Here's what I ran:

$Company = "Contoso"
$Alias = "*jerry*"
$rf = { (($Company -eq "Contoso") -and ($Alias -ne $null)) }
$rf | Get-Member

Encasing the $rf = assignment in single quotes gets us a string:

$rf = '{ (($Company -eq "Contoso") -and ($Alias -ne $null)) }'

I don't have an Exchange environment to test on, though. If that doesn't work for you, could you provide the full Set-AddressList command to diagnose?


问:
How can I change an element's text without changing its child elements?
I'd like to update element's text dynamically:

   **text to change**
   <someChild>
       text that should not change
   </someChild>
   <someChild>
       text that should not change
   </someChild>

```

I'm new to jQuery, so this task seems to be quite challenging for me.
Could someone point me to a function/selector to use?

If it is possible, I'd like to do it without adding a new container for the text I need to change.

答:
This is an old question but you can make a simple function like this to make your life easier:

```<code>$.fn.toText = function(str) {
    var cache = this.children();
    this.text(str).append(cache);
}
</code>```

Example:

```<code><div id="my-div">
   **text to change**
   <p>
       text that should not change
   </p>
   <p>
       text that should not change
   </p>
</div>
</code>```

Usage:

```<code>$("#my-div").toText("helloworld");
</code>```

Body:
I'd like to update element's text dynamically:

   **text to change**
   <someChild>
       text that should not change
   </someChild>
   <someChild>
       text that should not change
   </someChild>

I'm new to jQuery, so this task seems to be quite challenging for me.
Could someone point me to a function/selector to use?

If it is possible, I'd like to do it without adding a new container for the text I need to change.

Body:
This is an old question but you can make a simple function like this to make your life easier:

$.fn.toText = function(str) {
    var cache = this.children();
    this.text(str).append(cache);
}

Example:

<div id="my-div">
   **text to change**
   <p>
       text that should not change
   </p>
   <p>
       text that should not change
   </p>
</div>

Usage:

$("#my-div").toText("helloworld");


问:
Webpack command not found
I have installed webpack using

npm install -g webpack

and

```<code>npm install webpack
</code>```

I also installed webpack-dev-server

```<code>npm install -g webpack-dev-server
</code>```

After completion of installation, I ran the command webpack but, it shows below error

webpack: command not found

I am not getting what is the error.

答:
If you want to use global installation, you can find webpack script in [node_installed_path]/lib/node_modules/webpack/bin/, you can use with absolute path, adding to PATH environment variable, or symbolic link,  etc.

If you want to use local installation, find it in ./node_modules/.bin/.

I recommand using local installation (for same reason about babel).

Title: Webpack command not found

Body:
I have installed webpack using

npm install -g webpack

and

npm install webpack

I also installed webpack-dev-server

npm install -g webpack-dev-server

After completion of installation, I ran the command webpack but, it shows below error

webpack: command not found

I am not getting what is the error.


问:
android - Place imageview next to two textviews under each other

How do i create above layout in android studio ?

答:
First add line in your app level build.gradle file following line of code in dependencies

```<code> compile 'de.hdodenhof:circleimageview:2.1.0'
</code>```

after try following code

```<code>   <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="3">

        <LinearLayout
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="match_parent">

            <de.hdodenhof.circleimageview.CircleImageView
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/meal_image_order"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:src="@mipmap/profile" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_weight="2">

            <TextView
                android:id="@+id/tv1"
                android:textSize="15sp"
                android:textStyle="bold"
                android:textColor="#000"
                android:gravity="start"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Broad Bean" />

            <TextView
                android:id="@+id/tv2"
                android:textColor="#000"
                android:gravity="start"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:text="Broad" />

        </LinearLayout>
    </LinearLayout>
</code>```

Body:
First add line in your app level build.gradle file following line of code in dependencies

 compile 'de.hdodenhof:circleimageview:2.1.0'

after try following code

   <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="horizontal"
        android:weightSum="3">

        <LinearLayout
            android:layout_weight="1"
            android:layout_width="0dp"
            android:layout_height="match_parent">

            <de.hdodenhof.circleimageview.CircleImageView
                xmlns:app="http://schemas.android.com/apk/res-auto"
                android:id="@+id/meal_image_order"
                android:layout_width="80dp"
                android:layout_height="80dp"
                android:src="@mipmap/profile" />

        </LinearLayout>

        <LinearLayout
            android:layout_width="0dp"
            android:layout_height="match_parent"
            android:orientation="vertical"
            android:layout_weight="2">

            <TextView
                android:id="@+id/tv1"
                android:textSize="15sp"
                android:textStyle="bold"
                android:textColor="#000"
                android:gravity="start"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:text="Broad Bean" />

            <TextView
                android:id="@+id/tv2"
                android:textColor="#000"
                android:gravity="start"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="3dp"
                android:text="Broad" />

        </LinearLayout>
    </LinearLayout>


问:
Getting Content type 'application/json' not supported
I am getting below exception when i am using @RequestBody in my controller class.

But I need to use @RequestBody only for post method.

Caused by: org.springframework.web.HttpMediaTypeNotSupportedException:
  Content type 'application/json' not supported

Anyone can help how to solve this issue..

答:
Firstly, Make sure that you have a correctly jackson version using:

```<code><dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.0</version>
</dependency>
<dependency>
     <groupId>com.fasterxml.jackson.core</groupId>
     <artifactId>jackson-databind</artifactId>
     <version>2.8.0</version>
 </dependency>
 <dependency>
     <artifactId>jackson-annotations</artifactId>
     <groupId>com.fasterxml.jackson.core</groupId>
     <version>2.8.0</version>
 </dependency>
</code>```

As for me, when I use the version of v2.7.6 or v2.8.7. This error came to me! And I change to v2.8.0, It work well!

Secondly, Make sure your controller code:

```<code>@RestController
@RequestMapping(value = "/user", produces = {MediaType.APPLICATION_JSON}, consumes = {MediaType.APPLICATION_JSON})
public class UserController extends GenericController<User, String> {

    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    public ResponseMessage add(@RequestBody User user) {
       String id = getService().insert(user);
       return ResponseMessage.created(id );
    }
}
</code>```

RequestBody:

```<code>{
    "username":"123",
    "password":"123",
    "name":"123",
    "phone":"123",
    "email":"123@qq.com",
    "status":1
}
</code>```

Postman :

Postman Post

Hope it helps you!

Body:
Firstly, Make sure that you have a correctly jackson version using:

<dependency>
    <groupId>com.fasterxml.jackson.core</groupId>
    <artifactId>jackson-core</artifactId>
    <version>2.8.0</version>
</dependency>
<dependency>
     <groupId>com.fasterxml.jackson.core</groupId>
     <artifactId>jackson-databind</artifactId>
     <version>2.8.0</version>
 </dependency>
 <dependency>
     <artifactId>jackson-annotations</artifactId>
     <groupId>com.fasterxml.jackson.core</groupId>
     <version>2.8.0</version>
 </dependency>

As for me, when I use the version of v2.7.6 or v2.8.7. This error came to me! And I change to v2.8.0, It work well!

Secondly, Make sure your controller code:

@RestController
@RequestMapping(value = "/user", produces = {MediaType.APPLICATION_JSON}, consumes = {MediaType.APPLICATION_JSON})
public class UserController extends GenericController<User, String> {

    @RequestMapping(method = RequestMethod.POST)
    @ResponseStatus(HttpStatus.CREATED)
    public ResponseMessage add(@RequestBody User user) {
       String id = getService().insert(user);
       return ResponseMessage.created(id );
    }
}

RequestBody:

{
    "username":"123",
    "password":"123",
    "name":"123",
    "phone":"123",
    "email":"123@qq.com",
    "status":1
}

Postman :

Postman Post

Hope it helps you!


问:
CheckBox in RecyclerView keeps on checking different items
Here's the XML for my items inside the RecyclerView

```<code><android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cvItems"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_margin="2dp"
    card_view:cardElevation="0dp"
    card_view:contentPadding="0dp"
    card_view:cardBackgroundColor="#FFFFFF"
    >

    <LinearLayout
        android:orientation="horizontal"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent">
        <TextView
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="0.8"
            android:id="@+id/tvContent"
            android:textSize="15dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp" />
        <CheckBox
            android:id="@+id/cbSelect"
            android:layout_width="0dip"
            android:layout_weight="0.2"
            android:layout_height="match_parent"
            android:button="@drawable/cb_checked"
            android:gravity="center_horizontal"
            android:textAlignment="center"
            android:layout_gravity="center_horizontal" />
    </LinearLayout>
</android.support.v7.widget.CardView>
</code>```

And here's the RecyclerView adapter that inflate the layout above for each of its items:

```<code>public class AdapterTrashIncome extends RecyclerView.Adapter<AdapterTrashIncome.ViewHolder> {

    private ArrayList<ObjectIncome> myItems = new ArrayList<>();

    public AdapterTrashIncome(ArrayList<ObjectIncome> getItems, Context context){
        try {
            mContext = context;
            myItems = getItems;
        }catch (Exception e){
            Log.e(FILE_NAME, "51: " + e.toString());
            e.printStackTrace();
        }
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        public TextView tvContent;
        public CheckBox cbSelect;

        public ViewHolder(View v) {
            super(v);
            tvContent = (TextView) v.findViewById(R.id.tvContent);
            cbSelect = (CheckBox) v.findViewById(R.id.cbSelect);
        }
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {
        final ObjectIncome objIncome = myItems.get(position);
        String content = "<b>lalalla</b>";
        holder.tvContent.setText(Html.fromHtml(content));
    }
}
</code>```

The problem is, let's say I have 10 items inside the RecyclerView. When I checked the checkbox on item 1,2,3 then I scroll down the RecyclerView, suddenly some of the other items eg items 8,9 is checked. And when I scroll up again, item 1 and 3 is checked but not item 2. Any idea why this happen?

答:
You can use Model class to keep track of each RecyclerView item's CheckBox. Full reference is from : RecyclerView Checkbox Android

setTag and getTag is used to keep track of CheckBox status. Check full reference link for more information. It also teaches how to send checked items to Next Activity.

Make Model class:

```<code>public class Model {

    private boolean isSelected;
    private String animal;

    public String getAnimal() {
        return animal;
    }

    public void setAnimal(String animal) {
        this.animal = animal;
    }

    public boolean getSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }
}
</code>```

Create integer.xml

```<code><?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="btnplusview">1</integer>
    <integer name="btnpluspos">2</integer>
</resources>
</code>```

Finally RecyclerView.Adapter looks like this:

```<code>import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;

public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.MyViewHolder> {

    private LayoutInflater inflater;
    public static ArrayList<Model> imageModelArrayList;
    private Context ctx;

    public CustomAdapter(Context ctx, ArrayList<Model> imageModelArrayList) {
        inflater = LayoutInflater.from(ctx);
        this.imageModelArrayList = imageModelArrayList;
        this.ctx = ctx;
    }

    @Override
    public CustomAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.rv_item, parent, false);
        MyViewHolder holder = new MyViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(final CustomAdapter.MyViewHolder holder, int position) {
        holder.checkBox.setText("Checkbox " + position);
        holder.checkBox.setChecked(imageModelArrayList.get(position).getSelected());
        holder.tvAnimal.setText(imageModelArrayList.get(position).getAnimal());

        // holder.checkBox.setTag(R.integer.btnplusview, convertView);
        holder.checkBox.setTag(position);
        holder.checkBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Integer pos = (Integer) holder.checkBox.getTag();
                Toast.makeText(ctx, imageModelArrayList.get(pos).getAnimal() + " clicked!", Toast.LENGTH_SHORT).show();

                if (imageModelArrayList.get(pos).getSelected()) {
                    imageModelArrayList.get(pos).setSelected(false);
                } else {
                    imageModelArrayList.get(pos).setSelected(true);
                }
            }
        });
    }

    @Override
    public int getItemCount() {
        return imageModelArrayList.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {

        protected CheckBox checkBox;
        private TextView tvAnimal;

        public MyViewHolder(View itemView) {
            super(itemView);
            checkBox = (CheckBox) itemView.findViewById(R.id.cb);
            tvAnimal = (TextView) itemView.findViewById(R.id.animal);
        }
    }
}
</code>```

Body:
Here's the XML for my items inside the RecyclerView

<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/cvItems"
    android:layout_height="wrap_content"
    android:layout_width="fill_parent"
    android:layout_margin="2dp"
    card_view:cardElevation="0dp"
    card_view:contentPadding="0dp"
    card_view:cardBackgroundColor="#FFFFFF"
    >

    <LinearLayout
        android:orientation="horizontal"
        android:layout_height="fill_parent"
        android:layout_width="fill_parent">
        <TextView
            android:layout_width="0dip"
            android:layout_height="match_parent"
            android:layout_weight="0.8"
            android:id="@+id/tvContent"
            android:textSize="15dp"
            android:paddingLeft="5dp"
            android:paddingRight="5dp" />
        <CheckBox
            android:id="@+id/cbSelect"
            android:layout_width="0dip"
            android:layout_weight="0.2"
            android:layout_height="match_parent"
            android:button="@drawable/cb_checked"
            android:gravity="center_horizontal"
            android:textAlignment="center"
            android:layout_gravity="center_horizontal" />
    </LinearLayout>
</android.support.v7.widget.CardView>

And here's the RecyclerView adapter that inflate the layout above for each of its items:

public class AdapterTrashIncome extends RecyclerView.Adapter<AdapterTrashIncome.ViewHolder> {

    private ArrayList<ObjectIncome> myItems = new ArrayList<>();

    public AdapterTrashIncome(ArrayList<ObjectIncome> getItems, Context context){
        try {
            mContext = context;
            myItems = getItems;
        }catch (Exception e){
            Log.e(FILE_NAME, "51: " + e.toString());
            e.printStackTrace();
        }
    }

    public class ViewHolder extends RecyclerView.ViewHolder {
        public TextView tvContent;
        public CheckBox cbSelect;

        public ViewHolder(View v) {
            super(v);
            tvContent = (TextView) v.findViewById(R.id.tvContent);
            cbSelect = (CheckBox) v.findViewById(R.id.cbSelect);
        }
    }

    @Override
    public void onBindViewHolder(ViewHolder holder, final int position) {
        final ObjectIncome objIncome = myItems.get(position);
        String content = "lalalla";
        holder.tvContent.setText(Html.fromHtml(content));
    }
}

The problem is, let's say I have 10 items inside the RecyclerView. When I checked the checkbox on item 1,2,3 then I scroll down the RecyclerView, suddenly some of the other items eg items 8,9 is checked. And when I scroll up again, item 1 and 3 is checked but not item 2. Any idea why this happen?

Body:
You can use Model class to keep track of each RecyclerView item's CheckBox. Full reference is from : RecyclerView Checkbox Android

setTag and getTag is used to keep track of CheckBox status. Check full reference link for more information. It also teaches how to send checked items to Next Activity.

Make Model class:

public class Model {

    private boolean isSelected;
    private String animal;

    public String getAnimal() {
        return animal;
    }

    public void setAnimal(String animal) {
        this.animal = animal;
    }

    public boolean getSelected() {
        return isSelected;
    }

    public void setSelected(boolean selected) {
        isSelected = selected;
    }
}

Create integer.xml

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <integer name="btnplusview">1</integer>
    <integer name="btnpluspos">2</integer>
</resources>

Finally RecyclerView.Adapter looks like this:

import android.content.Context;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CheckBox;
import android.widget.TextView;
import android.widget.Toast;

import java.util.ArrayList;

public class CustomAdapter extends RecyclerView.Adapter<CustomAdapter.MyViewHolder> {

    private LayoutInflater inflater;
    public static ArrayList<Model> imageModelArrayList;
    private Context ctx;

    public CustomAdapter(Context ctx, ArrayList<Model> imageModelArrayList) {
        inflater = LayoutInflater.from(ctx);
        this.imageModelArrayList = imageModelArrayList;
        this.ctx = ctx;
    }

    @Override
    public CustomAdapter.MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view = inflater.inflate(R.layout.rv_item, parent, false);
        MyViewHolder holder = new MyViewHolder(view);
        return holder;
    }

    @Override
    public void onBindViewHolder(final CustomAdapter.MyViewHolder holder, int position) {
        holder.checkBox.setText("Checkbox " + position);
        holder.checkBox.setChecked(imageModelArrayList.get(position).getSelected());
        holder.tvAnimal.setText(imageModelArrayList.get(position).getAnimal());

        // holder.checkBox.setTag(R.integer.btnplusview, convertView);
        holder.checkBox.setTag(position);
        holder.checkBox.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Integer pos = (Integer) holder.checkBox.getTag();
                Toast.makeText(ctx, imageModelArrayList.get(pos).getAnimal() + " clicked!", Toast.LENGTH_SHORT).show();

                if (imageModelArrayList.get(pos).getSelected()) {
                    imageModelArrayList.get(pos).setSelected(false);
                } else {
                    imageModelArrayList.get(pos).setSelected(true);
                }
            }
        });
    }

    @Override
    public int getItemCount() {
        return imageModelArrayList.size();
    }

    class MyViewHolder extends RecyclerView.ViewHolder {

        protected CheckBox checkBox;
        private TextView tvAnimal;

        public MyViewHolder(View itemView) {
            super(itemView);
            checkBox = (CheckBox) itemView.findViewById(R.id.cb);
            tvAnimal = (TextView) itemView.findViewById(R.id.animal);
        }
    }
}


问:
Two open taskpanes side by side
I am making an Office add-in which has two ribbon buttons. Each button is linked to a different TaskpaneId, and clicking on each button opens a different taskpane:

```<code><bt:Urls>
    <bt:Url id="Contoso.Taskpane1.Url" DefaultValue="https://localhost:3000/addin/page1" />
    <bt:Url id="Contoso.Taskpane2.Url" DefaultValue="https://localhost:3000/addin/page2" />
</bt:Urls>
</code>```

It seems that I have seen some Office Add-ins where two task panes can be shown side by side simultaneously (I forgot which exactly the add-ins are). I need this from time to time, does anyone know how to realise this?

答:
Script Lab is one such add-in.  All you need to do is create two different buttons that have a ShowTaskpane action with different IDs.

Example from Script Lab's prod manifest: https://github.com/OfficeDev/script-lab/blob/master/manifests/script-lab-prod.xml

```<code>            <Control xsi:type="Button" id="PG.CodeCommand">
              <Label resid="PG.CodeCommand.Label" />
              <Supertip>
                <Title resid="PG.CodeCommand.TipTitle" />
                <Description resid="PG.CodeSupertip.Desc" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="PG.Icon.Code.16" />
                <bt:Image size="32" resid="PG.Icon.Code.32" />
                <bt:Image size="80" resid="PG.Icon.Code.80" />
              </Icon>
              <Action xsi:type="ShowTaskpane">
                <TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId>
                        <===== A taskpane ID. This one is a "special" one that allows the taskpane
                               to auto-open if a document is marked as belonging to the add-in.

                <SourceLocation resid="PG.Code.Url" />
                <Title resid="PG.CodeCommand.Title" />
              </Action>
            </Control>
            <Control xsi:type="Button" id="PG.RunCommand">
              <Label resid="PG.RunCommand.Label" />
              <Supertip>
                <Title resid="PG.RunCommand.TipTitle" />
                <Description resid="PG.RunSupertip.Desc" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="PG.Icon.Run.16" />
                <bt:Image size="32" resid="PG.Icon.Run.32" />
                <bt:Image size="80" resid="PG.Icon.Run.80" />
              </Icon>
              <Action xsi:type="ShowTaskpane">
                        <===== Whereas this one dosn't specify a taskpane ID,
                               and so it is different by default (but probably
                               should be explicit, come to think of it...)

                <SourceLocation resid="PG.Run.Url" />
                <Title resid="PG.RunCommand.Title" />
              </Action>
            </Control>
</code>```

For the auto-open in particular, see https://dev.office.com/docs/add-ins/design/automatically-open-a-task-pane-with-a-document.

Title: Two open taskpanes side by side

Body:
I am making an Office add-in which has two ribbon buttons. Each button is linked to a different TaskpaneId, and clicking on each button opens a different taskpane:

<bt:Urls>
    <bt:Url id="Contoso.Taskpane1.Url" DefaultValue="https://localhost:3000/addin/page1" />
    <bt:Url id="Contoso.Taskpane2.Url" DefaultValue="https://localhost:3000/addin/page2" />
</bt:Urls>

It seems that I have seen some Office Add-ins where two task panes can be shown side by side simultaneously (I forgot which exactly the add-ins are). I need this from time to time, does anyone know how to realise this?

Body:
Script Lab is one such add-in.  All you need to do is create two different buttons that have a ShowTaskpane action with different IDs.

Example from Script Lab's prod manifest: https://github.com/OfficeDev/script-lab/blob/master/manifests/script-lab-prod.xml

            <Control xsi:type="Button" id="PG.CodeCommand">
              <Label resid="PG.CodeCommand.Label" />
              <Supertip>
                <Title resid="PG.CodeCommand.TipTitle" />
                <Description resid="PG.CodeSupertip.Desc" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="PG.Icon.Code.16" />
                <bt:Image size="32" resid="PG.Icon.Code.32" />
                <bt:Image size="80" resid="PG.Icon.Code.80" />
              </Icon>
              <Action xsi:type="ShowTaskpane">
                <TaskpaneId>Office.AutoShowTaskpaneWithDocument</TaskpaneId>
                        <===== A taskpane ID. This one is a "special" one that allows the taskpane
                               to auto-open if a document is marked as belonging to the add-in.

                <SourceLocation resid="PG.Code.Url" />
                <Title resid="PG.CodeCommand.Title" />
              </Action>
            </Control>
            <Control xsi:type="Button" id="PG.RunCommand">
              <Label resid="PG.RunCommand.Label" />
              <Supertip>
                <Title resid="PG.RunCommand.TipTitle" />
                <Description resid="PG.RunSupertip.Desc" />
              </Supertip>
              <Icon>
                <bt:Image size="16" resid="PG.Icon.Run.16" />
                <bt:Image size="32" resid="PG.Icon.Run.32" />
                <bt:Image size="80" resid="PG.Icon.Run.80" />
              </Icon>
              <Action xsi:type="ShowTaskpane">
                        <===== Whereas this one dosn't specify a taskpane ID,
                               and so it is different by default (but probably
                               should be explicit, come to think of it...)

                <SourceLocation resid="PG.Run.Url" />
                <Title resid="PG.RunCommand.Title" />
              </Action>
            </Control>

For the auto-open in particular, see https://dev.office.com/docs/add-ins/design/automatically-open-a-task-pane-with-a-document.


问:
Firebase Crash Reporting - Not all symbol files uploaded
I've set up Firebase Crash Reporting, including the run script as per the Firebase documentation, but there's a big issue: not all symbol files are uploaded when I build a new archive.

After I build a new archive, two UUID's symbol files were uploaded to the Firebase Console; however, there are dozens of UUID's for the archive I built (I know this from downloading the dSYMs from iTunes Connect).

Now, I've had a few crash reports come in, none of which are symbolicated.  I can manually upload the dSYM files for each missing UUID using Firebase's batch-upload script, but that only allows future stack traces to be symbolicated. Any existing crashes are virtually useless to me.

There isn't much Firebase documentation about how the symbol files are uploaded, but from what I gather, all symbols should be uploaded for each new build, including archive builds.

So I guess my questions are:

Am I missing a setup step?

If this is expected behaviour, what is going on? Why are only some files uploaded?

Does the run script output a log? Maybe I can view it and see if there were any errors.

Here is my run script:

```<code>if [ "$CONFIGURATION" == "Release" ]; then
    GOOGLE_APP_ID=<app-id>
    "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}"/<app>/Firebase/CrashReportingKey.json
fi
</code>```

Thanks!

答:
I wrote a Python 2.7 script to upload my dSYM's

I created this file structure in Projects source directory

```<code>Scripts/
    |upload_syms.py
    |syms/
        |myVersion/
            |FE98728-928748923B78-ASDASDF...
</code>```

upload_syms.py

```<code>from sys import argv
from os import listdir, system

version = argv[1]
symPath = 'syms/' + version

command = './../Pods/FirebaseCrash/batch-upload '
command += '-i ../App/Info.plist '
command += '-p ../App/GoogleService-Info.plist '
command += '../App/ServiceAccount.json '
command += symPath + '/'

symFiles = [f for f in listdir(symPath) if f != '.DS_Store']

for sym in symFiles:
    print 'Upload ' + sym + '...'
    system(command + sym)
    print

print 'Uploaded ' + str(len(symFiles)) + ' dSYM files'
</code>```

Used by running in Terminal

```<code>python upload_syms.py myVersion
</code>```

Body:
I've set up Firebase Crash Reporting, including the run script as per the Firebase documentation, but there's a big issue: not all symbol files are uploaded when I build a new archive.

After I build a new archive, two UUID's symbol files were uploaded to the Firebase Console; however, there are dozens of UUID's for the archive I built (I know this from downloading the dSYMs from iTunes Connect).

Now, I've had a few crash reports come in, none of which are symbolicated.  I can manually upload the dSYM files for each missing UUID using Firebase's batch-upload script, but that only allows future stack traces to be symbolicated. Any existing crashes are virtually useless to me.

There isn't much Firebase documentation about how the symbol files are uploaded, but from what I gather, all symbols should be uploaded for each new build, including archive builds.

So I guess my questions are:

Am I missing a setup step?

If this is expected behaviour, what is going on? Why are only some files uploaded?

Does the run script output a log? Maybe I can view it and see if there were any errors.

Here is my run script:

if [ "$CONFIGURATION" == "Release" ]; then
    GOOGLE_APP_ID=<app-id>
    "${PODS_ROOT}"/FirebaseCrash/upload-sym "${SRCROOT}"/<app>/Firebase/CrashReportingKey.json
fi

Thanks!

Body:
I wrote a Python 2.7 script to upload my dSYM's

I created this file structure in Projects source directory

Scripts/
    |upload_syms.py
    |syms/
        |myVersion/
            |FE98728-928748923B78-ASDASDF...

upload_syms.py

from sys import argv
from os import listdir, system

version = argv[1]
symPath = 'syms/' + version

command = './../Pods/FirebaseCrash/batch-upload '
command += '-i ../App/Info.plist '
command += '-p ../App/GoogleService-Info.plist '
command += '../App/ServiceAccount.json '
command += symPath + '/'

symFiles = [f for f in listdir(symPath) if f != '.DS_Store']

for sym in symFiles:
    print 'Upload ' + sym + '...'
    system(command + sym)
    print

print 'Uploaded ' + str(len(symFiles)) + ' dSYM files'

Used by running in Terminal

python upload_syms.py myVersion


问:
What is Information Architecture and Information Design? How can I practise that?
I am learning User Experience. They says Information Architecture is much important to UX. I am studying about IA in online But I wonder how can I  practise it? Please Help.
Thanks.</p>

答:
I'm an IA.

Information Architecture is a discipline that can be considered part of the "User Experience" domain. For a good look at this, view "Elements of User Experience" (pdf) by Jesse James Garrett to see where it fits.

Suggested starting point on Information Architecture: read the 'Polar Bear Book': "Information Architecture for the Web and Beyond, 4th ed", Rosenfeld, Morville and Arango. This is the classic text on the field. Its definition of what IAs do: Connect Users with Content through Context is an old one, but the simplest explanation. (f.e., today I've been working on a site section which changes in response to how far down a timeline a user is - it's using the timeline context to get the user the right content).

Boxes and Arrows is a site that has focused a lot on the IA discipline, though it's changed a bit in recent years (as has the IA landscape). It's worth your time to take a look.

The Information Architecture Summit (in Lyons, France for 2018, in the US, most likely, in 2019) is a great place to meet information architects, understand the community, get some starting points. The people who defined the domain are often there, and easy to talk to.

One way to think about what an IA does for a page/site/app/etc. is that the IA designs the information hierarchy so the user can find the important things, so that all things are as findable as they can be, and so the user understands where she is and what she can do at all times in a site.

An Interaction Designer designs user flow through a series of interactions (not necessarily pages)

A UX Designer manages the overall experience of the site, designs it to be coherent and satisfying, while hitting business goals

A Visual designer adds visual flair, while serving the usability, coherence, brand and overall experience of the site.

Information Design is a completely different discipline from Information architecture.

A couple of well-known Information Design leaders are Edward Tufte and Stephen Few. They are concerned with users' ability to understand your presented dataset.

They do this with good design heuristics ("maximize the data/ink ratio") and critique ("don't use chartjunk"), as well as great basic advice ("if you don't have a story to tell, you don't have anything to present". "Steal with abandon. There's no reason to re-solve a problem that has been solved for 100 years").

They also appear on Jesse James Garrett's chart on the Elements of UX.

Hope this gives you some useful tips for where to begin.


问:
How to use Google map
I am working on Xamarin forms. I am confused as to which Plugin for google map I should use to avoid problems later on.

Are these two the same? Are they providing the same set of functionalities and work well in Android and iOS.

1) Xamarin.Forms.maps

2) Xamarin.Forms.GoogleMap

Need your guidance.

Thanks

答:
Xamarin.Forms.Maps just uses the native map APIs on each platform and provided by Xamarin. There are some APIs which are abstration for displaying map. You can see the API referernce here.

On the other hands, Xamarin.Forms.GoogleMap is 3rd party maps library for Xamarin.Forms optimized for Google maps. As I know, this is forked from Xamarin.Forms.Maps. Please refer to Xamarin.Forms.GoogleMaps project.

Title: How to use Google map


问:
How to disable button based on state?
In my reactjs app I have a button that is disabled/enabled based on a state value:

```<code><button disabled={this.state.modelvalue === 0 ? true : false} onClick={this.showMessage}>Select</button>
</code>```

The modelvalue state is set by changing the select value:

```<code><div className="row">
      <div className="col-md-6">
            <select name="" id="" value={this.state.modelvalue} onChange={this.handleChangeModel}>
              <option value ="0">plse select value</option>
              <option value ="1">One</option>
            </select>
      </div>
</div>

 handleChangeModel(event) {
    this.setState({modelvalue: event.target.value});
 }
</code>```

The handleChangeModel sets the state.modelvalue but for some reason when you change from 'one' back to 'plse select value' the button does not get disabled? Even though the state.modelvalue is 0 again?

答:
Below is the correct code:

class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      modelvalue: null
    }

    this.handleChangeModel = this.handleChangeModel.bind(this);
  }

 handleChangeModel(event) {
    this.setState({modelvalue: event.target.value});
 }

  render() {
    return (

            <select name="" id="" value={this.state.modelvalue} onChange={this.handleChangeModel}>
              <option value ="0">plse select value</option>
              <option value ="1">One</option>
            </select>

      <button disabled={this.state.modelvalue === "0" ? true : false} onClick={this.showMessage}>Select</button>

    );
  }
}

ReactDOM.render(<App />, document.getElementById('root'));```
<pre class="snippet-code-html lang-html prettyprint-override"><code><script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

<div id="root"></div></code>```

2 things that you missed:
1) Adding this.handleChangeModel = this.handleChangeModel.bind(this); in constructor so that you can bind context of this in handleChangeModel since its a callback method
2) Use this.state.modelvalue === "0" instead of this.state.modelvalue === 0

Title: How to disable button based on state?

Body:
In my reactjs app I have a button that is disabled/enabled based on a state value:

<button disabled={this.state.modelvalue === 0 ? true : false} onClick={this.showMessage}>Select</button>

The modelvalue state is set by changing the select value:

            <select name="" id="" value={this.state.modelvalue} onChange={this.handleChangeModel}>
              <option value ="0">plse select value</option>
              <option value ="1">One</option>
            </select>

 handleChangeModel(event) {
    this.setState({modelvalue: event.target.value});
 }

The handleChangeModel sets the state.modelvalue but for some reason when you change from 'one' back to 'plse select value' the button does not get disabled? Even though the state.modelvalue is 0 again?

Body:
Below is the correct code:

class App extends React.Component {

  constructor(props) {
    super(props);
    this.state = {
      modelvalue: null
    }

    this.handleChangeModel = this.handleChangeModel.bind(this);
  }

 handleChangeModel(event) {
    this.setState({modelvalue: event.target.value});
 }

  render() {
    return (
      <div className="row">
      <div className="col-md-6">
            <select name="" id="" value={this.state.modelvalue} onChange={this.handleChangeModel}>
              <option value ="0">plse select value</option>
              <option value ="1">One</option>
            </select>
      </div>

      <button disabled={this.state.modelvalue === "0" ? true : false} onClick={this.showMessage}>Select</button>
      </div>
    );
  }
}

ReactDOM.render(<App />, document.getElementById('root'));

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>

<div id="root"></div>

2 things that you missed:
1) Adding this.handleChangeModel = this.handleChangeModel.bind(this); in constructor so that you can bind context of this in handleChangeModel since its a callback method
2) Use this.state.modelvalue === "0" instead of this.state.modelvalue === 0


问:
Script stops working when I insert into another script
I have a problem that is killing me right now because I can't see why it isn't working. I have made a script in one file that works, but when I copy/paste it into the file that I want it to work in, it doesn't work.
Here's the script I just made:

```<code><html>
<body>
<p id="myElement"></p>
    <script>
        if (window.location.hash == "#hello") {
            document.getElementById("myElement").innerHTML = 'Vi har Hello';
        } else {
            document.getElementById("myElement").innerHTML = '';
        }
    </script>
</body>
</html>
</code>```

Here it works, but when I insert it into the file that it was meant for it won't work. Here it is:

```<code><html>
<head>
    <title>...</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link href="layout/styles/layout.css" rel="stylesheet" type="text/css" media="all">
    <link rel="shortcut icon" href="images/favicon.ico">
</head>
<body id="top">
    <div id="forside"></div>
    <div class="bgded overlay" style="background-image:url('images/stor_1.png');">
        <div id="pageintro" class="hoc clear">
            <li>
                <p></p><h2>Log ind</h2>
                <p id="myElement"></p>
                <script>
                    if (window.location.hash == "#hello") {
                    document.getElementById("myElement").innerHTML = 'Vi har Hello';
                    } else {
                    document.getElementById("myElement").innerHTML = '';
                    }
                </script>
                <div id="comments">
                    <font color="black">
                        <form action="proces.php" method="post">
                            <input class="form-control" type="text" id="name" size="22" name="username" placeholder="Brugernavn" required><br>
                            <input class="form-control" type="password" id="name" size="22" name="pass" placeholder="Kodeord" required><br>
                            <input type="submit" name="submit" value="Log Ind!">
                        </form>
                    </font><br>
                    <a href="index.php"><i class="fa fa-chevron-left" aria-hidden="true"> Tilbage til forsiden</i></a>
                </div>
            </li>
        </div>
    </div>
<?php include_once "footer.php"; ?>
<a id="backtotop" href="#top"><i class="fa fa-chevron-up"></i></a>
    <script src="layout/scripts/jquery.min.js"></script>
    <script src="layout/scripts/jquery.mobilemenu.js"></script>
</body>
</html>
</code>```

What the script, I am inserting, does is to detect if #Hello is in the URL and if it is, it has to display some text... But it won't work.

Anybody who has an idea about what I could be doing wrong?

答:
try adding these

```<code><script src="layout/scripts/jquery.min.js"></script>
<script src="layout/scripts/jquery.mobilemenu.js"></script>
</code>```

at the top in the head section

Body:
I have a problem that is killing me right now because I can't see why it isn't working. I have made a script in one file that works, but when I copy/paste it into the file that I want it to work in, it doesn't work.
Here's the script I just made:

Here it works, but when I insert it into the file that it was meant for it won't work. Here it is:

    <title>...</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <link href="layout/styles/layout.css" rel="stylesheet" type="text/css" media="all">
    <link rel="shortcut icon" href="images/favicon.ico">

Log ind

                        <form action="proces.php" method="post">
                            <input class="form-control" type="text" id="name" size="22" name="username" placeholder="Brugernavn" required>

                            <input class="form-control" type="password" id="name" size="22" name="pass" placeholder="Kodeord" required>

                            <input type="submit" name="submit" value="Log Ind!">
                        </form>

                     Tilbage til forsiden

<?php include_once "footer.php"; ?>

What the script, I am inserting, does is to detect if #Hello is in the URL and if it is, it has to display some text... But it won't work.

Anybody who has an idea about what I could be doing wrong?

Body:
try adding these

<script src="layout/scripts/jquery.min.js"></script>
<script src="layout/scripts/jquery.mobilemenu.js"></script>

at the top in the head section


问:
How to convert SQL query for CakePHP?
I already have the right SQL query but now I have problem to change the query for CakePHP. What should I do to get the same SQL ? Thanks in advance.

```<code>SELECT tests.id, tests.name,tests.tag_on, tests.status, tests.date_scheduled, tests.date_done, tests.remarks,
field_user.name AS fielduser, sales_user.name AS salesuser
FROM tests
INNER JOIN users field_user ON (field_user.id = tests.field_user_id)
INNER JOIN users sales_user ON (sales_user.id = tests.sales_user_id);
</code>```

This is my TestsController.php

```<code>public function index()
{
        $this->paginate = ['limit' => 100, 'order' => ['date_scheduled' => 'asc'],
        'contain' => ['Users','FieldUsers'],
        'fields' => ['id', 'name', 'tag_on', 'status', 'date_scheduled', 'date_done', 'remarks', Users.id','Users.name','field_user_id','sales_user_id'],
        'sortWhitelist' => ['id', 'name','tag_on', 'status', 'date_scheduled', 'date_done', 'remarks','Users.id','Users.name','field_user_id','sales_user_id'],
        ];
    }
</code>```

This is my TestsTable.php

```<code>class TestsTable extends Table
    {

        public function initialize(array $config)
        {
            parent::initialize($config);

            $this->table('tests');
            $this->displayField('name');
            $this->primaryKey('id');

            $this->belongsTo('Users', [
                'className' => 'Users',
                'foreignKey' => 'sales_user_id',
                'joinType' => 'INNER'
            ]);

            $this->belongsTo('FieldUsers', [
                'className' => 'Users',
                'foreignKey' => 'field_user_id',
                'joinType' => 'INNER'
            ]);
</code>```

答:
You can do this in two ways of cake ORM, I am writing one from those 2

```<code>$this->Tests->find('all')
        ->contain(['Users', 'FieldUsers'])
        ->select(['Tests.name', 'Tests.tag_on', 'Tests.status',
             'FieldUsers.name'=>'fieldUser', 'Users.name'=>'userName'])
        ->limit('100')
        ->order(['date_scheduled' => 'asc']);
</code>```

You can use additional 2 things to get the result as array.

```<code>->hydrate(false)->toArray();  //Must be at the end
</code>```

Happy Coding :)

Title: How to convert SQL query for CakePHP?

Body:
I already have the right SQL query but now I have problem to change the query for CakePHP. What should I do to get the same SQL ? Thanks in advance.

SELECT tests.id, tests.name,tests.tag_on, tests.status, tests.date_scheduled, tests.date_done, tests.remarks,
field_user.name AS fielduser, sales_user.name AS salesuser
FROM tests
INNER JOIN users field_user ON (field_user.id = tests.field_user_id)
INNER JOIN users sales_user ON (sales_user.id = tests.sales_user_id);

This is my TestsController.php

public function index()
{
        $this->paginate = ['limit' => 100, 'order' => ['date_scheduled' => 'asc'],
        'contain' => ['Users','FieldUsers'],
        'fields' => ['id', 'name', 'tag_on', 'status', 'date_scheduled', 'date_done', 'remarks', Users.id','Users.name','field_user_id','sales_user_id'],
        'sortWhitelist' => ['id', 'name','tag_on', 'status', 'date_scheduled', 'date_done', 'remarks','Users.id','Users.name','field_user_id','sales_user_id'],
        ];
    }

This is my TestsTable.php

class TestsTable extends Table
    {

        public function initialize(array $config)
        {
            parent::initialize($config);

            $this->table('tests');
            $this->displayField('name');
            $this->primaryKey('id');

            $this->belongsTo('Users', [
                'className' => 'Users',
                'foreignKey' => 'sales_user_id',
                'joinType' => 'INNER'
            ]);

            $this->belongsTo('FieldUsers', [
                'className' => 'Users',
                'foreignKey' => 'field_user_id',
                'joinType' => 'INNER'
            ]);

Body:
You can do this in two ways of cake ORM, I am writing one from those 2

$this->Tests->find('all')
        ->contain(['Users', 'FieldUsers'])
        ->select(['Tests.name', 'Tests.tag_on', 'Tests.status',
             'FieldUsers.name'=>'fieldUser', 'Users.name'=>'userName'])
        ->limit('100')
        ->order(['date_scheduled' => 'asc']);

You can use additional 2 things to get the result as array.

->hydrate(false)->toArray();  //Must be at the end

Happy Coding :)


问:
How to require characters after domain name and slash of a url?
This is the regex I've come up with:

```<code>^(https:\/\/|http:\/\/)?(www.)?example\.com
</code>```

It will match everything from example.com even this address: https://www.example.com/

I want the regex to match any url with something after the domain like: https://www.example.com/testing/proof.php

It shouldn't match on a url looking like this: https://www.example.com/.

How is this done?

答:
dloeda's answer misses a real opportunity to show some best practices.  Consider all of these refinements:

the use of verbose "alternatives" (http|https) can be condensed to improve pattern efficiency and brevity.  Futhermore, when alternatives are necessary, always write the shortest potential mismatches first for highest efficiency.

changing the pattern delimiters from / to ~ means /'s don't need to be escaped between the delimiters, this improves pattern brevity and readability.

using a "quantifier" of 3 on w and 2 on / instead of www and // (respectively) is a personal choice about readability.  Typing out the repeated characters will actually reduce the pattern length.  The efficiency/accuracy will be the same.

the dot that follows www is not escaped, so it can match any character instead of the intended/literal dot.  Correcting this improves pattern accuracy.

depending on the language and function that you are implementing this regex pattern in, using capture groups instead of non-capture groups means unnecessary output bloat.  Using non-capture groups does decrease pattern brevity, but it may conserve memory.

the pattern uses a very literal example.com string in the pattern, but this will not serve you well if you are matching different domains.  Writing a non-literal domain expression will improve pattern suitability/flexibility.

Here is my suggested pattern: (Demo)

~^(?:https?:/{2})?(?:w{3}\.)?[^/]+/(?!/).+~

See these self-explanatory test cases:

```<code>https://www.pass.com/passing/pass.php
https://www.fail.com/
www.pass.com/pass.php
www.fail.com/
http://fail.com/
http://pass.com/passy-passerson
pass.com/pass.csv
fail.com
</code>```

Improvements:

Changed pattern delimiters from / to ~.

Replaced verbose alternatives expression with optional s.

Used non-capturing groups.

Used quantifier on w and /.

Escaped dot after w{3}

Match domain string using "negated character class".

After matching the domain string followed by /, inserted a negative lookahead for a second / to ensure that the pattern does not incorrectly match the two slashes that come before the domain.

If you are only going to be matching a single domain, then you can use a literal domain expression to make my pattern more readable, but it actually works less efficiently: (Demo)

~^(?:https?:/{2})?(?:w{3}\.)?example\.com/.+~

If you apply these best practices when you writing regex patterns, you will find your work will be a much higher quality versus simply being "correct".  I hope you found this post educational (and that I didn't waste my time typing this all out).

Body:
This is the regex I've come up with:

^(https:\/\/|http:\/\/)?(www.)?example\.com

It will match everything from example.com even this address: https://www.example.com/

I want the regex to match any url with something after the domain like: https://www.example.com/testing/proof.php

It shouldn't match on a url looking like this: https://www.example.com/.

How is this done?

Body:
dloeda's answer misses a real opportunity to show some best practices.  Consider all of these refinements:

the use of verbose "alternatives" (http|https) can be condensed to improve pattern efficiency and brevity.  Futhermore, when alternatives are necessary, always write the shortest potential mismatches first for highest efficiency.

changing the pattern delimiters from / to ~ means /'s don't need to be escaped between the delimiters, this improves pattern brevity and readability.

using a "quantifier" of 3 on w and 2 on / instead of www and // (respectively) is a personal choice about readability.  Typing out the repeated characters will actually reduce the pattern length.  The efficiency/accuracy will be the same.

the dot that follows www is not escaped, so it can match any character instead of the intended/literal dot.  Correcting this improves pattern accuracy.

depending on the language and function that you are implementing this regex pattern in, using capture groups instead of non-capture groups means unnecessary output bloat.  Using non-capture groups does decrease pattern brevity, but it may conserve memory.

the pattern uses a very literal example.com string in the pattern, but this will not serve you well if you are matching different domains.  Writing a non-literal domain expression will improve pattern suitability/flexibility.

Here is my suggested pattern: (Demo)

~^(?:https?:/{2})?(?:w{3}\.)?[^/]+/(?!/).+~

See these self-explanatory test cases:

https://www.pass.com/passing/pass.php
https://www.fail.com/
www.pass.com/pass.php
www.fail.com/
http://fail.com/
http://pass.com/passy-passerson
pass.com/pass.csv
fail.com

Improvements:

Changed pattern delimiters from / to ~.

Replaced verbose alternatives expression with optional s.

Used non-capturing groups.

Used quantifier on w and /.

Escaped dot after w{3}

Match domain string using "negated character class".

After matching the domain string followed by /, inserted a negative lookahead for a second / to ensure that the pattern does not incorrectly match the two slashes that come before the domain.

If you are only going to be matching a single domain, then you can use a literal domain expression to make my pattern more readable, but it actually works less efficiently: (Demo)

~^(?:https?:/{2})?(?:w{3}\.)?example\.com/.+~

If you apply these best practices when you writing regex patterns, you will find your work will be a much higher quality versus simply being "correct".  I hope you found this post educational (and that I didn't waste my time typing this all out).