text:
Q: MongoDB and PHP frameworks Apart from Lithium, Vork and F3 what other frameworks natively support mongodb?
I've seen the list on mongodb.org. Wanted to know if there were any newer ones they missed.
Thank you!

A: full list is on http://www.mongodb.org/display/DOCS/PHP+Libraries,+Frameworks,+and+Tools#

A: Here's a lightweight one that I've assembled. It's basically an object wrapper, something to easily map an object to a DB collection.
https://github.com/gatesvp/MongoModel
The docs are not quite there, but just take a look at the unit tests to get an idea for basic syntax.

A: ProdigyView has Mongo Support
http://www.prodigyview.com/tutorials/slideshare/417/99


text:
Q: Docx4J convert Chinese to pdf I'm having the following code to convert docx file to pdf file, my docx content having text box and Chinese characters.
String myFilePath = "testing.docx";

File docxFile = new File("testing.docx");
WordprocessingMLPackage wordprocessingMLPackage = WordprocessingMLPackage.load(docxFile);

Mapper identifierFontMapper = new IdentityPlusMapper();
wordprocessingMLPackage.setFontMapper(identifierFontMapper);

Mapper bestMatchingMapper = new BestMatchingMapper();
wordprocessingMLPackage.setFontMapper(bestMatchingMapper);

Docx4J.toPDF(wordprocessingMLPackage, new FileOutputStream(myFilePath + ".pdf"));

with these codes, I'm able to convert to pdf file, but the problem is that  the Chinese characters become #####.
is there any way to solve this problem?
here is my document.xml

A: Assuming you have docx4j-export-FO on your classpath, so that you are using XSL FO export, you should be able to see what characters are missing glyphs (turn on DEBUG logging for org.docx4j.fonts), and map a suitable font.
See for example https://github.com/plutext/docx4j-export-FO/blob/master/src/samples/docx4j/org/docx4j/samples/ConvertOutPDFviaXSLFO.java#L144
EDIT 29 Sept.
I see:
WARN org.docx4j.fonts.fop.util.FopConfigUtil .declareFonts line 123 - Document font Calibri is not mapped to a physical font!
WARN org.docx4j.fonts.fop.util.FopConfigUtil .declareFonts line 123 - Document font SimHei is not mapped to a physical font!
WARN org.docx4j.fonts.fop.util.FopConfigUtil .declareFonts line 123 - Document font Arial is not mapped to a physical font!
WARN org.docx4j.fonts.fop.util.FopConfigUtil .declareFonts line 123 - Document font Wingdings is not mapped to a physical font!
WARN org.docx4j.fonts.fop.util.FopConfigUtil .declareFonts line 123 - Document font 華康中黑體 is not mapped to a physical font!

WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Font "Symbol,normal,700" not found. Substituting with "Symbol,normal,400".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Font "ZapfDingbats,normal,700" not found. Substituting with "ZapfDingbats,normal,400".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Font "Calibri,normal,700" not found. Substituting with "any,normal,700".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "这" (0x8fd9) not available in font "Times-Bold".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "些" (0x4e9b) not available in font "Times-Bold".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "都" (0x90fd) not available in font "Times-Bold".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "只" (0x53ea) not available in font "Times-Bold".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "是" (0x662f) not available in font "Times-Bold".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "测" (0x6d4b) not available in font "Times-Bold".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "试" (0x8bd5) not available in font "Times-Bold".
WARN org.apache.fop.apps.FOUserAgent .processEvent line 94 - Glyph "而" (0x800c) not available in font "Times-Bold".

Note the Glyph X not available in font Y messages.  Therefore I'd need something like:
    Mapper fontMapper = new IdentityPlusMapper();
    wordMLPackage.setFontMapper(fontMapper);

    fontMapper.put("Times-Bold", PhysicalFonts.get(some Chinese font installed in my OS));

redpajama_set_name: RedPajamaStackExchange


text:
Q: cannot build react native project after react-native-git-upgrade I tried to upgrade react-native from 0.49.3 to 0.55.3. I followed the official [guide][1] and when I ran react-native-git-upgrade, I got the following log:
git-upgrade info Check for updates
git-upgrade info Using yarn 1.5.1
git-upgrade info Read package.json files
git-upgrade info Check declared version
git-upgrade info Check matching versions
git-upgrade info Check React peer dependency
git-upgrade info Check that Git is installed
git-upgrade info Get information from NPM registry
git-upgrade info Upgrading to React Native 0.55.3, React 16.3.1
git-upgrade info Setup temporary working directory
git-upgrade info Configure Git environment
git-upgrade info Init Git repository
git-upgrade info Add all files to commit
git-upgrade info Commit current project sources
git-upgrade info Create a tag before updating sources
git-upgrade info Generate old version template
git-upgrade info Add updated files to commit
git-upgrade info Commit old version template
git-upgrade info Install the new version
warning " > react-native-maps@0.20.1" has incorrect peer dependency "react@16.0.0".
warning " > react-native-maps@0.20.1" has incorrect peer dependency "react-native@0.51.0".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "@storybook/addons@^3.2.13".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "@storybook/channels@^3.2.13".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "@storybook/react@^3.2.13".
warning " > @storybook/addon-storyshots@3.2.13" has unmet peer dependency "babel-core@^6.26.0".
warning "@storybook/react-native > @storybook/ui > react-icons@2.2.7" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0 || ^16.0.0".
warning "@storybook/react-native > @storybook/ui > react-komposer@2.0.0" has incorrect peer dependency "react@^0.14.7 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-modal@2.4.1" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-modal@2.4.1" has incorrect peer dependency "react-dom@^0.14.0 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-treebeard@2.0.3" has incorrect peer dependency "react@^15.5.4".
warning "@storybook/react-native > @storybook/ui > react-treebeard@2.0.3" has incorrect peer dependency "react-dom@^15.5.4".
warning "@storybook/react-native > @storybook/ui > mantra-core > react-komposer@1.13.1" has incorrect peer dependency "react@^0.14.3 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > mantra-core > react-simple-di@1.2.0" has incorrect peer dependency "react@^0.14.0 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-komposer > react-stubber@1.0.0" has incorrect peer dependency "react@^0.14.7 || ^15.0.0".
warning "@storybook/react-native > @storybook/ui > react-treebeard > velocity-react@1.3.3" has incorrect peer dependency "react-dom@^15.3.0 || ^16.0.0".
warning "@storybook/react-native > @storybook/ui > react-treebeard > velocity-react > react-transition-group@1.2.1" has incorrect peer dependency "react-dom@^15.0.0 || ^16.0.0".
warning " > babel-jest@21.2.0" has unmet peer dependency "babel-core@^6.0.0 || ^7.0.0-alpha || ^7.0.0-beta || ^7.0.0".
warning " > enzyme@2.9.1" has incorrect peer dependency "react@0.13.x || 0.14.x || ^15.0.0-0 || 15.x".
warning " > react-addons-test-utils@15.4.2" has incorrect peer dependency "react-dom@^15.4.2".
warning "react-native > eslint-plugin-react-native@3.2.1" has unmet peer dependency "eslint@^3.17.0 || ^4.0.0".
git-upgrade info Generate new version template
git-upgrade info Add updated files to commit
git-upgrade info Commit new version template
git-upgrade info Generate the patch between the 2 versions
git-upgrade info Save the patch in temp directory
git-upgrade info Reset the 2 temporary commits
git-upgrade info Apply the patch
error: patch failed: .gitignore:51
Falling back to three-way merge...
Applied patch to '.gitignore' with conflicts.
error: ios/MyApp.xcodeproj/project.pbxproj: does not exist in index
error: ios/MyApp/AppDelegate.h: does not exist in index
error: ios/MyApp/AppDelegate.m: does not exist in index
error: ios/MyApp/main.m: does not exist in index
error: ios/MyAppTests/MyAppTests.m: does not exist in index
git-upgrade WARN The upgrade process succeeded but there might be conflicts to be resolved. See above for the list of files that have merge conflicts.
git-upgrade info Upgrade done

Notice these lines:
error: ios/MyApp.xcodeproj/project.pbxproj: does not exist in index
error: ios/MyApp/AppDelegate.h: does not exist in index
error: ios/MyApp/AppDelegate.m: does not exist in index
error: ios/MyApp/main.m: does not exist in index
error: ios/MyAppTests/MyAppTests.m: does not exist in index

These files are now all missing. Despite the message saying it succeeded, trying react-native -v yields
react-native-cli: 2.0.1
react-native: 0.55.3

And now the MyApp/ios/ directory is missing almost all of it's original files. If I even try react-native run-ios, I get xcodebuild: error: Scheme MyApp is not currently configured for the build action. Any suggestions would be incredibly helpful.

A: Figured it out. For those of you with this problem, all you need to do is delete your android/ios folder and use react-native eject which will regenerate the files necessary to rebuild your react-native project. This should be in the official react native upgrading guide IMO.


text:
Q: Django Docker MySQL docker-compose up error I am dockerizing my existing Django rest project which uses MySQL as database. I already have an exiting database with some data in it.
my dockerfile:
FROM python:2.7

ENV PYTHONUNBUFFERED 1
RUN mkdir /code
WORKDIR /code
COPY . /code/
RUN pip install -r requirements.txt

My docker-compose:
version: '3'

services:
  db:
    image: mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: libraries
      MYSQL_USER: root
      MYSQL_PASSWORD: root
  web:
    build: .
    command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
    volumes:
      - .:/code
    ports:
      - "8000:8000"

My settings.py:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql', #django.db.backends.mysql
        'NAME': 'libraries', #local: libraries #server:
        'USER': 'root', #localhost:root #root
        'PASSWORD': 'root', #local: root #server:
        'HOST': 'db', #docker: db #local: localhost  #server:
        'PORT': '3306',

}
}
My docker-compose build was successful.
However, docker-compose up gives me error with following log:
D:\Development\Personal projects\library_backend>docker-compose up
Creating librarybackend_web_1
Creating librarybackend_db_1
Attaching to librarybackend_db_1, librarybackend_web_1
db_1   | Initializing database
db_1   | 2018-01-15T09:33:20.031132Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1   | 2018-01-15T09:33:20.225632Z 0 [Warning] InnoDB: New log files created, LSN=45790
db_1   | 2018-01-15T09:33:20.259942Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
db_1   | 2018-01-15T09:33:20.304181Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 1fb0980b-f9d7-11e7-a333-0242ac120002.
db_1   | 2018-01-15T09:33:20.310216Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
db_1   | 2018-01-15T09:33:20.311813Z 1 [Warning] root@localhost is created with an empty password ! Please consider switching off the --initialize-insecure option.
web_1  | Traceback (most recent call last):
web_1  |   File "manage.py", line 10, in <module>
web_1  |     execute_from_command_line(sys.argv)
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 367, in execute_from_command_line
web_1  |     utility.execute()
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 359, in execute
web_1  |     self.fetch_command(subcommand).run_from_argv(self.argv)
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 294, in run_from_argv
web_1  |     self.execute(*args, **cmd_options)
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 342, in execute
web_1  |     self.check()
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/management/base.py", line 374, in check
web_1  |     include_deployment_checks=include_deployment_checks,
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/management/commands/migrate.py", line 61, in _run_checks
web_1  |     issues = run_checks(tags=[Tags.database])
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/checks/registry.py", line 81, in run_checks
web_1  |     new_errors = check(app_configs=app_configs)
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/core/checks/database.py", line 10, in check_database_backends
web_1  |     issues.extend(conn.validation.check(**kwargs))
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/validation.py", line 9, in check
web_1  |     issues.extend(self._check_sql_mode(**kwargs))
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/validation.py", line 13, in _check_sql_mode
web_1  |     with self.connection.cursor() as cursor:
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 231, in cursor
web_1  |     cursor = self.make_debug_cursor(self._cursor())
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 204, in _cursor
web_1  |     self.ensure_connection()
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
web_1  |     self.connect()
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/utils.py", line 94, in __exit__
web_1  |     six.reraise(dj_exc_type, dj_exc_value, traceback)
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 199, in ensure_connection
web_1  |     self.connect()
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/base/base.py", line 171, in connect
web_1  |     self.connection = self.get_new_connection(conn_params)
web_1  |   File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 263, in get_new_connection
web_1  |     conn = Database.connect(**conn_params)
web_1  |   File "/usr/local/lib/python2.7/site-packages/MySQLdb/__init__.py", line 81, in Connect
web_1  |     return Connection(*args, **kwargs)
web_1  |   File "/usr/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 193, in __init__
web_1  |     super(Connection, self).__init__(*args, **kwargs2)
web_1  | django.db.utils.OperationalError: (2003, "Can't connect to MySQL server on 'db' (111)")
librarybackend_web_1 exited with code 1
db_1   | 2018-01-15T09:33:22.105314Z 1 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:22.105400Z 1 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:22.105421Z 1 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:22.105455Z 1 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:22.105463Z 1 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:22.105485Z 1 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:22.105541Z 1 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:22.105560Z 1 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | Database initialized
db_1   | Initializing certificates
db_1   | Generating a 2048 bit RSA private key
db_1   | .....+++
db_1   | ................+++
db_1   | unable to write 'random state'
db_1   | writing new private key to 'ca-key.pem'
db_1   | -----
db_1   | Generating a 2048 bit RSA private key
db_1   | .............................+++
db_1   | ...................................................+++
db_1   | unable to write 'random state'
db_1   | writing new private key to 'server-key.pem'
db_1   | -----
db_1   | Generating a 2048 bit RSA private key
db_1   | ...........................................+++
db_1   | .........................................................+++
db_1   | unable to write 'random state'
db_1   | writing new private key to 'client-key.pem'
db_1   | -----
db_1   | Certificates initialized
db_1   | MySQL init process in progress...
db_1   | 2018-01-15T09:33:24.906502Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
db_1   | 2018-01-15T09:33:24.907479Z 0 [Note] mysqld (mysqld 5.7.20) starting as process 88 ...
db_1   | 2018-01-15T09:33:24.910342Z 0 [Note] InnoDB: PUNCH HOLE support available
db_1   | 2018-01-15T09:33:24.910423Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
db_1   | 2018-01-15T09:33:24.910438Z 0 [Note] InnoDB: Uses event mutexes
db_1   | 2018-01-15T09:33:24.910464Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
db_1   | 2018-01-15T09:33:24.910477Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.3
db_1   | 2018-01-15T09:33:24.910678Z 0 [Note] InnoDB: Using Linux native AIO
db_1   | 2018-01-15T09:33:24.911096Z 0 [Note] InnoDB: Number of pools: 1
db_1   | 2018-01-15T09:33:24.911363Z 0 [Note] InnoDB: Using CPU crc32 instructions
db_1   | 2018-01-15T09:33:24.912837Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
db_1   | 2018-01-15T09:33:24.918731Z 0 [Note] InnoDB: Completed initialization of buffer pool
db_1   | 2018-01-15T09:33:24.920395Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
db_1   | 2018-01-15T09:33:24.931813Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
db_1   | 2018-01-15T09:33:24.951614Z 0 [Note] InnoDB: Creating shared tablespace for temporary tables
db_1   | 2018-01-15T09:33:24.951919Z 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
db_1   | 2018-01-15T09:33:24.975721Z 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
db_1   | 2018-01-15T09:33:24.977199Z 0 [Note] InnoDB: 96 redo rollback segment(s) found. 96 redo rollback segment(s) are active.
db_1   | 2018-01-15T09:33:24.977267Z 0 [Note] InnoDB: 32 non-redo rollback segment(s) are active.
db_1   | 2018-01-15T09:33:24.977999Z 0 [Note] InnoDB: Waiting for purge to start
db_1   | 2018-01-15T09:33:25.028348Z 0 [Note] InnoDB: 5.7.20 started; log sequence number 2565377
db_1   | 2018-01-15T09:33:25.029193Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
db_1   | 2018-01-15T09:33:25.029854Z 0 [Note] Plugin 'FEDERATED' is disabled.
db_1   | 2018-01-15T09:33:25.031013Z 0 [Note] InnoDB: Buffer pool(s) load completed at 180115  9:33:25
db_1   | 2018-01-15T09:33:25.034240Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
db_1   | 2018-01-15T09:33:25.034617Z 0 [Warning] CA certificate ca.pem is self signed.
db_1   | 2018-01-15T09:33:25.042691Z 0 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.042766Z 0 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.042788Z 0 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.042820Z 0 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.042930Z 0 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.042991Z 0 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.044138Z 0 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.044179Z 0 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:25.049567Z 0 [Note] Event Scheduler: Loaded 0 events
db_1   | 2018-01-15T09:33:25.050237Z 0 [Note] mysqld: ready for connections.
db_1   | Version: '5.7.20'  socket: '/var/run/mysqld/mysqld.sock'  port: 0  MySQL Community Server (GPL)
db_1   | 2018-01-15T09:33:25.050281Z 0 [Note] Executing 'SELECT * FROM INFORMATION_SCHEMA.TABLES;' to get a list of tables using the deprecated partition engine. You may use the startup option '--disable-partition-engine-check' to skip this check.
db_1   | 2018-01-15T09:33:25.050295Z 0 [Note] Beginning of list of non-natively partitioned tables
db_1   | 2018-01-15T09:33:25.058196Z 0 [Note] End of list of non-natively partitioned tables
db_1   | Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
db_1   | Warning: Unable to load '/usr/share/zoneinfo/leap-seconds.list' as time zone. Skipping it.
db_1   | Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
db_1   | 2018-01-15T09:33:27.674996Z 5 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:27.675066Z 5 [Warning] 'user' entry 'mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:27.675096Z 5 [Warning] 'user' entry 'mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:27.675301Z 5 [Warning] 'db' entry 'performance_schema mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:27.675335Z 5 [Warning] 'db' entry 'sys mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:27.675438Z 5 [Warning] 'proxies_priv' entry '@ root@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:27.675600Z 5 [Warning] 'tables_priv' entry 'user mysql.session@localhost' ignored in --skip-name-resolve mode.
db_1   | 2018-01-15T09:33:27.675630Z 5 [Warning] 'tables_priv' entry 'sys_config mysql.sys@localhost' ignored in --skip-name-resolve mode.
db_1   | mysql: [Warning] Using a password on the command line interface can be insecure.
db_1   | mysql: [Warning] Using a password on the command line interface can be insecure.
db_1   | ERROR 1396 (HY000) at line 1: Operation CREATE USER failed for 'root'@'%'
librarybackend_db_1 exited with code 1

If I run the command second time then it works. Why is it happening?

A: Since the issue seems to be intermittent, I suspect the services/containers have a dependency like your Django service has a dependency on DB service hence you need to tell/define this in compose so that the DB container is always brought up prior to your Django application. You can do this by adding depends_on to your web service in compose as below -
version: '3'

services:
  db:
    image: mysql
    environment:
      MYSQL_ROOT_PASSWORD: root
      MYSQL_DATABASE: libraries
      MYSQL_USER: root
      MYSQL_PASSWORD: root

  web:
    build: .
    command: bash -c "python manage.py migrate && python manage.py runserver 0.0.0.0:8000"
    volumes:
      - .:/code
    depends_on:
      - db
    ports:
      - "8000:8000"


text:
Q: Dex Loader] Unable to execute dex: method ID not in [0, 0xffff]: 65536 Size Exceed First thing I got same question on several post, but all the post answers cannot give me any solution.
If I unchecked Android Private Libraries  then app is running but after the splash screen it's give class not found exceptions.
I have used the following libraries :

After adding google map for Business SDK, this problem occurs. I know it's exceed the size, but these libraries I cannot remove. Please suggest me to solve this problem.
I am using eclipse.

A: My answer is matched with the answer of this following question, his answer give me final solution.
Shrink Google Play Service
Who give negative vote of my question, please see this link and try to build up yourself like him. :)

A: I did the following as suggested by an answer found here StackOverFlow Unable to execute dex...
   I had to change my sdkversion from 20 to 21 then added the multidex and Viola
android {
compileSdkVersion 21
buildToolsVersion "21.1.0"

defaultConfig {
    ...
    // Enabling multidex support.
    multiDexEnabled true
}
...

}
After adding the changes approved I began to get another error classnotdeferror, (solution found here: noclassdeffounderror)  so I needed to add this code
and the app worked
added this to the gradle file:
compile 'com.android.support:multidex:1.0.0'

And then add the multidex support application to your manifest:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.multidex.myapplication">
<application
    ...
    android:name="android.support.multidex.MultiDexApplication">
    ...
</application>

hope this helps, happy coding!


text:
Q: xslt dynamically start and close tags I want to do something similar to the following:
<xsl:for-each select="Item">
  <xsl:if test="postion()=1 or position()=7>

  </xsl:if>

An Item

  <xsl:if test="position()=2">

  </xsl>
</xsl:for-each>

This will not work however because xslt views the unclosed
 within the if statement as invalid.
Sample input:
<Item>1</Item>
<Item>2</Item>

<Item>3</Item>

<Item>4</Item>

<Item>5</Item>

<Item>6</Item>

<Item>7</Item>

<Item>8</Item>

<Item>9</Item>

<Item>10</Item>

Expected output:

An Item

An Item

An Item

An Item

An Item

An Item

An Item

An Item

An Item

An Item

Thanks
-Ben

A: You should rewrite it to avoid the need for such tag soup. First group the items, such that each group is transformed to its own UL in the output, and then iterate over those groups (and for each group, iterate over the items within in).
For the particular code that you've posted, with hardcoded values, it's trivially refactored by moving the output for Item into its own template (a good idea, anyway), and then reusing that:
<xsl:template match="Item">

An Item

</xsl:template>

...

    <xsl:apply-templates select="Item[1]"/>

    <xsl:apply-templates select="Item[position() ≥ 2 and position() ≤ 7]"/>

<xsl:apply-templates select="Item[position() > 7]"/>

In practice, though, you probably has some more complicated way of determining the boundaries of your groups, but without knowing the exact requirement, it's hard to be more specific when answering this. You'll likely want to look at the Muenchian method of grouping if you use some key. If your groups are all fixed-size, with a few hardcoded exceptions (e.g. first item in its own group, and then every next 10 items form a new group), you could iterate over position instead.

A: If want you want is simply to group items into groups of six (or fewer, at the end) then you can use a recursive call to a template that spits out the first six Items in a list and then calls itself for any left over.
<?xml version="1.0" encoding="iso-8859-1"?>
<xsl:transform  xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
                version="1.0">
<xsl:output method="xml" indent="no" encoding="ISO-8859-1"/>

<xsl:template match="Item">

Item

</xsl:template>

<xsl:template name="group-of-six">
    <xsl:param name="items"/>

    <xsl:for-each select="$items[position() < 7]">
    <xsl:apply-templates select="."/>
    </xsl:for-each>

    <xsl:if test="count($items) > 6">
        <xsl:call-template name="group-of-six">
            <xsl:with-param name="items" select="$items[position() > 6]"/>
        </xsl:call-template>
    </xsl:if>
</xsl:template>

<xsl:template match="/">
    <Lists>
    <xsl:call-template name="group-of-six">
        <xsl:with-param name="items" select="//Item"/>
    </xsl:call-template>
    </Lists>
</xsl:template>

</xsl:transform>


text:
Q: DNA data via text file input in Java We have a group project to get data from a text file that will be input by the user. We have created a method to get the input and get the data saved to a output file but I'm stuck as to how we will get the file to be read for the methods we create that will then read through the file. Currently it just prints to the console.
public static void main(String[] args) throws FileNotFoundException {
    Scanner in = new Scanner(new File("dna.txt"));  //create scanner object for dna.txt
    processFile(in);//call the method using scanner as parameter
    File outputFile = new File("DataOutput.txt");
    PrintStream fileOutput = new PrintStream(outputFile);
    fileOutput.close();
    }

public static void processFile(Scanner in) throws FileNotFoundException{
    Scanner console = new Scanner(System.in);//open Scanner in the console
    System.out.println("File to be read: ");//prompt user to enter the txt file
    String inputFile = console.next();//turns file into string and read in console
    while (in.hasNextLine()){//while stuff is in file, keep looping
        String s = in.nextLine();//contents in file = string s. we can now process s with arrays
        System.out.println(s);//print s
    }

    }
}


text:
Q: iOS In-App Purchases invalid product identifier in ONLY iOS6 I'm trying to test In App Purchase within the sandbox environment.
And I've checked all http://troybrant.net/blog/2010/01/invalid-product-ids/ methioned.
It's my code of getting products response from APPLE SERVER.
- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response {
    NSLog(@"############ REQUEST RECEIVED RESPONSE %@", response.products);

    for (NSString *productID in response.invalidProductIdentifiers) {
        NSLog(@"Invalid product identifier: %@", productID);
    }
}

I can get all my products with iOS5.X devices. But all invalidProductIdentifiers with iOS6.x devices. I'm very confused. I have no idea about what can cause this.
It's my test results below.
I've tested in all versions of simulator, FINE
*Device              *iOSVersion                           Result

ipod3                 5.0                             FINE

iphone4              5.1.1                            FINE

ipod5                 6.1.2                    Invalid Product Identifiers

iphone5              6.1.3                     Invalid Product Identifiers

anyone has some ideas?  Any help is appreciated.

A: iOS 6 Simulator does not support testing In-App Purchase.
Please use a device to test your apps that use this feature.
Please Check This Link :
http://developer.apple.com/library/ios/#releasenotes/General/RN-iOSSDK-6_0/


text:
Q: shell script multiple select I have a select statement that shows a list of dynamic files ($list). I'd like to be able to input "1, 2, 3" and it will have file 1, file 2, and file 3 be selected. How do I modify this select (maybe even a different structure is needed) to allow multiple options to be selected?
select option in $list; do
        case $option in
            * )
                if [ "$option" ]; then
                    echo "Selected: " $option
                    break
                else
                    echo "Invalid input. Try again."
                fi;
        esac
    done

A: This code doesn't use select , but does pretty much what you want-
#! /bin/bash
files=("file1" "file2" "file3" "file4" "Quit")

menuitems() {
    echo "Avaliable options:"
    for i in ${!files[@]}; do
        printf "%3d%s) %s\n" $((i+1)) "${choices[i]:- }" "${files[i]}"
    done
    [[ "$msg" ]] && echo "$msg"; :
}

prompt="Enter an option (enter again to uncheck, press RETURN when done): "
while menuitems && read -rp "$prompt" num && [[ "$num" ]]; do
    [[ "$num" != *[![:digit:]]* ]] && (( num > 0 && num <= ${#files[@]} )) || {
        msg="Invalid option: $num"; continue
    }
    if [ $num == ${#files[@]} ];then
      exit
    fi
    ((num--)); msg="${files[num]} was ${choices[num]:+un-}selected"
    [[ "${choices[num]}" ]] && choices[num]="" || choices[num]="x"
done

printf "You selected"; msg=" nothing"
for i in ${!files[@]}; do
    [[ "${choices[i]}" ]] && { printf " %s" "${files[i]}"; msg=""; }
done
echo "$msg"

Demo-
$ ./test.sh
Avaliable options:
  1 ) file1
  2 ) file2
  3 ) file3
  4 ) file4
  5 ) Quit
Enter an option (enter again to uncheck, press RETURN when done): 1
Avaliable options:
  1x) file1
  2 ) file2
  3 ) file3
  4 ) file4
  5 ) Quit
file1 was selected
Enter an option (enter again to uncheck, press RETURN when done): 2
Avaliable options:
  1x) file1
  2x) file2
  3 ) file3
  4 ) file4
  5 ) Quit
file2 was selected
Enter an option (enter again to uncheck, press RETURN when done): 3
Avaliable options:
  1x) file1
  2x) file2
  3x) file3
  4 ) file4
  5 ) Quit
file3 was selected
Enter an option (enter again to uncheck, press RETURN when done): 1
Avaliable options:
  1 ) file1
  2x) file2
  3x) file3
  4 ) file4
  5 ) Quit
file1 was un-selected
Enter an option (enter again to uncheck, press RETURN when done):
You selected file2 file3

A: As select always fills the variable REPLY, you could loop through your $list afterwards. (The VAR in $list $VAR is only filled, with single selection.)
e.g:
select ITEMS in $list; do
    case $ITEMS in
        * )
            break
    esac
done

# it $ITEMS is empty, but $REPLY not, we got multi selection
if [ -z "$ITEMS" ] && [ -n "$REPLY" ]; then
    # add some spaces to begin and end for simpler checking below, regarding multi digit REPLY entries
    REPLY_LIST=" $REPLY "
    CNT=1
    for ITEM in $list; do
        if [[ "$REPLY_LIST" =~ " $CNT " ]]; then
            ITEMS="$ITEMS $ITEM"
        fi
        CNT=$((CNT+1))
    done
elif [ -z "$ITEMS" ]; then
    echo nothing selected
    exit
fi
echo "Selected: $ITEMS ($REPLY)"


text:
Q: RTL8188CUS AP and Client mode simultaneously with hostapd in Linux? I'm trying to figure out how to set up my RTL8188CUS Wifi dongle to run in both AP and Client mode at the same time.
How can I do this in Linux?
I have hostapd running fine and I remember reading about AP+Client mode somewhere a while ago for the RTL8188, but I can't remember where.
Additional info
I'm on Debian 4.7.2-5 for ARM.
Linux kernel 3.4.90+.
I found the following threads that might be of use and (I think) relevant:
Link 1: How do I use a single wireless adapter for both an access point and client on raspberry pi?
Link 2: Creating WiFi Access point on a single interface in Linux
I tried the first first link, no success.
UPDATE
I have managed to get iw list to work on Debain 8 Jessie x64.
It outputs the following:

software interface modes (can always be added):

    * AP/VLAN
    * monitor

interface combinations are not supported

However according to Realteks release notes of their latest drivers
they state that the RTL8188CUS supports concurrent modes such as STA+AP as of version 4.0.0_5967.20121201
Doesn't this contradict what iw list states?
If not, how would an STA+AP mode be achieved?
UPDATE
I figured it out. Please see my answer for more info.

A: It depends on network cards. I do not own an RTL8188, so i cannot tell you off-hand, but I can show you how to find out.
You must issue the command
 iw list

and, among its abundant output, you will find something like:
Supported interface modes:
             * IBSS
             * managed
             * AP
             * AP/VLAN
             * monitor
    software interface modes (can always be added):
             * AP/VLAN
             * monitor
    valid interface combinations:
             * #{ managed } <= 1, #{ AP } <= 1,
               total <= 2, #channels <= 1, STA/AP BI must match
             * #{ managed } <= 2,
               total <= 2, #channels <= 1

AP mode is the Access Point mode, managed is the usual client mode, and this is for my card.
You must check that both AP and managed appear among the supported modes, then you must check the valid interface combinations: in my case, the first allowed combination is clearly that of a (simultaneous) AP and managed mode (but no more than one each), provided the same channel is used. It might be different in your case.
In order to make this work, you must have two distinct virtual interfaces on the same NIC. You do it as follows:
service network-manager stop
iw dev wlan0 del
iw phy phy0 interface add new0 type station
service network-manager start
iw phy phy0 interface add new1 type __ap
hostapd -B /etc/hostapd.conf

First I stop the network manager, which has its own way of messing everything up, then I rename new0 the virtual interface on the physical interface called phy0 (adapt it to your case if yours is not called phy0, you obtain the name from the output of iw list), restart the network manager so that I can connect the virtual interface new0 to whichever AP I have near me.
Now I can add a new interface of type AP on the same hardware (please notice the double underscore preceding ap in the command), lastly I start hostpad.
The configuration of hostapd and of routing/DNS/DHCP depends on your specific needs, and cannot be established a priori.

A: I managed to solve my problem after a couple of weeks of research.
Simple answer is;
The command iw does not find any indications of mixed modes on RTL chips.
The reason being that the RTL drivers by default do not support mixed modes.
Realtek call this Concurrent modes, and the RTL drivers are by default compiled with the concurrent mode-related code commented out.
In order to compile the drivers with concurrent mode activated you need to simply uncomment 3 lines of code in their source code.
Concurrent modes supported are STA+STA, STA+AP, STA+P2P.
You can find my full back-story and full guide on how to compile the drivers and the RTL compatible HOSTAPD version on this link:
http://randomstuffidosometimes.blogspot.se/2016/03/rtl8192cu-and-rtl8188cus-in-station-and.html


text:
Q: EXCEPTION with IIS 7.5 with Webservice built on .net 2.0 i have webservice that is using .net 2.0 server 2003 32 bit
when i host it under iis 6 with basic and intergated auth enabled it works great.
but when i host the same service under IIS 7.5  server 2008 64bitwith intergated app pool running with apppool identity with basic and windwos auth enabled. i have 32bit support enabled on the app pool
i get follwoing error below

  <soap:Body>
      <soap:Fault>
         <soap:Code>
            <soap:Value>soap:MustUnderstand</soap:Value>
         </soap:Code>
         <soap:Reason>
            <soap:Text

xml:lang="en">System.Web.Services.Protocols.SoapHeaderException: SOAP
  header Security was not understood.
         at
  System.Web.Services.Protocols.SoapHeaderHandling.SetHeaderMembers(SoapHeaderCollection
  headers, Object target, SoapHeaderMapping[] mappings,
  SoapHeaderDirection direction, Boolean client)
         at
  System.Web.Services.Protocols.SoapServerProtocol.CreateServerInstance()
         at System.Web.Services.Protocols.WebServiceHandler.Invoke()
         at
  System.Web.Services.Protocols.WebServiceHandler.CoreProcessRequest()

A: Maybe you don't have all the software installed to run the code? Like WSE 3?
Or is it a default web service you are running?
Cerveser


text:
Q: Cannot install PyPi library using pipenv I am trying to install the PyPi names library using pipenv
https://pypi.org/project/names/
The package successfully installs after running:
pipenv install names
But I still receive the error message:
File "blockchain.py", line 4, in <module>
    import names
ModuleNotFoundError: No module named 'names'

When I try doing:
pip install names

I get the message :
(Blockchain) bash-3.2$ pip install names

Requirement already satisfied: names in /Users/ayunas/.local/share/virtualenvs/Blockchain-xNznGcTc/lib/python3.7/site-packages (0.3.0)

A: This is most likely occurring because the location of your pip install isn't matching the location of the python you're running. pipenv run pip install names will install names to your virtualenvironment; pip install names installs it to your system python.
You can check this for yourself by opening up a terminal and typing in where pip and where python and then pipenv run where pip and pipenv run where python. Note the differences :)


text:
Q: Adding classes to custom Angular Components? I am trying to allow a user to add any number of classes to the outer HTML of a child component. So lets say there is a component called app-button, with html like:
app-button.component.html
<button
[ngClass] = {"..."}
[class] = "static classes"
>
{{text}}
</button>

I want a user to be able to add any number of classes to this app-button selector, such that it will add classes to the button tag.
For instance, within a parent component, if a user does:
parent.component.html
<app-button class = "user-class1 user-class2 ..." >
</app-button>

I want the app-button HTML to end up like this:
<button
[ngClass] = {"..."}
[class] = "static classes user-class1 user-class2"
>
{{text}}
</button>

I need some way to do this so that it is not specific to any classname, but works for any class a user would want to add.

A: app-button.component.ts
Add myClasses input variable inside your component class.
@Input() myClasses;

app-button.component.html
<button [ngClass]="myClasses" class = "static classes">
  {{text}}
</button>

parent.component.ts
Create an array for your dynamic css classes.
classes = ['a', 'b', 'c'];

parent.component.html
Pass your classes array into app-button component.
<app-button [myClasses]="classes">
</app-button>


text:
Q: Orthonormal basis and unitary matrix... Let $u$ be a unitary matrix in $M_2(\mathbb R)$.
Prove that if {$b_1,b_2$} is an orthonormal basis of $\mathbb R^2$, then $u(b_2)$ is determined up to a negative sign by $u(b_1)$.
I don't understand what is being asked. Am I supposed to show that $u(b_1)$ and $u(b_2)$ are orthonormal?

A: Hints:
Denote by $\;\langle\,,\,\rangle\;$ the usual inner product in $\;\Bbb R^2\;$ :
$$\langle Ub_1\,,\,Ub_2\rangle=\langle b_1\,,\,U^*Ub_2\rangle=\langle b_1\,,\,b_2\rangle=0$$
Which means  $\;Ub_1\perp Ub_2\;$ ...

A: Hint:
You have $\langle b_i, b_j\rangle = \delta_{ij}$ since the given basis is orthonormal. From that how can you use the properties of a unitary matrix to get $\langle u(b_i), u(b_j)\rangle = \delta_{ij}$?


text:
Q: How can i get the current form which has the focus in infopath? I have to get the currently focussed control in infopath. I only found "objects" via xmlPathNavigator, but with this i can not check if an element has the focus.
Thanks

A: Your best bet is ContextChanged event - http://msdn.microsoft.com/en-us/library/microsoft.office.infopath.formevents.contextchanged.aspx.
There is no direct access to controls in InfoPath.


text:
Q: Sharing rule for report content I want to show a report to external community user. I created a report in SF admin side and then exposed it on the community portal. But the report shows all the records. I only want the external community user to see the records which are related to his Account. The community users are assigned a role on the Account level.
Can a apply a sharing rule on user role to restrict the report content and show only those records which are related to his Account?


text:
Q: Distinct Values in Laravel Hello Friends I am using the following query :
$cur_date = date('Y-m-d');
   $clientTemp = DB::table('clients')->where('quotations.exp_date','<',$cur_date)
     ->join('quotations','quotations.customer_id','=','clients.id')
      ->get()
       ->map(function ($clientTemp) {
        return [
            'id' => $clientTemp->id,
            'hash' => $clientTemp->hash,
            'name' => $clientTemp->first_name.' '.$clientTemp->last_name,
            'email' => $clientTemp->email,
            'mobile' => $clientTemp->mobile
        ];
    });

I am getting this data from two tables :
1. Qutoations and 2. Clients.
In quotations table if the exp_date is less than current date then the details will be fetched from client table.
But there is possibility then there are more than 1 rows in quotation table but I want to fetch only one table from that for which customer_id is unique. How can I fetch unique row with same customer_id from quotations table

A: You should use groupby
$cur_date = date('Y-m-d');    $clientTemp = DB::table('clients')->where('quotations.exp_date','<',$cur_date)
     ->join('quotations','quotations.customer_id','=','clients.id')
     ->->groupBy('quotations.customer_id')
      ->get()
       ->map(function ($clientTemp) {
        return [
            'id' => $clientTemp->id,
            'hash' => $clientTemp->hash,
            'name' => $clientTemp->first_name.' '.$clientTemp->last_name,
            'email' => $clientTemp->email,
            'mobile' => $clientTemp->mobile
        ];
    });

A: You'd need to use a GROUP BY clause but due to MySQL's default ONLY_FULL_GROUP_BY mode, you must aggregate any column that has more than one value.
You don't seem to be actually using any values from quotations, so you could just add:
DB::table('clients')->select('clients.*')->groupBy('clients.id')...

Otherwise, you'd need to tell MySQL how to aggregate any rows that have multiple values, like:
DB::table('clients')->selectRaw('clients.*, MIN(quotations.id)')->groupBy('clients.id')...


text:
Q: Error when run jar Exception in thread "main" java.lang.NoSuchMethodError scala.Predef$.$conforms()Lscala/Predef$$less$colon$less; I work on spark application using (spark 2.0.0 & scala 2.11.8) and the application works fine within intellij Idea environment. I've extracted application as jar file and tried to run spark application from jar file but this error raised on terminal:
Exception in thread "main" java.lang.NoSuchMethodError: scala.Predef$.$conforms()Lscala/Predef$$less$colon$less;
at org.apache.spark.util.Utils$.getSystemProperties(Utils.scala:1632)
at org.apache.spark.SparkConf.loadFromSystemProperties(SparkConf.scala:65)
at org.apache.spark.SparkConf.<init>(SparkConf.scala:60)
at org.apache.spark.SparkConf.<init>(SparkConf.scala:55)
at Main$.main(Main.scala:26)
at Main.main(Main.scala)

I've read discussions and similar question but all of them talk about different scala versions, however my sbt file is this:
name := "BaiscFM"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.0.0"
libraryDependencies += "org.apache.spark" % "spark-streaming_2.11" % "2.0.0"
libraryDependencies += "org.apache.spark" % "spark-streaming-kafka-0-8_2.11" % "2.0.0"
libraryDependencies += "com.datastax.spark" % "spark-cassandra-connector_2.11" % "2.0.0"
libraryDependencies += "org.apache.spark" % "spark-core_2.11" % "2.0.0"
libraryDependencies += "org.apache.spark" % "spark-graphx_2.11" % "2.0.0"
libraryDependencies += "com.typesafe.akka" % "akka-actor_2.11" % "2.4.17"
libraryDependencies += "net.liftweb" % "lift-json_2.11" % "2.6"
libraryDependencies += "com.typesafe.play" % "play-json_2.11" % "2.4.0-M2"
libraryDependencies += "org.json" % "json" % "20090211"
libraryDependencies += "org.scalaj" % "scalaj-http_2.11" % "2.3.0"
libraryDependencies += "org.drools" % "drools-core" % "6.3.0.Final"
libraryDependencies += "org.drools" % "drools-compiler" % "6.3.0.Final"

How to fix this problem?


text:
Q: Finding greatest sum of difference between integers that meet a certain condition I have a list of 1,000,000 integers. Each integer is smaller than or equal to 100,000.
I have to find the greatest sum of the difference between integers where the first integer is smaller than the second, and the second integer is larger than the third. The third integer is allowed to be smaller OR larger than the first. Furthermore, the first integer has to be located before the second, and the second integer has to be located before the third.
My algorithm for solving this is as follows:
1) Run the list provided through a loop.
2) Pick the largest integer after the current integer that is read.
3) Find the difference between this and the current integer.
4) Pick the smallest integer located after the integer in part (2). Find the difference between this integer and the integer found in part (2).
5) Add this to the integer found in part (3) and store this value as the current highest.
6) Repeat this process and replace the current highest as necessary.
However, my algorithm for solving this fails the time constraints (1 second per test case). It's also incorrect for a few test cases. I'm using C++ for your information.
An example is provided below.
Input:
60
70
30
50
40
60
20
10
Output: 80
Explanation: The third, sixth and eighth integers in the list satisfy the condition best.
My Question: What's the best (fastest) way to solve this problem?

A: Problem with current approach
Your current algorithm is not quite correct, consider the sequence:
1,99,1,100,99

Your current algorithm will pick the following cases (the different cases correspond to different starting locations):
1,100,99 score 100
99,100,99 score 2
1,100,99 score 100

however, the best choice is 1,99,1 for a score of 98*2=196
Also the complexity is O(n^2) which will be too slow.
Better algorithm
A O(n) approach to this is to compute an array A[n] which gives the smallest value in the range 0,1,..,n-1, and an array B[n] which gives the smallest value in the range n+1,n+2,..,end.
You can compute these in O(n) by working forwards through the array to make A, and backwards to make B.
Once you have these, you can make a third pass through the array.  For each index i, you choose A[i] for the first element, i for the middle element, B[i] for the third element.
You work out the score for this combination and keep the best one.
(You can also combine a couple of these passes for a slightly more complicated but potentially more efficient solution.)

A: Are you picking three consecutive integers from the list?
If not, then clearly sorting the list and picking smallest, largest, smallest is always the winner?
If you have to use three consecutive integers from the list, then you really have no choice but to process the list sequentially working out the differences and holding onto the biggest?
I interpret this problem to mean that you must pick three integers where A,B,C appear in that order in the list, but are not necessarily consecutive, is that correct?
If so, imagine splitting your list up into N subsequences of M numbers. For each subsequence find the largest and smallest number.
Then use these to pick the best sequence of smallest, largest, smallest, or largest smallest largest.
As long as every pick is in a different subsequence then you are done. If two of the numbers happen to be in the same subsequence, then you need to check that they appear in the correct order. If they do not, discard that solution and choose the next best.
I would suggest that probably choosing subsequence size of about 1000 elements will give you a very low probability of two numbers being in the same sequence, and still reduce the comparisons by a lot.
==============
Alternative answer
Suppose that we have two consecutive subsequence of ten numbers, and you work out the best ABC in each, then I have two ABC sequences, and I can easily combine them, there are only a few ways to combine these sequences, and one of the combinations must be the best for the twenty element list.
You can then build this up dynamic style.


text:
Q: 'FastText' object has no attribute 'vocab' I want to use Fasttext in my program, but that error prevent me to do it. I want to create embedding matrix for my program, with following code:
model = gensim.models.fasttext.load_facebook_model(EMBEDDING_FILE)

EMBEDDING_DIM = 300
nb_words = min(MAX_NB_WORDS, len(word_index)) + 1
embedding_matrix = np.zeros((nb_words, EMBEDDING_DIM))
for word, i in word_index.items():
    if word in model.vocab:
        embedding_matrix[i] = model.word_vec(word)
print('Null word embeddings: %d' % np.sum(np.sum(embedding_matrix, axis=1) == 0))


text:
Q: Error caused by RegEx? I'm using a system where I need to enter hundreds of RegEx expressions.  I've recently changed a few things and am getting the following error:

java.lang.RuntimeException: ?+* follows nothing in expression

I've no idea what this means and would really appreciate any pointers for what I should be looking for to fix it.
Many thanks :)
Katie

A: The obvious interpretation is that you have a regex that starts with a '?', a '+' or a '*' meta-character.  Maybe it should have been escaped.  Maybe you've accidentally deleted the preceding things that is "quantified" by the meta-character.

I do have a '*' at the beginning of some expressions - is that bad?

Yup.  If that is supposed to match a literal asterisk character, it must be preceded by a '\' to escape it.  (And as Felix Kling pointed out, the '\' will itself need to be escaped if the regex is embedded in a Java string literal.)

Should I be putting '.*' (ie. dot star) instead?

It depends what you want the regex to match at that point.  '.*' means "eagerly match zero or more characters".  If that's what you mean, that's what you should use.

A: It means you have a quantifier (+,?, or *) that isn't quantifying anything. My guess is you might have forgotten to escape one of those characters (with \) when trying to match it.


text:
Q: Serialport port fault when i work with embedded system I want to create communication with Com Ports.
I can write and read any data on my computer, but when I work with embedded system, my system doesn't read data.
My code:
if (!serialPort1.IsOpen)
{
    serialPort1.PortName = cbComPort.SelectedItem.ToString();
    serialPort1.BaudRate = 9600;
    serialPort1.Open();
    serialPort1.ReadTimeout = 5000;
    //serialPort1.WriteTimeout = 1500;
    serialPort1.WriteLine("USB>>READ<END");
    string gelenveri;
    bool durum = false;
    while (!durum)
    {
        try
        {
            gelenveri = serialPort1.ReadLine();
            lblGelen.Text = gelenveri;
            serialPort1.Close();
            durum = true;
            lblKarakterDeneme.Text = hextobinary(karakter_temizle(gelenveri));
            veriyerlestir(lblKarakterDeneme.Text);
        }
        catch (TimeoutException)
        {
            MessageBox.Show("Veri Alınamadı");
            serialPort1.Close();
        }
        break;
    }
}

A: i find answer for this my question,
i canceled  serialPort1.ReadLine(); and i use SerialDataReceivedEventArgs


text:
Q: A question about two rules in isomorphism and cardinality In class I have encountered the next two rules:

*

*the next models - $\langle \mathcal{P}(A),\subseteq \rangle$ and $\langle \mathcal{P}(B),\subseteq \rangle$ are isomorphic, if $A$ and $B$, have the same cardinality.

I had a chance to use this rule in a certain question, but I wondered to find out that I was wrong. Now, I am not sure when I can apply this rule. The question was finding isomorphism between $\langle \mathcal{P}(\mathbb{N})\cup\{\mathbb{Z}\},\subseteq \rangle$ and $\langle \mathcal{P}(\mathbb{N}),\subseteq \rangle$, which are not isomorphic. But on the next question, I have found that: $\langle \mathcal{P}(\mathbb{N}\cup\{\mathbb{Z}\}
),\subseteq \rangle$ and $\langle \mathcal{P}(\mathbb{N}),\subseteq \rangle$ are indeed isomorphic, and I cannot see the differences at all, because in both scenarios we have the same cardinalities of the models. Therefore, I need an extended explanation of when I can apply this rule, etc.

*

*if $B=\{X\in\mathcal{P}(\mathbb{Z}):x\ is\ finite\}$ then $\left|B\right|=\left|\mathcal{P}(\mathbb{Z})\right|=\left|\mathbb{R}\right|$.

Can you give me an explanation for why is true?
Thanks!

A: Note that $\mathcal P(\Bbb N)\cup\{\Bbb Z\}$ is not of the form $\mathcal P(\text{something})$, and therefore the rule that is only about posets ofa that form cannot be applied.
We can see that $\langle \mathcal P(\Bbb N)\cup\{\Bbb Z\},\subseteq \rangle$ and $\langle \mathcal P(\Bbb N),\subseteq \rangle$ are not isomorphic because only the first has a unique second-largest element, i.e.,
$$ \exists a\,\exists b\,\forall c\colon (c=a\lor c\subseteq b)\land a\ne b$$
holds in only one of the two posets.

Moreover, in your second question, the set $B$ of finite subsets of $\Bbb Z$ is only countably infinite (do you see how you can write it as countable union of countable sets?), hence strictly smaller than $\Bbb R$ in cardinality.


text:
Q: MYSQL Query returning column when should be value I am trying to not show any results with the value "Money" b.title in the title but %Money% is returning:
Unknown column 'Money' in 'where clause'

Query:
SELECT `id`,`name`
FROM `users` AS u
WHERE `id` NOT IN ('
   SELECT `user_id`
   FROM `purchases` AS p
   INNER JOIN `books` b ON b.id = p.book_id AND b.title LIKE '%Money%'')

A: Remove extra apostrophe's:
SELECT `id`,`name`
FROM `users` AS u
WHERE `id` NOT IN (
   SELECT `user_id`
   FROM `purchases` AS p
   INNER JOIN `books` b ON b.id = p.book_id AND b.title LIKE '%Money%')

A: Let's have a closer look at your query to understand what's going on:
WHERE `id` NOT IN ('SELECT [...] LIKE '%Money%'')
--                 |<---------------->|^     ^ ^---- another string
--                   this is a string  |     |
--                                     |     |
--                               % is the modulo operator

So the expression within the brackets reads: "some string modulo Money modulo empty string". Without quotes around it, Money refers to a column name, which does not exist and that's where the query fails.
The only reason that you don't get a syntax error is that "%" is a valid operator. So it kind of "works" by accident.
The solution, as already mentioned: Don't quote the subquery, it is an SQL expression, not a string.


text:
Q: Elasticsearch query hits missing documents by search after I have a little problem when querying elasticsearch 6.8. I have a createdAt information in the documents and I am using createdAt information with search after
My query is:
{
  "from": 0,
  "size": 2500,
  "query": {
    "bool": {
      "filter": [
        {
          "bool": {
            "should": [
              {
                "bool": {
                  "must_not": [
                    {
                      "exists": {
                        "field": "uni",
                        "boost": 1
                      }
                    }
                  ],
                  "adjust_pure_negative": true,
                  "boost": 1
                }
              },
              {
                "match": {
                  "uni": {
                    "query": "false",
                    "operator": "OR",
                    "prefix_length": 0,
                    "max_expansions": 50,
                    "fuzzy_transpositions": true,
                    "lenient": false,
                    "zero_terms_query": "NONE",
                    "auto_generate_synonyms_phrase_query": true,
                    "boost": 1
                  }
                }
              }
            ],
            "adjust_pure_negative": true,
            "minimum_should_match": "1",
            "boost": 1
          }
        },
        {
          "exists": {
            "field": "pt",
            "boost": 1
          }
        }
      ],
      "should": [
        {
          "bool": {
            "must_not": [
              {
                "exists": {
                  "field": "del",
                  "boost": 1
                }
              }
            ],
            "adjust_pure_negative": true,
            "boost": 1
          }
        },
        {
          "match": {
            "del": {
              "query": false,
              "operator": "OR",
              "prefix_length": 0,
              "max_expansions": 50,
              "fuzzy_transpositions": true,
              "lenient": false,
              "zero_terms_query": "NONE",
              "auto_generate_synonyms_phrase_query": true,
              "boost": 1
            }
          }
        }
      ],
      "adjust_pure_negative": true,
      "minimum_should_match": "1",
      "boost": 1
    }
  },
  "_source": {
    "includes": [
      "did",
      "ca"
    ],
    "excludes": []
  },
  "sort": [
    {
      "ca": {
        "order": "asc"
      }
    }
  ],
  "search_after": [
    1596545647769
  ]
}

I have an 100k documents but with that way I am hiting 99.996 documents, the problem is totalHits shows the 100.000 but when I query on the kibana it gives me last batch as 4 missing documents. For example I am getting my documents as 2500 documents batches, in the last one it should be from 97.500 to 100.000 but it gives me 99.996.
When I do same query with search scroll api with 2500 documents batches, it gives me 100.000 documents.
Note: If I use search scroll, I am using scroll key to be able to continue. If I use search after, I am using createdAt information to get next documents.
What can cause this problem ?

A: If there are any documents that might contain the exact same value for the ca field, then the solution would be to simply use another tie breaker field in the sort clause so that two documents with the same cavalue can still be sorted properly.
Like this:
  "sort": [
    {
      "ca": {
        "order": "asc"
      }
    },
    {
      "tie_breaker_field": {
        "order": "asc"
      }
    }
  ],


text:
Q: How to get first occurrence non zero key value pair from any associative array I have an associative array:
$pair = array(
  'S'=>'0',
  'I'=>'50',
  'P'=>'30'
);

From this pair of key and values, I need first occurrence non zero value from key value pair only,
from my example I'm expecting key I and value 50.

A: Do something like this:
function findNonZero($var){
    // returns whether the input is non zero
    return($var > 0);
}

$pair = array(
    'S'=>'0',
    'I'=>'50',
    'P'=>'30'
);

$newPair = array_filter($pair, "findNonZero");
var_dump($newPair); //Contains array of non-zero values

A: You can do that with usual foreach loop
$pair = array(
  'S'=>'0',
  'I'=>'50',
  'P'=>'30'
);

foreach($pair as $k=>$v)  {
   if ($v) break;
}
echo "$k => $v"; // I => 50

demo

A: You can use php functions array_filter(), array_slice(), or use a foreach loop.
<?php
// filter out empty values, and get first item
$value = array_slice(array_filter($pair), 0, 1);

// check not empty
if (!empty($value)) {
    // get key
    echo 'key   => '.array_keys($value)[0].PHP_EOL;

    // get value
    echo 'value => '.array_values($value)[0];
}

https://3v4l.org/tr3bp
Result:
key   => I
value => 50

Or use a loop:
<?php
$value = [];
foreach ($pair as $k => $v) {
    if (!empty($v)) {
        $value[$k] = $v;
        break;
    }
}

if (!empty($value)) {
    echo 'key   => '.array_keys($value)[0].PHP_EOL;
    echo 'value => '.array_values($value)[0];
}

https://3v4l.org/tPeAq
Result:
key   => I
value => 50

Or use a generator,
<?php
$getNoneEmpty = function() use ($pair) {
    foreach ($pair as $key => $value) {
        if (!empty($value)) {
            yield [$key => $value];
        }
    }
};

// get first
$value = $getNoneEmpty()->current();

if (!empty($value)) {
    echo 'key   => '.array_keys($value)[0].PHP_EOL;
    echo 'value => '.array_values($value)[0].PHP_EOL;
}

// or loop over all
foreach ($getNoneEmpty() as $value) {
    echo 'key   => '.array_keys($value)[0].PHP_EOL;
    echo 'value => '.array_values($value)[0].PHP_EOL;
}

https://3v4l.org/mnnHl
Result:
key   => I
value => 50
key   => I
value => 50
key   => P
value => 30

Many ways to skin a cat, though, if you don't want the key/value you can also do it differently.


text:
Q: Gradle can't find dependency I have problem with gradle in Android Studio 0.5.2.
It's shown below:

Could not find com.android.support:support-v4:19.0.0.
            Required by:
            org.codepond:wizardroid:1.2.0
            Please install the Android Support Repository from the Android SDK Manager.

I Also Installed Android Support Repository.
My build.gradle looks like this:
apply plugin: 'android-library'
apply plugin: 'android-maven'
apply plugin: 'signing'

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.0"

    defaultConfig {
        minSdkVersion 9
        targetSdkVersion 19
        versionCode project.ext.versionCode
        versionName version
    }
}

dependencies {
    compile 'com.android.support:support-v4:19.0.0'
}

ext.isReleaseVersion = !version.endsWith("SNAPSHOT")
boolean hasCredentials = hasProperty('sonatypeUsername') && hasProperty('sonatypeUsername')

signing {
    required { isReleaseVersion && gradle.taskGraph.hasTask("uploadArchives") }
    sign configurations.archives
}

uploadArchives {
    configuration = configurations.archives

    repositories {
        mavenDeployer {
            beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }

            repository(url: 'https://oss.sonatype.org/service/local/staging/deploy/maven2/') {
                if (hasCredentials) {
                    authentication(userName: sonatypeUsername, password: sonatypePassword)
                }
            }

            snapshotRepository(url: 'https://oss.sonatype.org/content/repositories/snapshots/') {
                if (hasCredentials) {
                    authentication(userName: sonatypeUsername, password: sonatypePassword)
                }
            }

            pom.project {
                name 'WizarDroid'
                description 'Lightweight Android library for creating step by step wizards'
                url 'http://wizardroid.codepond.org'

                scm {
                    url 'http://www.github.com/nimrodda/wizardroid'
                    connection 'scm:git://github.com/Nimrodda/WizarDroid.git'
                    developerConnection 'scm:git://github.com/Nimrodda/WizarDroid.git'
                }

                licenses {
                    license {
                        name 'The MIT License (MIT)'
                        url 'https://raw.github.com/Nimrodda/WizarDroid/master/license'
                        distribution 'repo'
                    }
                }

                developers {
                    developer {
                        id 'nimrodda'
                        name 'Nimrod Dayan'
                        email 'feedback@codepond.org'
                    }
                }

                organization {
                    name 'CodePond.org'
                    url 'http://www.codepond.org'
                }

                issueManagement {
                    system 'GitHub Issues'
                    url 'https://github.com/nimrodda/wizardroid/issues'
                }

                parent {
                    groupId 'org.sonatype.oss'
                    artifactId 'oss-parent'
                    version 7
                }
            }
        }
    }
}

A: You should change build.gradle to
dependencies {
    compile 'com.android.support:support-v4:19.1.+'
}


text: Q: Redirecting Users to a mobile version of a static site using WURFL Would I simply us the capability filter and have it return the devices capabilities, and then based off of the capabilities, write an if else statement that will either redirect the user to the mobile or the desktop version of my site based off of devices? Basically how do I implement WURFL into my website, I am reading the documentation and the configuration information is all there but there is no clear solution for my problem, I am fairly new to all of this, so this is likely a very basic question. Thanks


text:
Q: nginx - putting PHP through TCP instead of sockets I received error like this bellow:

2014/07/18 15:01:24 [error] 5700#0: *1 upstream sent too big header while reading response header from upstream, client: 1.2.3.4, server: serv_name.com, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "serv_name.pl"

I know to solve this problem I have to put PHP traffic through TCP instead of sockets. Only for one webb application - we have 12 webs running on nginx at the time. How can I do this only for this one speciefied  web app ?
It would be enough to add in /etc/php5/fpm/pool.d directory file web_name.conf ?
What should i put into this file ?

I have to add more information because I messed up a bit. Above error is for SQL requests and there occured parallely error 502 which is connected with socket PHP traffic - thats why I wrote about changing sockets into TCP.

A: You don't need to switch to TCP... in fact, you will end up with a performance penalty for doing so.  All you need to do is increase your buffer sizes.
fastcgi_buffers 16 8k;

You can increase this as needed for your application.  You can also change the size of the buffer, but there is no reason to do this as it will automatically pick based on the page size for your system.
http://nginx.org/en/docs/http/ngx_http_fastcgi_module.html#fastcgi_buffers


text:
Q: Let $h:S_4 \rightarrow \mathbb{Z}$ be a group homomorphism. Prove that $h(x) =0$ for all $x \in S_4$ This a 3 part question. I struggle working with $S_4$ but seem to understand the questions if $S_4$ was not the codomain.

*

*Let $f:\mathbb{Z} \rightarrow S_4$ be a group homomorphism such that $f(1)=(1243)$. Precisely describe im($f$) and ker($f$).

*Let G be a group, and let $x \in G$ such that ord$(x)$ is finite. Let $K$ be another group and let $g:G \rightarrow K$ be a group homomorphism. Explain why ord(g($x$)) in $K$ is a divisor of ord($x$).

*Now let $h:S_4 \rightarrow \mathbb{Z}$ be a group homomorphism. Prove that $h(x) =0$ for all $x \in S_4$.

A: $S_4$ is the group of permutations of 4 elements. Let $*$ represent composition of two permutations.
Part 1:
Since identity must map to identity,
$$f(0)=()$$
$$f(1)=(1243)$$
$$f(2)=f(1+1) = f(1)*f(1) = (14)(23)$$
$$f(3)=f(2+1) = f(2)*f(1) = (1342)$$
$$f(4)=f(3+1) = f(3)*f(1) = ()$$
Let $n=4q+r$, where $0\le r<4$ and $n,q\in \Bbb Z$.
$$f(n) = f(4q+r) = f(4q)*f(r)=f(4)^q*f(r)=()^q*f(r)=f(r)$$
So $$Im(f)=\{(),(1243),(14)(23),(1342)\}$$
$$Ker(f)=\{4n|n\in \Bbb Z\}$$
Part 2:
Let $m=ord(x)$ and $n=ord(g(x))$ where $x \in G$. So, $x^m=1_G$:-
Since identity must map to identity,
$$g(1_G)=g(x^m)=(g(x))^m = 1_K$$
$$(g(x))^m = 1_K \implies m=nk $$
Thus n divides m.
Part 3:
Let $x \in S_4$ such that $|h(x)| = M$ is maximum. Then $h(x*x)=h(x)+h(x)=2h(x)$.
By assumption, $|h(x)|\ge|2h(x)|$. Therefore $|h(x)|=0$. Since maximum is zero, and $|h(x)|\ge0$, $h(t)=0$ for all $t\in S_4$.


text:
Q: Webpack-dev-server doesn't work after upgraded its version I was using webpack-dev-server of version ^3.11.2 and I migrated the version to the latest ^4.7.4. Then as usual I tried to run the dev server (e.g. webpack serve --config ./webpack.config.dev.js --port 8080") but the localhost page doesn't seem to work well and doesn't host as it did before the version upgrade.
Here the below is the devServer part of the webpack config file when I used in the old version ^3.11.2.
devServer: {
    contentBase: path.join(__dirname, "public"),
    port: 3000,
    publicPath: "/dist/",
    writeToDisk: true
},

The below is the config now I'm trying to working on with the latest webpack-devserver, but it doesn't work as well for some reason.
devServer: {
    port: 3000,
    static: {
    directory: path.join(__dirname, 'public'),
    publicPath: '/dist/',
    },
    devMiddleware: {
    writeToDisk: true,
    },
},

The directory structure is like:
./dist
./dist/bundle.js
./public
./public/index.html
./src
./src/index.js
./webpack.config.dev.js

Thanks.

A: What you need to do is install the latest version of these packages as well
"webpack-cli": "^4.10.0",
"@webpack-cli/serve": "^1.7.0",

and it should work.


text:
Q: Castle windsor property injection and componentnotfoundexception exception I register my components as below in castle windsor container :
    public class ServicesInstaller : IWindsorInstaller
{
    public void Install(IWindsorContainer container, IConfigurationStore store)
    {

        var appDomain = System.AppDomain.CurrentDomain;
        var basePath = appDomain.RelativeSearchPath ?? appDomain.BaseDirectory;
        var path = basePath + "\\";

        var bizPath = path + "Business.dll";
        var asm = Assembly.LoadFile(bizPath);

        foreach (Type type in asm.GetTypes().Where(q => q.Name.EndsWith("Business") && !q.IsInterface))
        {
            var interfaceName = type.GetInterfaces().FirstOrDefault(q => q.Name == "I" + type.Name);
            if (interfaceName != null)
            {
                container.Register(Component.For(interfaceName).ImplementedBy(type).LifestyleTransient());
            }
        }

    }

}

and then I try to resolve a component which is a property that has InjectDependency attribute  :
[InjectDependency]
public IPostBusiness postBiz { get; set; }

with this code :
foreach (var prop in this.GetType().GetProperties())
        {
            object[] attrs = prop.GetCustomAttributes(true);
            foreach (object attr in attrs)
            {
                InjectDependencyAttribute authAttr = attr as InjectDependencyAttribute;
                if (authAttr != null)
                {
                    var instance = ContainerManager.Container.Resolve(prop.PropertyType);
                    prop.SetValue(this, instance);
                }
            }
        }

here an exception throws when it wants to resolve the component "No component for supporting the service Business.IPostBusiness was found"
Point : I used the below code too but it didn't work .
 var allInterfaces = asm.GetTypes().Where(q => q.Name.EndsWith("Business") && q.IsInterface);
        container.Register(Classes.FromAssembly(asm).BasedOn(allInterfaces).WithServiceBase().LifestyleTransient());

but when I register as below it works :
container.Register(Component.For<IPostBusiness>().ImplementedBy<PostBusiness>().LifestyleTransient());

Am I doing something wrong ? Any help?


text:
Q: Handling Mappings when migrating Get Index call from Transport client to Rest High Level Client We are migrating from Transport Client to High Level Rest Client. How do we reconcile the difference in the mappings field of GetIndexResponse object returned from Transport client vs Rest High Level Client?
For transport client, we use this code to obtain the index information:
        GetIndexResponse response = client.get()
                .admin()
                .indices()
                .prepareGetIndex()
                .setFeatures(GetIndexRequest.Feature.MAPPINGS, GetIndexRequest.Feature.SETTINGS)
                .setIndices(indices)
                .get();

The response mappings field is a ImmutableOpenMap<String, ImmutableOpenMap<String, MappingMetaData>>
But for rest high level client, the mappings field is just a Map<String, MappingMetadata>.
Here is the code for High Level Rest Client:
        GetIndexRequest request = new GetIndexRequest(indices);
        request.addFeatures(GetIndexRequest.Feature.MAPPINGS, GetIndexRequest.Feature.SETTINGS);
        try {
            GetIndexResponse response = esClient.indices().get(request, RequestOptions.DEFAULT);
            return
        } catch (IOException ex) {
            throw new SafeRuntimeException(ex);
        }
    }

These are the response object classes:
Transport Client: org.elasticsearch.action.admin.indices.get.GetIndexResponse
Rest High Level Client: org.elasticsearch.client.indices.GetIndexResponse

A: for mappings use the GetMappings request:
ImmutableOpenMap<String, ?> mappings = esclient.admin().indices().getMappings(new GetMappingsRequest()).actionGet().getMappings();

and you can also specify the indices you want.
EDIT: ah i see, you mean this:
client.indices().getMapping(new GetMappingsRequest().indices("index_name1", "index_name2"), RequestOptions.DEFAULT);
client.indices().getSettings(new GetSettingsRequest().indices("index_name1", "index_name2"), RequestOptions.DEFAULT);

when "client" is an instance of the High level REST client.


text:
Q: Latest stable revision with ivy excluding alpha & beta releases For our project we like to have most dependecies automaticaly up to date so we want to use the lastest strategies in IVY. However we dont want to run the bleeding edge of the dependencies ie. alpha and beta versions.
When using:
<dependency org="org.apache.httpcomponents" name="httpclient" rev="latest.revision" />
or
<dependency org="org.apache.httpcomponents" name="httpclient" rev="latest.release" />
We get revision 4.4-alpha1
This is understandable as we use the ibiblio resolver which contains the following xml in maven-metadata.xml

<metadata>
 <groupId>org.apache.httpcomponents</groupId>
 <artifactId>httpclient</artifactId>
 <versioning>
   <latest>4.4-alpha1</latest>
   <release>4.4-alpha1</release>
   <versions>
    <version>4.0-alpha1</version>
<!-- snip --->
    <version>4.3-alpha1</version>
    <version>4.3-beta1</version>
    <version>4.3-beta2</version>
    <version>4.3</version>
    <version>4.3.1</version>
    <version>4.3.2</version>
    <version>4.3.3</version>
    <version>4.3.4</version>
    <version>4.3.5</version>
    <version>4.4-alpha1</version>
   </versions>
   <lastUpdated>20140801101402</lastUpdated>
 </versioning>
</metadata>
The meta data indicates the alpha version as both release and latest. (not sure if this is related actualy)
In this case we there is a version we would like to get in the metadata list being 4.3.5
Now ivy has a construct with  and  but the documentation is quite sparse, and i cant figure out how to make this strategy 'ignore' the alpha release.
I tried variation of the following to no avail (using rev="latest.test") :
`

Edit:
From the source code of org.apache.ivy.plugins.latest.LatestRevisionStrategy it appears specialmeanings wont be able to solve this since the version is first split in parts and then compared on a part by part basis.
If there is a way to forbid revisions that contain a specific string my problem would also be solved.
`

A: The source code of org.apache.ivy.plugins.latest.LatestRevisionStrategy indicated it's impossible to fix this with special-meaning strings in a latestStrategy element. (thanks to: this post)
we ended up using a version matcher to enforse ivy to not use -beta- or -alpha releases.
Its not an optimal solution and the regexp probably needs to be updated a few times still.
in ivysettings.xml:
<version-matchers usedefaults="true">
    <pattern-vm name="lastest.nobeta">
        <match  revision="latest.nobeta" pattern="\.*\d+\.\d+\.?\d*(FINAL|RELEASE|STABLE)?"  matcher="regexp" />
    </pattern-vm>
</version-matchers>

and in ivy.xml:
<dependency org="org.apache.poi" name="poi" rev="latest.nobeta"/>

Not entirely sure if this takes the lastest version but so far that seems to be the case.


text:
Q: Dealing with missing values in the following code I have run the following code , based on :Extracting the time series of all pixel values in the study area for one band in an image collection in Google Earth Engine in a CSV file, to extract pixel values of precipitation from "NOAA/PERSIANN-CDR".
var scale = 27830

var bands = ['precipitation']
var collection = ee.ImageCollection('NOAA/PERSIANN-CDR')
  .filterDate('2010-01-01', '2015-01-01')
  .filterBounds(geometry)
  .map(extractPixels)
  .flatten()

//print('Collection: ', collection);

var bands = collection.select('precipitation');
print("reza")
Export.table.toDrive({
  collection: collection,
  selectors: ['date', 'latitude', 'longitude','precipitation']
})

function extractPixels(image) {
  var mask = ee.Image(1) // Create some mask - remove clouds etc.
  var pixels = image
    .select(bands)
    .addBands(ee.Image.pixelLonLat())
    .updateMask(image.mask().reduce(ee.Reducer.min())) // Mask everything if something is masked
    .updateMask(mask)
    .reduceRegion({
      reducer: ee.Reducer.toList(),
      geometry: geometry,
      scale: scale,
      maxPixels: 1e30
    })

  return ee.FeatureCollection(
    ee.Array(pixels.values())
      .transpose()
      .toList()
      .map(function (values) {
        var properties = ee.Dictionary.fromLists(pixels.keys(), values)
        return ee.Feature(null, properties)
          .set('date', image.date().format('yyyy-MM-dd'))
      })
  )
}

print('reza finished')

When the it gets to the missing values announce the following error:

"Error: Error in map(ID=20100928): Array: No numbers in 'values', must
provide a type. (Error code: 3)" .

How can I add some conditions on code to skip missing values and insert "non" in the CSV file?

A: You can split this into two mappings. Extract the list of pixel values for each image, returning a feature for each image, remove features without any values, then convert the lists of pixel values into separate features.
var geometry = Map.getBounds(true)
var scale = 27830

var bands = ['precipitation']
var collection = ee.ImageCollection('NOAA/PERSIANN-CDR')
  .filterDate('2010-01-01', '2015-01-01')
  .filterBounds(geometry)
  .map(extractPixels)
  .filter(ee.Filter.gt('count', 0))
  .map(pixelsToFeatures)
  .flatten()

Export.table.toDrive({
  collection: collection,
  selectors: ['date', 'latitude', 'longitude', 'precipitation']
})

function extractPixels(image) {
  var mask = ee.Image(1) // Create some mask - remove clouds etc.
  var pixels = image
    .select(bands)
    .addBands(ee.Image.pixelLonLat())
    .updateMask(image.mask().reduce(ee.Reducer.min())) // Mask everything if something is masked
    .updateMask(mask)
    .reduceRegion({
      reducer: ee.Reducer.toList(),
      geometry: geometry,
      scale: scale,
      maxPixels: 1e30
    })
  return ee.Feature(null, pixels)
    .set('date', image.date().format('yyyy-MM-dd'))
    .set('count', ee.List(pixels.get('latitude')).size()) // Allow filtering away empty features
}

function pixelsToFeatures(feature) {
  var pixels = ee.Feature(feature).toDictionary(bands.concat(['longitude', 'latitude']))
  return ee.FeatureCollection(
    ee.Array(pixels.values())
      .transpose()
      .toList()
      .map(function (values) {
        var properties = ee.Dictionary.fromLists(pixels.keys(), values)
          .set('date', feature.get('date'))
        return ee.Feature(null, properties)
      })
  )
}

https://code.earthengine.google.com/cbc4483a25a0d7684faf18f5bd07e1d7


text:
Q: Panel BackColor setting color of it's controls I want to set the background color of the panel area only but it somehow also sets the background color of its controls, what's wrong with it?
public Form1()
    {
        InitializeComponent();
        Panel p = new Panel();
        p.Size = this.ClientSize;
        p.BackColor = Color.Black; // The button will also have black background color
        Button b = new Button();
        b.Size = new Size(this.ClientSize.Width, 50);
        p.Controls.Add(b);
        this.Controls.Add(p);
    }

A: This is by design. The BackColor property is an ambient property by default, meaning that it inherits its value from its parent control. When you set it explicitly to a particular value, that overrides the ambient nature and forces it to use that particular value.
explicitly set the color of button like this
p.Controls.Add(b);
b.BackColor = Color.White;
this.Controls.Add(p);


text:
Q: MySQL Union query: PASSING TEMP ClaimID field value to TEMP1 table ClaimID in one union query CREATE DEFINER=`root`@`localhost` PROCEDURE `SP_DupAuditCriteria_1`()
BEGIN
    set @RowNbr=concat(date_format(curdate(),'%Y%m%d'),'0000000');

select temp.* from
(SELECT c.*, concat(c.VendorID,a.VendorID) as MergeH200A, concat(a.VendorID,c.VendorID) as MergeH200B, 'New' as Record_Type, @RowNbr:= @RowNbr + 1 AS ClaimID
FROM tbldupaudit_currentitems AS c
    inner join tbldupaudit_archiveitems a
        on c.InvoiceID = a.InvoiceID
        and c.GrossAmount = a.GrossAmount) as temp
    inner join tbldupaudit_archiveitems b
        on temp.InvoiceID = b.InvoiceID
        and temp.GrossAmount = b.GrossAmount
        and temp.VendorID = b.VendorID
        and temp.VoucherID <> b.VoucherID
Union all
select temp1.* from
(SELECT f.*, concat(f.VendorID,d.VendorID) as MergeH200A, concat(d.VendorID,f.VendorID) as MergeH200B, 'ARCHIVE' as Record_Type, 1 AS ClaimID
FROM tbldupaudit_archiveitems AS f
    inner join tbldupaudit_currentitems d
        on f.InvoiceID = d.InvoiceID
        and f.GrossAmount = d.GrossAmount) as temp1
    inner join tbldupaudit_currentitems e
        on temp1.InvoiceID = e.InvoiceID
        and temp1.GrossAmount = e.GrossAmount
        and temp1.VendorID = e.VendorID
        and temp1.VoucherID <> e.VoucherID
order by InvoiceID, Record_Type DESC;

END

trying make unique ClaimID for each pair. I am able to generate sequential number for first half union all but same ClaimID not able to generate in other half Union all.
Please help me in how to create/generate one unique ID for matched items.
Thank you!]1

A: In the second select  ( after the UNION ALL) you are  not incrementing a var so if you want both value incrementeedc  the try using a var also for the second
select temp.*
from (
    SELECT c.*, concat(c.VendorID,a.VendorID) as MergeH200A, concat(a.VendorID,c.VendorID) as MergeH200B, 'New' as Record_Type
        , @RowNbr:= @RowNbr + 1 AS ClaimID
    FROM tbldupaudit_currentitems AS c
    inner join tbldupaudit_archiveitems a on c.InvoiceID = a.InvoiceID
        and c.GrossAmount = a.GrossAmount
    ) as temp
inner join tbldupaudit_archiveitems b on temp.InvoiceID = b.InvoiceID
    and temp.GrossAmount = b.GrossAmount
        and temp.VendorID = b.VendorID
            and temp.VoucherID <> b.VoucherID
Union all
select temp1.*
from (
    SELECT f.*, concat(f.VendorID,d.VendorID) as MergeH200A, concat(d.VendorID,f.VendorID) as MergeH200B, 'ARCHIVE' as Record_Type
        , @RowNbr:= @RowNbr + 1 AS ClaimID
    FROM tbldupaudit_archiveitems AS f
    inner join tbldupaudit_currentitems d on f.InvoiceID = d.InvoiceID
        and f.GrossAmount = d.GrossAmount
) as temp1
inner join tbldupaudit_currentitems e on temp1.InvoiceID = e.InvoiceID
      and temp1.GrossAmount = e.GrossAmount
        and temp1.VendorID = e.VendorID
            and temp1.VoucherID <> e.VoucherID
order by InvoiceID, Record_Type DESC;

A: Modelling example - see fiddle :
SELECT CONCAT( 'prefix', LPAD( CASE @prev
                               WHEN @prev := InvoiceID
                               THEN @num
                               ELSE @num := @num + 1
                               END, 8, '0' ) ) ClaimID, InvoiceID, Amount, FromTable
FROM ( SELECT InvoiceID, Amount, 'CurrentItems' FromTable
       FROM CurrentItems
       UNION ALL
       SELECT InvoiceID, Amount, 'ArchivedItems'
       FROM ArchivedItems
       WHERE EXISTS ( SELECT NULL
                      FROM CurrentItems
                      WHERE CurrentItems.InvoiceID = ArchivedItems.InvoiceID) ) unioned,
     ( SELECT @prev := 0, @num := 1000 ) variables
ORDER BY InvoiceID, FromTable DESC;


text:
Q: Parse/deserialize MTOM/XOP Data .NET How can I parse/deserialize a MTOM/XOP response that I get from  a web service using WCF? I have the response on disk. I have copied the response below:
Date: Wed, 02 May 2012 09:38:57 GMT
Server: Microsoft-IIS/6.0
P3P:CP="BUS CUR CONo FIN IVDo ONL OUR PHY SAMo TELo"
X-Powered-By: ASP.NET
X-AspNet-Version: 4.0.30319
X-WindowsLive-Hydra: H: BLU165-ds6 V: 16.3.133.328 D: 2012-03-29T02:31:31
X-Response-Time: 78.1245
X-TransactionID: d491414e-46fd-47b2-82ce-e9cea9f564aa;BLU165-ds6;16.3.133.328;2012-05-02 09:38:57 UTC;78.1245 ms
Set-Cookie: HMDST=dGVhcG90ZG9tZYtZm3GzLm1r3f+/q8+gdzrAPYmy9kJ+SmDZuFmVgk3E983xNyeoTZkkdIr6t8y3P4V+vPzmytdaqqFwtI8vBuc=; domain=.mail.services.live.com; path=/
Cache-Control: no-cache
Pragma: no-cache
Expires: -1
Content-Type: application/xop+xml
Content-Length: 6386

MIME-Version: 1.0
Content-Type: Multipart/Related;boundary=DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM;
    type="application/xop+xml";
    start="<DeltaSyncMTOMFetchResponse@mail.services.live.com>";

--DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM
content-transfer-encoding: binary
content-type: application/xop+xml; charset=utf-8; type="application/xop+xml"
content-id: <DeltaSyncMTOMFetchResponse@mail.services.live.com>

<ItemOperations xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:B="HMMAIL:" xmlns:D="HMSYNC:" xmlns="ItemOperations:"><Status>1</Status><Responses><Fetch><ServerId>E631966A-9439-11E1-8E7B-00215AD9A7B8</ServerId><Status>1</Status><Message><xop:Include href="cid:1.634715231374437235@example.org" /></Message></Fetch></Responses></ItemOperations>
--DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM
content-transfer-encoding: binary
content-type: application/octet-stream
content-id: <1.634715231374437235@example.org>

....Binary Content
--DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM--

Any help is much appreciated.

A: You can deserialize the response using the WCF classes, as I'll show below. But before we proceed, this MTOM is invalid - the parameter boundary of the Content-Type header is malformed. Since it contains the '?' character, it needs to be quoted (look at the MIME RFC, section 5.1, definition of token).
Now, to deserialize it, you need to open the document with a MTOM reader - and XmlDictionaryReader.CreateMtomReader will give you exactly that. With that reader created, you can pass it to the DataContractSerializer to deserialize the object. The code below shows how this can be done.
    public class StackOverflow_10531128
    {
        const string MTOM = @"MIME-Version: 1.0
Content-Type: Multipart/Related;boundary=DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM;
    type=""application/xop+xml"";
    start=""<DeltaSyncMTOMFetchResponse@mail.services.live.com>"";

--DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM
content-transfer-encoding: binary
Content-Type: application/xop+xml; charset=utf-8; type=""application/xop+xml""
content-id: <DeltaSyncMTOMFetchResponse@mail.services.live.com>

<ItemOperations xmlns:xop=""http://www.w3.org/2004/08/xop/include"" xmlns:B=""HMMAIL:"" xmlns:D=""HMSYNC:"" xmlns=""ItemOperations:"">
    <Status>1</Status>
    <Responses>
        <Fetch>
            <ServerId>E631966A-9439-11E1-8E7B-00215AD9A7B8</ServerId>
            <Status>1</Status>
            <Message><xop:Include href=""cid:1.634715231374437235@example.org"" /></Message>
        </Fetch>
    </Responses>
</ItemOperations>
--DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM
content-transfer-encoding: binary
Content-Type: application/octet-stream
content-id: <1.634715231374437235@example.org>

this is a binary content; it could be anything but for simplicity I'm using text
--DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM--";

        [DataContract(Name = "ItemOperations", Namespace = "ItemOperations:")]
        public class ItemOperations
        {
            [DataMember(Order = 1)]
            public int Status { get; set; }
            [DataMember(Order = 2)]
            public Responses Responses { get; set; }
        }

        [CollectionDataContract(Name = "Responses", Namespace = "ItemOperations:", ItemName = "Fetch")]
        public class Responses : List<Fetch>
        {
        }

        [DataContract(Name = "Fetch", Namespace = "ItemOperations:")]
        public class Fetch
        {
            [DataMember(Order = 1)]
            public Guid ServerId { get; set; }
            [DataMember(Order = 2)]
            public int Status { get; set; }
            [DataMember(Order = 3)]
            public byte[] Message { get; set; }
        }

        public static void Test()
        {
            MemoryStream ms;
            ItemOperations obj;
            DataContractSerializer dcs = new DataContractSerializer(typeof(ItemOperations));

            string fixedMtom = MTOM.Replace(
                "Multipart/Related;boundary=DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM;",
                "Multipart/Related;boundary=\"DeltaSync91ABCB4AF5D24B8F988B77ED7A19733D?MTOM\";");
            ms = new MemoryStream(Encoding.UTF8.GetBytes(fixedMtom));
            XmlDictionaryReader reader = XmlDictionaryReader.CreateMtomReader(ms, Encoding.UTF8, XmlDictionaryReaderQuotas.Max);
            obj = (ItemOperations)dcs.ReadObject(reader);
            Console.WriteLine(obj.Status);
            Console.WriteLine(obj.Responses.Count);
            foreach (var resp in obj.Responses)
            {
                Console.WriteLine("  {0}", resp.ServerId);
                Console.WriteLine("  {0}", resp.Status);
                Console.WriteLine("  {0}", string.Join(" ", resp.Message.Select(b => string.Format("{0:X2}", (int)b))));
            }
        }
    }


text:
Q: javascript global variables - scope for functions? I tried making a simple program using javascript which will calculate the sum and average of two numbers entered in the textfields.
<script>
var a=parseInt(document.getElementById("text1").value);
var b=parseInt(document.getElementById("text2").value);
function sum()
{
var result = document.getElementById("valueofsum");
var sum=a+b;
result.innerHTML = sum;
}

function average()
{
var result = document.getElementById("valueofavg");
var avg=(a+b)/2;
result.innerHTML = avg;

}

function reset()
{
 document.getElementById("text1").value = "";
 document.getElementById("text2").value = "";
 document.getElementById("valueofsum").innerHTML = "";
 document.getElementById("valueofavg").innerHTML = "";
}
</script>

The two variables which reads the values from textfields are globally declared and initialized as "a" and "b".
The sum and average are returned as NaN(NotaNumber) instead of the calculated results.
If i use/declare both the variables inside the functions as local variables the code seems out to be working properly which makes me wonder about the scope of global variables in javascript?

A: You are reading the values from the inputs when the page loads (at which point they are, presumably, empty strings).
If you want to get the values at the time the sum or average functions run (i.e. after the user has entered something into them), then you need to fetch their values when those functions run.
See the following code example:
function sum() {
  var a=parseInt(document.getElementById("text1").value);
  var b=parseInt(document.getElementById("text2").value);
  var result = document.getElementById("valueofsum");
  var sum=a+b;
  result.innerHTML = sum;
}

A: You are not providing any HTML code , so i guess you have placed your script at the start of your page and the HTML code follows after it resulting in your code running prior to the DOM creation , thus no "text1" and "text2" elements actually exist at that point.
When you place them inside the Function , you simply avoid the above issue , cause i suspect you are executing these functions at the end of your Page , or with any onClick event somewhere.
If that is not the case , please provide a bit more insight of the structure of your page.

A: You are getting values outside, in global scope and when those lines were executed, values were empty. You need to get the fields reference in global scope to avoid repetition but get values in side functions.
<script>
  var a = document.getElementById("text1");
  var b = document.getElementById("text2");
  function sum()
  {
  var result = document.getElementById("valueofsum");
  var sum = parseInt(a.value) + parseInt(b.value);
  result.innerHTML = sum;
  return sum;
  }

  function average()
  {
  var result = document.getElementById("valueofavg");
  var avg= sum()/2;
  result.innerHTML = avg;
  return avg;
  }

  function reset()
  {
   document.getElementById("text1").value = "";
   document.getElementById("text2").value = "";
   document.getElementById("valueofsum").innerHTML = "";
   document.getElementById("valueofavg").innerHTML = "";
  }
</script>


text:
Q: CRON messages being delayed for arbitrary long time in syslog I found in a few servers's syslog that some of the CRON related messages are written in a wrong time, like the following:
Aug 21 06:26:01 hty-controller CRON[30159]: (root) CMD (   python /.../clean_image_child.py)
Aug 21 06:26:01 hty-controller CRON[30156]: (CRON) info (...)
Aug 21 06:26:03 hty-controller CRON[29302]: (CRON) info (...)
Aug 19 04:01:01 hty-controller CRON[30176]: (root) CMD (   python /.../clean_image_child.py)
Aug 21 06:27:01 hty-controller CRON[30178]: (root) CMD (   python /var/lib/.../recycle_bin.py)
Aug 21 06:27:01 hty-controller CRON[30179]: (root) CMD (   python /.../clean_image_child.py)
Aug 21 06:27:01 hty-controller CRON[30177]: (CRON) info (...)

It is found that the messages with "wrong time" are referring to a previous date time, and the syslog content at the time being referred to is actually missing exactly these lines of messages (according to CRON schedule). That is the messages seems to be delayed for a long time when written to syslog.
In the above example, the script clean_image_child.py is being executed every minute. The expected one line of CRON message about its execution did not show up in syslog on the minute of "Aug 19 04:01", but was delayed to (after) "Aug 21 06:26". A careful check on all the servers shows that the observation can be confirmed for all such cases where we still have the "syslog snippet with missing CRON messages" (some are too old and have been rotated). And we found no such cases (of message delays in syslog) for any applications/services other than CRON.
We made an experiment to investigate this. We gave another script to CRON for executing every minute, which appends one line of message with a timestamp to another (its own) log file. In this self managed log file we have one message  every minute from the script, without a single miss. But in syslog there were missing CRON messages about running it at some points, which appeared a few hours or days later. So it is only the message (not the schedule of execution) that is being delayed.
The servers are running ubuntu 14.04.1 LTS with a (self compiled) 3.18 kernel (3.18.0-031800-generic X86_64). The CRON version is 3.0pl1-124ubuntu2. And rsyslogd version is 7.4.4-1ubuntu2.
Although it looks like this behavior will not affect other services in the system, I'm still curious - why would this happen? Is it a bug or miss config in CRON, or in rsyslogd, or a version miss match between the kernel and those applications?

A: Actually this is a duplicate of @Stone 's comment. Just make it clear to everyone this do have an answer.
In short, there is a bug in the version of rsyslog I'm using, which will delay syslog message it received for arbitrary length of time. Bug report is here.   And upgrading rsyslog solved the problem. It is not CRON's fault.